├── .circleci └── config.yml ├── .dockerignore ├── .githooks └── pre-commit ├── .gitignore ├── CONTRIBUTORS ├── LICENSE ├── README.md ├── app ├── travel-admin │ ├── commands │ │ ├── adduser.go │ │ ├── commands.go │ │ ├── gentoken.go │ │ ├── getuser.go │ │ ├── keygen.go │ │ └── schema.go │ └── main.go ├── travel-api │ ├── handlers │ │ ├── check.go │ │ ├── feed.go │ │ └── handlers.go │ └── main.go └── travel-ui │ ├── assets │ ├── scripts │ │ ├── d3.js │ │ ├── main.js │ │ └── query.js │ ├── styles │ │ └── main.css │ └── views │ │ └── index.tmpl │ ├── handlers │ ├── check.go │ ├── fetch.go │ ├── handlers.go │ └── index.go │ └── main.go ├── business ├── data │ ├── advisory │ │ ├── advisory.go │ │ └── models.go │ ├── city │ │ ├── city.go │ │ └── models.go │ ├── data.go │ ├── data_test.go │ ├── place │ │ ├── models.go │ │ └── place.go │ ├── schema │ │ ├── graphql │ │ │ ├── public_key.pem │ │ │ └── schema.graphql │ │ ├── models.go │ │ └── schema.go │ ├── tests │ │ └── tests.go │ ├── user │ │ ├── models.go │ │ └── user.go │ └── weather │ │ ├── models.go │ │ └── weather.go ├── feeds │ ├── advisory │ │ ├── advisory.go │ │ └── advisory_test.go │ ├── loader │ │ ├── loader.go │ │ └── marshal.go │ ├── places │ │ ├── places.go │ │ └── places_test.go │ └── weather │ │ ├── weather.go │ │ └── weather_test.go ├── sys │ ├── auth │ │ ├── auth.go │ │ └── auth_test.go │ ├── metrics │ │ └── metrics.go │ └── validate │ │ ├── errors.go │ │ └── validate.go └── web │ └── mid │ ├── doc.go │ ├── errors.go │ ├── logger.go │ ├── metrics.go │ └── panics.go ├── foundation ├── docker │ └── docker.go ├── keystore │ ├── keystore.go │ ├── keystore_test.go │ └── test.pem └── web │ ├── middleware.go │ ├── request.go │ ├── response.go │ ├── shutdown.go │ └── web.go ├── go.mod ├── go.sum ├── makefile ├── vendor ├── github.com │ ├── AvraamMavridis │ │ └── randomcolor │ │ │ ├── .travis.yml │ │ │ ├── README.md │ │ │ └── randomcolor.go │ ├── ardanlabs │ │ ├── conf │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── conf.go │ │ │ ├── doc.go │ │ │ ├── fields.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── sources.go │ │ │ └── usage.go │ │ └── graphql │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ └── graphql.go │ ├── dgrijalva │ │ └── jwt-go │ │ │ └── v4 │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── MIGRATION_GUIDE.md │ │ │ ├── README.md │ │ │ ├── VERSION_HISTORY.md │ │ │ ├── claim_strings.go │ │ │ ├── claims.go │ │ │ ├── doc.go │ │ │ ├── ecdsa.go │ │ │ ├── ecdsa_utils.go │ │ │ ├── errors.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── hmac.go │ │ │ ├── keyfunc.go │ │ │ ├── map_claims.go │ │ │ ├── none.go │ │ │ ├── parser.go │ │ │ ├── parser_option.go │ │ │ ├── rsa.go │ │ │ ├── rsa_pss.go │ │ │ ├── rsa_utils.go │ │ │ ├── signing_method.go │ │ │ ├── signing_option.go │ │ │ ├── time.go │ │ │ ├── token.go │ │ │ └── validation_helper.go │ ├── dimfeld │ │ └── httptreemux │ │ │ └── v5 │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── context.go │ │ │ ├── go.mod │ │ │ ├── group.go │ │ │ ├── panichandler.go │ │ │ ├── path.go │ │ │ ├── router.go │ │ │ ├── tree.go │ │ │ ├── treemux_16.go │ │ │ ├── treemux_17.go │ │ │ ├── unescape_17.go │ │ │ └── unescape_18.go │ ├── go-playground │ │ ├── locales │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── currency │ │ │ │ └── currency.go │ │ │ ├── en │ │ │ │ └── en.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── logo.png │ │ │ └── rules.go │ │ ├── universal-translator │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── errors.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── import_export.go │ │ │ ├── logo.png │ │ │ ├── translator.go │ │ │ └── universal_translator.go │ │ └── validator │ │ │ └── v10 │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── MAINTAINERS.md │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── baked_in.go │ │ │ ├── cache.go │ │ │ ├── country_codes.go │ │ │ ├── currency_codes.go │ │ │ ├── doc.go │ │ │ ├── errors.go │ │ │ ├── field_level.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── logo.png │ │ │ ├── postcode_regexes.go │ │ │ ├── regexes.go │ │ │ ├── struct_level.go │ │ │ ├── translations.go │ │ │ ├── translations │ │ │ └── en │ │ │ │ └── en.go │ │ │ ├── util.go │ │ │ ├── validator.go │ │ │ └── validator_instance.go │ ├── google │ │ ├── go-cmp │ │ │ ├── LICENSE │ │ │ └── cmp │ │ │ │ ├── compare.go │ │ │ │ ├── export_panic.go │ │ │ │ ├── export_unsafe.go │ │ │ │ ├── internal │ │ │ │ ├── diff │ │ │ │ │ ├── debug_disable.go │ │ │ │ │ ├── debug_enable.go │ │ │ │ │ └── diff.go │ │ │ │ ├── flags │ │ │ │ │ └── flags.go │ │ │ │ ├── function │ │ │ │ │ └── func.go │ │ │ │ └── value │ │ │ │ │ ├── name.go │ │ │ │ │ ├── pointer_purego.go │ │ │ │ │ ├── pointer_unsafe.go │ │ │ │ │ ├── sort.go │ │ │ │ │ └── zero.go │ │ │ │ ├── options.go │ │ │ │ ├── path.go │ │ │ │ ├── report.go │ │ │ │ ├── report_compare.go │ │ │ │ ├── report_references.go │ │ │ │ ├── report_reflect.go │ │ │ │ ├── report_slices.go │ │ │ │ ├── report_text.go │ │ │ │ └── report_value.go │ │ └── uuid │ │ │ ├── .travis.yml │ │ │ ├── CONTRIBUTING.md │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── dce.go │ │ │ ├── doc.go │ │ │ ├── go.mod │ │ │ ├── hash.go │ │ │ ├── marshal.go │ │ │ ├── node.go │ │ │ ├── node_js.go │ │ │ ├── node_net.go │ │ │ ├── null.go │ │ │ ├── sql.go │ │ │ ├── time.go │ │ │ ├── util.go │ │ │ ├── uuid.go │ │ │ ├── version1.go │ │ │ └── version4.go │ ├── leodido │ │ └── go-urn │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── machine.go │ │ │ ├── machine.go.rl │ │ │ ├── makefile │ │ │ └── urn.go │ └── pkg │ │ └── errors │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ ├── go113.go │ │ └── stack.go ├── go.opencensus.io │ ├── AUTHORS │ ├── LICENSE │ ├── internal │ │ └── tagencoding │ │ │ └── tagencoding.go │ ├── metric │ │ ├── metricdata │ │ │ ├── doc.go │ │ │ ├── exemplar.go │ │ │ ├── label.go │ │ │ ├── metric.go │ │ │ ├── point.go │ │ │ ├── type_string.go │ │ │ └── unit.go │ │ └── metricproducer │ │ │ ├── manager.go │ │ │ └── producer.go │ ├── resource │ │ └── resource.go │ ├── stats │ │ ├── doc.go │ │ ├── internal │ │ │ └── record.go │ │ ├── measure.go │ │ ├── measure_float64.go │ │ ├── measure_int64.go │ │ ├── record.go │ │ ├── units.go │ │ └── view │ │ │ ├── aggregation.go │ │ │ ├── aggregation_data.go │ │ │ ├── collector.go │ │ │ ├── doc.go │ │ │ ├── export.go │ │ │ ├── view.go │ │ │ ├── view_to_metric.go │ │ │ ├── worker.go │ │ │ └── worker_commands.go │ └── tag │ │ ├── context.go │ │ ├── doc.go │ │ ├── key.go │ │ ├── map.go │ │ ├── map_codec.go │ │ ├── metadata.go │ │ ├── profile_19.go │ │ ├── profile_not19.go │ │ └── validate.go ├── golang.org │ └── x │ │ ├── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── bcrypt │ │ │ ├── base64.go │ │ │ └── bcrypt.go │ │ ├── blowfish │ │ │ ├── block.go │ │ │ ├── cipher.go │ │ │ └── const.go │ │ └── sha3 │ │ │ ├── doc.go │ │ │ ├── hashes.go │ │ │ ├── hashes_generic.go │ │ │ ├── keccakf.go │ │ │ ├── keccakf_amd64.go │ │ │ ├── keccakf_amd64.s │ │ │ ├── register.go │ │ │ ├── sha3.go │ │ │ ├── sha3_s390x.go │ │ │ ├── sha3_s390x.s │ │ │ ├── shake.go │ │ │ ├── shake_generic.go │ │ │ ├── xor.go │ │ │ ├── xor_generic.go │ │ │ └── xor_unaligned.go │ │ ├── sys │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ └── cpu │ │ │ ├── asm_aix_ppc64.s │ │ │ ├── byteorder.go │ │ │ ├── cpu.go │ │ │ ├── cpu_aix.go │ │ │ ├── cpu_arm.go │ │ │ ├── cpu_arm64.go │ │ │ ├── cpu_arm64.s │ │ │ ├── cpu_gc_arm64.go │ │ │ ├── cpu_gc_s390x.go │ │ │ ├── cpu_gc_x86.go │ │ │ ├── cpu_gccgo_arm64.go │ │ │ ├── cpu_gccgo_s390x.go │ │ │ ├── cpu_gccgo_x86.c │ │ │ ├── cpu_gccgo_x86.go │ │ │ ├── cpu_linux.go │ │ │ ├── cpu_linux_arm.go │ │ │ ├── cpu_linux_arm64.go │ │ │ ├── cpu_linux_mips64x.go │ │ │ ├── cpu_linux_noinit.go │ │ │ ├── cpu_linux_ppc64x.go │ │ │ ├── cpu_linux_s390x.go │ │ │ ├── cpu_mips64x.go │ │ │ ├── cpu_mipsx.go │ │ │ ├── cpu_netbsd_arm64.go │ │ │ ├── cpu_other_arm.go │ │ │ ├── cpu_other_arm64.go │ │ │ ├── cpu_other_mips64x.go │ │ │ ├── cpu_ppc64x.go │ │ │ ├── cpu_riscv64.go │ │ │ ├── cpu_s390x.go │ │ │ ├── cpu_s390x.s │ │ │ ├── cpu_wasm.go │ │ │ ├── cpu_x86.go │ │ │ ├── cpu_x86.s │ │ │ ├── cpu_zos.go │ │ │ ├── cpu_zos_s390x.go │ │ │ ├── hwcap_linux.go │ │ │ ├── syscall_aix_gccgo.go │ │ │ └── syscall_aix_ppc64_gc.go │ │ ├── text │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── internal │ │ │ ├── language │ │ │ │ ├── common.go │ │ │ │ ├── compact.go │ │ │ │ ├── compact │ │ │ │ │ ├── compact.go │ │ │ │ │ ├── language.go │ │ │ │ │ ├── parents.go │ │ │ │ │ ├── tables.go │ │ │ │ │ └── tags.go │ │ │ │ ├── compose.go │ │ │ │ ├── coverage.go │ │ │ │ ├── language.go │ │ │ │ ├── lookup.go │ │ │ │ ├── match.go │ │ │ │ ├── parse.go │ │ │ │ ├── tables.go │ │ │ │ └── tags.go │ │ │ └── tag │ │ │ │ └── tag.go │ │ └── language │ │ │ ├── coverage.go │ │ │ ├── doc.go │ │ │ ├── go1_1.go │ │ │ ├── go1_2.go │ │ │ ├── language.go │ │ │ ├── match.go │ │ │ ├── parse.go │ │ │ ├── tables.go │ │ │ └── tags.go │ │ └── time │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ └── rate │ │ └── rate.go ├── googlemaps.github.io │ └── maps │ │ ├── .gitignore │ │ ├── .releaserc │ │ ├── AUTHORS │ │ ├── CODE_OF_CONDUCT.md │ │ ├── CONTRIB.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── client.go │ │ ├── directions.go │ │ ├── distancematrix.go │ │ ├── doc.go │ │ ├── elevation.go │ │ ├── encoding.go │ │ ├── geocoding.go │ │ ├── geolocation.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── internal │ │ ├── signer.go │ │ └── types.go │ │ ├── latlng.go │ │ ├── metrics │ │ ├── metric.go │ │ └── opencensus.go │ │ ├── places.go │ │ ├── polyline.go │ │ ├── roads.go │ │ ├── staticmap.go │ │ ├── timezone.go │ │ ├── transport.go │ │ └── types.go └── modules.txt ├── wiki ├── gcp-figure1.png ├── gcp-figure2.png ├── gcp-figure3.png ├── gcp-figure4.png ├── gcp-figure5.png ├── gcp-figure6.png ├── gcp-figure7.png └── ui.png └── zarf ├── compose ├── compose-config.yaml ├── compose-dbonly-config.yaml ├── compose-dbonly.yaml └── compose.yaml ├── docker ├── dockerfile.travel-api └── dockerfile.travel-ui ├── k8s ├── base │ ├── kustomization.yaml │ └── travel.yaml ├── cloud │ ├── kind-config.yaml │ ├── kustomization.yaml │ ├── travel-config.yaml │ └── travel.yaml └── kind │ ├── dgraph.yaml │ ├── kind-config.yaml │ ├── kustomization.yaml │ └── travel-config.yaml └── keys └── 54bb2165-71e1-41a6-af3e-7da4a0e1e2c1.pem /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | machine: 5 | image: ubuntu-2004:202010-01 6 | steps: 7 | - checkout 8 | - run: 9 | name: Install Go 1.17 10 | command: | 11 | sudo rm -rf /usr/local/go 12 | wget -O go.tgz https://dl.google.com/go/go1.17.linux-amd64.tar.gz 13 | sudo tar -C /usr/local -xzf go.tgz 14 | which go 15 | go version 16 | - run: 17 | name: Run vet 18 | command: | 19 | go vet ./... 20 | - run: 21 | name: Run staticheck 22 | command: | 23 | wget -O staticcheck.tgz https://github.com/dominikh/go-tools/releases/download/2021.1.2/staticcheck_linux_amd64.tar.gz 24 | sudo tar -xzf staticcheck.tgz 25 | ./staticcheck/staticcheck --version 26 | ./staticcheck/staticcheck ./... 27 | - run: 28 | name: Download the DB image 29 | command: | 30 | docker pull dgraph/standalone:master 31 | - run: 32 | name: Run tests 33 | command: | 34 | go test ./... -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .circleci/ 2 | z/ 3 | .dockerignore 4 | .gitgnore 5 | CONTRIBUTORS 6 | docker* 7 | LICENSE 8 | makefile 9 | README.md -------------------------------------------------------------------------------- /.githooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This script can be bypassed by using the --no-verify 4 | # parameter when checking in 5 | 6 | files_modified = `git diff-index --name-only HEAD` 7 | files_modified_arr = files_modified.split("\n") 8 | 9 | # puts "Checking files: #{files_modified_arr.inspect}" 10 | 11 | bad_files = 0 12 | 13 | # Build a hash of all the keys and things you don't want 14 | # checked in here. 15 | # Note the pair of slashes before the slash quote, this 16 | # is to ensure a slash quote is built into the string 17 | # to be passed to grep. 18 | 19 | regexs = { 20 | "Google Key" => "[a-z0-9_]{39}", 21 | } 22 | 23 | files_modified_arr.each do |file| 24 | regexs.each_pair do |key_name, regex| 25 | if ((file == "go.sum") || (file.include? "_test") || (file.include? "graphql.go") || (file.include? "vendor")) 26 | next 27 | end 28 | grep_command = "grep -iE \"#{regex}\" #{file}" 29 | res = `#{grep_command}` 30 | unless res == "" 31 | bad_files += 1 32 | puts "Match rule for #{key_name} on file: #{file} res: #{res}" 33 | end 34 | end 35 | end 36 | 37 | exit bad_files -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # binaries 2 | app/travel-admin/travel-admin 3 | app/travel-api/travel-api 4 | app/travel-ui/travel-ui 5 | 6 | # keys 7 | .keys 8 | .keys_cloud 9 | 10 | # Mac 11 | .DS_Store 12 | 13 | # Backup files 14 | *~* 15 | 16 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 17 | *.o 18 | *.a 19 | *.so 20 | 21 | # Folders 22 | _obj 23 | _test 24 | 25 | # Editor files 26 | .idea/ 27 | *.iml 28 | *.swp 29 | 30 | # Architecture specific extensions/prefixes 31 | *.[568vq] 32 | [568vq].out 33 | 34 | *.cgo1.go 35 | *.cgo2.c 36 | _cgo_defun.c 37 | _cgo_gotypes.go 38 | _cgo_export.* 39 | 40 | _testmain.go 41 | 42 | *.exe 43 | //*.test 44 | .vscode/tasks.json 45 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who can contribute 2 | # (and typically have contributed) code to the gotraining repository. 3 | # 4 | # Names should be added to this file only after verifying that 5 | # the individual or the individual's organization has agreed to 6 | # the appropriate Contributor License Agreement, found here: 7 | # 8 | # http://code.google.com/legal/individual-cla-v1.0.html 9 | # http://code.google.com/legal/corporate-cla-v1.0.html 10 | # 11 | # The agreement for individuals can be filled out on the web. 12 | 13 | # Names should be added to this file like so: 14 | # Name 15 | # 16 | # An entry with two email addresses specifies that the 17 | # first address should be used in the submit logs and 18 | # that the second address should be recognized as the 19 | # same person when interacting with Rietveld. 20 | 21 | # Please keep the list sorted. 22 | 23 | Andreas 24 | Daniel Mai 25 | Karthic Rao 26 | Prashant Shahi 27 | William Kennedy -------------------------------------------------------------------------------- /app/travel-admin/commands/adduser.go: -------------------------------------------------------------------------------- 1 | package commands 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "time" 8 | 9 | "github.com/dgraph-io/travel/business/data" 10 | "github.com/dgraph-io/travel/business/data/user" 11 | "github.com/google/uuid" 12 | "github.com/pkg/errors" 13 | ) 14 | 15 | // AddUser handles the creation of users. 16 | func AddUser(log *log.Logger, gqlConfig data.GraphQLConfig, newUser user.NewUser) error { 17 | if newUser.Name == "" || newUser.Email == "" || newUser.Password == "" || newUser.Role == "" { 18 | fmt.Println("help: adduser ") 19 | return ErrHelp 20 | } 21 | 22 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) 23 | defer cancel() 24 | 25 | store := user.NewStore( 26 | log, 27 | data.NewGraphQL(gqlConfig), 28 | ) 29 | traceID := uuid.New().String() 30 | 31 | usr, err := store.Add(ctx, traceID, newUser, time.Now()) 32 | if err != nil { 33 | return errors.Wrap(err, "adding user") 34 | } 35 | 36 | fmt.Println("user id:", usr.ID) 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /app/travel-admin/commands/commands.go: -------------------------------------------------------------------------------- 1 | // Package commands contains the functionality for the set of commands 2 | // currently supported by the CLI tooling. 3 | package commands 4 | 5 | import "errors" 6 | 7 | // ErrHelp provides context that help was given. 8 | var ErrHelp = errors.New("provided help") 9 | -------------------------------------------------------------------------------- /app/travel-admin/commands/getuser.go: -------------------------------------------------------------------------------- 1 | package commands 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "time" 8 | 9 | "github.com/dgraph-io/travel/business/data" 10 | "github.com/dgraph-io/travel/business/data/user" 11 | "github.com/google/uuid" 12 | "github.com/pkg/errors" 13 | ) 14 | 15 | // GetUser returns information about a user by email. 16 | func GetUser(log *log.Logger, gqlConfig data.GraphQLConfig, email string) error { 17 | if email == "" { 18 | fmt.Println("help: getuser ") 19 | return ErrHelp 20 | } 21 | 22 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) 23 | defer cancel() 24 | 25 | store := user.NewStore( 26 | log, 27 | data.NewGraphQL(gqlConfig), 28 | ) 29 | traceID := uuid.New().String() 30 | 31 | usr, err := store.QueryByEmail(ctx, traceID, email) 32 | if err != nil { 33 | return errors.Wrap(err, "getting user") 34 | } 35 | 36 | fmt.Printf("user: %#v\n", usr) 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /app/travel-admin/commands/keygen.go: -------------------------------------------------------------------------------- 1 | package commands 2 | 3 | import ( 4 | "crypto/rand" 5 | "crypto/rsa" 6 | "crypto/x509" 7 | "encoding/pem" 8 | "fmt" 9 | "os" 10 | 11 | "github.com/pkg/errors" 12 | ) 13 | 14 | // KeyGen creates an x509 private/public key for auth tokens. 15 | func KeyGen() error { 16 | 17 | // Generate a new private key. 18 | privateKey, err := rsa.GenerateKey(rand.Reader, 2048) 19 | if err != nil { 20 | return ErrHelp 21 | } 22 | 23 | // Create a file for the private key information in PEM form. 24 | privateFile, err := os.Create("private.pem") 25 | if err != nil { 26 | return errors.Wrap(err, "creating private file") 27 | } 28 | defer privateFile.Close() 29 | 30 | // Construct a PEM block for the private key. 31 | privateBlock := pem.Block{ 32 | Type: "RSA PRIVATE KEY", 33 | Bytes: x509.MarshalPKCS1PrivateKey(privateKey), 34 | } 35 | 36 | // Write the private key to the private key file. 37 | if err := pem.Encode(privateFile, &privateBlock); err != nil { 38 | return errors.Wrap(err, "encoding to private file") 39 | } 40 | 41 | // Marshal the public key from the private key to PKIX. 42 | asn1Bytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey) 43 | if err != nil { 44 | return errors.Wrap(err, "marshaling public key") 45 | } 46 | 47 | // Create a file for the public key information in PEM form. 48 | publicFile, err := os.Create("public.pem") 49 | if err != nil { 50 | return errors.Wrap(err, "creating public file") 51 | } 52 | defer privateFile.Close() 53 | 54 | // Construct a PEM block for the public key. 55 | publicBlock := pem.Block{ 56 | Type: "RSA PUBLIC KEY", 57 | Bytes: asn1Bytes, 58 | } 59 | 60 | // Write the public key to the private key file. 61 | if err := pem.Encode(publicFile, &publicBlock); err != nil { 62 | return errors.Wrap(err, "encoding to public file") 63 | } 64 | 65 | fmt.Println("private and public key files generated") 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /app/travel-api/handlers/check.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "log" 7 | "net/http" 8 | "time" 9 | 10 | "github.com/dgraph-io/travel/business/data" 11 | ) 12 | 13 | type checkGroup struct { 14 | build string 15 | gqlConfig data.GraphQLConfig 16 | } 17 | 18 | func (cg *checkGroup) readiness(w http.ResponseWriter, r *http.Request) { 19 | health := struct { 20 | Version string `json:"version"` 21 | Status string `json:"status"` 22 | }{ 23 | Version: cg.build, 24 | } 25 | 26 | // Wait for a second to see if the database is ready. 27 | ctx, cancel := context.WithTimeout(r.Context(), time.Second) 28 | defer cancel() 29 | 30 | if err := data.Validate(ctx, cg.gqlConfig.URL, 100*time.Millisecond); err != nil { 31 | 32 | // If the database is not ready we will tell the client and use a 500 33 | // status. Do not respond by just returning an error because further up in 34 | // the call stack will interpret that as an unhandled error. 35 | health.Status = "db not ready" 36 | if err := response(w, http.StatusInternalServerError, health); err != nil { 37 | log.Println("liveness", "ERROR", err) 38 | } 39 | } 40 | 41 | health.Status = "ok" 42 | if err := response(w, http.StatusOK, health); err != nil { 43 | log.Println("liveness", "ERROR", err) 44 | } 45 | } 46 | 47 | func response(w http.ResponseWriter, statusCode int, data interface{}) error { 48 | jsonData, err := json.Marshal(data) 49 | if err != nil { 50 | return err 51 | } 52 | 53 | w.Header().Set("Content-Type", "application/json") 54 | w.WriteHeader(statusCode) 55 | 56 | if _, err := w.Write(jsonData); err != nil { 57 | return err 58 | } 59 | 60 | return nil 61 | } 62 | -------------------------------------------------------------------------------- /app/travel-ui/handlers/check.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "log" 7 | "net/http" 8 | "time" 9 | 10 | "github.com/dgraph-io/travel/business/data" 11 | ) 12 | 13 | type checkGroup struct { 14 | build string 15 | gqlConfig data.GraphQLConfig 16 | } 17 | 18 | func (cg *checkGroup) readiness(w http.ResponseWriter, r *http.Request) { 19 | health := struct { 20 | Version string `json:"version"` 21 | Status string `json:"status"` 22 | }{ 23 | Version: cg.build, 24 | } 25 | 26 | // Wait for a second to see if the database is ready. 27 | ctx, cancel := context.WithTimeout(r.Context(), time.Second) 28 | defer cancel() 29 | 30 | if err := data.Validate(ctx, cg.gqlConfig.URL, 100*time.Millisecond); err != nil { 31 | 32 | // If the database is not ready we will tell the client and use a 500 33 | // status. Do not respond by just returning an error because further up in 34 | // the call stack will interpret that as an unhandled error. 35 | health.Status = "db not ready" 36 | if err := response(w, http.StatusInternalServerError, health); err != nil { 37 | log.Println("liveness", "ERROR", err) 38 | } 39 | } 40 | 41 | health.Status = "ok" 42 | if err := response(w, http.StatusOK, health); err != nil { 43 | log.Println("liveness", "ERROR", err) 44 | } 45 | } 46 | 47 | func response(w http.ResponseWriter, statusCode int, data interface{}) error { 48 | jsonData, err := json.Marshal(data) 49 | if err != nil { 50 | return err 51 | } 52 | 53 | w.Header().Set("Content-Type", "application/json") 54 | w.WriteHeader(statusCode) 55 | 56 | if _, err := w.Write(jsonData); err != nil { 57 | return err 58 | } 59 | 60 | return nil 61 | } 62 | -------------------------------------------------------------------------------- /app/travel-ui/handlers/index.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "html/template" 7 | "io" 8 | "net/http" 9 | "os" 10 | 11 | "github.com/dgraph-io/travel/business/data" 12 | "github.com/pkg/errors" 13 | ) 14 | 15 | type indexGroup struct { 16 | tmpl *template.Template 17 | graphQLEndpoint string 18 | authHeaderName string 19 | authToken string 20 | mapsKey string 21 | } 22 | 23 | func newIndex(gqlConfig data.GraphQLConfig, browserEndpoint string, mapsKey string) (indexGroup, error) { 24 | index, err := os.Open("assets/views/index.tmpl") 25 | if err != nil { 26 | return indexGroup{}, errors.Wrap(err, "open index page") 27 | } 28 | defer index.Close() 29 | rawTmpl, err := io.ReadAll(index) 30 | if err != nil { 31 | return indexGroup{}, errors.Wrap(err, "reading index page") 32 | } 33 | 34 | tmpl := template.New("index") 35 | if _, err := tmpl.Parse(string(rawTmpl)); err != nil { 36 | return indexGroup{}, errors.Wrap(err, "creating template") 37 | } 38 | 39 | ig := indexGroup{ 40 | tmpl: tmpl, 41 | graphQLEndpoint: browserEndpoint, 42 | authHeaderName: gqlConfig.AuthHeaderName, 43 | authToken: gqlConfig.AuthToken, 44 | mapsKey: mapsKey, 45 | } 46 | 47 | return ig, nil 48 | } 49 | 50 | func (ig *indexGroup) handler(ctx context.Context, w http.ResponseWriter, r *http.Request) error { 51 | var markup bytes.Buffer 52 | vars := map[string]interface{}{ 53 | "GraphQLEndpoint": ig.graphQLEndpoint + "/graphql", 54 | "MapsKey": ig.mapsKey, 55 | "AuthHeaderName": ig.authHeaderName, 56 | "AuthToken": ig.authToken, 57 | } 58 | 59 | if err := ig.tmpl.Execute(&markup, vars); err != nil { 60 | return errors.Wrap(err, "executing template") 61 | } 62 | 63 | io.Copy(w, &markup) 64 | return nil 65 | } 66 | -------------------------------------------------------------------------------- /business/data/advisory/models.go: -------------------------------------------------------------------------------- 1 | package advisory 2 | 3 | // Advisory contains the travel advisory result captured for a city. 4 | type Advisory struct { 5 | ID string `json:"id,omitempty"` 6 | City City `json:"city"` 7 | Country string `json:"country"` 8 | CountryCode string `json:"country_code"` 9 | Continent string `json:"continent"` 10 | Score float64 `json:"score"` 11 | LastUpdated string `json:"last_updated"` 12 | Message string `json:"message"` 13 | Source string `json:"source"` 14 | } 15 | 16 | // City is used to capture the city id in relationships. 17 | type City struct { 18 | ID string `json:"id"` 19 | } 20 | 21 | // ============================================================================= 22 | 23 | type id struct { 24 | Resp struct { 25 | Entities []struct { 26 | ID string `json:"id"` 27 | } `json:"entities"` 28 | } `json:"resp"` 29 | } 30 | 31 | func (id) document() string { 32 | return `{ 33 | entities: advisory { 34 | id 35 | } 36 | }` 37 | } 38 | 39 | type result struct { 40 | Resp struct { 41 | Msg string 42 | NumUids int 43 | } `json:"resp"` 44 | } 45 | 46 | func (result) document() string { 47 | return `{ 48 | msg, 49 | numUids, 50 | }` 51 | } 52 | -------------------------------------------------------------------------------- /business/data/city/models.go: -------------------------------------------------------------------------------- 1 | package city 2 | 3 | // City represents a city and its coordinates. 4 | type City struct { 5 | ID string `json:"id,omitempty"` 6 | Name string `json:"name"` 7 | Lat float64 `json:"lat"` 8 | Lng float64 `json:"lng"` 9 | } 10 | 11 | // ============================================================================= 12 | 13 | type id struct { 14 | Resp struct { 15 | Entities []struct { 16 | ID string `json:"id"` 17 | } `json:"entities"` 18 | } `json:"resp"` 19 | } 20 | 21 | func (id) document() string { 22 | return `{ 23 | entities: city { 24 | id 25 | } 26 | }` 27 | } 28 | -------------------------------------------------------------------------------- /business/data/place/models.go: -------------------------------------------------------------------------------- 1 | package place 2 | 3 | // Place contains the place data points captured from the API. 4 | type Place struct { 5 | ID string `json:"id,omitempty"` 6 | Category string `json:"category"` 7 | City City `json:"city"` 8 | PlaceID string `json:"place_id"` 9 | CityName string `json:"city_name"` 10 | Name string `json:"name"` 11 | Address string `json:"address"` 12 | Lat float64 `json:"lat"` 13 | Lng float64 `json:"lng"` 14 | LocationType []string `json:"location_type"` 15 | AvgUserRating float32 `json:"avg_user_rating"` 16 | NumberOfRatings int `json:"no_user_rating"` 17 | GmapsURL string `json:"gmaps_url"` 18 | PhotoReferenceID string `json:"photo_id"` 19 | } 20 | 21 | // City is used to capture the city id in relationships. 22 | type City struct { 23 | ID string `json:"id"` 24 | } 25 | 26 | // ============================================================================= 27 | 28 | type id struct { 29 | Resp struct { 30 | Entities []struct { 31 | ID string `json:"id"` 32 | } `json:"entities"` 33 | } `json:"resp"` 34 | } 35 | 36 | func (id) document() string { 37 | return `{ 38 | entities: place { 39 | id 40 | } 41 | }` 42 | } 43 | -------------------------------------------------------------------------------- /business/data/schema/graphql/public_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnZ/BW/tuLr0uxZFw1Q5m 3 | P1JpIksU46o+kIaqIXZjSAduma18m+oSgd1L19Fs9otAjfAlkyU8HF1hJNj/PVv8 4 | MY72vhIWv60xBB4caXuLmflAiJEtvxHfw3WtVR9npQqEowcwrsf7MSSfdHwM4S+F 5 | bMmcl/mE9c7DUrYJBUgu1IbdI7vrEoPE65GFafjZQHkPLUX8OaRXOt4rkT6HfYv+ 6 | XqaCs6Ie+dt6xL5HiQpO90/89CAJhi2q8AXvhfxqCVVfLxxd3jNJVq2olkCOLJRE 7 | uJ29Bb460yKOAiDigEUobUpmvT6ggUZNrX71yP0GZxQFBhq9j1IRgPVg4CDA0Pw5 8 | FQIDAQAB 9 | -----END RSA PUBLIC KEY----- -------------------------------------------------------------------------------- /business/data/schema/models.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | // UploadFeedRequest is the data required to make a feed/upload request. 4 | type UploadFeedRequest struct { 5 | CountryCode string `json:"countrycode"` 6 | CityName string `json:"cityname"` 7 | Lat float64 `json:"lat"` 8 | Lng float64 `json:"lng"` 9 | } 10 | 11 | // UploadFeedResponse is the response from the feed/upload request. 12 | type UploadFeedResponse struct { 13 | CountryCode string `json:"country_code"` 14 | CityName string `json:"city_name"` 15 | Lat float64 `json:"lat"` 16 | Lng float64 `json:"lng"` 17 | Message string `json:"message"` 18 | } 19 | -------------------------------------------------------------------------------- /business/data/tests/tests.go: -------------------------------------------------------------------------------- 1 | // Package tests contains supporting code for running tests. 2 | package tests 3 | 4 | import ( 5 | "bytes" 6 | "fmt" 7 | "io" 8 | "log" 9 | "os" 10 | "testing" 11 | 12 | "github.com/dgraph-io/travel/foundation/docker" 13 | ) 14 | 15 | // Success and failure markers. 16 | const ( 17 | Success = "\u2713" 18 | Failed = "\u2717" 19 | ) 20 | 21 | // Configuration for running tests. 22 | const ( 23 | dbImage = "dgraph/standalone:master" 24 | dbPort = "8080" 25 | ) 26 | 27 | // NewUnit creates a test value with necessary application state to run 28 | // database tests. It will return the host to use to connect to the database. 29 | func NewUnit(t *testing.T) (*log.Logger, string, func()) { 30 | r, w, _ := os.Pipe() 31 | old := os.Stdout 32 | os.Stdout = w 33 | 34 | c := docker.StartContainer(t, dbImage, dbPort) 35 | 36 | // teardown is the function that should be invoked when the caller is done 37 | // with the database. 38 | teardown := func() { 39 | t.Helper() 40 | t.Log("tearing down test ...") 41 | docker.StopContainer(t, c.ID) 42 | 43 | w.Close() 44 | var buf bytes.Buffer 45 | io.Copy(&buf, r) 46 | os.Stdout = old 47 | fmt.Println("******************** LOGS ********************") 48 | fmt.Print(buf.String()) 49 | fmt.Println("******************** LOGS ********************") 50 | } 51 | 52 | url := fmt.Sprintf("http://%s", c.Host) 53 | log := log.New(os.Stdout, "TEST : ", log.LstdFlags|log.Lmicroseconds|log.Lshortfile) 54 | 55 | return log, url, teardown 56 | } 57 | -------------------------------------------------------------------------------- /business/data/user/models.go: -------------------------------------------------------------------------------- 1 | package user 2 | 3 | import "time" 4 | 5 | // User represents someone with access to the system. 6 | type User struct { 7 | ID string `json:"id"` 8 | Name string `json:"name"` 9 | Email string `json:"email"` 10 | Role string `json:"role"` 11 | PasswordHash string `json:"password_hash"` 12 | DateCreated time.Time `json:"date_created"` 13 | DateUpdated time.Time `json:"date_updated"` 14 | } 15 | 16 | // NewUser contains information needed to create a new User. 17 | type NewUser struct { 18 | Name string `json:"name"` 19 | Email string `json:"email"` 20 | Role string `json:"role"` 21 | Password string `json:"password"` 22 | PasswordConfirm string `json:"password_confirm"` 23 | } 24 | 25 | // ============================================================================= 26 | 27 | type id struct { 28 | Resp struct { 29 | Entities []struct { 30 | ID string `json:"id"` 31 | } `json:"entities"` 32 | } `json:"resp"` 33 | } 34 | 35 | func (id) document() string { 36 | return `{ 37 | entities: user { 38 | id 39 | } 40 | }` 41 | } 42 | 43 | type result struct { 44 | Resp struct { 45 | Msg string 46 | NumUids int 47 | } `json:"resp"` 48 | } 49 | 50 | func (result) document() string { 51 | return `{ 52 | msg, 53 | numUids, 54 | }` 55 | } 56 | -------------------------------------------------------------------------------- /business/data/weather/models.go: -------------------------------------------------------------------------------- 1 | package weather 2 | 3 | // Weather contains the weather data points captured from the API. 4 | type Weather struct { 5 | ID string `json:"id,omitempty"` 6 | City City `json:"city"` 7 | CityName string `json:"city_name"` 8 | Visibility string `json:"visibility"` 9 | Desc string `json:"description"` 10 | Temp float64 `json:"temp"` 11 | FeelsLike float64 `json:"feels_like"` 12 | MinTemp float64 `json:"temp_min"` 13 | MaxTemp float64 `json:"temp_max"` 14 | Pressure int `json:"pressure"` 15 | Humidity int `json:"humidity"` 16 | WindSpeed float64 `json:"wind_speed"` 17 | WindDirection int `json:"wind_direction"` 18 | Sunrise int `json:"sunrise"` 19 | Sunset int `json:"sunset"` 20 | } 21 | 22 | // City is used to capture the city id in relationships. 23 | type City struct { 24 | ID string `json:"id"` 25 | } 26 | 27 | // ============================================================================= 28 | 29 | type id struct { 30 | Resp struct { 31 | Entities []struct { 32 | ID string `json:"id"` 33 | } `json:"entities"` 34 | } `json:"resp"` 35 | } 36 | 37 | func (id) document() string { 38 | return `{ 39 | entities: weather { 40 | id 41 | } 42 | }` 43 | } 44 | 45 | type result struct { 46 | Resp struct { 47 | Msg string 48 | NumUids int 49 | } `json:"resp"` 50 | } 51 | 52 | func (result) document() string { 53 | return `{ 54 | msg, 55 | numUids, 56 | }` 57 | } 58 | -------------------------------------------------------------------------------- /business/sys/metrics/metrics.go: -------------------------------------------------------------------------------- 1 | // Package metrics cosntructs the metrics the application will track. 2 | package metrics 3 | 4 | import ( 5 | "context" 6 | "expvar" 7 | "sync" 8 | ) 9 | 10 | // ctxKeyMetric represents the type of value for the context key. 11 | type ctxKey int 12 | 13 | // Key is how metric values are stored/retrieved. 14 | const Key ctxKey = 1 15 | 16 | // ============================================================================= 17 | 18 | // The expvar variables can only be initalized once. Tests will make 19 | // a call to New several times. 20 | var ( 21 | m *Metrics 22 | mu sync.Mutex 23 | ) 24 | 25 | // ============================================================================= 26 | 27 | // Metrics represents the set of metrics we gather. These fields are 28 | // safe to be accessed concurrently. No extra abstraction is required. 29 | type Metrics struct { 30 | Goroutines *expvar.Int 31 | Requests *expvar.Int 32 | Errors *expvar.Int 33 | Panics *expvar.Int 34 | } 35 | 36 | // New constructs the metrics that will be tracked. 37 | func New() *Metrics { 38 | mu.Lock() 39 | defer mu.Unlock() 40 | 41 | if m == nil { 42 | m = &Metrics{ 43 | Goroutines: expvar.NewInt("goroutines"), 44 | Requests: expvar.NewInt("requests"), 45 | Errors: expvar.NewInt("errors"), 46 | Panics: expvar.NewInt("panics"), 47 | } 48 | } 49 | return m 50 | } 51 | 52 | // ============================================================================= 53 | 54 | // AddPanics increments the panics metric by 1. 55 | func AddPanics(ctx context.Context) { 56 | if v, ok := ctx.Value(Key).(*Metrics); ok { 57 | v.Panics.Add(1) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /business/sys/validate/errors.go: -------------------------------------------------------------------------------- 1 | package validate 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | ) 7 | 8 | // ErrInvalidID occurs when an ID is not in a valid form. 9 | var ErrInvalidID = errors.New("ID is not in its proper form") 10 | 11 | // ErrorResponse is the form used for API responses from failures in the API. 12 | type ErrorResponse struct { 13 | Error string `json:"error"` 14 | Fields string `json:"fields,omitempty"` 15 | } 16 | 17 | // RequestError is used to pass an error during the request through the 18 | // application with web specific context. 19 | type RequestError struct { 20 | Err error 21 | Status int 22 | Fields error 23 | } 24 | 25 | // NewRequestError wraps a provided error with an HTTP status code. This 26 | // function should be used when handlers encounter expected errors. 27 | func NewRequestError(err error, status int) error { 28 | return &RequestError{err, status, nil} 29 | } 30 | 31 | // Error implements the error interface. It uses the default message of the 32 | // wrapped error. This is what will be shown in the services' logs. 33 | func (err *RequestError) Error() string { 34 | return err.Err.Error() 35 | } 36 | 37 | // FieldError is used to indicate an error with a specific request field. 38 | type FieldError struct { 39 | Field string `json:"field"` 40 | Error string `json:"error"` 41 | } 42 | 43 | // FieldErrors represents a collection of field errors. 44 | type FieldErrors []FieldError 45 | 46 | // Error implments the error interface. 47 | func (fe FieldErrors) Error() string { 48 | d, err := json.Marshal(fe) 49 | if err != nil { 50 | return err.Error() 51 | } 52 | return string(d) 53 | } 54 | -------------------------------------------------------------------------------- /business/web/mid/doc.go: -------------------------------------------------------------------------------- 1 | // Package mid contains the set of middleware functions. 2 | package mid 3 | -------------------------------------------------------------------------------- /business/web/mid/logger.go: -------------------------------------------------------------------------------- 1 | package mid 2 | 3 | import ( 4 | "context" 5 | "log" 6 | "net/http" 7 | "time" 8 | 9 | "github.com/dgraph-io/travel/foundation/web" 10 | ) 11 | 12 | // Logger writes some information about the request to the logs in the 13 | // format: TraceID : (200) GET /foo -> IP ADDR (latency) 14 | func Logger(log *log.Logger) web.Middleware { 15 | 16 | // This is the actual middleware function to be executed. 17 | m := func(handler web.Handler) web.Handler { 18 | 19 | // Create the handler that will be attached in the middleware chain. 20 | h := func(ctx context.Context, w http.ResponseWriter, r *http.Request) error { 21 | 22 | // If the context is missing this value, request the service 23 | // to be shutdown gracefully. 24 | v, ok := ctx.Value(web.KeyValues).(*web.Values) 25 | if !ok { 26 | return web.NewShutdownError("web value missing from context") 27 | } 28 | 29 | log.Printf("%s: started: %s %s -> %s", 30 | v.TraceID, 31 | r.Method, r.URL.Path, r.RemoteAddr, 32 | ) 33 | 34 | // Call the next handler. 35 | err := handler(ctx, w, r) 36 | 37 | log.Printf("%s: completed: %s %s -> %s (%d) (%s)", 38 | v.TraceID, 39 | r.Method, r.URL.Path, r.RemoteAddr, 40 | v.StatusCode, time.Since(v.Now), 41 | ) 42 | 43 | // Return the error so it can be handled further up the chain. 44 | return err 45 | } 46 | 47 | return h 48 | } 49 | 50 | return m 51 | } 52 | -------------------------------------------------------------------------------- /business/web/mid/metrics.go: -------------------------------------------------------------------------------- 1 | package mid 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | "runtime" 7 | 8 | "github.com/dgraph-io/travel/business/sys/metrics" 9 | "github.com/dgraph-io/travel/foundation/web" 10 | ) 11 | 12 | // Metrics updates program counters. 13 | func Metrics(data *metrics.Metrics) web.Middleware { 14 | 15 | // This is the actual middleware function to be executed. 16 | m := func(handler web.Handler) web.Handler { 17 | 18 | // Create the handler that will be attached in the middleware chain. 19 | h := func(ctx context.Context, w http.ResponseWriter, r *http.Request) error { 20 | 21 | // Add the metrics value for metric gathering. 22 | ctx = context.WithValue(ctx, metrics.Key, data) 23 | 24 | // Call the next handler. 25 | err := handler(ctx, w, r) 26 | 27 | // Handle updating the metrics that can be handled here. 28 | 29 | // Increment the request counter. 30 | data.Requests.Add(1) 31 | 32 | // Increment if there is an error flowing through the request. 33 | if err != nil { 34 | data.Errors.Add(1) 35 | } 36 | 37 | // Update the count for the number of active goroutines every 100 requests. 38 | if data.Requests.Value()%100 == 0 { 39 | data.Goroutines.Set(int64(runtime.NumGoroutine())) 40 | } 41 | 42 | // Return the error so it can be handled further up the chain. 43 | return err 44 | } 45 | 46 | return h 47 | } 48 | 49 | return m 50 | } 51 | -------------------------------------------------------------------------------- /business/web/mid/panics.go: -------------------------------------------------------------------------------- 1 | package mid 2 | 3 | import ( 4 | "context" 5 | "log" 6 | "net/http" 7 | 8 | "github.com/dgraph-io/travel/business/sys/metrics" 9 | "github.com/dgraph-io/travel/foundation/web" 10 | "github.com/pkg/errors" 11 | ) 12 | 13 | // Panics recovers from panics and converts the panic to an error so it is 14 | // reported in Metrics and handled in Errors. 15 | func Panics(log *log.Logger) web.Middleware { 16 | 17 | // This is the actual middleware function to be executed. 18 | m := func(handler web.Handler) web.Handler { 19 | 20 | // Wrap this handler around the next one provided. 21 | h := func(ctx context.Context, w http.ResponseWriter, r *http.Request) (err error) { 22 | 23 | // Defer a function to recover from a panic and set the err return 24 | // variable after the fact. 25 | defer func() { 26 | if rec := recover(); rec != nil { 27 | err = errors.Errorf("PANIC: %v", rec) 28 | metrics.AddPanics(ctx) 29 | } 30 | }() 31 | 32 | // Call the next handler and set its return value in the err variable. 33 | return handler(ctx, w, r) 34 | } 35 | 36 | return h 37 | } 38 | 39 | return m 40 | } 41 | -------------------------------------------------------------------------------- /foundation/keystore/keystore_test.go: -------------------------------------------------------------------------------- 1 | package keystore_test 2 | 3 | import ( 4 | _ "embed" // Embed all sql documents 5 | 6 | "strings" 7 | "testing" 8 | "testing/fstest" 9 | 10 | "github.com/dgraph-io/travel/foundation/keystore" 11 | ) 12 | 13 | // Success and failure markers. 14 | const ( 15 | success = "\u2713" 16 | failed = "\u2717" 17 | ) 18 | 19 | //go:embed test.pem 20 | var keyDoc []byte 21 | 22 | func TestRead(t *testing.T) { 23 | t.Log("Given the need to parse a directory of private key files.") 24 | { 25 | fileName := "54bb2165-71e1-41a6-af3e-7da4a0e1e2c1.pem" 26 | keyID := strings.TrimRight(fileName, ".pem") 27 | fsys := fstest.MapFS{} 28 | fsys[fileName] = &fstest.MapFile{Data: keyDoc} 29 | 30 | testID := 0 31 | t.Logf("\tTest %d:\tWhen handling a directory of %d file(s).", testID, len(fsys)) 32 | { 33 | ks, err := keystore.NewFS(fsys) 34 | if err != nil { 35 | t.Fatalf("\t%s\tTest %d:\tShould be able to construct key store: %v", failed, testID, err) 36 | } 37 | t.Logf("\t%s\tTest %d:\tShould be able to construct key store.", success, testID) 38 | 39 | pk, err := ks.PrivateKey(keyID) 40 | if err != nil { 41 | t.Fatalf("\t%s\tTest %d:\tShould be able to find key in store: %v", failed, testID, err) 42 | } 43 | t.Logf("\t%s\tTest %d:\tShould be able to find key in store.", success, testID) 44 | 45 | if err := pk.Validate(); err != nil { 46 | t.Fatalf("\t%s\tTest %d:\tShould be able to validate the key: %v", failed, testID, err) 47 | } 48 | t.Logf("\t%s\tTest %d:\tShould be able to validate the key.", success, testID) 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /foundation/keystore/test.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEAvMAHb0IoLvoYuW2kA+LTmnk+hfnBq1eYIh4CT/rMPCxgtzjq 3 | U0guQOMnLg69ydyA5uu37v6rbS1+stuBTEiMQl/bxAhgLkGrUhgpZ10Bt6GzSEgw 4 | QNloZoGaxe4p20wMPpT4kcMKNHkQds3uONNcLxPUmfjbbH64g+seg28pbgQPwKFK 5 | tF7bIsOBgz0g5Ptn5mrkdzqMPUSy9k9VCu+R42LH9c75JsRzz4FeN+VzwMAL6yQn 6 | ZvOi7/zOgNyxeVia8XVKykrnhgcpiOn5oaLRBzQGN00Z7TuBRIfDJWU21qQN4Cq7 7 | keZmMP4gqCVWjYneK4bzrG/+H2w9BJ2TsmMGvwIDAQABAoIBAFQmQKpHkmavNYql 8 | 6POaksBRwaA1YzSijr7XJizGIXvKRSwqgb2zdnuTSgpspAx09Dr/aDdy7rZ0DAJt 9 | fk2mInINDottOIQm3txwzTS58GQQAT/+fxTKWJMqwPfxYFPWqbbU76T8kXYna0Gs 10 | OcK36GdMrgIfQqQyMs0Na8MpMg1LmkAxuqnFCXS/NMyKl9jInaaTS+Kz+BSzUMGQ 11 | zebfLFsf2N7sLZuimt9zlRG30JJTfBlB04xsYMo734usA2ITe8U0XqG6Og0qc6ev 12 | 6lsoM8hpvEUsQLcjQQ5up7xx3S2stZJ8o0X8GEX5qUMaomil8mZ7X5xOlEqf7p+v 13 | lXQ46cECgYEA2lbZQON6l3ZV9PCn9j1rEGaXio3SrAdTyWK3D1HF+/lEjClhMkfC 14 | XrECOZYj+fiI9n+YpSog+tTDF7FTLf7VP21d2gnhQN6KAXUnLIypzXxodcC6h+8M 15 | ZGJh/EydLvC7nPNoaXx96bohxzS8hrOlOlkCbr+8gPYKf8qkbe7HyxECgYEA3U6e 16 | x9g4FfTvI5MGrhp2BIzoRSn7HlNQzjJ71iMHmM2kBm7TsER8Co1PmPDrP8K/UyGU 17 | Q25usTsPSrHtKQEV6EsWKaP/6p2Q82sDkT9bZlV+OjRvOfpdO5rP6Q95vUmMGWJ/ 18 | S6oimbXXL8p3gDafw3vC1PCAhoaxMnGyKuZwlM8CgYEAixT1sXr2dZMg8DV4mMfI 19 | 8pqXf+AVyhWkzsz+FVkeyAKiIrKdQp0peI5C/5HfevVRscvX3aY3efCcEfSYKt2A 20 | 07WEKkdO4LahrIoHGT7FT6snE5NgfwTMnQl6p2/aVLNun20CHuf5gTBbIf069odr 21 | Af7/KLMkjfWs/HiGQ6zuQjECgYEAv+DIvlDz3+Wr6dYyNoXuyWc6g60wc0ydhQo0 22 | YKeikJPLoWA53lyih6uZ1escrP23UOaOXCDFjJi+W28FR0YProZbwuLUoqDW6pZg 23 | U3DxWDrL5L9NqKEwcNt7ZIDsdnfsJp5F7F6o/UiyOFd9YQb7YkxN0r5rUTg7Lpdx 24 | eMyv0/UCgYEAhX9MPzmTO4+N8naGFof1o8YP97pZj0HkEvM0hTaeAQFKJiwX5ijQ 25 | xumKGh//G0AYsjqP02ItzOm2mWnbI3FrNlKmGFvR6VxIZMOyXvpLofHucjJ5SWli 26 | eYjPklKcXaMftt1FVO4n+EKj1k1+Tv14nytq/J5WN+r4FBlNEYj/6vg= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /foundation/web/middleware.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | // Middleware is a function designed to run some code before and/or after 4 | // another Handler. It is designed to remove boilerplate or other concerns not 5 | // direct to any given Handler. 6 | type Middleware func(Handler) Handler 7 | 8 | // wrapMiddleware creates a new handler by wrapping middleware around a final 9 | // handler. The middlewares' Handlers will be executed by requests in the order 10 | // they are provided. 11 | func wrapMiddleware(mw []Middleware, handler Handler) Handler { 12 | 13 | // Loop backwards through the middleware invoking each one. Replace the 14 | // handler with the new wrapped handler. Looping backwards ensures that the 15 | // first middleware of the slice is the first to be executed by requests. 16 | for i := len(mw) - 1; i >= 0; i-- { 17 | h := mw[i] 18 | if h != nil { 19 | handler = h(handler) 20 | } 21 | } 22 | 23 | return handler 24 | } 25 | -------------------------------------------------------------------------------- /foundation/web/request.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | 7 | "github.com/dimfeld/httptreemux/v5" 8 | ) 9 | 10 | // Param returns the web call parameters from the request. 11 | func Param(r *http.Request, key string) string { 12 | m := httptreemux.ContextParams(r.Context()) 13 | return m[key] 14 | } 15 | 16 | // Decode reads the body of an HTTP request looking for a JSON document. The 17 | // body is decoded into the provided value. 18 | // 19 | // If the provided value is a struct then it is checked for validation tags. 20 | func Decode(r *http.Request, val interface{}) error { 21 | decoder := json.NewDecoder(r.Body) 22 | decoder.DisallowUnknownFields() 23 | if err := decoder.Decode(val); err != nil { 24 | return err 25 | } 26 | 27 | return nil 28 | } 29 | -------------------------------------------------------------------------------- /foundation/web/response.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "net/http" 7 | ) 8 | 9 | // Respond converts a Go value to JSON and sends it to the client. 10 | func Respond(ctx context.Context, w http.ResponseWriter, data interface{}, statusCode int) error { 11 | 12 | // Set the status code for the request logger middleware. 13 | // If the context is missing this value, don't set it and 14 | // make sure a reponse is provided. 15 | if v, ok := ctx.Value(KeyValues).(*Values); ok { 16 | v.StatusCode = statusCode 17 | } 18 | 19 | // If there is nothing to marshal then set status code and return. 20 | if statusCode == http.StatusNoContent { 21 | w.WriteHeader(statusCode) 22 | return nil 23 | } 24 | 25 | // Convert the response value to JSON. 26 | jsonData, err := json.Marshal(data) 27 | if err != nil { 28 | return err 29 | } 30 | 31 | // Set the content type and headers once we know marshaling has succeeded. 32 | w.Header().Set("Content-Type", "application/json") 33 | 34 | // Write the status code to the response. 35 | w.WriteHeader(statusCode) 36 | 37 | // Send the result back to the client. 38 | if _, err := w.Write(jsonData); err != nil { 39 | return err 40 | } 41 | 42 | return nil 43 | } 44 | -------------------------------------------------------------------------------- /foundation/web/shutdown.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "github.com/pkg/errors" 5 | ) 6 | 7 | // shutdown is a type used to help with the graceful termination of the service. 8 | type shutdown struct { 9 | Message string 10 | } 11 | 12 | // NewShutdownError returns an error that causes the framework to signal 13 | // a graceful shutdown. 14 | func NewShutdownError(message string) error { 15 | return &shutdown{message} 16 | } 17 | 18 | // Error is the implementation of the error interface. 19 | func (s *shutdown) Error() string { 20 | return s.Message 21 | } 22 | 23 | // IsShutdown checks to see if the shutdown error is contained 24 | // in the specified error value. 25 | func IsShutdown(err error) bool { 26 | if _, ok := errors.Cause(err).(*shutdown); ok { 27 | return true 28 | } 29 | return false 30 | } 31 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/dgraph-io/travel 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/AvraamMavridis/randomcolor v0.0.0-20180822172341-208aff70bf2c 7 | github.com/ardanlabs/conf v1.5.0 8 | github.com/ardanlabs/graphql v1.6.2 9 | github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 10 | github.com/dimfeld/httptreemux/v5 v5.4.0 11 | github.com/go-playground/locales v0.14.0 12 | github.com/go-playground/universal-translator v0.18.0 13 | github.com/go-playground/validator/v10 v10.10.0 14 | github.com/google/go-cmp v0.5.7 15 | github.com/google/uuid v1.3.0 16 | github.com/pkg/errors v0.9.1 17 | go.opencensus.io v0.23.0 // indirect 18 | golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 19 | golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect 20 | golang.org/x/text v0.3.7 // indirect 21 | golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect 22 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect 23 | googlemaps.github.io/maps v1.3.2 24 | ) 25 | -------------------------------------------------------------------------------- /vendor/github.com/AvraamMavridis/randomcolor/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | notifications: 3 | email: false 4 | language: go 5 | go: 6 | - "1.10.x" 7 | - master -------------------------------------------------------------------------------- /vendor/github.com/AvraamMavridis/randomcolor/README.md: -------------------------------------------------------------------------------- 1 | # randomcolor 2 | 3 | Go package to generate random colors 4 | 5 | [![Build Status](https://travis-ci.org/AvraamMavridis/randomcolor.svg?branch=master)](https://travis-ci.org/AvraamMavridis/randomcolor) 6 | 7 | ```go 8 | package main 9 | 10 | import ( 11 | "github.com/AvraamMavridis/randomcolor" 12 | ) 13 | 14 | func main() { 15 | var colorInHex string = randomcolor.GetRandomColorInHex() 16 | var colorInRGB randomcolor.RGBColor = randomcolor.GetRandomColorInRgb() 17 | var colorInHSV randomcolor.HSVColor = randomcolor.GetRandomColorInHSV() 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/conf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who can contribute 2 | # (and typically have contributed) code to the gotraining repository. 3 | # 4 | # Names should be added to this file only after verifying that 5 | # the individual or the individual's organization has agreed to 6 | # the appropriate Contributor License Agreement, found here: 7 | # 8 | # http://code.google.com/legal/individual-cla-v1.0.html 9 | # http://code.google.com/legal/corporate-cla-v1.0.html 10 | # 11 | # The agreement for individuals can be filled out on the web. 12 | 13 | # Names should be added to this file like so: 14 | # Name 15 | # 16 | # An entry with two email addresses specifies that the 17 | # first address should be used in the submit logs and 18 | # that the second address should be recognized as the 19 | # same person when interacting with Rietveld. 20 | 21 | # Please keep the list sorted. 22 | 23 | Arash Bina 24 | Andy Walker 25 | Bruno Pereira 26 | Enrico204 27 | Fábio Correia 28 | Kelsey Hightower 29 | Peter Bourgon 30 | Steven Edwards 31 | William Kennedy -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/conf/README.md: -------------------------------------------------------------------------------- 1 | # Conf 2 | 3 | [![CircleCI](https://circleci.com/gh/ardanlabs/conf.svg?style=svg)](https://circleci.com/gh/ardanlabs/conf) 4 | 5 | Copyright 2018, 2019, 2020, 2021, Ardan Labs 6 | info@ardanlabs.com 7 | 8 | ## Licensing 9 | 10 | ``` 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | ``` 23 | 24 | ## About The Project 25 | 26 | Package conf provides support for using environmental variables and command 27 | line arguments for configuration. 28 | 29 | All of the documentation can be found on the [go.dev](https://pkg.go.dev/github.com/ardanlabs/conf?tab=doc) website. 30 | -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/conf/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/ardanlabs/conf 2 | 3 | go 1.13 4 | 5 | require github.com/google/go-cmp v0.3.1 6 | -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/conf/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= 2 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 3 | -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/graphql/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who can contribute 2 | # (and typically have contributed) code to the gotraining repository. 3 | # 4 | # Names should be added to this file only after verifying that 5 | # the individual or the individual's organization has agreed to 6 | # the appropriate Contributor License Agreement, found here: 7 | # 8 | # http://code.google.com/legal/individual-cla-v1.0.html 9 | # http://code.google.com/legal/corporate-cla-v1.0.html 10 | # 11 | # The agreement for individuals can be filled out on the web. 12 | 13 | # Names should be added to this file like so: 14 | # Name 15 | # 16 | # An entry with two email addresses specifies that the 17 | # first address should be used in the submit logs and 18 | # that the second address should be recognized as the 19 | # same person when interacting with Rietveld. 20 | 21 | # Please keep the list sorted. 22 | 23 | Dan Kortschak 24 | William Kennedy -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/graphql/README.md: -------------------------------------------------------------------------------- 1 | # graphql 2 | Simple GraphQL client for executing mutations and queries. 3 | 4 | [![CircleCI](https://circleci.com/gh/ardanlabs/graphql.svg?style=svg)](https://circleci.com/gh/ardanlabs/graphql) 5 | 6 | Copyright 2020, 2021, Ardan Labs 7 | info@ardanlabs.com 8 | 9 | ## Licensing 10 | 11 | ``` 12 | Licensed under the Apache License, Version 2.0 (the "License"); 13 | you may not use this file except in compliance with the License. 14 | You may obtain a copy of the License at 15 | 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | 18 | Unless required by applicable law or agreed to in writing, software 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | ``` 24 | 25 | ## About The Project 26 | 27 | Package graphql provides support for executing mutations and queries against a 28 | database using GraphQL. It was designed specifically for working with [Dgraph](https://dgraph.io/). 29 | 30 | All of the documentation can be found on the [go.dev](https://pkg.go.dev/github.com/ardanlabs/graphql?tab=doc) website. 31 | -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/graphql/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/ardanlabs/graphql 2 | 3 | go 1.14 4 | 5 | require github.com/google/go-cmp v0.5.5 6 | -------------------------------------------------------------------------------- /vendor/github.com/ardanlabs/graphql/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= 2 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 3 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 4 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 5 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | bin 3 | 4 | 5 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | script: 4 | - go vet ./... 5 | - go test -v ./... 6 | 7 | go: 8 | - "1.11" 9 | - "1.12" 10 | - "1.13" 11 | - tip 12 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Dave Grijalva 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | 9 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/claim_strings.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "encoding/json" 5 | "reflect" 6 | ) 7 | 8 | // ClaimStrings is used for parsing claim properties that 9 | // can be either a string or array of strings 10 | type ClaimStrings []string 11 | 12 | // ParseClaimStrings is used to produce a ClaimStrings value 13 | // from the various forms it may present during encoding/decodeing 14 | func ParseClaimStrings(value interface{}) (ClaimStrings, error) { 15 | switch v := value.(type) { 16 | case string: 17 | return ClaimStrings{v}, nil 18 | case []string: 19 | return ClaimStrings(v), nil 20 | case []interface{}: 21 | result := make(ClaimStrings, 0, len(v)) 22 | for i, vv := range v { 23 | if x, ok := vv.(string); ok { 24 | result = append(result, x) 25 | } else { 26 | return nil, &json.UnsupportedTypeError{Type: reflect.TypeOf(v[i])} 27 | } 28 | } 29 | return result, nil 30 | case nil: 31 | return nil, nil 32 | default: 33 | return nil, &json.UnsupportedTypeError{Type: reflect.TypeOf(v)} 34 | } 35 | } 36 | 37 | // UnmarshalJSON implements the json package's Unmarshaler interface 38 | func (c *ClaimStrings) UnmarshalJSON(data []byte) error { 39 | var value interface{} 40 | err := json.Unmarshal(data, &value) 41 | if err != nil { 42 | return err 43 | } 44 | 45 | *c, err = ParseClaimStrings(value) 46 | return err 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/doc.go: -------------------------------------------------------------------------------- 1 | // Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html 2 | // 3 | // See README.md for more info. 4 | package jwt 5 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/ecdsa_utils.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "crypto/ecdsa" 5 | "crypto/x509" 6 | "encoding/pem" 7 | "errors" 8 | ) 9 | 10 | // Errors returned by EC signing methods 11 | var ( 12 | ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") 13 | ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") 14 | ) 15 | 16 | // ParseECPrivateKeyFromPEM is a helper function for 17 | // parsing a PEM encoded Elliptic Curve Private Key Structure 18 | func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { 19 | var err error 20 | 21 | // Parse PEM block 22 | var block *pem.Block 23 | if block, _ = pem.Decode(key); block == nil { 24 | return nil, ErrKeyMustBePEMEncoded 25 | } 26 | 27 | // Parse the key 28 | var parsedKey interface{} 29 | if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { 30 | return nil, err 31 | } 32 | 33 | var pkey *ecdsa.PrivateKey 34 | var ok bool 35 | if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { 36 | return nil, ErrNotECPrivateKey 37 | } 38 | 39 | return pkey, nil 40 | } 41 | 42 | // ParseECPublicKeyFromPEM is a helper function for 43 | // parsing a PEM encoded PKCS1 or PKCS8 public key 44 | func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { 45 | var err error 46 | 47 | // Parse PEM block 48 | var block *pem.Block 49 | if block, _ = pem.Decode(key); block == nil { 50 | return nil, ErrKeyMustBePEMEncoded 51 | } 52 | 53 | // Parse the key 54 | var parsedKey interface{} 55 | if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { 56 | if cert, err := x509.ParseCertificate(block.Bytes); err == nil { 57 | parsedKey = cert.PublicKey 58 | } else { 59 | return nil, err 60 | } 61 | } 62 | 63 | var pkey *ecdsa.PublicKey 64 | var ok bool 65 | if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { 66 | return nil, ErrNotECPublicKey 67 | } 68 | 69 | return pkey, nil 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/dgrijalva/jwt-go/v4 2 | 3 | go 1.12 4 | 5 | require golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 6 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/go.sum: -------------------------------------------------------------------------------- 1 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 2 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 3 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/keyfunc.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import "fmt" 4 | 5 | // Keyfunc is the type passed to Parse methods to supply 6 | // the key for verification. The function receives the parsed, 7 | // but unverified Token. This allows you to use properties in the 8 | // Header of the token (such as `kid`) to identify which key to use. 9 | type Keyfunc func(*Token) (interface{}, error) 10 | 11 | // KnownKeyfunc is a helper for generating a Keyfunc from a known 12 | // signing method and key. If your implementation only supports a single signing method 13 | // and key, this is for you. 14 | func KnownKeyfunc(signingMethod SigningMethod, key interface{}) Keyfunc { 15 | return func(t *Token) (interface{}, error) { 16 | if signingMethod.Alg() != t.Header["alg"] { 17 | return nil, fmt.Errorf("unexpected signing method: %v, expected: %v", t.Header["alg"], signingMethod.Alg()) 18 | } 19 | return key, nil 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/signing_method.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | var signingMethods = map[string]func() SigningMethod{} 8 | var signingMethodLock = new(sync.RWMutex) 9 | 10 | // SigningMethod is the interface used for signing and verifying tokens 11 | type SigningMethod interface { 12 | Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid 13 | Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error 14 | Alg() string // returns the alg identifier for this method (example: 'HS256') 15 | } 16 | 17 | // RegisterSigningMethod stores the "alg" name and a factory function pair 18 | // used internally for looking up a signing method based on "alg". 19 | // This is typically done during init() in the method's implementation 20 | func RegisterSigningMethod(alg string, f func() SigningMethod) { 21 | signingMethodLock.Lock() 22 | defer signingMethodLock.Unlock() 23 | 24 | signingMethods[alg] = f 25 | } 26 | 27 | // GetSigningMethod returns the signing method registered by RegisterSigningMethod 28 | // This is used by the library internally during parsing and validation. 29 | func GetSigningMethod(alg string) (method SigningMethod) { 30 | signingMethodLock.RLock() 31 | defer signingMethodLock.RUnlock() 32 | 33 | if methodF, ok := signingMethods[alg]; ok { 34 | method = methodF() 35 | } 36 | return 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/v4/signing_option.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | // CodingContext provides context to TokenMarshaller and TokenUnmarshaller 4 | type CodingContext struct { 5 | FieldDescriptor // Which field are we encoding/decoding? 6 | Header map[string]interface{} // The token Header, if available 7 | } 8 | 9 | // FieldDescriptor describes which field is being processed. Used by CodingContext 10 | // This is to enable the marshaller to treat the head and body differently 11 | type FieldDescriptor uint8 12 | 13 | // Constants describe which field is being processed by custom Marshaller 14 | const ( 15 | HeaderFieldDescriptor FieldDescriptor = 0 16 | ClaimsFieldDescriptor FieldDescriptor = 1 17 | ) 18 | 19 | // SigningOption can be passed to signing related methods on Token to customize behavior 20 | type SigningOption func(*signingOptions) 21 | 22 | type signingOptions struct { 23 | marshaller TokenMarshaller 24 | } 25 | 26 | // TokenMarshaller is the interface you must implement to provide custom JSON marshalling 27 | // behavior. It is the same as json.Marshal with the addition of the FieldDescriptor. 28 | // The field value will let your marshaller know which field is being processed. 29 | // This is to facilitate things like compression, where you wouldn't want to compress 30 | // the head. 31 | type TokenMarshaller func(ctx CodingContext, v interface{}) ([]byte, error) 32 | 33 | // WithMarshaller returns a SigningOption that will tell the signing code to use your custom Marshaller 34 | func WithMarshaller(m TokenMarshaller) SigningOption { 35 | return func(o *signingOptions) { 36 | o.marshaller = m 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/dimfeld/httptreemux/v5/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | 25 | .idea/ 26 | -------------------------------------------------------------------------------- /vendor/github.com/dimfeld/httptreemux/v5/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | gobuild_args: "-v -race" 4 | go: 5 | - 1.5 6 | - 1.6 7 | - 1.7 8 | - 1.8 9 | - 1.9 10 | - tip 11 | 12 | matrix: 13 | allow_failures: 14 | - go: tip 15 | -------------------------------------------------------------------------------- /vendor/github.com/dimfeld/httptreemux/v5/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014,2015 Daniel Imfeld 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/dimfeld/httptreemux/v5/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/dimfeld/httptreemux/v5 2 | 3 | go 1.9 4 | -------------------------------------------------------------------------------- /vendor/github.com/dimfeld/httptreemux/v5/unescape_17.go: -------------------------------------------------------------------------------- 1 | // +build !go1.8 2 | 3 | package httptreemux 4 | 5 | import "net/url" 6 | 7 | func unescape(path string) (string, error) { 8 | return url.QueryUnescape(path) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/dimfeld/httptreemux/v5/unescape_18.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package httptreemux 4 | 5 | import "net/url" 6 | 7 | func unescape(path string) (string, error) { 8 | return url.PathUnescape(path) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/locales/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/locales/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.13.1 4 | - tip 5 | matrix: 6 | allow_failures: 7 | - go: tip 8 | 9 | notifications: 10 | email: 11 | recipients: dean.karn@gmail.com 12 | on_success: change 13 | on_failure: always 14 | 15 | before_install: 16 | - go install github.com/mattn/goveralls 17 | 18 | # Only clone the most recent commit. 19 | git: 20 | depth: 1 21 | 22 | script: 23 | - go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./... 24 | 25 | after_success: | 26 | goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN -------------------------------------------------------------------------------- /vendor/github.com/go-playground/locales/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Go Playground 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/go-playground/locales/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/go-playground/locales 2 | 3 | go 1.13 4 | 5 | require golang.org/x/text v0.3.6 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/locales/go.sum: -------------------------------------------------------------------------------- 1 | golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= 2 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 3 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/locales/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/vendor/github.com/go-playground/locales/logo.png -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | *.coverprofile -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.13.4 4 | - tip 5 | matrix: 6 | allow_failures: 7 | - go: tip 8 | 9 | notifications: 10 | email: 11 | recipients: dean.karn@gmail.com 12 | on_success: change 13 | on_failure: always 14 | 15 | before_install: 16 | - go install github.com/mattn/goveralls 17 | 18 | # Only clone the most recent commit. 19 | git: 20 | depth: 1 21 | 22 | script: 23 | - go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./... 24 | 25 | after_success: | 26 | [ $TRAVIS_GO_VERSION = 1.13.4 ] && 27 | goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Go Playground 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/Makefile: -------------------------------------------------------------------------------- 1 | GOCMD=GO111MODULE=on go 2 | 3 | linters-install: 4 | @golangci-lint --version >/dev/null 2>&1 || { \ 5 | echo "installing linting tools..."; \ 6 | curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \ 7 | } 8 | 9 | lint: linters-install 10 | golangci-lint run 11 | 12 | test: 13 | $(GOCMD) test -cover -race ./... 14 | 15 | bench: 16 | $(GOCMD) test -bench=. -benchmem ./... 17 | 18 | .PHONY: test lint linters-install -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/go-playground/universal-translator 2 | 3 | go 1.13 4 | 5 | require github.com/go-playground/locales v0.14.0 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/go.sum: -------------------------------------------------------------------------------- 1 | github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= 2 | github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= 3 | github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= 4 | github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= 5 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 6 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 7 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/universal-translator/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/vendor/github.com/go-playground/universal-translator/logo.png -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | bin 10 | 11 | # Architecture specific extensions/prefixes 12 | *.[568vq] 13 | [568vq].out 14 | 15 | *.cgo1.go 16 | *.cgo2.c 17 | _cgo_defun.c 18 | _cgo_gotypes.go 19 | _cgo_export.* 20 | 21 | _testmain.go 22 | 23 | *.exe 24 | *.test 25 | *.prof 26 | *.test 27 | *.out 28 | *.txt 29 | cover.html 30 | README.html 31 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dean Karn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Maintainers Guide 2 | 3 | ### Semantic Versioning 4 | Semantic versioning as defined [here](https://semver.org) must be strictly adhered to. 5 | 6 | ### External Dependencies 7 | Any new external dependencies MUST: 8 | - Have a compatible LICENSE present. 9 | - Be actively maintained. 10 | - Be approved by @go-playground/admins 11 | 12 | ### PR Merge Requirements 13 | - Up-to-date branch. 14 | - Passing tests and linting. 15 | - CODEOWNERS approval. 16 | - Tests that cover both the Happy and Unhappy paths. -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/Makefile: -------------------------------------------------------------------------------- 1 | GOCMD=GO111MODULE=on go 2 | 3 | linters-install: 4 | @golangci-lint --version >/dev/null 2>&1 || { \ 5 | echo "installing linting tools..."; \ 6 | curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \ 7 | } 8 | 9 | lint: linters-install 10 | golangci-lint run 11 | 12 | test: 13 | $(GOCMD) test -cover -race ./... 14 | 15 | bench: 16 | $(GOCMD) test -bench=. -benchmem ./... 17 | 18 | .PHONY: test lint linters-install -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/go-playground/validator/v10 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/davecgh/go-spew v1.1.1 // indirect 7 | github.com/go-playground/assert/v2 v2.0.1 8 | github.com/go-playground/locales v0.14.0 9 | github.com/go-playground/universal-translator v0.18.0 10 | github.com/kr/pretty v0.3.0 // indirect 11 | github.com/leodido/go-urn v1.2.1 12 | github.com/rogpeppe/go-internal v1.8.0 // indirect 13 | github.com/stretchr/testify v1.7.0 // indirect 14 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 15 | golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect 16 | golang.org/x/text v0.3.6 17 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 18 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/vendor/github.com/go-playground/validator/v10/logo.png -------------------------------------------------------------------------------- /vendor/github.com/go-playground/validator/v10/translations.go: -------------------------------------------------------------------------------- 1 | package validator 2 | 3 | import ut "github.com/go-playground/universal-translator" 4 | 5 | // TranslationFunc is the function type used to register or override 6 | // custom translations 7 | type TranslationFunc func(ut ut.Translator, fe FieldError) string 8 | 9 | // RegisterTranslationsFunc allows for registering of translations 10 | // for a 'ut.Translator' for use within the 'TranslationFunc' 11 | type RegisterTranslationsFunc func(ut ut.Translator) error 12 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/export_panic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build purego 6 | // +build purego 7 | 8 | package cmp 9 | 10 | import "reflect" 11 | 12 | const supportExporters = false 13 | 14 | func retrieveUnexportedField(reflect.Value, reflect.StructField, bool) reflect.Value { 15 | panic("no support for forcibly accessing unexported fields") 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/export_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !purego 6 | // +build !purego 7 | 8 | package cmp 9 | 10 | import ( 11 | "reflect" 12 | "unsafe" 13 | ) 14 | 15 | const supportExporters = true 16 | 17 | // retrieveUnexportedField uses unsafe to forcibly retrieve any field from 18 | // a struct such that the value has read-write permissions. 19 | // 20 | // The parent struct, v, must be addressable, while f must be a StructField 21 | // describing the field to retrieve. If addr is false, 22 | // then the returned value will be shallowed copied to be non-addressable. 23 | func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value { 24 | ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() 25 | if !addr { 26 | // A field is addressable if and only if the struct is addressable. 27 | // If the original parent value was not addressable, shallow copy the 28 | // value to make it non-addressable to avoid leaking an implementation 29 | // detail of how forcibly exporting a field works. 30 | if ve.Kind() == reflect.Interface && ve.IsNil() { 31 | return reflect.Zero(f.Type) 32 | } 33 | return reflect.ValueOf(ve.Interface()).Convert(f.Type) 34 | } 35 | return ve 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !cmp_debug 6 | // +build !cmp_debug 7 | 8 | package diff 9 | 10 | var debug debugger 11 | 12 | type debugger struct{} 13 | 14 | func (debugger) Begin(_, _ int, f EqualFunc, _, _ *EditScript) EqualFunc { 15 | return f 16 | } 17 | func (debugger) Update() {} 18 | func (debugger) Finish() {} 19 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flags 6 | 7 | // Deterministic controls whether the output of Diff should be deterministic. 8 | // This is only used for testing. 9 | var Deterministic bool 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build purego 6 | // +build purego 7 | 8 | package value 9 | 10 | import "reflect" 11 | 12 | // Pointer is an opaque typed pointer and is guaranteed to be comparable. 13 | type Pointer struct { 14 | p uintptr 15 | t reflect.Type 16 | } 17 | 18 | // PointerOf returns a Pointer from v, which must be a 19 | // reflect.Ptr, reflect.Slice, or reflect.Map. 20 | func PointerOf(v reflect.Value) Pointer { 21 | // NOTE: Storing a pointer as an uintptr is technically incorrect as it 22 | // assumes that the GC implementation does not use a moving collector. 23 | return Pointer{v.Pointer(), v.Type()} 24 | } 25 | 26 | // IsNil reports whether the pointer is nil. 27 | func (p Pointer) IsNil() bool { 28 | return p.p == 0 29 | } 30 | 31 | // Uintptr returns the pointer as a uintptr. 32 | func (p Pointer) Uintptr() uintptr { 33 | return p.p 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !purego 6 | // +build !purego 7 | 8 | package value 9 | 10 | import ( 11 | "reflect" 12 | "unsafe" 13 | ) 14 | 15 | // Pointer is an opaque typed pointer and is guaranteed to be comparable. 16 | type Pointer struct { 17 | p unsafe.Pointer 18 | t reflect.Type 19 | } 20 | 21 | // PointerOf returns a Pointer from v, which must be a 22 | // reflect.Ptr, reflect.Slice, or reflect.Map. 23 | func PointerOf(v reflect.Value) Pointer { 24 | // The proper representation of a pointer is unsafe.Pointer, 25 | // which is necessary if the GC ever uses a moving collector. 26 | return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} 27 | } 28 | 29 | // IsNil reports whether the pointer is nil. 30 | func (p Pointer) IsNil() bool { 31 | return p.p == nil 32 | } 33 | 34 | // Uintptr returns the pointer as a uintptr. 35 | func (p Pointer) Uintptr() uintptr { 36 | return uintptr(p.p) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/internal/value/zero.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package value 6 | 7 | import ( 8 | "math" 9 | "reflect" 10 | ) 11 | 12 | // IsZero reports whether v is the zero value. 13 | // This does not rely on Interface and so can be used on unexported fields. 14 | func IsZero(v reflect.Value) bool { 15 | switch v.Kind() { 16 | case reflect.Bool: 17 | return v.Bool() == false 18 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 19 | return v.Int() == 0 20 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 21 | return v.Uint() == 0 22 | case reflect.Float32, reflect.Float64: 23 | return math.Float64bits(v.Float()) == 0 24 | case reflect.Complex64, reflect.Complex128: 25 | return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0 26 | case reflect.String: 27 | return v.String() == "" 28 | case reflect.UnsafePointer: 29 | return v.Pointer() == 0 30 | case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: 31 | return v.IsNil() 32 | case reflect.Array: 33 | for i := 0; i < v.Len(); i++ { 34 | if !IsZero(v.Index(i)) { 35 | return false 36 | } 37 | } 38 | return true 39 | case reflect.Struct: 40 | for i := 0; i < v.NumField(); i++ { 41 | if !IsZero(v.Field(i)) { 42 | return false 43 | } 44 | } 45 | return true 46 | } 47 | return false 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-cmp/cmp/report.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cmp 6 | 7 | // defaultReporter implements the reporter interface. 8 | // 9 | // As Equal serially calls the PushStep, Report, and PopStep methods, the 10 | // defaultReporter constructs a tree-based representation of the compared value 11 | // and the result of each comparison (see valueNode). 12 | // 13 | // When the String method is called, the FormatDiff method transforms the 14 | // valueNode tree into a textNode tree, which is a tree-based representation 15 | // of the textual output (see textNode). 16 | // 17 | // Lastly, the textNode.String method produces the final report as a string. 18 | type defaultReporter struct { 19 | root *valueNode 20 | curr *valueNode 21 | } 22 | 23 | func (r *defaultReporter) PushStep(ps PathStep) { 24 | r.curr = r.curr.PushStep(ps) 25 | if r.root == nil { 26 | r.root = r.curr 27 | } 28 | } 29 | func (r *defaultReporter) Report(rs Result) { 30 | r.curr.Report(rs) 31 | } 32 | func (r *defaultReporter) PopStep() { 33 | r.curr = r.curr.PopStep() 34 | } 35 | 36 | // String provides a full report of the differences detected as a structured 37 | // literal in pseudo-Go syntax. String may only be called after the entire tree 38 | // has been traversed. 39 | func (r *defaultReporter) String() string { 40 | assert(r.root != nil && r.curr == nil) 41 | if r.root.NumDiff == 0 { 42 | return "" 43 | } 44 | ptrs := new(pointerReferences) 45 | text := formatOptions{}.FormatDiff(r.root, ptrs) 46 | resolveReferences(text) 47 | return text.String() 48 | } 49 | 50 | func assert(ok bool) { 51 | if !ok { 52 | panic("assertion failure") 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.3 5 | - 1.5.3 6 | - tip 7 | 8 | script: 9 | - go test -v ./... 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to this project! 4 | 5 | ### Legal requirements 6 | 7 | In order to protect both you and ourselves, you will need to sign the 8 | [Contributor License Agreement](https://cla.developers.google.com/clas). 9 | 10 | You may have already signed it for other Google projects. 11 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | bmatsuo 3 | shawnps 4 | theory 5 | jboverfelt 6 | dsymonds 7 | cd1 8 | wallclockbuilder 9 | dansouza 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009,2014 Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/README.md: -------------------------------------------------------------------------------- 1 | # uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) 2 | The uuid package generates and inspects UUIDs based on 3 | [RFC 4122](http://tools.ietf.org/html/rfc4122) 4 | and DCE 1.1: Authentication and Security Services. 5 | 6 | This package is based on the github.com/pborman/uuid package (previously named 7 | code.google.com/p/go-uuid). It differs from these earlier packages in that 8 | a UUID is a 16 byte array rather than a byte slice. One loss due to this 9 | change is the ability to represent an invalid UUID (vs a NIL UUID). 10 | 11 | ###### Install 12 | `go get github.com/google/uuid` 13 | 14 | ###### Documentation 15 | [![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) 16 | 17 | Full `go doc` style documentation for the package can be viewed online without 18 | installing this package by using the GoDoc site here: 19 | http://pkg.go.dev/github.com/google/uuid 20 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package uuid generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security 8 | // Services. 9 | // 10 | // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to 11 | // maps or compared directly. 12 | package uuid 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/google/uuid 2 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "crypto/md5" 9 | "crypto/sha1" 10 | "hash" 11 | ) 12 | 13 | // Well known namespace IDs and UUIDs 14 | var ( 15 | NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) 16 | NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) 17 | NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) 18 | NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) 19 | Nil UUID // empty UUID, all zeros 20 | ) 21 | 22 | // NewHash returns a new UUID derived from the hash of space concatenated with 23 | // data generated by h. The hash should be at least 16 byte in length. The 24 | // first 16 bytes of the hash are used to form the UUID. The version of the 25 | // UUID will be the lower 4 bits of version. NewHash is used to implement 26 | // NewMD5 and NewSHA1. 27 | func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { 28 | h.Reset() 29 | h.Write(space[:]) //nolint:errcheck 30 | h.Write(data) //nolint:errcheck 31 | s := h.Sum(nil) 32 | var uuid UUID 33 | copy(uuid[:], s) 34 | uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) 35 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant 36 | return uuid 37 | } 38 | 39 | // NewMD5 returns a new MD5 (Version 3) UUID based on the 40 | // supplied name space and data. It is the same as calling: 41 | // 42 | // NewHash(md5.New(), space, data, 3) 43 | func NewMD5(space UUID, data []byte) UUID { 44 | return NewHash(md5.New(), space, data, 3) 45 | } 46 | 47 | // NewSHA1 returns a new SHA1 (Version 5) UUID based on the 48 | // supplied name space and data. It is the same as calling: 49 | // 50 | // NewHash(sha1.New(), space, data, 5) 51 | func NewSHA1(space UUID, data []byte) UUID { 52 | return NewHash(sha1.New(), space, data, 5) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/marshal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import "fmt" 8 | 9 | // MarshalText implements encoding.TextMarshaler. 10 | func (uuid UUID) MarshalText() ([]byte, error) { 11 | var js [36]byte 12 | encodeHex(js[:], uuid) 13 | return js[:], nil 14 | } 15 | 16 | // UnmarshalText implements encoding.TextUnmarshaler. 17 | func (uuid *UUID) UnmarshalText(data []byte) error { 18 | id, err := ParseBytes(data) 19 | if err != nil { 20 | return err 21 | } 22 | *uuid = id 23 | return nil 24 | } 25 | 26 | // MarshalBinary implements encoding.BinaryMarshaler. 27 | func (uuid UUID) MarshalBinary() ([]byte, error) { 28 | return uuid[:], nil 29 | } 30 | 31 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 32 | func (uuid *UUID) UnmarshalBinary(data []byte) error { 33 | if len(data) != 16 { 34 | return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) 35 | } 36 | copy(uuid[:], data) 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node_js.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build js 6 | 7 | package uuid 8 | 9 | // getHardwareInterface returns nil values for the JS version of the code. 10 | // This remvoves the "net" dependency, because it is not used in the browser. 11 | // Using the "net" library inflates the size of the transpiled JS code by 673k bytes. 12 | func getHardwareInterface(name string) (string, []byte) { return "", nil } 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node_net.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !js 6 | 7 | package uuid 8 | 9 | import "net" 10 | 11 | var interfaces []net.Interface // cached list of interfaces 12 | 13 | // getHardwareInterface returns the name and hardware address of interface name. 14 | // If name is "" then the name and hardware address of one of the system's 15 | // interfaces is returned. If no interfaces are found (name does not exist or 16 | // there are no interfaces) then "", nil is returned. 17 | // 18 | // Only addresses of at least 6 bytes are returned. 19 | func getHardwareInterface(name string) (string, []byte) { 20 | if interfaces == nil { 21 | var err error 22 | interfaces, err = net.Interfaces() 23 | if err != nil { 24 | return "", nil 25 | } 26 | } 27 | for _, ifs := range interfaces { 28 | if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { 29 | return ifs.Name, ifs.HardwareAddr 30 | } 31 | } 32 | return "", nil 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/sql.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "database/sql/driver" 9 | "fmt" 10 | ) 11 | 12 | // Scan implements sql.Scanner so UUIDs can be read from databases transparently. 13 | // Currently, database types that map to string and []byte are supported. Please 14 | // consult database-specific driver documentation for matching types. 15 | func (uuid *UUID) Scan(src interface{}) error { 16 | switch src := src.(type) { 17 | case nil: 18 | return nil 19 | 20 | case string: 21 | // if an empty UUID comes from a table, we return a null UUID 22 | if src == "" { 23 | return nil 24 | } 25 | 26 | // see Parse for required string format 27 | u, err := Parse(src) 28 | if err != nil { 29 | return fmt.Errorf("Scan: %v", err) 30 | } 31 | 32 | *uuid = u 33 | 34 | case []byte: 35 | // if an empty UUID comes from a table, we return a null UUID 36 | if len(src) == 0 { 37 | return nil 38 | } 39 | 40 | // assumes a simple slice of bytes if 16 bytes 41 | // otherwise attempts to parse 42 | if len(src) != 16 { 43 | return uuid.Scan(string(src)) 44 | } 45 | copy((*uuid)[:], src) 46 | 47 | default: 48 | return fmt.Errorf("Scan: unable to scan type %T into UUID", src) 49 | } 50 | 51 | return nil 52 | } 53 | 54 | // Value implements sql.Valuer so that UUIDs can be written to databases 55 | // transparently. Currently, UUIDs map to strings. Please consult 56 | // database-specific driver documentation for matching types. 57 | func (uuid UUID) Value() (driver.Value, error) { 58 | return uuid.String(), nil 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | // randomBits completely fills slice b with random data. 12 | func randomBits(b []byte) { 13 | if _, err := io.ReadFull(rander, b); err != nil { 14 | panic(err.Error()) // rand should never fail 15 | } 16 | } 17 | 18 | // xvalues returns the value of a byte as a hexadecimal digit or 255. 19 | var xvalues = [256]byte{ 20 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 21 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 24 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 26 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 27 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 28 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 30 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 33 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 34 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 36 | } 37 | 38 | // xtob converts hex characters x1 and x2 into a byte. 39 | func xtob(x1, x2 byte) (byte, bool) { 40 | b1 := xvalues[x1] 41 | b2 := xvalues[x2] 42 | return (b1 << 4) | b2, b1 != 255 && b2 != 255 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | ) 10 | 11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock 12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID 13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot 14 | // be set NewUUID returns nil. If clock sequence has not been set by 15 | // SetClockSequence then it will be set automatically. If GetTime fails to 16 | // return the current NewUUID returns nil and an error. 17 | // 18 | // In most cases, New should be used. 19 | func NewUUID() (UUID, error) { 20 | var uuid UUID 21 | now, seq, err := GetTime() 22 | if err != nil { 23 | return uuid, err 24 | } 25 | 26 | timeLow := uint32(now & 0xffffffff) 27 | timeMid := uint16((now >> 32) & 0xffff) 28 | timeHi := uint16((now >> 48) & 0x0fff) 29 | timeHi |= 0x1000 // Version 1 30 | 31 | binary.BigEndian.PutUint32(uuid[0:], timeLow) 32 | binary.BigEndian.PutUint16(uuid[4:], timeMid) 33 | binary.BigEndian.PutUint16(uuid[6:], timeHi) 34 | binary.BigEndian.PutUint16(uuid[8:], seq) 35 | 36 | nodeMu.Lock() 37 | if nodeID == zeroID { 38 | setNodeInterface("") 39 | } 40 | copy(uuid[10:], nodeID[:]) 41 | nodeMu.Unlock() 42 | 43 | return uuid, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/leodido/go-urn/.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.dll 3 | *.so 4 | *.dylib 5 | 6 | *.test 7 | 8 | *.out 9 | *.txt 10 | 11 | vendor/ -------------------------------------------------------------------------------- /vendor/github.com/leodido/go-urn/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.13.x 5 | - 1.14.x 6 | - 1.15.x 7 | - tip 8 | 9 | before_install: 10 | - go get -t -v ./... 11 | 12 | script: 13 | - go test -race -coverprofile=coverage.txt -covermode=atomic 14 | 15 | after_success: 16 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /vendor/github.com/leodido/go-urn/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Leonardo Di Donato 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/leodido/go-urn/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/leodido/go-urn 2 | 3 | go 1.13 4 | 5 | require github.com/stretchr/testify v1.6.1 6 | -------------------------------------------------------------------------------- /vendor/github.com/leodido/go-urn/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 2 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 5 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 6 | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= 7 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 8 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 9 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 10 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 11 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 12 | -------------------------------------------------------------------------------- /vendor/github.com/leodido/go-urn/makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | 3 | build: machine.go 4 | 5 | images: docs/urn.png 6 | 7 | machine.go: machine.go.rl 8 | ragel -Z -G2 -e -o $@ $< 9 | @sed -i '/^\/\/line/d' $@ 10 | @$(MAKE) -s file=$@ snake2camel 11 | @gofmt -w -s $@ 12 | 13 | docs/urn.dot: machine.go.rl 14 | @mkdir -p docs 15 | ragel -Z -e -Vp $< -o $@ 16 | 17 | docs/urn.png: docs/urn.dot 18 | dot $< -Tpng -o $@ 19 | 20 | .PHONY: bench 21 | bench: *_test.go machine.go 22 | go test -bench=. -benchmem -benchtime=5s ./... 23 | 24 | .PHONY: tests 25 | tests: *_test.go machine.go 26 | go test -race -timeout 10s -coverprofile=coverage.out -covermode=atomic -v ./... 27 | 28 | .PHONY: clean 29 | clean: 30 | @rm -rf docs 31 | @rm -f machine.go 32 | 33 | .PHONY: snake2camel 34 | snake2camel: 35 | @awk -i inplace '{ \ 36 | while ( match($$0, /(.*)([a-z]+[0-9]*)_([a-zA-Z0-9])(.*)/, cap) ) \ 37 | $$0 = cap[1] cap[2] toupper(cap[3]) cap[4]; \ 38 | print \ 39 | }' $(file) -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.11.x 5 | - 1.12.x 6 | - 1.13.x 7 | - tip 8 | 9 | script: 10 | - make check 11 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/Makefile: -------------------------------------------------------------------------------- 1 | PKGS := github.com/pkg/errors 2 | SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS)) 3 | GO := go 4 | 5 | check: test vet gofmt misspell unconvert staticcheck ineffassign unparam 6 | 7 | test: 8 | $(GO) test $(PKGS) 9 | 10 | vet: | test 11 | $(GO) vet $(PKGS) 12 | 13 | staticcheck: 14 | $(GO) get honnef.co/go/tools/cmd/staticcheck 15 | staticcheck -checks all $(PKGS) 16 | 17 | misspell: 18 | $(GO) get github.com/client9/misspell/cmd/misspell 19 | misspell \ 20 | -locale GB \ 21 | -error \ 22 | *.md *.go 23 | 24 | unconvert: 25 | $(GO) get github.com/mdempsky/unconvert 26 | unconvert -v $(PKGS) 27 | 28 | ineffassign: 29 | $(GO) get github.com/gordonklaus/ineffassign 30 | find $(SRCDIRS) -name '*.go' | xargs ineffassign 31 | 32 | pedantic: check errcheck 33 | 34 | unparam: 35 | $(GO) get mvdan.cc/unparam 36 | unparam ./... 37 | 38 | errcheck: 39 | $(GO) get github.com/kisielk/errcheck 40 | errcheck $(PKGS) 41 | 42 | gofmt: 43 | @echo Checking code is gofmted 44 | @test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)" 45 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/go113.go: -------------------------------------------------------------------------------- 1 | // +build go1.13 2 | 3 | package errors 4 | 5 | import ( 6 | stderrors "errors" 7 | ) 8 | 9 | // Is reports whether any error in err's chain matches target. 10 | // 11 | // The chain consists of err itself followed by the sequence of errors obtained by 12 | // repeatedly calling Unwrap. 13 | // 14 | // An error is considered to match a target if it is equal to that target or if 15 | // it implements a method Is(error) bool such that Is(target) returns true. 16 | func Is(err, target error) bool { return stderrors.Is(err, target) } 17 | 18 | // As finds the first error in err's chain that matches target, and if so, sets 19 | // target to that error value and returns true. 20 | // 21 | // The chain consists of err itself followed by the sequence of errors obtained by 22 | // repeatedly calling Unwrap. 23 | // 24 | // An error matches target if the error's concrete value is assignable to the value 25 | // pointed to by target, or if the error has a method As(interface{}) bool such that 26 | // As(target) returns true. In the latter case, the As method is responsible for 27 | // setting target. 28 | // 29 | // As will panic if target is not a non-nil pointer to either a type that implements 30 | // error, or to any interface type. As returns false if err is nil. 31 | func As(err error, target interface{}) bool { return stderrors.As(err, target) } 32 | 33 | // Unwrap returns the result of calling the Unwrap method on err, if err's 34 | // type contains an Unwrap method returning error. 35 | // Otherwise, Unwrap returns nil. 36 | func Unwrap(err error) error { 37 | return stderrors.Unwrap(err) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricdata/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package metricdata contains the metrics data model. 16 | // 17 | // This is an EXPERIMENTAL package, and may change in arbitrary ways without 18 | // notice. 19 | package metricdata // import "go.opencensus.io/metric/metricdata" 20 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricdata/exemplar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package metricdata 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | // Exemplars keys. 22 | const ( 23 | AttachmentKeySpanContext = "SpanContext" 24 | ) 25 | 26 | // Exemplar is an example data point associated with each bucket of a 27 | // distribution type aggregation. 28 | // 29 | // Their purpose is to provide an example of the kind of thing 30 | // (request, RPC, trace span, etc.) that resulted in that measurement. 31 | type Exemplar struct { 32 | Value float64 // the value that was recorded 33 | Timestamp time.Time // the time the value was recorded 34 | Attachments Attachments // attachments (if any) 35 | } 36 | 37 | // Attachments is a map of extra values associated with a recorded data point. 38 | type Attachments map[string]interface{} 39 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricdata/label.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package metricdata 16 | 17 | // LabelKey represents key of a label. It has optional 18 | // description attribute. 19 | type LabelKey struct { 20 | Key string 21 | Description string 22 | } 23 | 24 | // LabelValue represents the value of a label. 25 | // The zero value represents a missing label value, which may be treated 26 | // differently to an empty string value by some back ends. 27 | type LabelValue struct { 28 | Value string // string value of the label 29 | Present bool // flag that indicated whether a value is present or not 30 | } 31 | 32 | // NewLabelValue creates a new non-nil LabelValue that represents the given string. 33 | func NewLabelValue(val string) LabelValue { 34 | return LabelValue{Value: val, Present: true} 35 | } 36 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricdata/metric.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package metricdata 16 | 17 | import ( 18 | "time" 19 | 20 | "go.opencensus.io/resource" 21 | ) 22 | 23 | // Descriptor holds metadata about a metric. 24 | type Descriptor struct { 25 | Name string // full name of the metric 26 | Description string // human-readable description 27 | Unit Unit // units for the measure 28 | Type Type // type of measure 29 | LabelKeys []LabelKey // label keys 30 | } 31 | 32 | // Metric represents a quantity measured against a resource with different 33 | // label value combinations. 34 | type Metric struct { 35 | Descriptor Descriptor // metric descriptor 36 | Resource *resource.Resource // resource against which this was measured 37 | TimeSeries []*TimeSeries // one time series for each combination of label values 38 | } 39 | 40 | // TimeSeries is a sequence of points associated with a combination of label 41 | // values. 42 | type TimeSeries struct { 43 | LabelValues []LabelValue // label values, same order as keys in the metric descriptor 44 | Points []Point // points sequence 45 | StartTime time.Time // time we started recording this time series 46 | } 47 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricdata/type_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type Type"; DO NOT EDIT. 2 | 3 | package metricdata 4 | 5 | import "strconv" 6 | 7 | const _Type_name = "TypeGaugeInt64TypeGaugeFloat64TypeGaugeDistributionTypeCumulativeInt64TypeCumulativeFloat64TypeCumulativeDistributionTypeSummary" 8 | 9 | var _Type_index = [...]uint8{0, 14, 30, 51, 70, 91, 117, 128} 10 | 11 | func (i Type) String() string { 12 | if i < 0 || i >= Type(len(_Type_index)-1) { 13 | return "Type(" + strconv.FormatInt(int64(i), 10) + ")" 14 | } 15 | return _Type_name[_Type_index[i]:_Type_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricdata/unit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package metricdata 16 | 17 | // Unit is a string encoded according to the case-sensitive abbreviations from the 18 | // Unified Code for Units of Measure: http://unitsofmeasure.org/ucum.html 19 | type Unit string 20 | 21 | // Predefined units. To record against a unit not represented here, create your 22 | // own Unit type constant from a string. 23 | const ( 24 | UnitDimensionless Unit = "1" 25 | UnitBytes Unit = "By" 26 | UnitMilliseconds Unit = "ms" 27 | ) 28 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/metric/metricproducer/producer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package metricproducer 16 | 17 | import ( 18 | "go.opencensus.io/metric/metricdata" 19 | ) 20 | 21 | // Producer is a source of metrics. 22 | type Producer interface { 23 | // Read should return the current values of all metrics supported by this 24 | // metric provider. 25 | // The returned metrics should be unique for each combination of name and 26 | // resource. 27 | Read() []*metricdata.Metric 28 | } 29 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/stats/internal/record.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package internal 16 | 17 | import ( 18 | "go.opencensus.io/tag" 19 | ) 20 | 21 | // DefaultRecorder will be called for each Record call. 22 | var DefaultRecorder func(tags *tag.Map, measurement interface{}, attachments map[string]interface{}) 23 | 24 | // SubscriptionReporter reports when a view subscribed with a measure. 25 | var SubscriptionReporter func(measure string) 26 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/stats/measure_float64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | package stats 17 | 18 | // Float64Measure is a measure for float64 values. 19 | type Float64Measure struct { 20 | desc *measureDescriptor 21 | } 22 | 23 | // M creates a new float64 measurement. 24 | // Use Record to record measurements. 25 | func (m *Float64Measure) M(v float64) Measurement { 26 | return Measurement{ 27 | m: m, 28 | desc: m.desc, 29 | v: v, 30 | } 31 | } 32 | 33 | // Float64 creates a new measure for float64 values. 34 | // 35 | // See the documentation for interface Measure for more guidance on the 36 | // parameters of this function. 37 | func Float64(name, description, unit string) *Float64Measure { 38 | mi := registerMeasureHandle(name, description, unit) 39 | return &Float64Measure{mi} 40 | } 41 | 42 | // Name returns the name of the measure. 43 | func (m *Float64Measure) Name() string { 44 | return m.desc.name 45 | } 46 | 47 | // Description returns the description of the measure. 48 | func (m *Float64Measure) Description() string { 49 | return m.desc.description 50 | } 51 | 52 | // Unit returns the unit of the measure. 53 | func (m *Float64Measure) Unit() string { 54 | return m.desc.unit 55 | } 56 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/stats/measure_int64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | package stats 17 | 18 | // Int64Measure is a measure for int64 values. 19 | type Int64Measure struct { 20 | desc *measureDescriptor 21 | } 22 | 23 | // M creates a new int64 measurement. 24 | // Use Record to record measurements. 25 | func (m *Int64Measure) M(v int64) Measurement { 26 | return Measurement{ 27 | m: m, 28 | desc: m.desc, 29 | v: float64(v), 30 | } 31 | } 32 | 33 | // Int64 creates a new measure for int64 values. 34 | // 35 | // See the documentation for interface Measure for more guidance on the 36 | // parameters of this function. 37 | func Int64(name, description, unit string) *Int64Measure { 38 | mi := registerMeasureHandle(name, description, unit) 39 | return &Int64Measure{mi} 40 | } 41 | 42 | // Name returns the name of the measure. 43 | func (m *Int64Measure) Name() string { 44 | return m.desc.name 45 | } 46 | 47 | // Description returns the description of the measure. 48 | func (m *Int64Measure) Description() string { 49 | return m.desc.description 50 | } 51 | 52 | // Unit returns the unit of the measure. 53 | func (m *Int64Measure) Unit() string { 54 | return m.desc.unit 55 | } 56 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/stats/units.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | package stats 17 | 18 | // Units are encoded according to the case-sensitive abbreviations from the 19 | // Unified Code for Units of Measure: http://unitsofmeasure.org/ucum.html 20 | const ( 21 | UnitNone = "1" // Deprecated: Use UnitDimensionless. 22 | UnitDimensionless = "1" 23 | UnitBytes = "By" 24 | UnitMilliseconds = "ms" 25 | UnitSeconds = "s" 26 | ) 27 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/stats/view/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | // Package view contains support for collecting and exposing aggregates over stats. 17 | // 18 | // In order to collect measurements, views need to be defined and registered. 19 | // A view allows recorded measurements to be filtered and aggregated. 20 | // 21 | // All recorded measurements can be grouped by a list of tags. 22 | // 23 | // OpenCensus provides several aggregation methods: Count, Distribution and Sum. 24 | // 25 | // Count only counts the number of measurement points recorded. 26 | // Distribution provides statistical summary of the aggregated data by counting 27 | // how many recorded measurements fall into each bucket. 28 | // Sum adds up the measurement values. 29 | // LastValue just keeps track of the most recently recorded measurement value. 30 | // All aggregations are cumulative. 31 | // 32 | // Views can be registered and unregistered at any time during program execution. 33 | // 34 | // Libraries can define views but it is recommended that in most cases registering 35 | // views be left up to applications. 36 | // 37 | // Exporting 38 | // 39 | // Collected and aggregated data can be exported to a metric collection 40 | // backend by registering its exporter. 41 | // 42 | // Multiple exporters can be registered to upload the data to various 43 | // different back ends. 44 | package view // import "go.opencensus.io/stats/view" 45 | 46 | // TODO(acetechnologist): Add a link to the language independent OpenCensus 47 | // spec when it is available. 48 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/stats/view/export.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package view 16 | 17 | // Exporter exports the collected records as view data. 18 | // 19 | // The ExportView method should return quickly; if an 20 | // Exporter takes a significant amount of time to 21 | // process a Data, that work should be done on another goroutine. 22 | // 23 | // It is safe to assume that ExportView will not be called concurrently from 24 | // multiple goroutines. 25 | // 26 | // The Data should not be modified. 27 | type Exporter interface { 28 | ExportView(viewData *Data) 29 | } 30 | 31 | // RegisterExporter registers an exporter. 32 | // Collected data will be reported via all the 33 | // registered exporters. Once you no longer 34 | // want data to be exported, invoke UnregisterExporter 35 | // with the previously registered exporter. 36 | // 37 | // Binaries can register exporters, libraries shouldn't register exporters. 38 | func RegisterExporter(e Exporter) { 39 | defaultWorker.RegisterExporter(e) 40 | } 41 | 42 | // UnregisterExporter unregisters an exporter. 43 | func UnregisterExporter(e Exporter) { 44 | defaultWorker.UnregisterExporter(e) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/context.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | package tag 17 | 18 | import ( 19 | "context" 20 | ) 21 | 22 | // FromContext returns the tag map stored in the context. 23 | func FromContext(ctx context.Context) *Map { 24 | // The returned tag map shouldn't be mutated. 25 | ts := ctx.Value(mapCtxKey) 26 | if ts == nil { 27 | return nil 28 | } 29 | return ts.(*Map) 30 | } 31 | 32 | // NewContext creates a new context with the given tag map. 33 | // To propagate a tag map to downstream methods and downstream RPCs, add a tag map 34 | // to the current context. NewContext will return a copy of the current context, 35 | // and put the tag map into the returned one. 36 | // If there is already a tag map in the current context, it will be replaced with m. 37 | func NewContext(ctx context.Context, m *Map) context.Context { 38 | return context.WithValue(ctx, mapCtxKey, m) 39 | } 40 | 41 | type ctxKey struct{} 42 | 43 | var mapCtxKey = ctxKey{} 44 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | /* 17 | Package tag contains OpenCensus tags. 18 | 19 | Tags are key-value pairs. Tags provide additional cardinality to 20 | the OpenCensus instrumentation data. 21 | 22 | Tags can be propagated on the wire and in the same 23 | process via context.Context. Encode and Decode should be 24 | used to represent tags into their binary propagation form. 25 | */ 26 | package tag // import "go.opencensus.io/tag" 27 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/key.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | package tag 17 | 18 | // Key represents a tag key. 19 | type Key struct { 20 | name string 21 | } 22 | 23 | // NewKey creates or retrieves a string key identified by name. 24 | // Calling NewKey more than once with the same name returns the same key. 25 | func NewKey(name string) (Key, error) { 26 | if !checkKeyName(name) { 27 | return Key{}, errInvalidKeyName 28 | } 29 | return Key{name: name}, nil 30 | } 31 | 32 | // MustNewKey returns a key with the given name, and panics if name is an invalid key name. 33 | func MustNewKey(name string) Key { 34 | k, err := NewKey(name) 35 | if err != nil { 36 | panic(err) 37 | } 38 | return k 39 | } 40 | 41 | // Name returns the name of the key. 42 | func (k Key) Name() string { 43 | return k.name 44 | } 45 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/metadata.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | 16 | package tag 17 | 18 | const ( 19 | // valueTTLNoPropagation prevents tag from propagating. 20 | valueTTLNoPropagation = 0 21 | 22 | // valueTTLUnlimitedPropagation allows tag to propagate without any limits on number of hops. 23 | valueTTLUnlimitedPropagation = -1 24 | ) 25 | 26 | // TTL is metadata that specifies number of hops a tag can propagate. 27 | // Details about TTL metadata is specified at https://github.com/census-instrumentation/opencensus-specs/blob/master/tags/TagMap.md#tagmetadata 28 | type TTL struct { 29 | ttl int 30 | } 31 | 32 | var ( 33 | // TTLUnlimitedPropagation is TTL metadata that allows tag to propagate without any limits on number of hops. 34 | TTLUnlimitedPropagation = TTL{ttl: valueTTLUnlimitedPropagation} 35 | 36 | // TTLNoPropagation is TTL metadata that prevents tag from propagating. 37 | TTLNoPropagation = TTL{ttl: valueTTLNoPropagation} 38 | ) 39 | 40 | type metadatas struct { 41 | ttl TTL 42 | } 43 | 44 | // Metadata applies metadatas specified by the function. 45 | type Metadata func(*metadatas) 46 | 47 | // WithTTL applies metadata with provided ttl. 48 | func WithTTL(ttl TTL) Metadata { 49 | return func(m *metadatas) { 50 | m.ttl = ttl 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/profile_19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // +build go1.9 16 | 17 | package tag 18 | 19 | import ( 20 | "context" 21 | "runtime/pprof" 22 | ) 23 | 24 | func do(ctx context.Context, f func(ctx context.Context)) { 25 | m := FromContext(ctx) 26 | keyvals := make([]string, 0, 2*len(m.m)) 27 | for k, v := range m.m { 28 | keyvals = append(keyvals, k.Name(), v.value) 29 | } 30 | pprof.Do(ctx, pprof.Labels(keyvals...), f) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/profile_not19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // +build !go1.9 16 | 17 | package tag 18 | 19 | import "context" 20 | 21 | func do(ctx context.Context, f func(ctx context.Context)) { 22 | f(ctx) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/go.opencensus.io/tag/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017, OpenCensus Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tag 16 | 17 | import "errors" 18 | 19 | const ( 20 | maxKeyLength = 255 21 | 22 | // valid are restricted to US-ASCII subset (range 0x20 (' ') to 0x7e ('~')). 23 | validKeyValueMin = 32 24 | validKeyValueMax = 126 25 | ) 26 | 27 | var ( 28 | errInvalidKeyName = errors.New("invalid key name: only ASCII characters accepted; max length must be 255 characters") 29 | errInvalidValue = errors.New("invalid value: only ASCII characters accepted; max length must be 255 characters") 30 | ) 31 | 32 | func checkKeyName(name string) bool { 33 | if len(name) == 0 { 34 | return false 35 | } 36 | if len(name) > maxKeyLength { 37 | return false 38 | } 39 | return isASCII(name) 40 | } 41 | 42 | func isASCII(s string) bool { 43 | for _, c := range s { 44 | if (c < validKeyValueMin) || (c > validKeyValueMax) { 45 | return false 46 | } 47 | } 48 | return true 49 | } 50 | 51 | func checkValue(v string) bool { 52 | if len(v) > maxKeyLength { 53 | return false 54 | } 55 | return isASCII(v) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/bcrypt/base64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bcrypt 6 | 7 | import "encoding/base64" 8 | 9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 10 | 11 | var bcEncoding = base64.NewEncoding(alphabet) 12 | 13 | func base64Encode(src []byte) []byte { 14 | n := bcEncoding.EncodedLen(len(src)) 15 | dst := make([]byte, n) 16 | bcEncoding.Encode(dst, src) 17 | for dst[n-1] == '=' { 18 | n-- 19 | } 20 | return dst[:n] 21 | } 22 | 23 | func base64Decode(src []byte) ([]byte, error) { 24 | numOfEquals := 4 - (len(src) % 4) 25 | for i := 0; i < numOfEquals; i++ { 26 | src = append(src, '=') 27 | } 28 | 29 | dst := make([]byte, bcEncoding.DecodedLen(len(src))) 30 | n, err := bcEncoding.Decode(dst, src) 31 | if err != nil { 32 | return nil, err 33 | } 34 | return dst[:n], nil 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/hashes_generic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !gc || purego || !s390x 6 | // +build !gc purego !s390x 7 | 8 | package sha3 9 | 10 | import ( 11 | "hash" 12 | ) 13 | 14 | // new224Asm returns an assembly implementation of SHA3-224 if available, 15 | // otherwise it returns nil. 16 | func new224Asm() hash.Hash { return nil } 17 | 18 | // new256Asm returns an assembly implementation of SHA3-256 if available, 19 | // otherwise it returns nil. 20 | func new256Asm() hash.Hash { return nil } 21 | 22 | // new384Asm returns an assembly implementation of SHA3-384 if available, 23 | // otherwise it returns nil. 24 | func new384Asm() hash.Hash { return nil } 25 | 26 | // new512Asm returns an assembly implementation of SHA3-512 if available, 27 | // otherwise it returns nil. 28 | func new512Asm() hash.Hash { return nil } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/keccakf_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && !purego && gc 6 | // +build amd64,!purego,gc 7 | 8 | package sha3 9 | 10 | // This function is implemented in keccakf_amd64.s. 11 | 12 | //go:noescape 13 | 14 | func keccakF1600(a *[25]uint64) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/register.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.4 6 | // +build go1.4 7 | 8 | package sha3 9 | 10 | import ( 11 | "crypto" 12 | ) 13 | 14 | func init() { 15 | crypto.RegisterHash(crypto.SHA3_224, New224) 16 | crypto.RegisterHash(crypto.SHA3_256, New256) 17 | crypto.RegisterHash(crypto.SHA3_384, New384) 18 | crypto.RegisterHash(crypto.SHA3_512, New512) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/sha3_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc && !purego 6 | // +build gc,!purego 7 | 8 | #include "textflag.h" 9 | 10 | // func kimd(function code, chain *[200]byte, src []byte) 11 | TEXT ·kimd(SB), NOFRAME|NOSPLIT, $0-40 12 | MOVD function+0(FP), R0 13 | MOVD chain+8(FP), R1 14 | LMG src+16(FP), R2, R3 // R2=base, R3=len 15 | 16 | continue: 17 | WORD $0xB93E0002 // KIMD --, R2 18 | BVS continue // continue if interrupted 19 | MOVD $0, R0 // reset R0 for pre-go1.8 compilers 20 | RET 21 | 22 | // func klmd(function code, chain *[200]byte, dst, src []byte) 23 | TEXT ·klmd(SB), NOFRAME|NOSPLIT, $0-64 24 | // TODO: SHAKE support 25 | MOVD function+0(FP), R0 26 | MOVD chain+8(FP), R1 27 | LMG dst+16(FP), R2, R3 // R2=base, R3=len 28 | LMG src+40(FP), R4, R5 // R4=base, R5=len 29 | 30 | continue: 31 | WORD $0xB93F0024 // KLMD R2, R4 32 | BVS continue // continue if interrupted 33 | MOVD $0, R0 // reset R0 for pre-go1.8 compilers 34 | RET 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/shake_generic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !gc || purego || !s390x 6 | // +build !gc purego !s390x 7 | 8 | package sha3 9 | 10 | // newShake128Asm returns an assembly implementation of SHAKE-128 if available, 11 | // otherwise it returns nil. 12 | func newShake128Asm() ShakeHash { 13 | return nil 14 | } 15 | 16 | // newShake256Asm returns an assembly implementation of SHAKE-256 if available, 17 | // otherwise it returns nil. 18 | func newShake256Asm() ShakeHash { 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/xor.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (!amd64 && !386 && !ppc64le) || purego 6 | // +build !amd64,!386,!ppc64le purego 7 | 8 | package sha3 9 | 10 | // A storageBuf is an aligned array of maxRate bytes. 11 | type storageBuf [maxRate]byte 12 | 13 | func (b *storageBuf) asBytes() *[maxRate]byte { 14 | return (*[maxRate]byte)(b) 15 | } 16 | 17 | var ( 18 | xorIn = xorInGeneric 19 | copyOut = copyOutGeneric 20 | xorInUnaligned = xorInGeneric 21 | copyOutUnaligned = copyOutGeneric 22 | ) 23 | 24 | const xorImplementationUnaligned = "generic" 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/xor_generic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package sha3 6 | 7 | import "encoding/binary" 8 | 9 | // xorInGeneric xors the bytes in buf into the state; it 10 | // makes no non-portable assumptions about memory layout 11 | // or alignment. 12 | func xorInGeneric(d *state, buf []byte) { 13 | n := len(buf) / 8 14 | 15 | for i := 0; i < n; i++ { 16 | a := binary.LittleEndian.Uint64(buf) 17 | d.a[i] ^= a 18 | buf = buf[8:] 19 | } 20 | } 21 | 22 | // copyOutGeneric copies uint64s to a byte buffer. 23 | func copyOutGeneric(d *state, b []byte) { 24 | for i := 0; len(b) >= 8; i++ { 25 | binary.LittleEndian.PutUint64(b, d.a[i]) 26 | b = b[8:] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/xor_unaligned.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (amd64 || 386 || ppc64le) && !purego 6 | // +build amd64 386 ppc64le 7 | // +build !purego 8 | 9 | package sha3 10 | 11 | import "unsafe" 12 | 13 | // A storageBuf is an aligned array of maxRate bytes. 14 | type storageBuf [maxRate / 8]uint64 15 | 16 | func (b *storageBuf) asBytes() *[maxRate]byte { 17 | return (*[maxRate]byte)(unsafe.Pointer(b)) 18 | } 19 | 20 | // xorInUnaligned uses unaligned reads and writes to update d.a to contain d.a 21 | // XOR buf. 22 | func xorInUnaligned(d *state, buf []byte) { 23 | n := len(buf) 24 | bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0]))[: n/8 : n/8] 25 | if n >= 72 { 26 | d.a[0] ^= bw[0] 27 | d.a[1] ^= bw[1] 28 | d.a[2] ^= bw[2] 29 | d.a[3] ^= bw[3] 30 | d.a[4] ^= bw[4] 31 | d.a[5] ^= bw[5] 32 | d.a[6] ^= bw[6] 33 | d.a[7] ^= bw[7] 34 | d.a[8] ^= bw[8] 35 | } 36 | if n >= 104 { 37 | d.a[9] ^= bw[9] 38 | d.a[10] ^= bw[10] 39 | d.a[11] ^= bw[11] 40 | d.a[12] ^= bw[12] 41 | } 42 | if n >= 136 { 43 | d.a[13] ^= bw[13] 44 | d.a[14] ^= bw[14] 45 | d.a[15] ^= bw[15] 46 | d.a[16] ^= bw[16] 47 | } 48 | if n >= 144 { 49 | d.a[17] ^= bw[17] 50 | } 51 | if n >= 168 { 52 | d.a[18] ^= bw[18] 53 | d.a[19] ^= bw[19] 54 | d.a[20] ^= bw[20] 55 | } 56 | } 57 | 58 | func copyOutUnaligned(d *state, buf []byte) { 59 | ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0])) 60 | copy(buf, ab[:]) 61 | } 62 | 63 | var ( 64 | xorIn = xorInUnaligned 65 | copyOut = copyOutUnaligned 66 | ) 67 | 68 | const xorImplementationUnaligned = "unaligned" 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 12 | // 13 | 14 | TEXT ·syscall6(SB),NOSPLIT,$0-88 15 | JMP syscall·syscall6(SB) 16 | 17 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 18 | JMP syscall·rawSyscall6(SB) 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/byteorder.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | import ( 8 | "runtime" 9 | ) 10 | 11 | // byteOrder is a subset of encoding/binary.ByteOrder. 12 | type byteOrder interface { 13 | Uint32([]byte) uint32 14 | Uint64([]byte) uint64 15 | } 16 | 17 | type littleEndian struct{} 18 | type bigEndian struct{} 19 | 20 | func (littleEndian) Uint32(b []byte) uint32 { 21 | _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 22 | return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 23 | } 24 | 25 | func (littleEndian) Uint64(b []byte) uint64 { 26 | _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 27 | return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | 28 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 29 | } 30 | 31 | func (bigEndian) Uint32(b []byte) uint32 { 32 | _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 33 | return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 34 | } 35 | 36 | func (bigEndian) Uint64(b []byte) uint64 { 37 | _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 38 | return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | 39 | uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 40 | } 41 | 42 | // hostByteOrder returns littleEndian on little-endian machines and 43 | // bigEndian on big-endian machines. 44 | func hostByteOrder() byteOrder { 45 | switch runtime.GOARCH { 46 | case "386", "amd64", "amd64p32", 47 | "alpha", 48 | "arm", "arm64", 49 | "mipsle", "mips64le", "mips64p32le", 50 | "nios2", 51 | "ppc64le", 52 | "riscv", "riscv64", 53 | "sh": 54 | return littleEndian{} 55 | case "armbe", "arm64be", 56 | "m68k", 57 | "mips", "mips64", "mips64p32", 58 | "ppc", "ppc64", 59 | "s390", "s390x", 60 | "shbe", 61 | "sparc", "sparc64": 62 | return bigEndian{} 63 | } 64 | panic("unknown architecture") 65 | } 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix 6 | // +build aix 7 | 8 | package cpu 9 | 10 | const ( 11 | // getsystemcfg constants 12 | _SC_IMPL = 2 13 | _IMPL_POWER8 = 0x10000 14 | _IMPL_POWER9 = 0x20000 15 | ) 16 | 17 | func archInit() { 18 | impl := getsystemcfg(_SC_IMPL) 19 | if impl&_IMPL_POWER8 != 0 { 20 | PPC64.IsPOWER8 = true 21 | } 22 | if impl&_IMPL_POWER9 != 0 { 23 | PPC64.IsPOWER8 = true 24 | PPC64.IsPOWER9 = true 25 | } 26 | 27 | Initialized = true 28 | } 29 | 30 | func getsystemcfg(label int) (n uint64) { 31 | r0, _ := callgetsystemcfg(label) 32 | n = uint64(r0) 33 | return 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // func getisar0() uint64 11 | TEXT ·getisar0(SB),NOSPLIT,$0-8 12 | // get Instruction Set Attributes 0 into x0 13 | // mrs x0, ID_AA64ISAR0_EL1 = d5380600 14 | WORD $0xd5380600 15 | MOVD R0, ret+0(FP) 16 | RET 17 | 18 | // func getisar1() uint64 19 | TEXT ·getisar1(SB),NOSPLIT,$0-8 20 | // get Instruction Set Attributes 1 into x0 21 | // mrs x0, ID_AA64ISAR1_EL1 = d5380620 22 | WORD $0xd5380620 23 | MOVD R0, ret+0(FP) 24 | RET 25 | 26 | // func getpfr0() uint64 27 | TEXT ·getpfr0(SB),NOSPLIT,$0-8 28 | // get Processor Feature Register 0 into x0 29 | // mrs x0, ID_AA64PFR0_EL1 = d5380400 30 | WORD $0xd5380400 31 | MOVD R0, ret+0(FP) 32 | RET 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | package cpu 9 | 10 | func getisar0() uint64 11 | func getisar1() uint64 12 | func getpfr0() uint64 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | // +build gc 7 | 8 | package cpu 9 | 10 | // haveAsmFunctions reports whether the other functions in this file can 11 | // be safely called. 12 | func haveAsmFunctions() bool { return true } 13 | 14 | // The following feature detection functions are defined in cpu_s390x.s. 15 | // They are likely to be expensive to call so the results should be cached. 16 | func stfle() facilityList 17 | func kmQuery() queryResult 18 | func kmcQuery() queryResult 19 | func kmctrQuery() queryResult 20 | func kmaQuery() queryResult 21 | func kimdQuery() queryResult 22 | func klmdQuery() queryResult 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gc_x86.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (386 || amd64 || amd64p32) && gc 6 | // +build 386 amd64 amd64p32 7 | // +build gc 8 | 9 | package cpu 10 | 11 | // cpuid is implemented in cpu_x86.s for gc compiler 12 | // and in cpu_gccgo.c for gccgo. 13 | func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 14 | 15 | // xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler 16 | // and in cpu_gccgo.c for gccgo. 17 | func xgetbv() (eax, edx uint32) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gccgo 6 | // +build gccgo 7 | 8 | package cpu 9 | 10 | func getisar0() uint64 { return 0 } 11 | func getisar1() uint64 { return 0 } 12 | func getpfr0() uint64 { return 0 } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gccgo 6 | // +build gccgo 7 | 8 | package cpu 9 | 10 | // haveAsmFunctions reports whether the other functions in this file can 11 | // be safely called. 12 | func haveAsmFunctions() bool { return false } 13 | 14 | // TODO(mundaym): the following feature detection functions are currently 15 | // stubs. See https://golang.org/cl/162887 for how to fix this. 16 | // They are likely to be expensive to call so the results should be cached. 17 | func stfle() facilityList { panic("not implemented for gccgo") } 18 | func kmQuery() queryResult { panic("not implemented for gccgo") } 19 | func kmcQuery() queryResult { panic("not implemented for gccgo") } 20 | func kmctrQuery() queryResult { panic("not implemented for gccgo") } 21 | func kmaQuery() queryResult { panic("not implemented for gccgo") } 22 | func kimdQuery() queryResult { panic("not implemented for gccgo") } 23 | func klmdQuery() queryResult { panic("not implemented for gccgo") } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386 amd64 amd64p32 6 | // +build gccgo 7 | 8 | #include 9 | #include 10 | 11 | // Need to wrap __get_cpuid_count because it's declared as static. 12 | int 13 | gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, 14 | uint32_t *eax, uint32_t *ebx, 15 | uint32_t *ecx, uint32_t *edx) 16 | { 17 | return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx); 18 | } 19 | 20 | // xgetbv reads the contents of an XCR (Extended Control Register) 21 | // specified in the ECX register into registers EDX:EAX. 22 | // Currently, the only supported value for XCR is 0. 23 | // 24 | // TODO: Replace with a better alternative: 25 | // 26 | // #include 27 | // 28 | // #pragma GCC target("xsave") 29 | // 30 | // void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { 31 | // unsigned long long x = _xgetbv(0); 32 | // *eax = x & 0xffffffff; 33 | // *edx = (x >> 32) & 0xffffffff; 34 | // } 35 | // 36 | // Note that _xgetbv is defined starting with GCC 8. 37 | void 38 | gccgoXgetbv(uint32_t *eax, uint32_t *edx) 39 | { 40 | __asm(" xorl %%ecx, %%ecx\n" 41 | " xgetbv" 42 | : "=a"(*eax), "=d"(*edx)); 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (386 || amd64 || amd64p32) && gccgo 6 | // +build 386 amd64 amd64p32 7 | // +build gccgo 8 | 9 | package cpu 10 | 11 | //extern gccgoGetCpuidCount 12 | func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32) 13 | 14 | func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { 15 | var a, b, c, d uint32 16 | gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d) 17 | return a, b, c, d 18 | } 19 | 20 | //extern gccgoXgetbv 21 | func gccgoXgetbv(eax, edx *uint32) 22 | 23 | func xgetbv() (eax, edx uint32) { 24 | var a, d uint32 25 | gccgoXgetbv(&a, &d) 26 | return a, d 27 | } 28 | 29 | // gccgo doesn't build on Darwin, per: 30 | // https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gcc.rb#L76 31 | func darwinSupportsAVX512() bool { 32 | return false 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !386 && !amd64 && !amd64p32 && !arm64 6 | // +build !386,!amd64,!amd64p32,!arm64 7 | 8 | package cpu 9 | 10 | func archInit() { 11 | if err := readHWCAP(); err != nil { 12 | return 13 | } 14 | doinit() 15 | Initialized = true 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | func doinit() { 8 | ARM.HasSWP = isSet(hwCap, hwcap_SWP) 9 | ARM.HasHALF = isSet(hwCap, hwcap_HALF) 10 | ARM.HasTHUMB = isSet(hwCap, hwcap_THUMB) 11 | ARM.Has26BIT = isSet(hwCap, hwcap_26BIT) 12 | ARM.HasFASTMUL = isSet(hwCap, hwcap_FAST_MULT) 13 | ARM.HasFPA = isSet(hwCap, hwcap_FPA) 14 | ARM.HasVFP = isSet(hwCap, hwcap_VFP) 15 | ARM.HasEDSP = isSet(hwCap, hwcap_EDSP) 16 | ARM.HasJAVA = isSet(hwCap, hwcap_JAVA) 17 | ARM.HasIWMMXT = isSet(hwCap, hwcap_IWMMXT) 18 | ARM.HasCRUNCH = isSet(hwCap, hwcap_CRUNCH) 19 | ARM.HasTHUMBEE = isSet(hwCap, hwcap_THUMBEE) 20 | ARM.HasNEON = isSet(hwCap, hwcap_NEON) 21 | ARM.HasVFPv3 = isSet(hwCap, hwcap_VFPv3) 22 | ARM.HasVFPv3D16 = isSet(hwCap, hwcap_VFPv3D16) 23 | ARM.HasTLS = isSet(hwCap, hwcap_TLS) 24 | ARM.HasVFPv4 = isSet(hwCap, hwcap_VFPv4) 25 | ARM.HasIDIVA = isSet(hwCap, hwcap_IDIVA) 26 | ARM.HasIDIVT = isSet(hwCap, hwcap_IDIVT) 27 | ARM.HasVFPD32 = isSet(hwCap, hwcap_VFPD32) 28 | ARM.HasLPAE = isSet(hwCap, hwcap_LPAE) 29 | ARM.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM) 30 | ARM.HasAES = isSet(hwCap2, hwcap2_AES) 31 | ARM.HasPMULL = isSet(hwCap2, hwcap2_PMULL) 32 | ARM.HasSHA1 = isSet(hwCap2, hwcap2_SHA1) 33 | ARM.HasSHA2 = isSet(hwCap2, hwcap2_SHA2) 34 | ARM.HasCRC32 = isSet(hwCap2, hwcap2_CRC32) 35 | } 36 | 37 | func isSet(hwc uint, value uint) bool { 38 | return hwc&value != 0 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (mips64 || mips64le) 6 | // +build linux 7 | // +build mips64 mips64le 8 | 9 | package cpu 10 | 11 | // HWCAP bits. These are exposed by the Linux kernel 5.4. 12 | const ( 13 | // CPU features 14 | hwcap_MIPS_MSA = 1 << 1 15 | ) 16 | 17 | func doinit() { 18 | // HWCAP feature bits 19 | MIPS64X.HasMSA = isSet(hwCap, hwcap_MIPS_MSA) 20 | } 21 | 22 | func isSet(hwc uint, value uint) bool { 23 | return hwc&value != 0 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x 6 | // +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x 7 | 8 | package cpu 9 | 10 | func doinit() {} 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (ppc64 || ppc64le) 6 | // +build linux 7 | // +build ppc64 ppc64le 8 | 9 | package cpu 10 | 11 | // HWCAP/HWCAP2 bits. These are exposed by the kernel. 12 | const ( 13 | // ISA Level 14 | _PPC_FEATURE2_ARCH_2_07 = 0x80000000 15 | _PPC_FEATURE2_ARCH_3_00 = 0x00800000 16 | 17 | // CPU features 18 | _PPC_FEATURE2_DARN = 0x00200000 19 | _PPC_FEATURE2_SCV = 0x00100000 20 | ) 21 | 22 | func doinit() { 23 | // HWCAP2 feature bits 24 | PPC64.IsPOWER8 = isSet(hwCap2, _PPC_FEATURE2_ARCH_2_07) 25 | PPC64.IsPOWER9 = isSet(hwCap2, _PPC_FEATURE2_ARCH_3_00) 26 | PPC64.HasDARN = isSet(hwCap2, _PPC_FEATURE2_DARN) 27 | PPC64.HasSCV = isSet(hwCap2, _PPC_FEATURE2_SCV) 28 | } 29 | 30 | func isSet(hwc uint, value uint) bool { 31 | return hwc&value != 0 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const ( 8 | // bit mask values from /usr/include/bits/hwcap.h 9 | hwcap_ZARCH = 2 10 | hwcap_STFLE = 4 11 | hwcap_MSA = 8 12 | hwcap_LDISP = 16 13 | hwcap_EIMM = 32 14 | hwcap_DFP = 64 15 | hwcap_ETF3EH = 256 16 | hwcap_VX = 2048 17 | hwcap_VXE = 8192 18 | ) 19 | 20 | func initS390Xbase() { 21 | // test HWCAP bit vector 22 | has := func(featureMask uint) bool { 23 | return hwCap&featureMask == featureMask 24 | } 25 | 26 | // mandatory 27 | S390X.HasZARCH = has(hwcap_ZARCH) 28 | 29 | // optional 30 | S390X.HasSTFLE = has(hwcap_STFLE) 31 | S390X.HasLDISP = has(hwcap_LDISP) 32 | S390X.HasEIMM = has(hwcap_EIMM) 33 | S390X.HasETF3EH = has(hwcap_ETF3EH) 34 | S390X.HasDFP = has(hwcap_DFP) 35 | S390X.HasMSA = has(hwcap_MSA) 36 | S390X.HasVX = has(hwcap_VX) 37 | if S390X.HasVX { 38 | S390X.HasVXE = has(hwcap_VXE) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_mips64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build mips64 || mips64le 6 | // +build mips64 mips64le 7 | 8 | package cpu 9 | 10 | const cacheLineSize = 32 11 | 12 | func initOptions() { 13 | options = []option{ 14 | {Name: "msa", Feature: &MIPS64X.HasMSA}, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_mipsx.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build mips || mipsle 6 | // +build mips mipsle 7 | 8 | package cpu 9 | 10 | const cacheLineSize = 32 11 | 12 | func initOptions() {} 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_other_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !linux && arm 6 | // +build !linux,arm 7 | 8 | package cpu 9 | 10 | func archInit() {} 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_other_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !linux && !netbsd && arm64 6 | // +build !linux,!netbsd,arm64 7 | 8 | package cpu 9 | 10 | func doinit() {} 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !linux && (mips64 || mips64le) 6 | // +build !linux 7 | // +build mips64 mips64le 8 | 9 | package cpu 10 | 11 | func archInit() { 12 | Initialized = true 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ppc64 || ppc64le 6 | // +build ppc64 ppc64le 7 | 8 | package cpu 9 | 10 | const cacheLineSize = 128 11 | 12 | func initOptions() { 13 | options = []option{ 14 | {Name: "darn", Feature: &PPC64.HasDARN}, 15 | {Name: "scv", Feature: &PPC64.HasSCV}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_riscv64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build riscv64 6 | // +build riscv64 7 | 8 | package cpu 9 | 10 | const cacheLineSize = 32 11 | 12 | func initOptions() {} 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_wasm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build wasm 6 | // +build wasm 7 | 8 | package cpu 9 | 10 | // We're compiling the cpu package for an unknown (software-abstracted) CPU. 11 | // Make CacheLinePad an empty struct and hope that the usual struct alignment 12 | // rules are good enough. 13 | 14 | const cacheLineSize = 0 15 | 16 | func initOptions() {} 17 | 18 | func archInit() {} 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_x86.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (386 || amd64 || amd64p32) && gc 6 | // +build 386 amd64 amd64p32 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 12 | TEXT ·cpuid(SB), NOSPLIT, $0-24 13 | MOVL eaxArg+0(FP), AX 14 | MOVL ecxArg+4(FP), CX 15 | CPUID 16 | MOVL AX, eax+8(FP) 17 | MOVL BX, ebx+12(FP) 18 | MOVL CX, ecx+16(FP) 19 | MOVL DX, edx+20(FP) 20 | RET 21 | 22 | // func xgetbv() (eax, edx uint32) 23 | TEXT ·xgetbv(SB),NOSPLIT,$0-8 24 | MOVL $0, CX 25 | XGETBV 26 | MOVL AX, eax+0(FP) 27 | MOVL DX, edx+4(FP) 28 | RET 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_zos.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | func archInit() { 8 | doinit() 9 | Initialized = true 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | func initS390Xbase() { 8 | // get the facilities list 9 | facilities := stfle() 10 | 11 | // mandatory 12 | S390X.HasZARCH = facilities.Has(zarch) 13 | S390X.HasSTFLE = facilities.Has(stflef) 14 | S390X.HasLDISP = facilities.Has(ldisp) 15 | S390X.HasEIMM = facilities.Has(eimm) 16 | 17 | // optional 18 | S390X.HasETF3EH = facilities.Has(etf3eh) 19 | S390X.HasDFP = facilities.Has(dfp) 20 | S390X.HasMSA = facilities.Has(msa) 21 | S390X.HasVX = facilities.Has(vx) 22 | if S390X.HasVX { 23 | S390X.HasVXE = facilities.Has(vxe) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/hwcap_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | import ( 8 | "io/ioutil" 9 | ) 10 | 11 | const ( 12 | _AT_HWCAP = 16 13 | _AT_HWCAP2 = 26 14 | 15 | procAuxv = "/proc/self/auxv" 16 | 17 | uintSize = int(32 << (^uint(0) >> 63)) 18 | ) 19 | 20 | // For those platforms don't have a 'cpuid' equivalent we use HWCAP/HWCAP2 21 | // These are initialized in cpu_$GOARCH.go 22 | // and should not be changed after they are initialized. 23 | var hwCap uint 24 | var hwCap2 uint 25 | 26 | func readHWCAP() error { 27 | buf, err := ioutil.ReadFile(procAuxv) 28 | if err != nil { 29 | // e.g. on android /proc/self/auxv is not accessible, so silently 30 | // ignore the error and leave Initialized = false. On some 31 | // architectures (e.g. arm64) doinit() implements a fallback 32 | // readout and will set Initialized = true again. 33 | return err 34 | } 35 | bo := hostByteOrder() 36 | for len(buf) >= 2*(uintSize/8) { 37 | var tag, val uint 38 | switch uintSize { 39 | case 32: 40 | tag = uint(bo.Uint32(buf[0:])) 41 | val = uint(bo.Uint32(buf[4:])) 42 | buf = buf[8:] 43 | case 64: 44 | tag = uint(bo.Uint64(buf[0:])) 45 | val = uint(bo.Uint64(buf[8:])) 46 | buf = buf[16:] 47 | } 48 | switch tag { 49 | case _AT_HWCAP: 50 | hwCap = val 51 | case _AT_HWCAP2: 52 | hwCap2 = val 53 | } 54 | } 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Recreate a getsystemcfg syscall handler instead of 6 | // using the one provided by x/sys/unix to avoid having 7 | // the dependency between them. (See golang.org/issue/32102) 8 | // Morever, this file will be used during the building of 9 | // gccgo's libgo and thus must not used a CGo method. 10 | 11 | //go:build aix && gccgo 12 | // +build aix,gccgo 13 | 14 | package cpu 15 | 16 | import ( 17 | "syscall" 18 | ) 19 | 20 | //extern getsystemcfg 21 | func gccgoGetsystemcfg(label uint32) (r uint64) 22 | 23 | func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) { 24 | r1 = uintptr(gccgoGetsystemcfg(uint32(label))) 25 | e1 = syscall.GetErrno() 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Minimal copy of x/sys/unix so the cpu package can make a 6 | // system call on AIX without depending on x/sys/unix. 7 | // (See golang.org/issue/32102) 8 | 9 | //go:build aix && ppc64 && gc 10 | // +build aix,ppc64,gc 11 | 12 | package cpu 13 | 14 | import ( 15 | "syscall" 16 | "unsafe" 17 | ) 18 | 19 | //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" 20 | 21 | //go:linkname libc_getsystemcfg libc_getsystemcfg 22 | 23 | type syscallFunc uintptr 24 | 25 | var libc_getsystemcfg syscallFunc 26 | 27 | type errno = syscall.Errno 28 | 29 | // Implemented in runtime/syscall_aix.go. 30 | func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) 31 | func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) 32 | 33 | func callgetsystemcfg(label int) (r1 uintptr, e1 errno) { 34 | r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) 35 | return 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/common.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package language 4 | 5 | // This file contains code common to the maketables.go and the package code. 6 | 7 | // AliasType is the type of an alias in AliasMap. 8 | type AliasType int8 9 | 10 | const ( 11 | Deprecated AliasType = iota 12 | Macro 13 | Legacy 14 | 15 | AliasTypeUnknown AliasType = -1 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/compact.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package language 6 | 7 | // CompactCoreInfo is a compact integer with the three core tags encoded. 8 | type CompactCoreInfo uint32 9 | 10 | // GetCompactCore generates a uint32 value that is guaranteed to be unique for 11 | // different language, region, and script values. 12 | func GetCompactCore(t Tag) (cci CompactCoreInfo, ok bool) { 13 | if t.LangID > langNoIndexOffset { 14 | return 0, false 15 | } 16 | cci |= CompactCoreInfo(t.LangID) << (8 + 12) 17 | cci |= CompactCoreInfo(t.ScriptID) << 12 18 | cci |= CompactCoreInfo(t.RegionID) 19 | return cci, true 20 | } 21 | 22 | // Tag generates a tag from c. 23 | func (c CompactCoreInfo) Tag() Tag { 24 | return Tag{ 25 | LangID: Language(c >> 20), 26 | RegionID: Region(c & 0x3ff), 27 | ScriptID: Script(c>>12) & 0xff, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/compact/compact.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package compact defines a compact representation of language tags. 6 | // 7 | // Common language tags (at least all for which locale information is defined 8 | // in CLDR) are assigned a unique index. Each Tag is associated with such an 9 | // ID for selecting language-related resources (such as translations) as well 10 | // as one for selecting regional defaults (currency, number formatting, etc.) 11 | // 12 | // It may want to export this functionality at some point, but at this point 13 | // this is only available for use within x/text. 14 | package compact // import "golang.org/x/text/internal/language/compact" 15 | 16 | import ( 17 | "sort" 18 | "strings" 19 | 20 | "golang.org/x/text/internal/language" 21 | ) 22 | 23 | // ID is an integer identifying a single tag. 24 | type ID uint16 25 | 26 | func getCoreIndex(t language.Tag) (id ID, ok bool) { 27 | cci, ok := language.GetCompactCore(t) 28 | if !ok { 29 | return 0, false 30 | } 31 | i := sort.Search(len(coreTags), func(i int) bool { 32 | return cci <= coreTags[i] 33 | }) 34 | if i == len(coreTags) || coreTags[i] != cci { 35 | return 0, false 36 | } 37 | return ID(i), true 38 | } 39 | 40 | // Parent returns the ID of the parent or the root ID if id is already the root. 41 | func (id ID) Parent() ID { 42 | return parents[id] 43 | } 44 | 45 | // Tag converts id to an internal language Tag. 46 | func (id ID) Tag() language.Tag { 47 | if int(id) >= len(coreTags) { 48 | return specialTags[int(id)-len(coreTags)] 49 | } 50 | return coreTags[id].Tag() 51 | } 52 | 53 | var specialTags []language.Tag 54 | 55 | func init() { 56 | tags := strings.Split(specialTagsStr, " ") 57 | specialTags = make([]language.Tag, len(tags)) 58 | for i, t := range tags { 59 | specialTags[i] = language.MustParse(t) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/coverage.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package language 6 | 7 | // BaseLanguages returns the list of all supported base languages. It generates 8 | // the list by traversing the internal structures. 9 | func BaseLanguages() []Language { 10 | base := make([]Language, 0, NumLanguages) 11 | for i := 0; i < langNoIndexOffset; i++ { 12 | // We included "und" already for the value 0. 13 | if i != nonCanonicalUnd { 14 | base = append(base, Language(i)) 15 | } 16 | } 17 | i := langNoIndexOffset 18 | for _, v := range langNoIndex { 19 | for k := 0; k < 8; k++ { 20 | if v&1 == 1 { 21 | base = append(base, Language(i)) 22 | } 23 | v >>= 1 24 | i++ 25 | } 26 | } 27 | return base 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/tags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package language 6 | 7 | // MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. 8 | // It simplifies safe initialization of Tag values. 9 | func MustParse(s string) Tag { 10 | t, err := Parse(s) 11 | if err != nil { 12 | panic(err) 13 | } 14 | return t 15 | } 16 | 17 | // MustParseBase is like ParseBase, but panics if the given base cannot be parsed. 18 | // It simplifies safe initialization of Base values. 19 | func MustParseBase(s string) Language { 20 | b, err := ParseBase(s) 21 | if err != nil { 22 | panic(err) 23 | } 24 | return b 25 | } 26 | 27 | // MustParseScript is like ParseScript, but panics if the given script cannot be 28 | // parsed. It simplifies safe initialization of Script values. 29 | func MustParseScript(s string) Script { 30 | scr, err := ParseScript(s) 31 | if err != nil { 32 | panic(err) 33 | } 34 | return scr 35 | } 36 | 37 | // MustParseRegion is like ParseRegion, but panics if the given region cannot be 38 | // parsed. It simplifies safe initialization of Region values. 39 | func MustParseRegion(s string) Region { 40 | r, err := ParseRegion(s) 41 | if err != nil { 42 | panic(err) 43 | } 44 | return r 45 | } 46 | 47 | // Und is the root language. 48 | var Und Tag 49 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.2 6 | // +build !go1.2 7 | 8 | package language 9 | 10 | import "sort" 11 | 12 | func sortStable(s sort.Interface) { 13 | ss := stableSort{ 14 | s: s, 15 | pos: make([]int, s.Len()), 16 | } 17 | for i := range ss.pos { 18 | ss.pos[i] = i 19 | } 20 | sort.Sort(&ss) 21 | } 22 | 23 | type stableSort struct { 24 | s sort.Interface 25 | pos []int 26 | } 27 | 28 | func (s *stableSort) Len() int { 29 | return len(s.pos) 30 | } 31 | 32 | func (s *stableSort) Less(i, j int) bool { 33 | return s.s.Less(i, j) || !s.s.Less(j, i) && s.pos[i] < s.pos[j] 34 | } 35 | 36 | func (s *stableSort) Swap(i, j int) { 37 | s.s.Swap(i, j) 38 | s.pos[i], s.pos[j] = s.pos[j], s.pos[i] 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.2 6 | // +build go1.2 7 | 8 | package language 9 | 10 | import "sort" 11 | 12 | var sortStable = sort.Stable 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/time/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/time/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/time/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/time/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/.gitignore: -------------------------------------------------------------------------------- 1 | coverage.out 2 | .idea 3 | .vscode 4 | coverage.txt -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/.releaserc: -------------------------------------------------------------------------------- 1 | branches: 2 | - master 3 | plugins: 4 | - "@semantic-release/commit-analyzer" 5 | - "@semantic-release/release-notes-generator" 6 | - "@semantic-release/git" 7 | - "@semantic-release/github" 8 | options: 9 | debug: true 10 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Go Client for Google Maps Services authors 2 | # for copyright purposes. This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | 11 | Google Inc. 12 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/CONTRIB.md: -------------------------------------------------------------------------------- 1 | How to contribute 2 | ================= 3 | 4 | Want to help out? That's awesome! 5 | 6 | The library is open source and lives on GitHub at: 7 | https://github.com/googlemaps/google-maps-services-go. 8 | Open an issue or fork the library and submit a pull request. 9 | 10 | Keep in mind that before we can accept any pull requests we have to jump 11 | through a couple of legal hurdles, primarily a Contributor License Agreement 12 | (CLA): 13 | 14 | - **If you are an individual writing original source code** 15 | and you're sure you own the intellectual property, 16 | then you'll need to sign an 17 | [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). 18 | - **If you work for a company that wants to allow you to contribute your work**, 19 | then you'll need to sign a 20 | [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html) 21 | 22 | Follow either of the two links above to access the appropriate CLA and 23 | instructions for how to sign and return it. Once we receive it, we'll be able 24 | to accept your pull requests. 25 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who have contributed to the project. The 2 | # copyright is held by those individuals or organizations in the AUTHORS file. 3 | # 4 | # Names should be added to this file like so: 5 | # Name 6 | 7 | # Please keep the list sorted by first name. 8 | 9 | Brett Morgan @domesticmouse 10 | Chris Broadfoot @broady 11 | James MacWhyte @jmacwhyte 12 | Sam Thorogood @samthor 13 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /* 16 | Package maps provides a client library for the Google Maps Web Service APIs. 17 | Please see https://developers.google.com/maps/documentation/webservices/ for 18 | an overview of the Maps Web Service API suite. 19 | */ 20 | package maps // import "googlemaps.github.io/maps" 21 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/go.mod: -------------------------------------------------------------------------------- 1 | module googlemaps.github.io/maps 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/google/uuid v1.1.1 7 | github.com/kr/pretty v0.2.0 8 | github.com/sergi/go-diff v1.1.0 9 | github.com/stretchr/testify v1.6.1 10 | go.opencensus.io v0.22.3 11 | golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/internal/signer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package internal 16 | 17 | import ( 18 | "crypto/hmac" 19 | "crypto/sha1" 20 | "encoding/base64" 21 | "fmt" 22 | "net/url" 23 | ) 24 | 25 | // generateSignature generates the base64 URL-encoded HMAC-SHA1 signature for the key and plaintext message. 26 | func generateSignature(key []byte, message string) (string, error) { 27 | mac := hmac.New(sha1.New, key) 28 | mac.Write([]byte(message)) 29 | return base64.URLEncoding.EncodeToString(mac.Sum(nil)), nil 30 | } 31 | 32 | // SignURL signs a url with a signature. 33 | // The signature is assumed to be in URL safe base64 encoding. 34 | // The returned signature string is URLEncoded. 35 | // See: https://developers.google.com/maps/documentation/business/webservices/auth#digital_signatures 36 | // See: https://developers.google.com/maps/faq#using-google-maps-apis 37 | func SignURL(path string, signature []byte, q url.Values) (string, error) { 38 | encodedQuery := q.Encode() 39 | message := fmt.Sprintf("%s?%s", path, encodedQuery) 40 | s, err := generateSignature(signature, message) 41 | if err != nil { 42 | return "", err 43 | } 44 | return fmt.Sprintf("%s&signature=%s", encodedQuery, s), nil 45 | } 46 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/metrics/metric.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | ) 7 | 8 | type Reporter interface { 9 | NewRequest(name string) Request 10 | } 11 | 12 | type Request interface { 13 | EndRequest(ctx context.Context, err error, httpResp *http.Response, metro string) 14 | } 15 | 16 | type NoOpReporter struct { 17 | } 18 | 19 | func (n NoOpReporter) NewRequest(name string) Request { 20 | return noOpRequest{} 21 | } 22 | 23 | type noOpRequest struct { 24 | } 25 | 26 | func (n noOpRequest) EndRequest(ctx context.Context, err error, httpResp *http.Response, metro string) { 27 | } 28 | -------------------------------------------------------------------------------- /vendor/googlemaps.github.io/maps/transport.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package maps 16 | 17 | import ( 18 | "fmt" 19 | "net/http" 20 | ) 21 | 22 | const userAgent = "GoogleGeoApiClientGo/0.1" 23 | 24 | // transport is an http.RoundTripper that replaces or appends userAgent the request's 25 | // User-Agent header. 26 | type transport struct { 27 | Base http.RoundTripper 28 | } 29 | 30 | // RoundTrip appends userAgent existing User-Agent header and performs the request 31 | // via t.Base. 32 | func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { 33 | req = cloneRequest(req) 34 | ua := req.Header.Get("User-Agent") 35 | if ua == "" { 36 | ua = userAgent 37 | } else { 38 | ua = fmt.Sprintf("%s;%s", ua, userAgent) 39 | } 40 | req.Header.Set("User-Agent", ua) 41 | return t.Base.RoundTrip(req) 42 | } 43 | 44 | // cloneRequest returns a clone of the provided *http.Request. 45 | // The clone is a shallow copy of the struct and its Header map. 46 | func cloneRequest(r *http.Request) *http.Request { 47 | // shallow copy of the struct 48 | r2 := new(http.Request) 49 | *r2 = *r 50 | // deep copy of the Header 51 | r2.Header = make(http.Header) 52 | for k, s := range r.Header { 53 | r2.Header[k] = s 54 | } 55 | return r2 56 | } 57 | -------------------------------------------------------------------------------- /wiki/gcp-figure1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure1.png -------------------------------------------------------------------------------- /wiki/gcp-figure2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure2.png -------------------------------------------------------------------------------- /wiki/gcp-figure3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure3.png -------------------------------------------------------------------------------- /wiki/gcp-figure4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure4.png -------------------------------------------------------------------------------- /wiki/gcp-figure5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure5.png -------------------------------------------------------------------------------- /wiki/gcp-figure6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure6.png -------------------------------------------------------------------------------- /wiki/gcp-figure7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/gcp-figure7.png -------------------------------------------------------------------------------- /wiki/ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgraph-io/travel/01d1cd098df9f3005ffe5cccb2f549143463fedf/wiki/ui.png -------------------------------------------------------------------------------- /zarf/compose/compose-config.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | 5 | dgraph-zero: 6 | environment: 7 | - DGRAPH_ZERO_MY=dgraph-zero:5080 8 | 9 | dgraph-alpha: 10 | environment: 11 | - DGRAPH_ALPHA_MY=dgraph-alpha:7080 12 | - DGRAPH_ALPHA_LRU_MB=1024 13 | - DGRAPH_ALPHA_ZERO=dgraph-zero:5080 14 | - DGRAPH_ALPHA_SECURITY=whitelist=0.0.0.0/0 15 | 16 | travel-api: 17 | environment: 18 | - TRAVEL_DGRAPH_URL=http://dgraph-alpha:8080 19 | - TRAVEL_API_KEYS_MAPS_KEY= 20 | 21 | travel-ui: 22 | environment: 23 | - TRAVEL_DGRAPH_URL=http://dgraph-alpha:8080 24 | - TRAVEL_API_KEYS_MAPS_KEY= 25 | -------------------------------------------------------------------------------- /zarf/compose/compose-dbonly-config.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | 5 | dgraph-zero: 6 | environment: 7 | - DGRAPH_ZERO_MY=dgraph-zero:5080 8 | 9 | dgraph-alpha: 10 | environment: 11 | - DGRAPH_ALPHA_MY=dgraph-alpha:7080 12 | - DGRAPH_ALPHA_LRU_MB=1024 13 | - DGRAPH_ALPHA_ZERO=dgraph-zero:5080 14 | - DGRAPH_ALPHA_SECURITY=whitelist=0.0.0.0/0 15 | -------------------------------------------------------------------------------- /zarf/compose/compose-dbonly.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | networks: 4 | shared-network: 5 | driver: bridge 6 | 7 | services: 8 | 9 | dgraph-zero: 10 | container_name: dgraph-zero 11 | networks: 12 | - shared-network 13 | image: dgraph/dgraph:master 14 | command: dgraph zero 15 | 16 | dgraph-alpha: 17 | container_name: dgraph-alpha 18 | networks: 19 | - shared-network 20 | image: dgraph/dgraph:master 21 | ports: 22 | - 8080:8080 23 | depends_on: 24 | - dgraph-zero 25 | command: dgraph alpha --vmodule=server=3 26 | -------------------------------------------------------------------------------- /zarf/compose/compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | networks: 4 | shared-network: 5 | driver: bridge 6 | 7 | services: 8 | 9 | dgraph-zero: 10 | container_name: dgraph-zero 11 | networks: 12 | - shared-network 13 | image: dgraph/dgraph:master 14 | command: dgraph zero 15 | 16 | dgraph-alpha: 17 | container_name: dgraph-alpha 18 | networks: 19 | - shared-network 20 | image: dgraph/dgraph:master 21 | ports: 22 | - 8080:8080 23 | depends_on: 24 | - dgraph-zero 25 | command: dgraph alpha --vmodule=server=3 26 | 27 | travel-api: 28 | container_name: travel-api 29 | networks: 30 | - shared-network 31 | image: travel-api-amd64:1.0 32 | ports: 33 | - 3000:3000 # API 34 | - 4000:4000 # DEBUG API 35 | depends_on: 36 | - dgraph-alpha 37 | 38 | travel-ui: 39 | container_name: travel-ui 40 | networks: 41 | - shared-network 42 | image: travel-ui-amd64:1.0 43 | ports: 44 | - 80:80 # API 45 | - 4080:4080 # DEBUG API 46 | depends_on: 47 | - dgraph-alpha -------------------------------------------------------------------------------- /zarf/docker/dockerfile.travel-api: -------------------------------------------------------------------------------- 1 | # Build the Go Binary. 2 | FROM golang:1.17 as build_travel-api 3 | ENV CGO_ENABLED 0 4 | ARG VCS_REF 5 | 6 | # Copy the source code into the container. 7 | COPY . /service 8 | 9 | # Build the api binary. We are doing this last since this will be different 10 | # every time we run through this process. 11 | WORKDIR /service/app/travel-api 12 | RUN go build -ldflags "-X main.build=${VCS_REF}" 13 | 14 | 15 | # Run the Go Binary in Alpine. 16 | FROM alpine:3.13 17 | ARG BUILD_DATE 18 | ARG VCS_REF 19 | COPY --from=build_travel-api /service/app/travel-api/travel-api /app/travel-api 20 | WORKDIR /app 21 | CMD ["/app/travel-api"] 22 | 23 | LABEL org.opencontainers.image.created="${BUILD_DATE}" \ 24 | org.opencontainers.image.title="travel-api" \ 25 | org.opencontainers.image.authors="ArdanLabs, Dgraph" \ 26 | org.opencontainers.image.source="https://github.com/dgraph-io/travel/app/travel-api" \ 27 | org.opencontainers.image.revision="${VCS_REF}" \ 28 | org.opencontainers.image.vendor="Dgraph" 29 | -------------------------------------------------------------------------------- /zarf/docker/dockerfile.travel-ui: -------------------------------------------------------------------------------- 1 | # Build the Go Binary. 2 | FROM golang:1.17 as build_travel-ui 3 | ENV CGO_ENABLED 0 4 | ARG VCS_REF 5 | 6 | # Copy the source code into the container. 7 | COPY . /service 8 | 9 | # Build the service binary. We are doing this last since this will be different 10 | # every time we run through this process. 11 | WORKDIR /service/app/travel-ui 12 | RUN go build -ldflags "-X main.build=${VCS_REF}" 13 | 14 | 15 | # Run the Go Binary in Alpine. 16 | FROM alpine:3.13 17 | ARG BUILD_DATE 18 | ARG VCS_REF 19 | ARG PACKAGE_NAME 20 | ARG PACKAGE_PREFIX 21 | COPY --from=build_travel-ui /service/app/travel-ui/assets/ /app/assets/ 22 | COPY --from=build_travel-ui /service/app/travel-ui/travel-ui /app/travel-ui 23 | WORKDIR /app 24 | CMD ["/app/travel-ui"] 25 | 26 | LABEL org.opencontainers.image.created="${BUILD_DATE}" \ 27 | org.opencontainers.image.title="travel-ui" \ 28 | org.opencontainers.image.authors="ArdanLabs, Dgraph" \ 29 | org.opencontainers.image.source="https://github.com/dgraph-io/travel/app/travel-ui" \ 30 | org.opencontainers.image.revision="${VCS_REF}" \ 31 | org.opencontainers.image.vendor="Dgraph" 32 | -------------------------------------------------------------------------------- /zarf/k8s/base/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - travel.yaml 5 | -------------------------------------------------------------------------------- /zarf/k8s/base/travel.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: travel-pod # Base POD name 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: travel # Selector for POD name search. 9 | template: 10 | metadata: 11 | labels: 12 | app: travel 13 | spec: 14 | dnsPolicy: ClusterFirstWithHostNet 15 | hostNetwork: true 16 | containers: 17 | - name: api 18 | image: travel-api-amd64:1.0 19 | env: 20 | - name: TRAVEL_API_KEYS_MAPS_KEY 21 | valueFrom: 22 | configMapKeyRef: 23 | name: travel 24 | key: map_key 25 | ports: 26 | - name: api 27 | containerPort: 3000 28 | - name: api-debug 29 | containerPort: 4000 30 | readinessProbe: 31 | httpGet: 32 | path: /v1/readiness 33 | port: 3000 34 | initialDelaySeconds: 30 35 | periodSeconds: 15 36 | - name: ui 37 | image: travel-ui-amd64:1.0 38 | env: 39 | - name: TRAVEL_API_KEYS_MAPS_KEY 40 | valueFrom: 41 | configMapKeyRef: 42 | name: travel 43 | key: map_key 44 | ports: 45 | - name: ui 46 | containerPort: 80 47 | - name: ui-debug 48 | containerPort: 4080 49 | readinessProbe: 50 | httpGet: 51 | path: /debug/readiness 52 | port: 4080 53 | initialDelaySeconds: 30 54 | periodSeconds: 15 55 | --- 56 | apiVersion: v1 57 | kind: Service 58 | metadata: 59 | name: travel-service 60 | spec: 61 | type: ClusterIP 62 | selector: 63 | service: travel 64 | ports: 65 | - name: ui 66 | port: 80 67 | targetPort: ui 68 | - name: ui-debug 69 | port: 4080 70 | targetPort: ui-debug 71 | -------------------------------------------------------------------------------- /zarf/k8s/cloud/kind-config.yaml: -------------------------------------------------------------------------------- 1 | 2 | kind: Cluster 3 | apiVersion: kind.x-k8s.io/v1alpha4 4 | nodes: 5 | - role: control-plane 6 | extraPortMappings: 7 | # travel-ui 8 | - containerPort: 80 9 | hostPort: 80 10 | - containerPort: 4080 11 | hostPort: 4080 12 | # travel-api 13 | - containerPort: 3000 14 | hostPort: 3000 15 | - containerPort: 4000 16 | hostPort: 4000 17 | -------------------------------------------------------------------------------- /zarf/k8s/cloud/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - travel.yaml 5 | - ./travel-config.yaml 6 | - ../base 7 | -------------------------------------------------------------------------------- /zarf/k8s/cloud/travel-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: travel 5 | data: 6 | map_key: "" 7 | dgraph_url: "https://12060636-087e-4a09-818a-47fd1eb4f0af.us-west-2.aws.cloud.dgraph.io/graphql" 8 | -------------------------------------------------------------------------------- /zarf/k8s/cloud/travel.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | spec: 4 | template: 5 | spec: 6 | containers: 7 | - name: api 8 | env: 9 | - name: TRAVEL_DGRAPH_URL 10 | valueFrom: 11 | configMapKeyRef: 12 | name: travel 13 | key: dgraph_url 14 | - name: ui 15 | env: 16 | - name: TRAVEL_DGRAPH_URL 17 | valueFrom: 18 | configMapKeyRef: 19 | name: travel 20 | key: dgraph_url 21 | -------------------------------------------------------------------------------- /zarf/k8s/kind/kind-config.yaml: -------------------------------------------------------------------------------- 1 | 2 | kind: Cluster 3 | apiVersion: kind.x-k8s.io/v1alpha4 4 | nodes: 5 | - role: control-plane 6 | extraPortMappings: 7 | # travel-ui 8 | - containerPort: 80 9 | hostPort: 80 10 | - containerPort: 4080 11 | hostPort: 4080 12 | # travel-api 13 | - containerPort: 3000 14 | hostPort: 3000 15 | - containerPort: 4000 16 | hostPort: 4000 17 | # dgraph-alpha 18 | - containerPort: 8080 19 | hostPort: 8080 20 | -------------------------------------------------------------------------------- /zarf/k8s/kind/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ./travel-config.yaml 5 | - ./dgraph.yaml 6 | - ../base 7 | -------------------------------------------------------------------------------- /zarf/k8s/kind/travel-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: travel 5 | data: 6 | map_key: "" 7 | -------------------------------------------------------------------------------- /zarf/keys/54bb2165-71e1-41a6-af3e-7da4a0e1e2c1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAnZ/BW/tuLr0uxZFw1Q5mP1JpIksU46o+kIaqIXZjSAduma18 3 | m+oSgd1L19Fs9otAjfAlkyU8HF1hJNj/PVv8MY72vhIWv60xBB4caXuLmflAiJEt 4 | vxHfw3WtVR9npQqEowcwrsf7MSSfdHwM4S+FbMmcl/mE9c7DUrYJBUgu1IbdI7vr 5 | EoPE65GFafjZQHkPLUX8OaRXOt4rkT6HfYv+XqaCs6Ie+dt6xL5HiQpO90/89CAJ 6 | hi2q8AXvhfxqCVVfLxxd3jNJVq2olkCOLJREuJ29Bb460yKOAiDigEUobUpmvT6g 7 | gUZNrX71yP0GZxQFBhq9j1IRgPVg4CDA0Pw5FQIDAQABAoIBAQCBehtRPYXSquBi 8 | tgfjW4Kt/ToTS22LXesquRPDjQYcws4dOp8jS/GL74Y/b+57zwNmFKAo8Oshuar0 9 | o7N2absN0ovosd8x8EhVQ46/LxcLke1qwSa8zyfp3R5W0AdJUQyHBn7885TpV1YM 10 | T2IdD/Yf2LTjObn4WLGlnZZnWlXtiNitjj6FRGC2kSxXMMl3ptZN7pQF+wPbAqzL 11 | 007XNYMMXNptgBnwUvbUUXyON9Ow+1hox/9crUHuHn60ITCKgRu0+OrgrqfOK6bJ 12 | f99rR5yl5YQYRkVoFGb68Pg7eTVOU260Tl1pgl0GCLojk1O4TFYuBuLZR1dOlx9I 13 | 1b30vrj5AoGBAMLHJVOXSebm2vor76lIgJqWL5kf9e3lZ4Y6zN7rrM+lKSia6fT5 14 | cAGfw+ce1ioyxkJZZ96bkq7EHwypC1GekntAEYixkyEW7H9H3TnPhyLn3ySHnBYb 15 | OKIHShK3XK8kes9khNKJ7FVY1fOj5JC67wQZRRhWlEyOFxKzH9KtygyTAoGBAM8r 16 | A5WNkWT9com4CLVuMmKrGAN+9LwHh7WA5jpqCgvNQ03kgzYH2lf75lVYhX09+bYF 17 | BM3obKyqM8RUp1iYyQr0sr7Ca/DpaMiAKfm9aLOd90xyLTmVUI5x7rwr7UXhlmrY 18 | 4K0bdvc3T7FBOxT/bfyRR4DosEyjcTyvj9gR/1S3AoGBAIf6seNmtlA+ENggfkNn 19 | e2jwurAjMPTxd9GtEUP7snyQaGiRpg3BamGn4QNkcs2o/uJpOmudnszl3GthRKap 20 | lsf21Ybhub6bG2ZMjHSEnmpPCGifR+fi/ymW/y6L1mfrhtVs7pFxeo2m5E8gtzwX 21 | VTA+WA+Cuiur8w26Adh6PZmDAoGAdFjN7IHTNAp69wlaKrq2pV89X0k/nRIFj1PS 22 | +N9wwOwIboh1gDSs1VjtJOVQIuRZh3YOGq37yoTUCeEZEtLLpdGDSUrbYDNV27TO 23 | 3ikX0jhXGKHO8FYBJd6qmxd4bBSja2Jd3Bpel7yCjyP5UHObi4rzw1vrFz97av+W 24 | I10ILsUCgYBmMCXEWDtM/f+Gq53yHV2XyZ7N0fDftPKFwyBgu+VvytacyMT8yFLO 25 | 8yePQjXKUmm1OE+LoVciT+dyibh0XfKmx936bK7GvHL6TKRYMfbuUqh5CQlGT2WE 26 | khtQ09sZjN4h5zTB5TO4JIPvOHQnxhpEnrw8kXkjQx/yVCM4TEHrbw== 27 | -----END RSA PRIVATE KEY----- 28 | --------------------------------------------------------------------------------