From 1b4c9695d42a701714af8780a4f995f92ef42470 Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 08:26:22 +0000 Subject: [PATCH 001/140] tmconnect build & publish scripts --- .github/workflows/branch.yml | 43 ++ .github/workflows/main.yml | 218 +++++++++ .gitignore | 6 + DEVME.md | 29 ++ Makefile | 5 + RELEASE.md | 5 + scripts/build.sh | 42 ++ scripts/publish.sh | 22 + tmconnect/Makefile | 6 + tmconnect/go.mod | 36 +- tmconnect/go.sum | 858 ++++++++++++++++++++++++----------- tmconnect/main.go | 14 + tmconnect/nfpm.yaml | 17 + tmconnect/scripts/build.sh | 26 ++ tmconnect/scripts/publish.sh | 70 +++ 15 files changed, 1133 insertions(+), 264 deletions(-) create mode 100644 .github/workflows/branch.yml create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 DEVME.md create mode 100644 Makefile create mode 100644 RELEASE.md create mode 100644 scripts/build.sh create mode 100644 scripts/publish.sh create mode 100644 tmconnect/nfpm.yaml create mode 100644 tmconnect/scripts/build.sh create mode 100644 tmconnect/scripts/publish.sh diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml new file mode 100644 index 00000000..1dac20a2 --- /dev/null +++ b/.github/workflows/branch.yml @@ -0,0 +1,43 @@ +name: Create version branch + +on: + push: + branches: [ feature/*, bugfix/* ] + +# git ls-remote | head -1 | sed "s/HEAD//" +jobs: + # isolate signing & repo cloning from docker image + auto-pr: + name: Automated Master Branch PR + runs-on: ubuntu-20.04 + permissions: + contents: write + packages: write + id-token: write + pull-requests: write + steps: + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + - name: Extract branch name on pull request + shell: bash + run: | + echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV + - name: Print debug data before publishing + run: | + echo "Source branch: ${{ env.SOURCE_BRANCH }}" + echo " Master ref.: ${{ env.MASTER_REF }}" + echo " Release ver.: ${{ env.RELEASE_VER }}" + echo " Event name: ${{ github.event_name }}" + echo " Repo. name: ${{ github.event.repository.name }}" + # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 + - name: Create version branch from master + uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f + if: startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + branch: ${{ env.RELEASE_VER }} + sha: ${{ env.MASTER_REF }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..2bce8845 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,218 @@ +name: Build, Release & Publish + +on: + push: + branches: [ v*.*.*, feature/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] + pull_request: + branches: [ v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] +jobs: + # isolate signing & repo cloning from docker image + setup: + name: Repo Setup + runs-on: ubuntu-20.04 + permissions: + contents: read + packages: write + id-token: write + pull-requests: write + steps: + - name: Install cosign + uses: sigstore/cosign-installer@v2.1.0 + with: + cosign-release: 'v1.6.0' + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + - name: Verify repo content + run: | + echo "(current dir): $PWD" && ls -l ./ + cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz + - name: Uploading artifacts + uses: actions/upload-artifact@v3.0.0 + with: + name: tools-src + path: ./src.tar.gz + build: + name: Repo Build + runs-on: ubuntu-20.04 + permissions: + contents: read + packages: write + id-token: write + pull-requests: write + needs: [setup] + container: + image: ghcr.io/kiracore/docker/base-image:v0.0.3.0 + steps: + - name: Checking dependency versions + run: | + . /etc/profile && echo "Utils Version: $(utilsVersion)" + go version + CDHelper version + flutter --version + dart --version + echo "ENVS: $(env)" + echo "HOME: $HOME" + echo " PWD: $PWD" + - name: Download artifacts + uses: actions/download-artifact@v3.0.0 + with: + name: tools-src + - name: Testing TOOLS + run: | + echo "(current dir): $PWD" && ls -l ./ + tar xvf ./src.tar.gz + chmod -Rv 555 ./scripts + make build + tmconnect version + - name: Publishing TOOLS binaries + shell: bash + run: | + make publish + touch ./RELEASE.md + cp -fv ./RELEASE.md ./bin/RELEASE.md + chmod -Rv 777 ./bin + echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md + echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo -e "\`\`\`" >> ./bin/RELEASE.md + tar -czvf deb.tar.gz -C ./bin . + - name: Uploading artifacts + uses: actions/upload-artifact@v3.0.0 + with: + name: tools-bin-deb + path: ./deb.tar.gz + release: + name: Create Release + runs-on: ubuntu-20.04 + needs: [build] + permissions: + contents: write + packages: write + id-token: write + pull-requests: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v3.0.0 + with: + name: tools-bin-deb + - name: Inspecting & organizing artifacts + run: | + echo "(current dir): $PWD" && ls -l ./ + tar xvf ./deb.tar.gz + chmod -Rv 777 ./ + echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV + # Branch name is also a version of the release + # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions + - name: Extract branch name on push + if: github.event_name == 'push' + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + - name: Extract branch name on pull request + if: github.event_name == 'pull_request' + env: + REF_BRANCH: ${{ github.event.pull_request.head.ref }} + BASE_REF_BRANCH: ${{ github.base_ref }} + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV + - name: Print debug data before publishing + run: | + echo "Source branch: ${{ env.SOURCE_BRANCH }}" + echo " Dest. branch: ${{ env.DESTINATION_BRANCH }}" + echo " Event name: ${{ github.event_name }}" + echo " Release ver.: ${{ env.RELEASE_VER }}" + - name: Reject on error + # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 + uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 + if: ${{ failure() }} + with: + spam_label: "Build Errors" + close_spam_prs: "yes" + access_token: ${{ secrets.GITHUB_TOKEN }} + # ref: https://github.com/softprops/action-gh-release, v0.1.14 + # Release on merge only (push action) - this should run only once +# - name: Publish release +# if: | +# github.event_name == 'push' && +# ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, 'rc') && !contains(env.SOURCE_BRANCH, '-') ) +# uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 +# with: +# body_path: RELEASE.md +# tag_name: ${{ env.SOURCE_BRANCH }} +# name: ${{ env.SOURCE_BRANCH }} +# prerelease: false +# draft: false +# fail_on_unmatched_files: true +# files: | +# ./tmconnect-linux-amd64.deb +# ./tmconnect-linux-arm64.deb +# ./tmconnect-darwin-amd64.deb +# ./tmconnect-darwin-arm64.deb +# ./tmconnect-windows-amd64.exe +# ./tmconnect-windows-arm64.exe + # ref: https://github.com/softprops/action-gh-release, v0.1.14 + # Release on merge only (push action) - this should run only once +# - name: Publish pre-release +# if: | +# github.event_name == 'push' && +# ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && contains(env.SOURCE_BRANCH, '-') ) +# uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 +# with: +# body_path: RELEASE.md +# tag_name: ${{ env.SOURCE_BRANCH }} +# name: ${{ env.SOURCE_BRANCH }} +# prerelease: true +# draft: false +# fail_on_unmatched_files: true +# files: | +# ./tmconnect-linux-amd64.deb +# ./tmconnect-linux-arm64.deb +# ./tmconnect-darwin-amd64.deb +# ./tmconnect-darwin-arm64.deb +# ./tmconnect-windows-amd64.exe +# ./tmconnect-windows-arm64.exe + # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 + - name: Approve pull request on success + uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 + if: | + ( github.event_name == 'pull_request' ) && + ( env.SOURCE_BRANCH == env.RELEASE_VER || env.DESTINATION_BRANCH == env.RELEASE_VER ) + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Cleanup all resources + shell: bash + run: | + rm -rfv ./* + echo "(current dir): $PWD" && ls -l ./ + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + - name: Create PR from a version branch to latest + # ref: https://github.com/repo-sync/pull-request + if: | + github.event_name == 'push' && + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) + uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 + with: + github_token: ${{ secrets.REPO_ACCESS }} + source_branch: ${{ env.SOURCE_BRANCH }} + destination_branch: 'latest' + pr_title: "${{ env.SOURCE_BRANCH }} -> latest" + pr_label: "kira-automation,automerge" + pr_allow_empty: true + - name: Auto-merge version branch to latest branch + uses: pascalgn/automerge-action@04dfc9eae2586d19b7362d4f6413c48135d9c25a + if: github.event_name == 'pull_request' && env.DESTINATION_BRANCH == 'latest' && + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) + env: + MERGE_LABELS: "automerge" + GITHUB_TOKEN: "${{ secrets.REPO_ACCESS }}" + LOG: "TRACE" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d252e6c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +bin/ +*/bin +nfpm_* +*/nfpm_* +*-tmp +*/*-tmp \ No newline at end of file diff --git a/DEVME.md b/DEVME.md new file mode 100644 index 00000000..3d628550 --- /dev/null +++ b/DEVME.md @@ -0,0 +1,29 @@ +# tools +KIRA Tools + +## Dependencies + +``` +UTILS_VER=$(utilsVersion 2> /dev/null || echo "") + +# Installing utils is essential to simplify the setup steps +if [[ $(versionToNumber "$UTILS_VER" || echo "0") -lt $(versionToNumber "v0.0.15" || echo "1") ]] ; then + echo "INFO: KIRA utils were NOT installed on the system, setting up..." && sleep 2 + KIRA_UTILS_BRANCH="v0.0.3" && cd /tmp && rm -fv ./i.sh && \ + wget https://raw.githubusercontent.com/KiraCore/tools/$KIRA_UTILS_BRANCH/bash-utils/install.sh -O ./i.sh && \ + chmod 777 ./i.sh && ./i.sh "$KIRA_UTILS_BRANCH" "/var/kiraglob" && . /etc/profile && loadGlobEnvs +else + echoInfo "INFO: KIRA utils are up to date, latest version $UTILS_VER" +fi +``` + +## Build + +``` +# set env variable to your local repos (will vary depending on the user) +setGlobEnv TOOLS_REPO "/mnt/c/Users/asmodat/Desktop/KIRA/GITHUB/tools" + +cd $TOOLS_REPO + +make build +``` \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..677de9ba --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +build: + ./scripts/build.sh + +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..6e3f3168 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,5 @@ +Release: `v0.0.4` + +Features: +* Added version command to `tmconnect` +* Build packages for `tmconnect` \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 00000000..7d24380f --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile + +UTILS_VER=$(utilsVersion 2> /dev/null || echo "") + +# Installing utils is essential to simplify the setup steps +if [[ $(versionToNumber "$UTILS_VER" || echo "0") -lt $(versionToNumber "v0.0.15" || echo "1") ]] ; then + echo "INFO: KIRA utils were NOT installed on the system, setting up..." && sleep 2 + KIRA_UTILS_BRANCH="v0.0.3" && cd /tmp && rm -fv ./i.sh && \ + wget https://raw.githubusercontent.com/KiraCore/tools/$KIRA_UTILS_BRANCH/bash-utils/install.sh -O ./i.sh && \ + chmod 777 ./i.sh && ./i.sh "$KIRA_UTILS_BRANCH" "/var/kiraglob" && . /etc/profile && loadGlobEnvs +else + echoInfo "INFO: KIRA utils are up to date, latest version $UTILS_VER" && sleep 2 +fi + +BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") +( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" + +# check if banch is a version branch +# TODO: add isVersion func to utils +if [[ $(versionToNumber "$BRANCH" || echo "0") -gt 0 ]] ; then + VERSION=$BRANCH + RELEASE_FILE=./RELEASE.md + RELEASE_VERSION=$(grep -Fn -m 1 'Release: ' $RELEASE_FILE | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') + RELEASE_LINE_NR=$(getFirstLineByPrefix "Release:" $RELEASE_FILE) + + # If release file is not present or release version is NOT defined then create RELEASE.md or append the Release version + if ($(isNullOrEmpty "$RELEASE_VERSION")) || [ ! -f $RELEASE_FILE ] || [ $RELEASE_LINE_NR -le 0 ] ; then + touch $RELEASE_FILE + echo -e "\n\rRelease: \`$VERSION\`" >> $RELEASE_FILE + # Otherwsie replace release with the number defined by the constants file + else + RELEASE_LINE_NR=$(getFirstLineByPrefix "Release:" $RELEASE_FILE) + setLineByNumber $RELEASE_LINE_NR "Release: \`$VERSION\`" $RELEASE_FILE + fi +fi + +# Build `tmconnect` +cd ./tmconnect +make build \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 00000000..f0aa9fd6 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile + +WORKDIR=$PWD + +BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") +( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" + +# Cleanup old binaries +rm -rfv ./bin + +# Publish tmconnect +cd ./tmconnect +make publish + +# Copy all binaries to bin directory +cd $WORKDIR +mkdir -p ./bin +cp -rfv ./tmconnect/bin/* ./bin +rm -rfv ./tmconnect/bin/* diff --git a/tmconnect/Makefile b/tmconnect/Makefile index b80ad28b..975c36c8 100644 --- a/tmconnect/Makefile +++ b/tmconnect/Makefile @@ -3,3 +3,9 @@ install: go.sum start: go run main.go + +build: + ./scripts/build.sh + +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/tmconnect/go.mod b/tmconnect/go.mod index 4562d4a3..303bc672 100644 --- a/tmconnect/go.mod +++ b/tmconnect/go.mod @@ -1,12 +1,36 @@ module github.com/KiraCore/tools/tmconnect -go 1.15 +go 1.17 require ( - github.com/cosmos/cosmos-sdk v0.34.4-0.20200917134338-9cb27fb171aa - github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d github.com/gogo/protobuf v1.3.2 - github.com/spf13/cobra v1.1.1 - github.com/tendermint/tendermint v0.34.3 - google.golang.org/protobuf v1.25.0 + github.com/spf13/cobra v1.3.0 + github.com/tendermint/tendermint v0.34.16 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcd v0.22.0-beta // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/go-kit/kit v0.12.0 // indirect + github.com/go-kit/log v0.2.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/gtank/merlin v0.1.1 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect + github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.12.1 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect + golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b // indirect + golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect + google.golang.org/protobuf v1.27.1 // indirect ) diff --git a/tmconnect/go.sum b/tmconnect/go.sum index 2375b094..70e0e86e 100644 --- a/tmconnect/go.sum +++ b/tmconnect/go.sum @@ -1,3 +1,4 @@ +bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -5,57 +6,102 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/keyring v1.1.5/go.mod h1:7hsVvt2qXgtadGevGJ4ujg+u8m6SpJ5TpHqTozIPqf0= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= +github.com/adlio/schema v1.2.3/go.mod h1:nD7ZWmMMbwU12Pqwg+qL0rTvHBrBXfNz+5UQxTfy38M= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.4/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= -github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= @@ -63,121 +109,144 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-sdk v0.34.4-0.20200917134338-9cb27fb171aa h1:pXHy1GFSsmMkpP4seUzzOy18AM04AbK42PXR+QOSSQ0= -github.com/cosmos/cosmos-sdk v0.34.4-0.20200917134338-9cb27fb171aa/go.mod h1:kO3VV10paWHqHnDJ8GteH2AKGAcv+Lpdy9+oWEKNUn4= -github.com/cosmos/cosmos-sdk v0.39.2 h1:nLfCJMkUuFt7ansi/YvCxwwxLFrgHCA3cYP4sJKYQdk= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/iavl v0.15.0-rc3/go.mod h1:rQ2zK/LuivThMjve3Yr6VkjvCqCXl+fgHCY7quiUA68= -github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= -github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= -github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= -github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= -github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= +github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -185,257 +254,294 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= -github.com/grpc-ecosystem/grpc-gateway v1.14.8/go.mod h1:NZE8t6vs6TnwLL/ITkaK8W3ecMLGAbh2jXTclvpiwYo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.3/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= -github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= +github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= +github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v1.0.3/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= -github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.13.0 h1:vJlpe9wPgDRM1Z+7Wj3zUUjY1nr6/1jNKyl7llliccg= -github.com/prometheus/common v0.13.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= -github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.0/go.mod h1:zuP2jVPHab6+IIyOx3nXHFN+euFNeS3W8XQkcdd4s7A= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= @@ -444,87 +550,86 @@ github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= -github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.0-rc3/go.mod h1:BoHcEpjfpBHc1Be7RQz3AHaXFNObcDG7SNHCev6Or4g= -github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84 h1:BI/EhLLh6SAlOtMaHePo8BNFLsNRiFNCtJ8cMBX+OE8= -github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84/go.mod h1:ZgOz3PoriH5yHRJmUmhDTVX8ps4+hzFvhmDq6MDUHxU= -github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= -github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= -github.com/tendermint/tendermint v0.34.0 h1:eXCfMgoqVSzrjzOj6clI9GAejcHH0LvOlRjpCmMJksU= -github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= -github.com/tendermint/tendermint v0.34.3 h1:9yEsf3WO5VAwPVwrmM+RffDMiijmNfWaBwNttHm0q5w= -github.com/tendermint/tendermint v0.34.3/go.mod h1:h57vnXeOlrdvvNFCqPBSaOrpOivl+2swWEtlUAqStYE= -github.com/tendermint/tm-db v0.6.1/go.mod h1:m3x9kRP4UFd7JODJL0yBAZqE7wTw+S37uAE90cTx7OA= -github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= -github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tendermint/tendermint v0.34.16 h1:J2h7SwKWEv/cPuby2gjFhY00L2nLCoJOVFZvDbVeA8Q= +github.com/tendermint/tendermint v0.34.16/go.mod h1:n0G22GynfeXTYbrn2IeLeB+oqsAe6R6jl4vZxZ1Y8F4= +github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -532,28 +637,33 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 h1:3erb+vDS8lU1sxfDHF4/hhWyaXnhIaO+7RgL4fDZORA= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -563,6 +673,11 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -571,16 +686,18 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -590,30 +707,71 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b h1:MWaHNqZy3KTpuTMAGvv+Kw+ylsEpmyJZizz1dqxnu28= +golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -621,56 +779,110 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed h1:J22ig1FUekjjkmZUM7pTKixYm8DvrYsvrBZdunYeIuQ= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -683,71 +895,193 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6 h1:iRN4+t0lvZX/l9gH14ARF9i58tsVa5a97k6aH95rC3Y= -google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -757,19 +1091,20 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= @@ -781,13 +1116,20 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/tmconnect/main.go b/tmconnect/main.go index be997161..4efafa97 100644 --- a/tmconnect/main.go +++ b/tmconnect/main.go @@ -37,6 +37,7 @@ const codeSuccess int = 0 const codeFail int = 1 const BlockchainChannel = byte(0x40) const PexChannel = byte(0x00) +const TmConnectVersion = "v0.0.1.0" func makeTimestamp() int64 { return time.Now().UnixNano() / int64(time.Millisecond) @@ -66,6 +67,13 @@ func main() { RunE: cmdNodeId, } + var versionCommand = &cobra.Command{ + Use: "version", + Short: "version", + Long: "Get TMCONNECT version", + RunE: cmdVersion, + } + var networkCommand = &cobra.Command{ Use: "network [options]", Short: "network", @@ -91,6 +99,7 @@ func main() { rootCmd.AddCommand(handshakeCommand) rootCmd.AddCommand(idCommand) rootCmd.AddCommand(networkCommand) + rootCmd.AddCommand(versionCommand) rootCmd.Execute() } @@ -202,6 +211,11 @@ func connect( } } +func cmdVersion(cmd *cobra.Command, args []string) error { + fmt.Print(TmConnectVersion) + return nil +} + func cmdHandshake(cmd *cobra.Command, args []string) error { // parse address to host and port printVerbose("parsing address: " + address) diff --git a/tmconnect/nfpm.yaml b/tmconnect/nfpm.yaml new file mode 100644 index 00000000..b599d44f --- /dev/null +++ b/tmconnect/nfpm.yaml @@ -0,0 +1,17 @@ +name: "tmconnect" +arch: "${ARCH}" +platform: "${PLATFORM}" +version: "${VERSION}" +section: "default" +priority: "extra" +replaces: +- tmconnect +provides: +- tmconnect +maintainer: "KIRA " +description: "TMCONNECT is KIRA a tool enabling to establish connection and handshake with tendermint nodes" +homepage: "https://github.com/KiraCore/tools" +license: "AGPL-3.0 license" +contents: +- src: ${SOURCE} + dst: ./bin/ diff --git a/tmconnect/scripts/build.sh b/tmconnect/scripts/build.sh new file mode 100644 index 00000000..bef574c7 --- /dev/null +++ b/tmconnect/scripts/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile + +LOCAL_PLATFORM="$(uname)" && LOCAL_PLATFORM="$(echo "$LOCAL_PLATFORM" | tr '[:upper:]' '[:lower:]' )" +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +LOCAL_OUT="${GOBIN}/tmconnect" + +PLATFORM="$1" && [ -z "$PLATFORM" ] && PLATFORM="$LOCAL_PLATFORM" +ARCH="$2" && [ -z "$ARCH" ] && ARCH="$LOCAL_ARCH" +OUTPUT="$3" && [ -z "$OUTPUT" ] && OUTPUT="$LOCAL_OUT" + +CONSTANS_FILE=./main.go +VERSION=$(grep -Fn -m 1 'TmConnectVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: TmConnectVersion was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old sekaid binary" + +go mod tidy +GO111MODULE=on go mod verify +env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ + +( [ "$PLATFORM" == "$LOCAL_PLATFORM" ] && [ "$ARCH" == "$LOCAL_ARCH" ] && [ -f $OUTPUT ] ) && \ + echoInfo "INFO: Sucessfully built tmconnect $($OUTPUT version)" || echoInfo "INFO: Sucessfully built tmconnect to '$OUTPUT'" + diff --git a/tmconnect/scripts/publish.sh b/tmconnect/scripts/publish.sh new file mode 100644 index 00000000..f1d94662 --- /dev/null +++ b/tmconnect/scripts/publish.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile + +go mod tidy +GO111MODULE=on go mod verify + +PKG_CONFIG_FILE=./nfpm.yaml + +function pcgConfigure() { + local ARCH="$1" + local VERSION="$2" + local PLATFORM="$3" + local SOURCE="$4" + local CONFIG="$5" + SOURCE=${SOURCE//"/"/"\/"} + sed -i"" "s/\${ARCH}/$ARCH/" $CONFIG + sed -i"" "s/\${VERSION}/$VERSION/" $CONFIG + sed -i"" "s/\${PLATFORM}/$PLATFORM/" $CONFIG + sed -i"" "s/\${SOURCE}/$SOURCE/" $CONFIG +} + +BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") +( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" + +CONSTANS_FILE=./main.go +VERSION=$(grep -Fn -m 1 'TmConnectVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: TmConnectVersion was NOT found in '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +function pcgRelease() { + local ARCH="$1" && ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]' ) + local VERSION="$2" && VERSION=$(echo "$VERSION" | tr '[:upper:]' '[:lower:]' ) + local PLATFORM="$3" && PLATFORM=$(echo "$PLATFORM" | tr '[:upper:]' '[:lower:]' ) + + local BIN_PATH=./bin/$ARCH/$PLATFORM + local RELEASE_DIR=./bin/deb/$PLATFORM + + mkdir -p $BIN_PATH $RELEASE_DIR + + echoInfo "INFO: Building $ARCH package for $PLATFORM..." + + TMP_PKG_CONFIG_FILE=./nfpm_${ARCH}_${PLATFORM}.yaml + rm -rfv $TMP_PKG_CONFIG_FILE && cp -v $PKG_CONFIG_FILE $TMP_PKG_CONFIG_FILE + + if [ "$PLATFORM" != "windows" ] ; then + local RELEASE_PATH="${RELEASE_DIR}/tmconnect_${VERSION}_${ARCH}.deb" + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/tmconnect" + pcgConfigure "$ARCH" "$VERSION" "$PLATFORM" "$BIN_PATH" $TMP_PKG_CONFIG_FILE + nfpm pkg --packager deb --target "$RELEASE_PATH" -f $TMP_PKG_CONFIG_FILE + cp -fv "$RELEASE_PATH" ./bin/sekai-${PLATFORM}-${ARCH}.deb + else + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/tmconnect.exe" + # deb is not supported on windows, simply copy the executables + cp -fv $BIN_PATH/tmconnect.exe ./bin/sekai-${PLATFORM}-${ARCH}.exe + fi +} + +rm -rfv ./bin + +# NOTE: To see available build architectures, run: go tool dist list +pcgRelease "amd64" "$VERSION" "linux" +pcgRelease "amd64" "$VERSION" "darwin" +pcgRelease "amd64" "$VERSION" "windows" +pcgRelease "arm64" "$VERSION" "linux" +pcgRelease "arm64" "$VERSION" "darwin" +pcgRelease "arm64" "$VERSION" "windows" + +rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb +echoInfo "INFO: Sucessfully published SEKAI deb packages into ./bin" From a8d66a076c18550ae77e8c7012cecb07121b6eb2 Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 10:12:30 +0000 Subject: [PATCH 002/140] allow chmod build --- .github/workflows/main.yml | 2 ++ bash-utils/utils.sh | 7 ++++++- scripts/build.sh | 15 +++------------ scripts/publish.sh | 1 + tmconnect/scripts/build.sh | 1 + tmconnect/scripts/publish.sh | 1 + 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2bce8845..a8e1d639 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,6 +63,8 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts + chmod -Rv 555 ./tmconnect/scripts + chmod -Rv 555 ./bash-utils make build tmconnect version - name: Publishing TOOLS binaries diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index 50934a03..9662a10a 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -9,9 +9,10 @@ REGEX_INTEGER="^-?[0-9]+$" REGEX_NUMBER="^[+-]?([0-9]*[.])?([0-9]+)?$" REGEX_PUBLIC_IP='^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(? /dev/null || echo -n "") if (! $(isNullOrWhitespaces "$kg_date_tmp")) && (! $(isNaturalNumber $kg_date_tmp)) ; then diff --git a/scripts/build.sh b/scripts/build.sh index 7d24380f..0a49f3e2 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,25 +2,16 @@ set -e set -x . /etc/profile +. ./bash-utils/utils.sh -UTILS_VER=$(utilsVersion 2> /dev/null || echo "") - -# Installing utils is essential to simplify the setup steps -if [[ $(versionToNumber "$UTILS_VER" || echo "0") -lt $(versionToNumber "v0.0.15" || echo "1") ]] ; then - echo "INFO: KIRA utils were NOT installed on the system, setting up..." && sleep 2 - KIRA_UTILS_BRANCH="v0.0.3" && cd /tmp && rm -fv ./i.sh && \ - wget https://raw.githubusercontent.com/KiraCore/tools/$KIRA_UTILS_BRANCH/bash-utils/install.sh -O ./i.sh && \ - chmod 777 ./i.sh && ./i.sh "$KIRA_UTILS_BRANCH" "/var/kiraglob" && . /etc/profile && loadGlobEnvs -else - echoInfo "INFO: KIRA utils are up to date, latest version $UTILS_VER" && sleep 2 -fi +echoInfo "INFO: KIRA utils, latest version $(utilsVersion)" BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") ( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" # check if banch is a version branch # TODO: add isVersion func to utils -if [[ $(versionToNumber "$BRANCH" || echo "0") -gt 0 ]] ; then +if ($(isVersion "$BRANCH")) ; then VERSION=$BRANCH RELEASE_FILE=./RELEASE.md RELEASE_VERSION=$(grep -Fn -m 1 'Release: ' $RELEASE_FILE | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') diff --git a/scripts/publish.sh b/scripts/publish.sh index f0aa9fd6..722b9920 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -2,6 +2,7 @@ set -e set -x . /etc/profile +. ./bash-utils/utils.sh WORKDIR=$PWD diff --git a/tmconnect/scripts/build.sh b/tmconnect/scripts/build.sh index bef574c7..1b589090 100644 --- a/tmconnect/scripts/build.sh +++ b/tmconnect/scripts/build.sh @@ -2,6 +2,7 @@ set -e set -x . /etc/profile +. ../bash-utils/utils.sh LOCAL_PLATFORM="$(uname)" && LOCAL_PLATFORM="$(echo "$LOCAL_PLATFORM" | tr '[:upper:]' '[:lower:]' )" LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") diff --git a/tmconnect/scripts/publish.sh b/tmconnect/scripts/publish.sh index f1d94662..f2aab09d 100644 --- a/tmconnect/scripts/publish.sh +++ b/tmconnect/scripts/publish.sh @@ -2,6 +2,7 @@ set -e set -x . /etc/profile +. ../bash-utils/utils.sh go mod tidy GO111MODULE=on go mod verify From 2ed7d03308ab9b9e9b23e9c87111de7dd17b1e7f Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 10:41:07 +0000 Subject: [PATCH 003/140] set valid release version --- .github/workflows/main.yml | 16 ++++++++++++++++ scripts/build.sh | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a8e1d639..d9b8dc0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,6 +44,21 @@ jobs: container: image: ghcr.io/kiracore/docker/base-image:v0.0.3.0 steps: + - name: Extract branch name on push + if: github.event_name == 'push' + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + - name: Extract branch name on pull request + if: github.event_name == 'pull_request' + env: + REF_BRANCH: ${{ github.event.pull_request.head.ref }} + BASE_REF_BRANCH: ${{ github.base_ref }} + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - name: Checking dependency versions run: | . /etc/profile && echo "Utils Version: $(utilsVersion)" @@ -65,6 +80,7 @@ jobs: chmod -Rv 555 ./scripts chmod -Rv 555 ./tmconnect/scripts chmod -Rv 555 ./bash-utils + export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make build tmconnect version - name: Publishing TOOLS binaries diff --git a/scripts/build.sh b/scripts/build.sh index 0a49f3e2..9f64b9eb 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -6,8 +6,7 @@ set -x echoInfo "INFO: KIRA utils, latest version $(utilsVersion)" -BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") -( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" +[ -z "$SOURCE_BRANCH" ] && BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") || BRANCH=$SOURCE_BRANCH # check if banch is a version branch # TODO: add isVersion func to utils From 3245dfdc8e0c19f17cefbfcf57f48aadc0961544 Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 10:53:04 +0000 Subject: [PATCH 004/140] print out branch name --- .github/workflows/main.yml | 2 +- scripts/build.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9b8dc0d..f5183d12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: uses: actions/download-artifact@v3.0.0 with: name: tools-src - - name: Testing TOOLS + - name: Building TOOLS run: | echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz diff --git a/scripts/build.sh b/scripts/build.sh index 9f64b9eb..5129771d 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -11,6 +11,7 @@ echoInfo "INFO: KIRA utils, latest version $(utilsVersion)" # check if banch is a version branch # TODO: add isVersion func to utils if ($(isVersion "$BRANCH")) ; then + echoInfo "INFO: Branch '$BRANCH' is versioned, release file be updated..." VERSION=$BRANCH RELEASE_FILE=./RELEASE.md RELEASE_VERSION=$(grep -Fn -m 1 'Release: ' $RELEASE_FILE | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') @@ -25,6 +26,8 @@ if ($(isVersion "$BRANCH")) ; then RELEASE_LINE_NR=$(getFirstLineByPrefix "Release:" $RELEASE_FILE) setLineByNumber $RELEASE_LINE_NR "Release: \`$VERSION\`" $RELEASE_FILE fi +else + echoWarn "WARNING: Branch '$BRANCH' is not versioned, release file will NOT be updated" fi # Build `tmconnect` From 1f4faf4c1968fc25ade09893bb4703c7f6d74232 Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 10:57:14 +0000 Subject: [PATCH 005/140] print out release file --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f5183d12..028b21c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,7 +123,7 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./deb.tar.gz chmod -Rv 777 ./ - echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV + echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./bin/RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV # Branch name is also a version of the release # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - name: Extract branch name on push @@ -147,6 +147,8 @@ jobs: echo " Dest. branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" echo " Release ver.: ${{ env.RELEASE_VER }}" + echo " Release file:" + cat ./bin/RELEASE.md - name: Reject on error # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 From d929449a99600eb6f9af65c2d65b12b10b2a8f49 Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 11:11:10 +0000 Subject: [PATCH 006/140] release fix --- .github/workflows/main.yml | 4 ++-- RELEASE.md | 2 +- scripts/build.sh | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 028b21c9..d5451346 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,7 +123,7 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./deb.tar.gz chmod -Rv 777 ./ - echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./bin/RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV + echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV # Branch name is also a version of the release # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - name: Extract branch name on push @@ -148,7 +148,7 @@ jobs: echo " Event name: ${{ github.event_name }}" echo " Release ver.: ${{ env.RELEASE_VER }}" echo " Release file:" - cat ./bin/RELEASE.md + cat ./RELEASE.md - name: Reject on error # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 diff --git a/RELEASE.md b/RELEASE.md index 6e3f3168..33dbe57b 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ -Release: `v0.0.4` +Release: `undefined` Features: * Added version command to `tmconnect` diff --git a/scripts/build.sh b/scripts/build.sh index 5129771d..5099c9cc 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -26,6 +26,9 @@ if ($(isVersion "$BRANCH")) ; then RELEASE_LINE_NR=$(getFirstLineByPrefix "Release:" $RELEASE_FILE) setLineByNumber $RELEASE_LINE_NR "Release: \`$VERSION\`" $RELEASE_FILE fi + + RELEASE_VERSION=$(grep -Fn -m 1 'Release: ' $RELEASE_FILE | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') + [ "${RELEASE_VERSION}" != "$VERSION" ] && echoErr "ERROR: Failed to update release file" && exit 1 else echoWarn "WARNING: Branch '$BRANCH' is not versioned, release file will NOT be updated" fi From 0c3ffdedb222eba0aa9eae07a0711cad375ee7a0 Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 11:13:43 +0000 Subject: [PATCH 007/140] allow edit release file --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5451346..f6ff6e9f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -80,6 +80,7 @@ jobs: chmod -Rv 555 ./scripts chmod -Rv 555 ./tmconnect/scripts chmod -Rv 555 ./bash-utils + chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make build tmconnect version From cc60da5511ef5ae671e02c28983d3cd891e10ecf Mon Sep 17 00:00:00 2001 From: asmodat Date: Thu, 17 Mar 2022 11:22:09 +0000 Subject: [PATCH 008/140] syntax --- tmconnect/scripts/build.sh | 2 +- tmconnect/scripts/publish.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tmconnect/scripts/build.sh b/tmconnect/scripts/build.sh index 1b589090..a79705f8 100644 --- a/tmconnect/scripts/build.sh +++ b/tmconnect/scripts/build.sh @@ -16,7 +16,7 @@ CONSTANS_FILE=./main.go VERSION=$(grep -Fn -m 1 'TmConnectVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') ($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: TmConnectVersion was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) -rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old sekaid binary" +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old tmconnect binary" go mod tidy GO111MODULE=on go mod verify diff --git a/tmconnect/scripts/publish.sh b/tmconnect/scripts/publish.sh index f2aab09d..416eb313 100644 --- a/tmconnect/scripts/publish.sh +++ b/tmconnect/scripts/publish.sh @@ -49,11 +49,11 @@ function pcgRelease() { ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/tmconnect" pcgConfigure "$ARCH" "$VERSION" "$PLATFORM" "$BIN_PATH" $TMP_PKG_CONFIG_FILE nfpm pkg --packager deb --target "$RELEASE_PATH" -f $TMP_PKG_CONFIG_FILE - cp -fv "$RELEASE_PATH" ./bin/sekai-${PLATFORM}-${ARCH}.deb + cp -fv "$RELEASE_PATH" ./bin/tmconnect-${PLATFORM}-${ARCH}.deb else ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/tmconnect.exe" # deb is not supported on windows, simply copy the executables - cp -fv $BIN_PATH/tmconnect.exe ./bin/sekai-${PLATFORM}-${ARCH}.exe + cp -fv $BIN_PATH/tmconnect.exe ./bin/tmconnect-${PLATFORM}-${ARCH}.exe fi } From ed19741bcff7584c6afca749e8cb28e38c273115 Mon Sep 17 00:00:00 2001 From: asmodat Date: Fri, 18 Mar 2022 10:23:53 +0000 Subject: [PATCH 009/140] tmkms binaries release --- .github/workflows/main.yml | 94 ++++++++++++----------- .gitignore | 6 +- scripts/publish.sh | 9 ++- tmkms-key-import/DEVME.md | 21 ++++++ tmkms-key-import/Makefile | 2 + tmkms-key-import/scripts/publish.sh | 65 ++++++++++++++++ tmkms-key-import/tmkms-key-import.py | 107 ++++++++++++++------------- 7 files changed, 208 insertions(+), 96 deletions(-) create mode 100644 tmkms-key-import/DEVME.md create mode 100644 tmkms-key-import/Makefile create mode 100644 tmkms-key-import/scripts/publish.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f6ff6e9f..ca083bd3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,12 +92,14 @@ jobs: cp -fv ./RELEASE.md ./bin/RELEASE.md chmod -Rv 777 ./bin echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . - name: Uploading artifacts @@ -160,46 +162,50 @@ jobs: access_token: ${{ secrets.GITHUB_TOKEN }} # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once -# - name: Publish release -# if: | -# github.event_name == 'push' && -# ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, 'rc') && !contains(env.SOURCE_BRANCH, '-') ) -# uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 -# with: -# body_path: RELEASE.md -# tag_name: ${{ env.SOURCE_BRANCH }} -# name: ${{ env.SOURCE_BRANCH }} -# prerelease: false -# draft: false -# fail_on_unmatched_files: true -# files: | -# ./tmconnect-linux-amd64.deb -# ./tmconnect-linux-arm64.deb -# ./tmconnect-darwin-amd64.deb -# ./tmconnect-darwin-arm64.deb -# ./tmconnect-windows-amd64.exe -# ./tmconnect-windows-arm64.exe + - name: Publish release + if: | + github.event_name == 'push' && + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, 'rc') && !contains(env.SOURCE_BRANCH, '-') ) + uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 + with: + body_path: RELEASE.md + tag_name: ${{ env.SOURCE_BRANCH }} + name: ${{ env.SOURCE_BRANCH }} + prerelease: false + draft: false + fail_on_unmatched_files: true + files: | + ./tmconnect-linux-amd64.deb + ./tmconnect-linux-arm64.deb + ./tmconnect-darwin-amd64.deb + ./tmconnect-darwin-arm64.deb + ./tmconnect-windows-amd64.exe + ./tmconnect-windows-arm64.exe + ./tmkms-key-import-linux-amd64 + ./tmkms-key-import-linux-arm64 # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once -# - name: Publish pre-release -# if: | -# github.event_name == 'push' && -# ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && contains(env.SOURCE_BRANCH, '-') ) -# uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 -# with: -# body_path: RELEASE.md -# tag_name: ${{ env.SOURCE_BRANCH }} -# name: ${{ env.SOURCE_BRANCH }} -# prerelease: true -# draft: false -# fail_on_unmatched_files: true -# files: | -# ./tmconnect-linux-amd64.deb -# ./tmconnect-linux-arm64.deb -# ./tmconnect-darwin-amd64.deb -# ./tmconnect-darwin-arm64.deb -# ./tmconnect-windows-amd64.exe -# ./tmconnect-windows-arm64.exe + - name: Publish pre-release + if: | + github.event_name == 'push' && + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && contains(env.SOURCE_BRANCH, '-') ) + uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 + with: + body_path: RELEASE.md + tag_name: ${{ env.SOURCE_BRANCH }} + name: ${{ env.SOURCE_BRANCH }} + prerelease: true + draft: false + fail_on_unmatched_files: true + files: | + ./tmconnect-linux-amd64.deb + ./tmconnect-linux-arm64.deb + ./tmconnect-darwin-amd64.deb + ./tmconnect-darwin-arm64.deb + ./tmconnect-windows-amd64.exe + ./tmconnect-windows-arm64.exe + ./tmkms-key-import-linux-amd64 + ./tmkms-key-import-linux-arm64 # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 diff --git a/.gitignore b/.gitignore index d252e6c4..60967c2b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,8 @@ bin/ nfpm_* */nfpm_* *-tmp -*/*-tmp \ No newline at end of file +*/*-tmp +*/.build +*/dist +*/spec +*/__pycache__ \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 722b9920..736fa8ab 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -15,9 +15,16 @@ rm -rfv ./bin # Publish tmconnect cd ./tmconnect make publish +cd $WORKDIR -# Copy all binaries to bin directory +# Publish tmkms-key-import +cd ./tmkms-key-import +make publish cd $WORKDIR + +# Copy all binaries to bin directory mkdir -p ./bin cp -rfv ./tmconnect/bin/* ./bin +cp -rfv ./tmkms-key-import/bin/* ./bin rm -rfv ./tmconnect/bin/* +rm -rfv ./tmkms-key-import/bin/* \ No newline at end of file diff --git a/tmkms-key-import/DEVME.md b/tmkms-key-import/DEVME.md new file mode 100644 index 00000000..f4ade32b --- /dev/null +++ b/tmkms-key-import/DEVME.md @@ -0,0 +1,21 @@ +## Dependencies + +``` +apt-get -y install upx wine python python3 python3-pip && \ + python3 -m pip install --upgrade pip &&\ + pip3 install crossenv && \ + pip3 install ECPy && \ + pip3 install pyinstaller && \ + pip3 install --upgrade pyinstaller + +# Installing specific python version (optional) +cd /usr/local && \ + wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0a4.tgz -O python.tgz && \ + rm -rfv ./python && tar -xvzf python.tgz && mv ./Python-3.11.0a4 ./python + +./python/configure --prefix="$PWD/python/bin" +make +make clean +make install +./python --version +``` \ No newline at end of file diff --git a/tmkms-key-import/Makefile b/tmkms-key-import/Makefile new file mode 100644 index 00000000..605e4452 --- /dev/null +++ b/tmkms-key-import/Makefile @@ -0,0 +1,2 @@ +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/tmkms-key-import/scripts/publish.sh b/tmkms-key-import/scripts/publish.sh new file mode 100644 index 00000000..6754c4a3 --- /dev/null +++ b/tmkms-key-import/scripts/publish.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile +. ../bash-utils/utils.sh + +LOCAL_PLATFORM="$(uname)" && LOCAL_PLATFORM="$(echo "$LOCAL_PLATFORM" | tr '[:upper:]' '[:lower:]' )" +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +BASEDIR=$PWD +WORKDIR=./bin/.work +SPECDIR=./bin/.spec +DISTDIR=./bin/.dist + +rm -rfv ./bin +mkdir -p ./bin + +function pcgRelease() { + local ARCH="$1" && ARCH=$(toLower "$ARCH") + local VERSION="$2" && VERSION=$(toLower "$VERSION") + local PLATFORM="$3" && PLATFORM=$(toLower "$PLATFORM") + + #local BIN_PATH=./bin/$ARCH/$PLATFORM + #local RELEASE_DIR=./bin/deb/$PLATFORM + #mkdir -p $BIN_PATH $RELEASE_DIR + + echoInfo "INFO: Building $ARCH package for $PLATFORM..." + + #TMP_PKG_CONFIG_FILE=./nfpm_${ARCH}_${PLATFORM}.yaml + #rm -rfv $TMP_PKG_CONFIG_FILE && cp -v $PKG_CONFIG_FILE $TMP_PKG_CONFIG_FILE + + [ "$ARCH" == "amd64" ] && ARCH_PY="x86_64" || ARCH_PY="$ARCH" + + if [ "$PLATFORM" == "windows" ] ; then + echoErr "ERROR: Unsupported platform '$PLATFORM'" && exit 1 + elif [ "$PLATFORM" == "darwin" ] ; then + echoErr "ERROR: Unsupported platform '$PLATFORM'" && exit 1 + elif [ "$PLATFORM" == "linux" ] ; then + pyinstaller ./tmkms-key-import.py \ + --log-level=DEBUG \ + --onefile \ + --clean \ + --name "tmkms-key-import" \ + --workpath=$WORKDIR \ + --specpath=$SPECDIR \ + --distpath=$DISTDIR \ + --target-architecture="$ARCH_PY" \ + --noconfirm + else + echoErr "ERROR: Unknown platform '$PLATFORM'" && exit 1 + fi + + cp -fv $DISTDIR/tmkms-key-import ./bin/tmkms-key-import-${PLATFORM}-${ARCH} + rm -rfv $WORKDIR $SPECDIR $DISTDIR __pycache__ +} + +pcgRelease "amd64" "$VERSION" "linux" +pcgRelease "arm64" "$VERSION" "linux" + +LOCAL_BIN="tmkms-key-import-${LOCAL_PLATFORM}-${LOCAL_ARCH}" + +[ -f $LOCAL_BIN ] && ./bin/tmkms-key-import-${LOCAL_PLATFORM}-${LOCAL_ARCH} version + +cd $BASEDIR + + # cd ./tmkms-key-import \ No newline at end of file diff --git a/tmkms-key-import/tmkms-key-import.py b/tmkms-key-import/tmkms-key-import.py index 700e43d4..42b2a4e3 100644 --- a/tmkms-key-import/tmkms-key-import.py +++ b/tmkms-key-import/tmkms-key-import.py @@ -12,6 +12,8 @@ import base64 import json +TMKMS_KEY_IMPORT_VERSION="v0.0.1.0" + TRACE=False def trace(x): if (TRACE): @@ -171,60 +173,65 @@ def derive_mnemonic(self, path, mnemonic, passphrase='', prefix=u'mnemonic'): return self.derive_seed(path, seed) if __name__ == "__main__": - mnem = sys.argv[1] - priv_json_path = sys.argv[2] - priv_key_path = sys.argv[3] - node_key_path = sys.argv[4] - node_id_path = sys.argv[5] - - path_arr = [ - 0x80000000 | 44, - 0x80000000 | 118, - 0x80000000 | 0, - 0, - 0] - - # Private validator key generator - priv = BIP32Ed25519().derive_mnemonic(path_arr, mnem) - ((kL, kR), A, c) = priv - - priv_key = str(base64.b64encode(kL + kR), "utf-8") - pub_key = str(base64.b64encode(kR), "utf-8") - address = _h256(kR)[:20].hex() - - priv_validator_key = { - "address": address.upper(), - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": pub_key - }, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": priv_key + arg1=sys.argv[1] + if arg1 == "version": + print(TMKMS_KEY_IMPORT_VERSION, end = '') + elif arg1 == "--help": + print("tmkms-key-import ") + else: + mnem = arg1 + priv_json_path = sys.argv[2] + priv_key_path = sys.argv[3] + node_key_path = sys.argv[4] + node_id_path = sys.argv[5] + + path_arr = [ + 0x80000000 | 44, + 0x80000000 | 118, + 0x80000000 | 0, + 0, + 0] + + # Private validator key generator + priv = BIP32Ed25519().derive_mnemonic(path_arr, mnem) + ((kL, kR), A, c) = priv + + priv_key = str(base64.b64encode(kL + kR), "utf-8") + pub_key = str(base64.b64encode(kR), "utf-8") + address = _h256(kR)[:20].hex() + + priv_validator_key = { + "address": address.upper(), + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": pub_key + }, + "priv_key": { + "type": "tendermint/PrivKeyEd25519", + "value": priv_key + } } - } - with open(priv_json_path, 'w') as f: - json.dump(priv_validator_key, f, ensure_ascii=False, indent=2) - f.close() + with open(priv_json_path, 'w') as f: + json.dump(priv_validator_key, f, ensure_ascii=False, indent=2) + f.close() - # base64.b64encode(kL) is the 32B key that can be placed raw inside the key file without need for tmkms import - with open(priv_key_path, 'w') as f: - f.write(str(base64.b64encode(kL), "utf-8")) - f.close() + # base64.b64encode(kL) is the 32B key that can be placed raw inside the key file without need for tmkms import + with open(priv_key_path, 'w') as f: + f.write(str(base64.b64encode(kL), "utf-8")) + f.close() - node_key = { - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": priv_key + node_key = { + "priv_key": { + "type": "tendermint/PrivKeyEd25519", + "value": priv_key + } } - } - - with open(node_key_path, 'w') as f: - json.dump(node_key, f, ensure_ascii=False, indent=2) - f.close() - with open(node_id_path, 'w') as f: - f.write(address) - f.close() + with open(node_key_path, 'w') as f: + json.dump(node_key, f, ensure_ascii=False, indent=2) + f.close() + with open(node_id_path, 'w') as f: + f.write(address) + f.close() From d2e21e5db372ebcfa70449d261858cef96ea480c Mon Sep 17 00:00:00 2001 From: asmodat Date: Fri, 18 Mar 2022 11:48:01 +0000 Subject: [PATCH 010/140] relese all binaries --- .github/workflows/main.yml | 36 +- RELEASE.md | 2 +- priv-validator-key-gen/Makefile | 6 + priv-validator-key-gen/go.mod | 8 +- priv-validator-key-gen/go.sum | 1005 +++++++++++++++++++-- priv-validator-key-gen/main.go | 11 + priv-validator-key-gen/nfpm.yaml | 17 + priv-validator-key-gen/scripts/build.sh | 27 + priv-validator-key-gen/scripts/publish.sh | 71 ++ scripts/build.sh | 37 +- scripts/publish.sh | 11 +- tmconnect/scripts/build.sh | 2 +- tmconnect/scripts/publish.sh | 2 +- 13 files changed, 1110 insertions(+), 125 deletions(-) create mode 100644 priv-validator-key-gen/nfpm.yaml create mode 100644 priv-validator-key-gen/scripts/build.sh create mode 100644 priv-validator-key-gen/scripts/publish.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ca083bd3..164eb0c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,7 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts + chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./priv-validator-key-gen/scripts chmod -Rv 555 ./bash-utils chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} @@ -92,14 +92,20 @@ jobs: cp -fv ./RELEASE.md ./bin/RELEASE.md chmod -Rv 777 ./bin echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " priv-validator-key-gen-linux-arm64: sha256:$(sha256sum ./bin/priv-validator-key-gen-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " priv-validator-key-gen-linux-amd64: sha256:$(sha256sum ./bin/priv-validator-key-gen-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "priv-validator-key-gen-windows-arm64: sha256:$(sha256sum ./bin/priv-validator-key-gen-windows-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "priv-validator-key-gen-windows-amd64: sha256:$(sha256sum ./bin/priv-validator-key-gen-windows-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " priv-validator-key-gen-darwin-arm64: sha256:$(sha256sum ./bin/priv-validator-key-gen-darwin-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " priv-validator-key-gen-darwin-amd64: sha256:$(sha256sum ./bin/priv-validator-key-gen-darwin-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . - name: Uploading artifacts @@ -183,6 +189,12 @@ jobs: ./tmconnect-windows-arm64.exe ./tmkms-key-import-linux-amd64 ./tmkms-key-import-linux-arm64 + ./priv-validator-key-gen-linux-arm64 + ./priv-validator-key-gen-linux-amd64 + ./priv-validator-key-gen-windows-arm64 + ./priv-validator-key-gen-windows-amd64 + ./priv-validator-key-gen-darwin-arm64 + ./priv-validator-key-gen-darwin-amd64 # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish pre-release @@ -206,6 +218,12 @@ jobs: ./tmconnect-windows-arm64.exe ./tmkms-key-import-linux-amd64 ./tmkms-key-import-linux-arm64 + ./priv-validator-key-gen-linux-arm64 + ./priv-validator-key-gen-linux-amd64 + ./priv-validator-key-gen-windows-arm64 + ./priv-validator-key-gen-windows-amd64 + ./priv-validator-key-gen-darwin-arm64 + ./priv-validator-key-gen-darwin-amd64 # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 diff --git a/RELEASE.md b/RELEASE.md index 33dbe57b..de5be702 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ -Release: `undefined` +Release: `v0.0.5.0` Features: * Added version command to `tmconnect` diff --git a/priv-validator-key-gen/Makefile b/priv-validator-key-gen/Makefile index b80ad28b..975c36c8 100644 --- a/priv-validator-key-gen/Makefile +++ b/priv-validator-key-gen/Makefile @@ -3,3 +3,9 @@ install: go.sum start: go run main.go + +build: + ./scripts/build.sh + +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/priv-validator-key-gen/go.mod b/priv-validator-key-gen/go.mod index 05058072..c5ba9ea1 100644 --- a/priv-validator-key-gen/go.mod +++ b/priv-validator-key-gen/go.mod @@ -3,7 +3,9 @@ module github.com/KiraCore/tools/priv-validator-key-gen go 1.15 require ( - github.com/cosmos/cosmos-sdk v0.34.4-0.20200917134338-9cb27fb171aa - github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d - github.com/tendermint/tendermint v0.34.0 + github.com/cosmos/cosmos-sdk v0.45.0 + github.com/cosmos/go-bip39 v1.0.0 + github.com/tendermint/tendermint v0.34.16 ) + +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/priv-validator-key-gen/go.sum b/priv-validator-key-gen/go.sum index cb64fc0f..9071d556 100644 --- a/priv-validator-key-gen/go.sum +++ b/priv-validator-key-gen/go.sum @@ -1,3 +1,4 @@ +bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -5,57 +6,157 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/keyring v1.1.5/go.mod h1:7hsVvt2qXgtadGevGJ4ujg+u8m6SpJ5TpHqTozIPqf0= +filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI= +filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= +github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM= +github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU= +github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= +github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= +github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= +github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= +github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= +github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= +github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= +github.com/adlio/schema v1.2.3 h1:GfKThfEsjS9cCz7gaF8zdXv4cpTdUqdljkKGDTbJjys= +github.com/adlio/schema v1.2.3/go.mod h1:nD7ZWmMMbwU12Pqwg+qL0rTvHBrBXfNz+5UQxTfy38M= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.4/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= +github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= @@ -64,21 +165,49 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= +github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= +github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= +github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.2.1 h1:/EeEo2EtN3umhbbgCveyjifoMYg0pS+nMMEemaYw634= +github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -87,93 +216,181 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-sdk v0.34.4-0.20200917134338-9cb27fb171aa h1:pXHy1GFSsmMkpP4seUzzOy18AM04AbK42PXR+QOSSQ0= -github.com/cosmos/cosmos-sdk v0.34.4-0.20200917134338-9cb27fb171aa/go.mod h1:kO3VV10paWHqHnDJ8GteH2AKGAcv+Lpdy9+oWEKNUn4= -github.com/cosmos/cosmos-sdk v0.39.2 h1:nLfCJMkUuFt7ansi/YvCxwwxLFrgHCA3cYP4sJKYQdk= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= +github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= +github.com/cosmos/cosmos-sdk v0.45.0 h1:DHD+CIRZ+cYgiLXuTEUL/aprnfPsWSwaww/fIZEsZlk= +github.com/cosmos/cosmos-sdk v0.45.0/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/iavl v0.15.0-rc3/go.mod h1:rQ2zK/LuivThMjve3Yr6VkjvCqCXl+fgHCY7quiUA68= -github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= -github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= +github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= +github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= +github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= -github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= +github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= +github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b h1:HBah4D48ypg3J7Np4N+HY/ZR76fx3HEUGxDU6Uk39oQ= +github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= +github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= +github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= +github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -181,87 +398,177 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= +github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= -github.com/grpc-ecosystem/grpc-gateway v1.14.8/go.mod h1:NZE8t6vs6TnwLL/ITkaK8W3ecMLGAbh2jXTclvpiwYo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM= +github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg= +github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= +github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= +github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= +github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -271,100 +578,210 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= +github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= +github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.3/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA= +github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= +github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.0.3 h1:1hbqejyQWCJBvtKAfdO0b1FmaEf2z/bxnjqbARass5k= +github.com/opencontainers/runc v1.0.3/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= +github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= +github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= +github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -372,18 +789,22 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -398,146 +819,259 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.13.0 h1:vJlpe9wPgDRM1Z+7Wj3zUUjY1nr6/1jNKyl7llliccg= -github.com/prometheus/common v0.13.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.0/go.mod h1:zuP2jVPHab6+IIyOx3nXHFN+euFNeS3W8XQkcdd4s7A= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= +github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.23.0 h1:UskrK+saS9P9Y789yNNulYKdARjPZuS35B8gJF2x60g= +github.com/rs/zerolog v1.23.0/go.mod h1:6c7hFfxPOy7TacJc4Fcdi24/J0NKYGzjG8FWRI916Qo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= +github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= +github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= +github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.0-rc3/go.mod h1:BoHcEpjfpBHc1Be7RQz3AHaXFNObcDG7SNHCev6Or4g= -github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84 h1:BI/EhLLh6SAlOtMaHePo8BNFLsNRiFNCtJ8cMBX+OE8= -github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84/go.mod h1:ZgOz3PoriH5yHRJmUmhDTVX8ps4+hzFvhmDq6MDUHxU= -github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= -github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= -github.com/tendermint/tendermint v0.34.0 h1:eXCfMgoqVSzrjzOj6clI9GAejcHH0LvOlRjpCmMJksU= -github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= -github.com/tendermint/tm-db v0.6.1/go.mod h1:m3x9kRP4UFd7JODJL0yBAZqE7wTw+S37uAE90cTx7OA= -github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= -github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= +github.com/tendermint/tendermint v0.34.16 h1:J2h7SwKWEv/cPuby2gjFhY00L2nLCoJOVFZvDbVeA8Q= +github.com/tendermint/tendermint v0.34.16/go.mod h1:n0G22GynfeXTYbrn2IeLeB+oqsAe6R6jl4vZxZ1Y8F4= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= +github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= +github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg= +github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= +github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 h1:3erb+vDS8lU1sxfDHF4/hhWyaXnhIaO+7RgL4fDZORA= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -547,16 +1081,30 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -572,26 +1120,76 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b h1:MWaHNqZy3KTpuTMAGvv+Kw+ylsEpmyJZizz1dqxnu28= +golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -603,51 +1201,118 @@ golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed h1:J22ig1FUekjjkmZUM7pTKixYm8DvrYsvrBZdunYeIuQ= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -660,28 +1325,108 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -693,13 +1438,66 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6 h1:iRN4+t0lvZX/l9gH14ARF9i58tsVa5a97k6aH95rC3Y= -google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -713,14 +1511,31 @@ google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -730,21 +1545,33 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -754,13 +1581,27 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= +nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/priv-validator-key-gen/main.go b/priv-validator-key-gen/main.go index 5a16a5a8..28366d88 100644 --- a/priv-validator-key-gen/main.go +++ b/priv-validator-key-gen/main.go @@ -12,13 +12,24 @@ import ( "github.com/tendermint/tendermint/privval" ) +const PrivValidatorKeyGenVersion = "v0.0.1.0" + func main() { mnemonic := flag.String("mnemonic", "", "a string") valkey := flag.String("valkey", "", "a string") nodekey := flag.String("nodekey", "", "a string") keyid := flag.String("keyid", "", "a string") + + var version bool + flag.BoolVar(&version, "version", false, "prints current version and exits") + flag.Parse() + if version { + fmt.Print(PrivValidatorKeyGenVersion) + return + } + if len(*mnemonic) == 0 { fmt.Println("mnemonic not set!") return diff --git a/priv-validator-key-gen/nfpm.yaml b/priv-validator-key-gen/nfpm.yaml new file mode 100644 index 00000000..17a8873c --- /dev/null +++ b/priv-validator-key-gen/nfpm.yaml @@ -0,0 +1,17 @@ +name: "priv-validator-key-gen" +arch: "${ARCH}" +platform: "${PLATFORM}" +version: "${VERSION}" +section: "default" +priority: "extra" +replaces: +- priv-validator-key-gen +provides: +- priv-validator-key-gen +maintainer: "KIRA " +description: "PRIV-VALIDATOR-KEY-GEN is KIRA a tool enabling generation of the validator keys from mnemonic" +homepage: "https://github.com/KiraCore/tools" +license: "AGPL-3.0 license" +contents: +- src: ${SOURCE} + dst: ./bin/ diff --git a/priv-validator-key-gen/scripts/build.sh b/priv-validator-key-gen/scripts/build.sh new file mode 100644 index 00000000..07b14280 --- /dev/null +++ b/priv-validator-key-gen/scripts/build.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile +. ../bash-utils/utils.sh + +LOCAL_PLATFORM=$(toLower $(uname)) +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +LOCAL_OUT="${GOBIN}/priv-validator-key-gen" + +PLATFORM="$1" && [ -z "$PLATFORM" ] && PLATFORM="$LOCAL_PLATFORM" +ARCH="$2" && [ -z "$ARCH" ] && ARCH="$LOCAL_ARCH" +OUTPUT="$3" && [ -z "$OUTPUT" ] && OUTPUT="$LOCAL_OUT" + +CONSTANS_FILE=./main.go +VERSION=$(grep -Fn -m 1 'PrivValidatorKeyGenVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: PrivValidatorKeyGenVersion was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old priv-validator-key-gen binary" + +go mod tidy +GO111MODULE=on go mod verify +env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ + +( [ "$PLATFORM" == "$LOCAL_PLATFORM" ] && [ "$ARCH" == "$LOCAL_ARCH" ] && [ -f $OUTPUT ] ) && \ + echoInfo "INFO: Sucessfully built priv-validator-key-gen $($OUTPUT --version)" || echoInfo "INFO: Sucessfully built priv-validator-key-gen to '$OUTPUT'" + diff --git a/priv-validator-key-gen/scripts/publish.sh b/priv-validator-key-gen/scripts/publish.sh new file mode 100644 index 00000000..34a85289 --- /dev/null +++ b/priv-validator-key-gen/scripts/publish.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile +. ../bash-utils/utils.sh + +go mod tidy +GO111MODULE=on go mod verify + +PKG_CONFIG_FILE=./nfpm.yaml + +function pcgConfigure() { + local ARCH="$1" + local VERSION="$2" + local PLATFORM="$3" + local SOURCE="$4" + local CONFIG="$5" + SOURCE=${SOURCE//"/"/"\/"} + sed -i"" "s/\${ARCH}/$ARCH/" $CONFIG + sed -i"" "s/\${VERSION}/$VERSION/" $CONFIG + sed -i"" "s/\${PLATFORM}/$PLATFORM/" $CONFIG + sed -i"" "s/\${SOURCE}/$SOURCE/" $CONFIG +} + +BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") +( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" + +CONSTANS_FILE=./main.go +VERSION=$(grep -Fn -m 1 'PrivValidatorKeyGenVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: PrivValidatorKeyGenVersion was NOT found in '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +function pcgRelease() { + local ARCH="$1" && ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]' ) + local VERSION="$2" && VERSION=$(echo "$VERSION" | tr '[:upper:]' '[:lower:]' ) + local PLATFORM="$3" && PLATFORM=$(echo "$PLATFORM" | tr '[:upper:]' '[:lower:]' ) + + local BIN_PATH=./bin/$ARCH/$PLATFORM + local RELEASE_DIR=./bin/deb/$PLATFORM + + mkdir -p $BIN_PATH $RELEASE_DIR + + echoInfo "INFO: Building $ARCH package for $PLATFORM..." + + TMP_PKG_CONFIG_FILE=./nfpm_${ARCH}_${PLATFORM}.yaml + rm -rfv $TMP_PKG_CONFIG_FILE && cp -v $PKG_CONFIG_FILE $TMP_PKG_CONFIG_FILE + + if [ "$PLATFORM" != "windows" ] ; then + local RELEASE_PATH="${RELEASE_DIR}/priv-validator-key-gen_${VERSION}_${ARCH}.deb" + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/priv-validator-key-gen" + pcgConfigure "$ARCH" "$VERSION" "$PLATFORM" "$BIN_PATH" $TMP_PKG_CONFIG_FILE + nfpm pkg --packager deb --target "$RELEASE_PATH" -f $TMP_PKG_CONFIG_FILE + cp -fv "$RELEASE_PATH" ./bin/priv-validator-key-gen-${PLATFORM}-${ARCH}.deb + else + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/priv-validator-key-gen.exe" + # deb is not supported on windows, simply copy the executables + cp -fv $BIN_PATH/priv-validator-key-gen.exe ./bin/priv-validator-key-gen-${PLATFORM}-${ARCH}.exe + fi +} + +rm -rfv ./bin + +# NOTE: To see available build architectures, run: go tool dist list +pcgRelease "amd64" "$VERSION" "linux" +pcgRelease "amd64" "$VERSION" "darwin" +pcgRelease "amd64" "$VERSION" "windows" +pcgRelease "arm64" "$VERSION" "linux" +pcgRelease "arm64" "$VERSION" "darwin" +pcgRelease "arm64" "$VERSION" "windows" + +rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb +echoInfo "INFO: Sucessfully published priv-validator-key-gen deb packages into ./bin" diff --git a/scripts/build.sh b/scripts/build.sh index 5099c9cc..5fed38ad 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,35 +4,18 @@ set -x . /etc/profile . ./bash-utils/utils.sh -echoInfo "INFO: KIRA utils, latest version $(utilsVersion)" +WORKDIR=$PWD -[ -z "$SOURCE_BRANCH" ] && BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") || BRANCH=$SOURCE_BRANCH +echoInfo "INFO: KIRA utils, latest version $(utilsVersion)" -# check if banch is a version branch -# TODO: add isVersion func to utils -if ($(isVersion "$BRANCH")) ; then - echoInfo "INFO: Branch '$BRANCH' is versioned, release file be updated..." - VERSION=$BRANCH - RELEASE_FILE=./RELEASE.md - RELEASE_VERSION=$(grep -Fn -m 1 'Release: ' $RELEASE_FILE | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') - RELEASE_LINE_NR=$(getFirstLineByPrefix "Release:" $RELEASE_FILE) +# Build `tmconnect` +cd ./tmconnect +make build +cd $WORKDIR - # If release file is not present or release version is NOT defined then create RELEASE.md or append the Release version - if ($(isNullOrEmpty "$RELEASE_VERSION")) || [ ! -f $RELEASE_FILE ] || [ $RELEASE_LINE_NR -le 0 ] ; then - touch $RELEASE_FILE - echo -e "\n\rRelease: \`$VERSION\`" >> $RELEASE_FILE - # Otherwsie replace release with the number defined by the constants file - else - RELEASE_LINE_NR=$(getFirstLineByPrefix "Release:" $RELEASE_FILE) - setLineByNumber $RELEASE_LINE_NR "Release: \`$VERSION\`" $RELEASE_FILE - fi +cd ./priv-validator-key-gen +make build +cd $WORKDIR - RELEASE_VERSION=$(grep -Fn -m 1 'Release: ' $RELEASE_FILE | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') - [ "${RELEASE_VERSION}" != "$VERSION" ] && echoErr "ERROR: Failed to update release file" && exit 1 -else - echoWarn "WARNING: Branch '$BRANCH' is not versioned, release file will NOT be updated" -fi -# Build `tmconnect` -cd ./tmconnect -make build \ No newline at end of file +echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), priv-validator-key-gen $(priv-validator-key-gen --version)" \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 736fa8ab..3544ff6d 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -22,9 +22,18 @@ cd ./tmkms-key-import make publish cd $WORKDIR +# Publish priv-validator-key-gen +cd ./priv-validator-key-gen +make publish +cd $WORKDIR + # Copy all binaries to bin directory mkdir -p ./bin + cp -rfv ./tmconnect/bin/* ./bin cp -rfv ./tmkms-key-import/bin/* ./bin +cp -rfv ./priv-validator-key-gen/bin/* ./bin + rm -rfv ./tmconnect/bin/* -rm -rfv ./tmkms-key-import/bin/* \ No newline at end of file +rm -rfv ./tmkms-key-import/bin/* +rm -rfv ./priv-validator-key-gen/bin/* \ No newline at end of file diff --git a/tmconnect/scripts/build.sh b/tmconnect/scripts/build.sh index a79705f8..40c30480 100644 --- a/tmconnect/scripts/build.sh +++ b/tmconnect/scripts/build.sh @@ -4,7 +4,7 @@ set -x . /etc/profile . ../bash-utils/utils.sh -LOCAL_PLATFORM="$(uname)" && LOCAL_PLATFORM="$(echo "$LOCAL_PLATFORM" | tr '[:upper:]' '[:lower:]' )" +LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") LOCAL_OUT="${GOBIN}/tmconnect" diff --git a/tmconnect/scripts/publish.sh b/tmconnect/scripts/publish.sh index 416eb313..c511cb29 100644 --- a/tmconnect/scripts/publish.sh +++ b/tmconnect/scripts/publish.sh @@ -68,4 +68,4 @@ pcgRelease "arm64" "$VERSION" "darwin" pcgRelease "arm64" "$VERSION" "windows" rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb -echoInfo "INFO: Sucessfully published SEKAI deb packages into ./bin" +echoInfo "INFO: Sucessfully published tmconnect deb packages into ./bin" From 8b06b5b1479d67ab2003fe0546a6a530e3187ec9 Mon Sep 17 00:00:00 2001 From: asmodat Date: Fri, 18 Mar 2022 12:19:38 +0000 Subject: [PATCH 011/140] update base image --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 164eb0c7..601b6b1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: pull-requests: write needs: [setup] container: - image: ghcr.io/kiracore/docker/base-image:v0.0.3.0 + image: ghcr.io/kiracore/docker/base-image:v0.0.4.0 steps: - name: Extract branch name on push if: github.event_name == 'push' From bc2b314fdc6971dc77d4a76401a554a1662de99f Mon Sep 17 00:00:00 2001 From: asmodat Date: Fri, 18 Mar 2022 15:08:53 +0000 Subject: [PATCH 012/140] priv validator key gen rename to validator key gen --- .github/workflows/main.yml | 54 +++++++++---------- priv-validator-key-gen/README.md | 20 ------- scripts/build.sh | 4 +- scripts/publish.sh | 8 +-- .../Makefile | 0 validator-key-gen/README.md | 20 +++++++ .../go.mod | 2 +- .../go.sum | 0 .../main.go | 0 .../nfpm.yaml | 8 +-- .../scripts/build.sh | 6 +-- .../scripts/publish.sh | 12 ++--- 12 files changed, 67 insertions(+), 67 deletions(-) delete mode 100644 priv-validator-key-gen/README.md rename {priv-validator-key-gen => validator-key-gen}/Makefile (100%) create mode 100644 validator-key-gen/README.md rename {priv-validator-key-gen => validator-key-gen}/go.mod (80%) rename {priv-validator-key-gen => validator-key-gen}/go.sum (100%) rename {priv-validator-key-gen => validator-key-gen}/main.go (100%) rename {priv-validator-key-gen => validator-key-gen}/nfpm.yaml (59%) rename {priv-validator-key-gen => validator-key-gen}/scripts/build.sh (76%) rename {priv-validator-key-gen => validator-key-gen}/scripts/publish.sh (80%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 601b6b1e..b3e5f6dd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,7 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./priv-validator-key-gen/scripts + chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts chmod -Rv 555 ./bash-utils chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} @@ -92,20 +92,20 @@ jobs: cp -fv ./RELEASE.md ./bin/RELEASE.md chmod -Rv 777 ./bin echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " priv-validator-key-gen-linux-arm64: sha256:$(sha256sum ./bin/priv-validator-key-gen-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " priv-validator-key-gen-linux-amd64: sha256:$(sha256sum ./bin/priv-validator-key-gen-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "priv-validator-key-gen-windows-arm64: sha256:$(sha256sum ./bin/priv-validator-key-gen-windows-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "priv-validator-key-gen-windows-amd64: sha256:$(sha256sum ./bin/priv-validator-key-gen-windows-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " priv-validator-key-gen-darwin-arm64: sha256:$(sha256sum ./bin/priv-validator-key-gen-darwin-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " priv-validator-key-gen-darwin-amd64: sha256:$(sha256sum ./bin/priv-validator-key-gen-darwin-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . - name: Uploading artifacts @@ -189,12 +189,12 @@ jobs: ./tmconnect-windows-arm64.exe ./tmkms-key-import-linux-amd64 ./tmkms-key-import-linux-arm64 - ./priv-validator-key-gen-linux-arm64 - ./priv-validator-key-gen-linux-amd64 - ./priv-validator-key-gen-windows-arm64 - ./priv-validator-key-gen-windows-amd64 - ./priv-validator-key-gen-darwin-arm64 - ./priv-validator-key-gen-darwin-amd64 + ./validator-key-gen-linux-arm64.deb + ./validator-key-gen-linux-amd64.deb + ./validator-key-gen-windows-arm64.exe + ./validator-key-gen-windows-amd64.exe + ./validator-key-gen-darwin-arm64.deb + ./validator-key-gen-darwin-amd64.deb # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish pre-release @@ -218,12 +218,12 @@ jobs: ./tmconnect-windows-arm64.exe ./tmkms-key-import-linux-amd64 ./tmkms-key-import-linux-arm64 - ./priv-validator-key-gen-linux-arm64 - ./priv-validator-key-gen-linux-amd64 - ./priv-validator-key-gen-windows-arm64 - ./priv-validator-key-gen-windows-amd64 - ./priv-validator-key-gen-darwin-arm64 - ./priv-validator-key-gen-darwin-amd64 + ./validator-key-gen-linux-arm64.deb + ./validator-key-gen-linux-amd64.deb + ./validator-key-gen-windows-arm64.exe + ./validator-key-gen-windows-amd64.exe + ./validator-key-gen-darwin-arm64.deb + ./validator-key-gen-darwin-amd64.deb # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 diff --git a/priv-validator-key-gen/README.md b/priv-validator-key-gen/README.md deleted file mode 100644 index fa4e5c48..00000000 --- a/priv-validator-key-gen/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Private Validator Key Generator - -## Install - -```bash -go build -make install -ln -s ./priv-validator-key-gen /bin/priv-validator-key-gen -``` - -## How to use - -```bash -priv-validator-key-gen --mnemonic="mnemonic here" --valkey="private validator key path here" --nodekey="node key path here" --keyid="node id path here" -``` - -E.g. -```bash -priv-validator-key-gen --mnemonic="swap exercise equip shoot mad inside floor wheel loan visual stereo build frozen always bulb naive subway foster marine erosion shuffle flee action there" --valkey=./priv_validator_key.json --nodekey=./node_key.json --keyid=./node_id.key -``` diff --git a/scripts/build.sh b/scripts/build.sh index 5fed38ad..37ed4f3d 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -13,9 +13,9 @@ cd ./tmconnect make build cd $WORKDIR -cd ./priv-validator-key-gen +cd ./validator-key-gen make build cd $WORKDIR -echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), priv-validator-key-gen $(priv-validator-key-gen --version)" \ No newline at end of file +echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), validator-key-gen $(validator-key-gen --version)" \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 3544ff6d..3172b734 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -22,8 +22,8 @@ cd ./tmkms-key-import make publish cd $WORKDIR -# Publish priv-validator-key-gen -cd ./priv-validator-key-gen +# Publish validator-key-gen +cd ./validator-key-gen make publish cd $WORKDIR @@ -32,8 +32,8 @@ mkdir -p ./bin cp -rfv ./tmconnect/bin/* ./bin cp -rfv ./tmkms-key-import/bin/* ./bin -cp -rfv ./priv-validator-key-gen/bin/* ./bin +cp -rfv ./validator-key-gen/bin/* ./bin rm -rfv ./tmconnect/bin/* rm -rfv ./tmkms-key-import/bin/* -rm -rfv ./priv-validator-key-gen/bin/* \ No newline at end of file +rm -rfv ./validator-key-gen/bin/* \ No newline at end of file diff --git a/priv-validator-key-gen/Makefile b/validator-key-gen/Makefile similarity index 100% rename from priv-validator-key-gen/Makefile rename to validator-key-gen/Makefile diff --git a/validator-key-gen/README.md b/validator-key-gen/README.md new file mode 100644 index 00000000..8fa380ab --- /dev/null +++ b/validator-key-gen/README.md @@ -0,0 +1,20 @@ +# Private Validator Key Generator + +## Install + +```bash +go build +make install +ln -s ./validator-key-gen /bin/validator-key-gen +``` + +## How to use + +```bash +validator-key-gen --mnemonic="mnemonic here" --valkey="private validator key path here" --nodekey="node key path here" --keyid="node id path here" +``` + +E.g. +```bash +validator-key-gen --mnemonic="swap exercise equip shoot mad inside floor wheel loan visual stereo build frozen always bulb naive subway foster marine erosion shuffle flee action there" --valkey=./priv_validator_key.json --nodekey=./node_key.json --keyid=./node_id.key +``` diff --git a/priv-validator-key-gen/go.mod b/validator-key-gen/go.mod similarity index 80% rename from priv-validator-key-gen/go.mod rename to validator-key-gen/go.mod index c5ba9ea1..e64a892b 100644 --- a/priv-validator-key-gen/go.mod +++ b/validator-key-gen/go.mod @@ -1,4 +1,4 @@ -module github.com/KiraCore/tools/priv-validator-key-gen +module github.com/KiraCore/tools/validator-key-gen go 1.15 diff --git a/priv-validator-key-gen/go.sum b/validator-key-gen/go.sum similarity index 100% rename from priv-validator-key-gen/go.sum rename to validator-key-gen/go.sum diff --git a/priv-validator-key-gen/main.go b/validator-key-gen/main.go similarity index 100% rename from priv-validator-key-gen/main.go rename to validator-key-gen/main.go diff --git a/priv-validator-key-gen/nfpm.yaml b/validator-key-gen/nfpm.yaml similarity index 59% rename from priv-validator-key-gen/nfpm.yaml rename to validator-key-gen/nfpm.yaml index 17a8873c..1e9ac9d4 100644 --- a/priv-validator-key-gen/nfpm.yaml +++ b/validator-key-gen/nfpm.yaml @@ -1,15 +1,15 @@ -name: "priv-validator-key-gen" +name: "validator-key-gen" arch: "${ARCH}" platform: "${PLATFORM}" version: "${VERSION}" section: "default" priority: "extra" replaces: -- priv-validator-key-gen +- validator-key-gen provides: -- priv-validator-key-gen +- validator-key-gen maintainer: "KIRA " -description: "PRIV-VALIDATOR-KEY-GEN is KIRA a tool enabling generation of the validator keys from mnemonic" +description: "VALIDATOR-KEY-GEN is KIRA a tool enabling generation of the validator keys from mnemonic" homepage: "https://github.com/KiraCore/tools" license: "AGPL-3.0 license" contents: diff --git a/priv-validator-key-gen/scripts/build.sh b/validator-key-gen/scripts/build.sh similarity index 76% rename from priv-validator-key-gen/scripts/build.sh rename to validator-key-gen/scripts/build.sh index 07b14280..af0a9e17 100644 --- a/priv-validator-key-gen/scripts/build.sh +++ b/validator-key-gen/scripts/build.sh @@ -6,7 +6,7 @@ set -x LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") -LOCAL_OUT="${GOBIN}/priv-validator-key-gen" +LOCAL_OUT="${GOBIN}/validator-key-gen" PLATFORM="$1" && [ -z "$PLATFORM" ] && PLATFORM="$LOCAL_PLATFORM" ARCH="$2" && [ -z "$ARCH" ] && ARCH="$LOCAL_ARCH" @@ -16,12 +16,12 @@ CONSTANS_FILE=./main.go VERSION=$(grep -Fn -m 1 'PrivValidatorKeyGenVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') ($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: PrivValidatorKeyGenVersion was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) -rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old priv-validator-key-gen binary" +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old validator-key-gen binary" go mod tidy GO111MODULE=on go mod verify env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ ( [ "$PLATFORM" == "$LOCAL_PLATFORM" ] && [ "$ARCH" == "$LOCAL_ARCH" ] && [ -f $OUTPUT ] ) && \ - echoInfo "INFO: Sucessfully built priv-validator-key-gen $($OUTPUT --version)" || echoInfo "INFO: Sucessfully built priv-validator-key-gen to '$OUTPUT'" + echoInfo "INFO: Sucessfully built validator-key-gen $($OUTPUT --version)" || echoInfo "INFO: Sucessfully built validator-key-gen to '$OUTPUT'" diff --git a/priv-validator-key-gen/scripts/publish.sh b/validator-key-gen/scripts/publish.sh similarity index 80% rename from priv-validator-key-gen/scripts/publish.sh rename to validator-key-gen/scripts/publish.sh index 34a85289..d4d9f50c 100644 --- a/priv-validator-key-gen/scripts/publish.sh +++ b/validator-key-gen/scripts/publish.sh @@ -45,15 +45,15 @@ function pcgRelease() { rm -rfv $TMP_PKG_CONFIG_FILE && cp -v $PKG_CONFIG_FILE $TMP_PKG_CONFIG_FILE if [ "$PLATFORM" != "windows" ] ; then - local RELEASE_PATH="${RELEASE_DIR}/priv-validator-key-gen_${VERSION}_${ARCH}.deb" - ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/priv-validator-key-gen" + local RELEASE_PATH="${RELEASE_DIR}/validator-key-gen_${VERSION}_${ARCH}.deb" + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/validator-key-gen" pcgConfigure "$ARCH" "$VERSION" "$PLATFORM" "$BIN_PATH" $TMP_PKG_CONFIG_FILE nfpm pkg --packager deb --target "$RELEASE_PATH" -f $TMP_PKG_CONFIG_FILE - cp -fv "$RELEASE_PATH" ./bin/priv-validator-key-gen-${PLATFORM}-${ARCH}.deb + cp -fv "$RELEASE_PATH" ./bin/validator-key-gen-${PLATFORM}-${ARCH}.deb else - ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/priv-validator-key-gen.exe" + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/validator-key-gen.exe" # deb is not supported on windows, simply copy the executables - cp -fv $BIN_PATH/priv-validator-key-gen.exe ./bin/priv-validator-key-gen-${PLATFORM}-${ARCH}.exe + cp -fv $BIN_PATH/validator-key-gen.exe ./bin/validator-key-gen-${PLATFORM}-${ARCH}.exe fi } @@ -68,4 +68,4 @@ pcgRelease "arm64" "$VERSION" "darwin" pcgRelease "arm64" "$VERSION" "windows" rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb -echoInfo "INFO: Sucessfully published priv-validator-key-gen deb packages into ./bin" +echoInfo "INFO: Sucessfully published validator-key-gen deb packages into ./bin" From 4c721f514fa46846fd2818f85d5e39e7b3c4b5dd Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 06:36:38 +0000 Subject: [PATCH 013/140] safeWget --- .github/workflows/branch.yml | 16 ++++++++++++++-- .github/workflows/main.yml | 16 ++++++++-------- RELEASE.md | 6 +++--- bash-utils/utils.sh | 20 +++++++++++++++++++- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 1dac20a2..7ab84059 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -22,9 +22,11 @@ jobs: - name: Extract branch name on pull request shell: bash run: | - echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV + RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" + echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV + git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | echo "Source branch: ${{ env.SOURCE_BRANCH }}" @@ -35,9 +37,19 @@ jobs: # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + if: env.TARGET_BRANCH_EXISTS == 'true' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} + - name: Create PR from feature to version branch + if: env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 + with: + github_token: ${{ secrets.REPO_ACCESS }} + source_branch: ${{ env.SOURCE_BRANCH }} + destination_branch: ${{ env.RELEASE_VER}} + pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ env.RELEASE_VER }}" + pr_label: "kira-automation" + pr_allow_empty: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3e5f6dd..d6572389 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,14 +92,14 @@ jobs: cp -fv ./RELEASE.md ./bin/RELEASE.md chmod -Rv 777 ./bin echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md diff --git a/RELEASE.md b/RELEASE.md index de5be702..03966add 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ -Release: `v0.0.5.0` +Release: `v0.0.6.0` Features: -* Added version command to `tmconnect` -* Build packages for `tmconnect` \ No newline at end of file +* Added `safeWget` +* Added auto PR to version branch workflow \ No newline at end of file diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index 9662a10a..385161c0 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -12,7 +12,7 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" function utilsVersion() { - echo "v0.0.16" + echo "v0.0.17" } # bash 3 (MAC) compatybility @@ -180,6 +180,24 @@ function md5() { fi } +function safeWget() { + local OUT_PATH=$1 + local FILE_URL=$2 + local EXPECTED_HASH=$3 + rm -fv $OUT_PATH + + wget "$FILE_URL" -O $OUT_PATH + FILE_HASH=$(sha256 $OUT_PATH) + if [ "$FILE_HASH" != "$EXPECTED_HASH" ]; then + rm -fv $OUT_PATH || echoErr "ERROR: Failed to delete '$OUT_PATH'" + echoErr "ERROR: Safe download filed: '$FILE_URL' -x-> '$OUT_PATH'" + echoErr "ERROR: Expected hash: '$EXPECTED_HASH', but got '$FILE_HASH'" + return 1 + else + echoInfo "INFO: Safe download suceeded: '$FILE_URL' ---> '$OUT_PATH'" + fi +} + function tryMkDir { for kg_var in "$@" ; do kg_var=$(echo "$kg_var" | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") From 3429008f56660ff016c5362926a94f69908d25f5 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 18:54:52 +0000 Subject: [PATCH 014/140] first independent kira utils release --- .github/workflows/main.yml | 10 +++- DEVME.md | 18 +++--- Makefile | 3 + RELEASE.md | 2 +- bash-utils/Makefile | 3 + bash-utils/install.sh | 56 ------------------- bash-utils/scripts/test.sh | 46 ++++++++++++++++ bash-utils/utils.sh | 109 +++++++++++++++++++++++++++++++++++-- scripts/publish.sh | 1 + scripts/test.sh | 16 ++++++ 10 files changed, 189 insertions(+), 75 deletions(-) create mode 100644 bash-utils/Makefile delete mode 100644 bash-utils/install.sh create mode 100644 bash-utils/scripts/test.sh create mode 100644 scripts/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6572389..66dc738f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,7 +33,7 @@ jobs: name: tools-src path: ./src.tar.gz build: - name: Repo Build + name: Repo Test & Build runs-on: ubuntu-20.04 permissions: contents: read @@ -73,15 +73,16 @@ jobs: uses: actions/download-artifact@v3.0.0 with: name: tools-src - - name: Building TOOLS + - name: Testing & Building TOOLS run: | echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts + chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts chmod -Rv 555 ./bash-utils chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} + make test make build tmconnect version - name: Publishing TOOLS binaries @@ -106,6 +107,7 @@ jobs: echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " kira-utils.sh: sha256:$(sha256sum ./bin/kira-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . - name: Uploading artifacts @@ -195,6 +197,7 @@ jobs: ./validator-key-gen-windows-amd64.exe ./validator-key-gen-darwin-arm64.deb ./validator-key-gen-darwin-amd64.deb + ./kira-utils.sh # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish pre-release @@ -224,6 +227,7 @@ jobs: ./validator-key-gen-windows-amd64.exe ./validator-key-gen-darwin-arm64.deb ./validator-key-gen-darwin-amd64.deb + ./kira-utils.sh # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 diff --git a/DEVME.md b/DEVME.md index 3d628550..a3c2c659 100644 --- a/DEVME.md +++ b/DEVME.md @@ -4,17 +4,13 @@ KIRA Tools ## Dependencies ``` -UTILS_VER=$(utilsVersion 2> /dev/null || echo "") - -# Installing utils is essential to simplify the setup steps -if [[ $(versionToNumber "$UTILS_VER" || echo "0") -lt $(versionToNumber "v0.0.15" || echo "1") ]] ; then - echo "INFO: KIRA utils were NOT installed on the system, setting up..." && sleep 2 - KIRA_UTILS_BRANCH="v0.0.3" && cd /tmp && rm -fv ./i.sh && \ - wget https://raw.githubusercontent.com/KiraCore/tools/$KIRA_UTILS_BRANCH/bash-utils/install.sh -O ./i.sh && \ - chmod 777 ./i.sh && ./i.sh "$KIRA_UTILS_BRANCH" "/var/kiraglob" && . /etc/profile && loadGlobEnvs -else - echoInfo "INFO: KIRA utils are up to date, latest version $UTILS_VER" -fi +VERSION="v0.0.6.0" && cd /tmp && rm -fv ./kira-utils.sh && \ +CHECKSUM="7bdf4da2165fa1828f399622594af68e83e764ba1ddeb472094d882d85dcdd71" && \ +wget https://github.com/KiraCore/tools/releases/download/$VERSION/kira-utils.sh && \ + FILE_HASH=$(sha256sum $1 | awk '{ print $1 }' | xargs || echo -n "") && \ + [ "$FILE_HASH" == "$CHECKSUM" ] && . ./utils.sh utilsSetup "/usr/local/bin" "/var/kiraglob" && \ + loadGlobEnvs && echoInfo "SUCCESS: kira-utils $(utilsVersion) were installed!" || \ + echo "ERROR: Invalid checksum '$FILE_HASH' or utilsSetup failed" ``` ## Build diff --git a/Makefile b/Makefile index 677de9ba..f30414b3 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +build: + ./scripts/test.sh + build: ./scripts/build.sh diff --git a/RELEASE.md b/RELEASE.md index 03966add..61d34e47 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Release: `v0.0.6.0` Features: -* Added `safeWget` +* Added `safeWget`,`getCpuCores`, `getCpuCores`, `getRamTotal`, `getArch`, `crossenvLink` * Added auto PR to version branch workflow \ No newline at end of file diff --git a/bash-utils/Makefile b/bash-utils/Makefile new file mode 100644 index 00000000..dbaf69a1 --- /dev/null +++ b/bash-utils/Makefile @@ -0,0 +1,3 @@ +test: + ./scripts/test.sh + \ No newline at end of file diff --git a/bash-utils/install.sh b/bash-utils/install.sh deleted file mode 100644 index 661b310c..00000000 --- a/bash-utils/install.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -set -e -touch /etc/profile -chmod 777 /etc/profile -. /etc/profile - -[ ! -z "$1" ] && KIRA_TOOLS_BRANCH="$1" -[ ! -z "$2" ] && KIRA_GLOBS_DIR="$2" -[ -z "$KIRA_TOOLS_BRANCH" ] && KIRA_TOOLS_BRANCH="main" -[ -z "$KIRA_GLOBS_DIR" ] && KIRA_GLOBS_DIR="/var/kiraglob" -[ -z "$KIRA_TOOLS_SRC" ] && KIRA_TOOLS_SRC="/usr/local/bin/kira-utils.sh" - -echo "INFO: Installing KIRA utils... " -echo "INFO: Default tools branch: $KIRA_TOOLS_BRANCH" -echo "INFO: Default glob store: $KIRA_GLOBS_DIR" -echo "INFO: Default utils src: $KIRA_TOOLS_SRC" -sleep 2 - -mkdir -p "$KIRA_GLOBS_DIR" - -cd /tmp -rm -fvr ./tools -rm -fv $KIRA_TOOLS_SRC - -git clone https://github.com/KiraCore/tools.git -b $KIRA_TOOLS_BRANCH -cd ./tools/bash-utils - -mv -fv ./utils.sh $KIRA_TOOLS_SRC - -. $KIRA_TOOLS_SRC - -SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" -USERNAME="${USER}" && [ "$USERNAME" == "root" ] && USERNAME="" -LOGNAME=$(logname 2> /dev/null echo "") && [ "$LOGNAME" == "root" ] && LOGNAME="" - -TARGET="/$LOGNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" -TARGET="/$USERNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" -TARGET="/$SUDOUSER/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" -TARGET="/root/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" -TARGET=~/.bashrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" -TARGET=~/.zshrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" -TARGET=~/.profile && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - -setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" -setGlobEnv KIRA_TOOLS_BRANCH "$KIRA_TOOLS_BRANCH" -setGlobEnv KIRA_TOOLS_SRC "$KIRA_TOOLS_SRC" - -AUTOLOAD_SET=$(getLastLineByPrefix "source $KIRA_TOOLS_SRC" /etc/profile 2> /dev/null || echo "-1") - -if [[ $AUTOLOAD_SET -lt 0 ]] ; then - echo "source $KIRA_TOOLS_SRC || echo \"ERROR: Failed to load kira utils from $KIRA_TOOLS_SRC\"" >> /etc/profile -fi - -loadGlobEnvs - -echoInfo "INFO: SUCCESS!, Installed kira bash-utils $(utilsVersion)" \ No newline at end of file diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh new file mode 100644 index 00000000..094cb661 --- /dev/null +++ b/bash-utils/scripts/test.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -e +set -x +. ./utils.sh + +timerStart +echoInfo "INFO: Starting bash-utils $(utilsVersion) testing..." + +sleep 2 + +if [[ $(timerSpan) -lt 2 ]] ; then + echoErr "ERROR: Failed testing timeStar, timeSpan, expected at least 2 seconds to elapse, but got '$(timerSpan)'" + exit 1 +elif [[ $(timerSpan) -gt 10 ]] ; then + echoErr "ERROR: Failed testing timeSpan, expected less then 10 seconds to elapse, but got '$(timerSpan)'" + exit 1 +fi + +timerPause +TMP_TIMER_SPAN=$(timerSpan) + +globDel UTILS_TESTS +globSet UTILS_TESTS "test" + +if [ "$(globGet utils_tests)" != "test" ] ; then + echoErr "ERROR: Failed testing globSet, globDel, globGet" + exit 1 +fi + +sleep 1 + +if [[ $(timerSpan) -ne $TMP_TIMER_SPAN ]] ; then + echoErr "ERROR: Failed testing timerPause, timerSpan, expected timer span to NOT change, got '$(timerSpan)', expected '$TMP_TIMER_SPAN'" + exit 1 +fi + +timerUnpause + +sleep 1 + +if [[ $(timerSpan) -lt 3 ]] ; then + echoErr "ERROR: Failed testing timerUnpause, timerSpan, expected at least 3 seconds to elapse, but got '$(timerSpan)'" + exit 1 +fi + +echoInfo "INFO: Successsfully executed all kira-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index 385161c0..19d21cad 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -12,7 +12,57 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" function utilsVersion() { - echo "v0.0.17" + echo "v0.0.18" +} + +# this is default installation script for utils +# . ./utils.sh && utilsSetup "/usr/local/bin" "/var/kiraglob" +function utilsSetup() { + local UTILS_DEST="$1" + local GLOBS_DIR="$2" + local UTILS_SOURCE="${BASH_SOURCE}" + + echoInfo "INFO: Starting utils setup from '$UTILS_SOURCE'" + + [ -z "$GLOBS_DIR" ] && KIRA_GLOBS_DIR="/var/kiraglob" || KIRA_GLOBS_DIR=$GLOBS_DIR + + if [ "$KIRA_TOOLS_SRC" != "$UTILS_DEST/kira-utils.sh" ] ; then + mkdir -p $UTILS_DEST + mv -fv $KIRA_TOOLS_SRC "$UTILS_DEST/kira-utils.sh" + chmod -v 555 $UTILS_DEST/kira-utils.sh + fi + + if [ ! -f $KIRA_TOOLS_SRC ] ; then + echoErr "ERROR: kira-utils.sh MUST be located in '$KIRA_TOOLS_SRC', update your KIRA_TOOLS_SRC env" + return 1 + else + local SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" + local USERNAME="${USER}" && [ "$USERNAME" == "root" ] && USERNAME="" + local LOGNAME=$(logname 2> /dev/null echo "") && [ "$LOGNAME" == "root" ] && LOGNAME="" + + local TARGET="/$LOGNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET="/$USERNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET="/$SUDOUSER/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET="/root/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET=~/.bashrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET=~/.zshrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET=~/.profile && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + + mkdir -p $KIRA_GLOBS_DIR + + setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" + setGlobEnv KIRA_TOOLS_SRC "$KIRA_TOOLS_SRC" + + local AUTOLOAD_SET=$(getLastLineByPrefix "source $KIRA_TOOLS_SRC" /etc/profile 2> /dev/null || echo "-1") + + if [[ $AUTOLOAD_SET -lt 0 ]] ; then + echo "source $KIRA_TOOLS_SRC || echo \"ERROR: Failed to load kira utils from $KIRA_TOOLS_SRC\"" >> /etc/profile + fi + + loadGlobEnvs + + echoInfo "INFO: SUCCESS!, Installed kira bash-utils $(utilsVersion)" + fi } # bash 3 (MAC) compatybility @@ -194,10 +244,25 @@ function safeWget() { echoErr "ERROR: Expected hash: '$EXPECTED_HASH', but got '$FILE_HASH'" return 1 else - echoInfo "INFO: Safe download suceeded: '$FILE_URL' ---> '$OUT_PATH'" + echoInfo "INFO: Safe download suceeded: '$FILE_URL' ---> '$(realpath $OUT_PATH)'" fi } +function getCpuCores() { + local CORES=$(cat /proc/cpuinfo | grep processor | wc -l 2> /dev/null || echo "0") + ($(isNaturalNumber "$CORES")) && echo $CORES || echo "0" +} + +function getRamTotal() { + local MEMORY=$(grep MemTotal /proc/meminfo | awk '{print $2}' || echo "0") + ($(isNaturalNumber "$MEMORY")) && echo $MEMORY || echo "0" +} + +function getArch() { + local ARCH=$(uname -m) + echo $(([[ "$ARCH" == *"arm"* ]] || [[ "$ARCH" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +} + function tryMkDir { for kg_var in "$@" ; do kg_var=$(echo "$kg_var" | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") @@ -400,14 +465,14 @@ function globFile() { function globGet() { local FILE=$(globFile "$1" "$2") - [[ -s FILE ]] && cat $FILE || echo "" + [[ -s "$FILE" ]] && cat $FILE || echo "" return 0 } # threadsafe global get function globGetTS() { local FILE=$(globFile "$1" "$2") - [[ -s "$FILE" ]] && sem --id "$1" "cat $FILE" || echo "" + [ -s "$FILE" ] && sem --id "$1" "cat $FILE" || echo "" return 0 } @@ -835,3 +900,39 @@ function setGlobLine() { function loadGlobEnvs() { . /etc/profile } + +# crossenvLink "$KIRA_BIN/CDHelper-/CDHelper" "/usr/local/bin/CDhelper" +# NOTE: the tag will be replaced by arm64 & amd64 +function crossenvLink() { + local SOURCE_PATH=$1 + local DESTINATION_PATH=$2 + + local FULL_SRC_PATH_ARM64="${SOURCE_PATH//arm64}" + local FULL_SRC_PATH_AMD64="${SOURCE_PATH//amd64}" + + if [ -f $FULL_SRC_PATH_ARM64 ] && [ -f $FULL_SRC_PATH_AMD64 ] ; then + cat > $DESTINATION_PATH << EOL +#!/usr/bin/env bash +set -e + +if [[ "\$(uname -m)" == *"arm"* ]] || [[ "\$(uname -m)" == *"aarch"* ]] ; then + if [ -z "$@" ] ; then + $FULL_SRC_PATH_ARM64 + else + $FULL_SRC_PATH_ARM64 "\$@" + fi +else + if [ -z "$@" ] ; then + $FULL_SRC_PATH_AMD64 + else + $FULL_SRC_PATH_AMD64 "\$@" + fi +fi +EOL + chmod -v 555 "$DESTINATION_PATH" "$FULL_SRC_PATH_AMD64" "$FULL_SRC_PATH_ARM64" + else + [ ! -f $FULL_SRC_PATH_ARM64 ] && echoErr "ERROR: Could NOT find arm64 relese: '$FULL_SRC_PATH_ARM64'" + [ ! -f $FULL_SRC_PATH_AMD64 ] && echoErr "ERROR: Could NOT find amd64 relese: '$FULL_SRC_PATH_AMD64'" + return 1 + fi +} diff --git a/scripts/publish.sh b/scripts/publish.sh index 3172b734..ba2e3514 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -33,6 +33,7 @@ mkdir -p ./bin cp -rfv ./tmconnect/bin/* ./bin cp -rfv ./tmkms-key-import/bin/* ./bin cp -rfv ./validator-key-gen/bin/* ./bin +cp -rfv ./bash-utils/utils.sh ./bin/kira-utils.sh rm -rfv ./tmconnect/bin/* rm -rfv ./tmkms-key-import/bin/* diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100644 index 00000000..9815d607 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile +. ./bash-utils/utils.sh + +WORKDIR=$PWD + +echoInfo "INFO: Staring all testing utilities..." + +# Test utils +cd ./bash-utils +make test +cd $WORKDIR + +echoInfo "SUCCESS: Testing finished" \ No newline at end of file From f4171d07942411fd78531dcf38b408af6050f81b Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 19:30:26 +0000 Subject: [PATCH 015/140] syntax --- .github/workflows/main.yml | 2 ++ Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66dc738f..4769b8fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,6 +69,8 @@ jobs: echo "ENVS: $(env)" echo "HOME: $HOME" echo " PWD: $PWD" + echo "Ref.: ${{ env.REF_BRANCH }}" + echo "Base: ${{ env.BASE_REF_BRANCH }}" - name: Download artifacts uses: actions/download-artifact@v3.0.0 with: diff --git a/Makefile b/Makefile index f30414b3..0d48a853 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -build: +test: ./scripts/test.sh build: From 55a69536f948cd3c3b829c14b9ae9a125bacdc21 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 19:35:06 +0000 Subject: [PATCH 016/140] synatx workflows --- .github/workflows/branch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 7ab84059..da2e8cee 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -22,8 +22,8 @@ jobs: - name: Extract branch name on pull request shell: bash run: | - RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" - echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + RELEASE_VER="$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" + echo "RELEASE_VER=\"$RELEASE_VER\"" >> $GITHUB_ENV echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV From 2bdf2c5d884fc22f29e96bf1645583ab06a7b9d5 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 19:53:44 +0000 Subject: [PATCH 017/140] create target branch & PR but only once / if the targed does not exist yet --- .github/workflows/branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index da2e8cee..fa175aa3 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -37,7 +37,7 @@ jobs: # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: env.TARGET_BRANCH_EXISTS == 'true' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + if: env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 9a9227442cbf099c5e4644ba7107ad4d64ed7660 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 19:59:03 +0000 Subject: [PATCH 018/140] source branchfix --- .github/workflows/branch.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index fa175aa3..974952c9 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -24,7 +24,7 @@ jobs: run: | RELEASE_VER="$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" echo "RELEASE_VER=\"$RELEASE_VER\"" >> $GITHUB_ENV - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + echo "SOURCE_BRANCH=\"$(echo ${GITHUB_REF#refs/heads/})\"" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing @@ -33,18 +33,19 @@ jobs: echo " Master ref.: ${{ env.MASTER_REF }}" echo " Release ver.: ${{ env.RELEASE_VER }}" echo " Event name: ${{ github.event_name }}" - echo " Repo. name: ${{ github.event.repository.name }}" + echo " Repo. name: ${{ github.event.repository.name }}" + echo "Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + if: env.TARGET_BRANCH_EXISTS == false && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch - if: env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + if: env.TARGET_BRANCH_EXISTS == false && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} From 62259e4ed648774af95d9d5904fd78de864b18dd Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 20:03:34 +0000 Subject: [PATCH 019/140] set refs corectly --- .github/workflows/branch.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 974952c9..b48b418c 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -23,8 +23,9 @@ jobs: shell: bash run: | RELEASE_VER="$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" + SOURCE_BRANCH="$(echo ${GITHUB_REF#refs/heads/} | xargs)" echo "RELEASE_VER=\"$RELEASE_VER\"" >> $GITHUB_ENV - echo "SOURCE_BRANCH=\"$(echo ${GITHUB_REF#refs/heads/})\"" >> $GITHUB_ENV + echo "SOURCE_BRANCH=\"$SOURCE_BRANCH\"" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing From 60d6cf90dda162dec274b8769fdc1613ed206aa7 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 20:08:38 +0000 Subject: [PATCH 020/140] workflow syntax --- .github/workflows/branch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index b48b418c..2aeb42d8 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -39,14 +39,14 @@ jobs: # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: env.TARGET_BRANCH_EXISTS == false && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + if: ( env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch - if: env.TARGET_BRANCH_EXISTS == false && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') + if: ( env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} From c04c13ca79e3592012b09c91838112115d8f772d Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 20:11:47 +0000 Subject: [PATCH 021/140] bool syntax --- .github/workflows/branch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 2aeb42d8..29dfd144 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -39,14 +39,14 @@ jobs: # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: ( env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + if: ( !env.TARGET_BRANCH_EXISTS && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch - if: ( env.TARGET_BRANCH_EXISTS == 'false' && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + if: ( !env.TARGET_BRANCH_EXISTS && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} From e4a1a731c264e1e3afa493f93d2eb358c32eb8f1 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sat, 19 Mar 2022 20:18:38 +0000 Subject: [PATCH 022/140] remove quotes --- .github/workflows/branch.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 29dfd144..9bef2eb3 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -22,11 +22,12 @@ jobs: - name: Extract branch name on pull request shell: bash run: | - RELEASE_VER="$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" + RELEASE_VER="$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '' | xargs)" SOURCE_BRANCH="$(echo ${GITHUB_REF#refs/heads/} | xargs)" - echo "RELEASE_VER=\"$RELEASE_VER\"" >> $GITHUB_ENV - echo "SOURCE_BRANCH=\"$SOURCE_BRANCH\"" >> $GITHUB_ENV - echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV + MASTER_REF="$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" + echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV + echo "MASTER_REF=$MASTER_REF" >> $GITHUB_ENV git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | @@ -39,14 +40,14 @@ jobs: # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: ( !env.TARGET_BRANCH_EXISTS && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + if: ( !contains(env.TARGET_BRANCH_EXISTS, 'true') && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch - if: ( !env.TARGET_BRANCH_EXISTS && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + if: ( !contains(env.TARGET_BRANCH_EXISTS, 'true') && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} From fe67b3ba23414e2b01721e8b5581ee9fd965d586 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sun, 20 Mar 2022 06:35:12 +0000 Subject: [PATCH 023/140] added global bash utils --- DEVME.md | 13 +++++++------ RELEASE.md | 5 ++--- bash-utils/README.md | 15 ++++++++++----- bash-utils/utils.sh | 45 +++++++++++++++++++++++++------------------- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/DEVME.md b/DEVME.md index a3c2c659..9efaf095 100644 --- a/DEVME.md +++ b/DEVME.md @@ -4,12 +4,13 @@ KIRA Tools ## Dependencies ``` -VERSION="v0.0.6.0" && cd /tmp && rm -fv ./kira-utils.sh && \ -CHECKSUM="7bdf4da2165fa1828f399622594af68e83e764ba1ddeb472094d882d85dcdd71" && \ -wget https://github.com/KiraCore/tools/releases/download/$VERSION/kira-utils.sh && \ - FILE_HASH=$(sha256sum $1 | awk '{ print $1 }' | xargs || echo -n "") && \ - [ "$FILE_HASH" == "$CHECKSUM" ] && . ./utils.sh utilsSetup "/usr/local/bin" "/var/kiraglob" && \ - loadGlobEnvs && echoInfo "SUCCESS: kira-utils $(utilsVersion) were installed!" || \ +VERSION="v0.0.7.0" && cd /tmp && rm -fv ./utils.sh && \ +CHECKSUM="5f47b6f6e302b9c582c68894b1dfb231ec81c593ca7bc0d21471f440aca1d9ac" && \ +wget https://github.com/KiraCore/tools/releases/download/$VERSION/kira-utils.sh -O ./utils.sh && \ + FILE_HASH=$(sha256sum ./utils.sh | awk '{ print $1 }' | xargs || echo -n "") && \ + [ "$FILE_HASH" == "$CHECKSUM" ] && chmod -v 555 ./utils.sh && \ + ./utils.sh utilsSetup ./utils.sh "/var/kiraglob" && . /etc/profile && \ + utils loadGlobEnvs && utils echoInfo "SUCCESS: kira-utils $(utils utilsVersion) were installed!" || \ echo "ERROR: Invalid checksum '$FILE_HASH' or utilsSetup failed" ``` diff --git a/RELEASE.md b/RELEASE.md index 61d34e47..ef3dfab9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,4 @@ -Release: `v0.0.6.0` +Release: `v0.0.7.0` Features: -* Added `safeWget`,`getCpuCores`, `getCpuCores`, `getRamTotal`, `getArch`, `crossenvLink` -* Added auto PR to version branch workflow \ No newline at end of file +* Added `kira-utils` as `utils` binary accessible globally \ No newline at end of file diff --git a/bash-utils/README.md b/bash-utils/README.md index f78be8a6..7d04af95 100644 --- a/bash-utils/README.md +++ b/bash-utils/README.md @@ -1,11 +1,16 @@ -# KIRA Bash Utils +## KIRA Bash Utils The ultimate collection of various bash-shell function to make access to various system components fast and simple from the CLI level -# Install +### Local Setup ``` -cd /tmp && read -p "Input branch name: " BRANCH && \ - wget https://raw.githubusercontent.com/KiraCore/tools/$BRANCH/bash-utils/install.sh -O ./i.sh && \ - chmod 555 ./i.sh && ./i.sh "$BRANCH" "/var/kiraglob" && . /etc/profile || echo "ERROR: Failed kira bash-utils installation" +./utils.sh utilsSetup ./utils.sh "/var/kiraglob" +``` + +### Remote Setup +``` +cd /tmp && rm -fv ./utils.sh && \ + wget https://raw.githubusercontent.com/KiraCore/tools/latest/bash-utils/utils.sh -O ./utils.sh && \ + chmod -v 555 ./utils && ./utils.sh utilsSetup ./utils.sh "/var/kiraglob" ``` diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index 19d21cad..fc617103 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -12,30 +12,31 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" function utilsVersion() { - echo "v0.0.18" + echo "v0.0.1.2" } # this is default installation script for utils -# . ./utils.sh && utilsSetup "/usr/local/bin" "/var/kiraglob" +# ./utils.sh utilsSetup ./utils.sh "/var/kiraglob" function utilsSetup() { - local UTILS_DEST="$1" + local UTILS_SOURCE="$1" local GLOBS_DIR="$2" - local UTILS_SOURCE="${BASH_SOURCE}" + local UTILS_DESTINATION="/usr/local/bin/kira-utils.sh" - echoInfo "INFO: Starting utils setup from '$UTILS_SOURCE'" - - [ -z "$GLOBS_DIR" ] && KIRA_GLOBS_DIR="/var/kiraglob" || KIRA_GLOBS_DIR=$GLOBS_DIR - - if [ "$KIRA_TOOLS_SRC" != "$UTILS_DEST/kira-utils.sh" ] ; then - mkdir -p $UTILS_DEST - mv -fv $KIRA_TOOLS_SRC "$UTILS_DEST/kira-utils.sh" - chmod -v 555 $UTILS_DEST/kira-utils.sh + if [ -z "$GLOBS_DIR" ] ; then + [ -z "$KIRA_GLOBS_DIR" ] && KIRA_GLOBS_DIR="/var/kiraglob" + else + KIRA_GLOBS_DIR=$GLOBS_DIR fi - if [ ! -f $KIRA_TOOLS_SRC ] ; then - echoErr "ERROR: kira-utils.sh MUST be located in '$KIRA_TOOLS_SRC', update your KIRA_TOOLS_SRC env" + if [ ! -f $UTILS_SOURCE ] ; then + echoErr "ERROR: utils source was NOT found" return 1 else + mkdir -p "/usr/local/bin" + mv -fv "$UTILS_SOURCE" "$UTILS_DESTINATION" + mv -fv "$UTILS_SOURCE" "/usr/local/bin/utils" + chmod -v 555 $UTILS_DESTINATION "/usr/local/bin/utils" + local SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" local USERNAME="${USER}" && [ "$USERNAME" == "root" ] && USERNAME="" local LOGNAME=$(logname 2> /dev/null echo "") && [ "$LOGNAME" == "root" ] && LOGNAME="" @@ -50,16 +51,16 @@ function utilsSetup() { mkdir -p $KIRA_GLOBS_DIR - setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" - setGlobEnv KIRA_TOOLS_SRC "$KIRA_TOOLS_SRC" + utils setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" + utils setGlobEnv KIRA_TOOLS_SRC "$UTILS_DESTINATION" - local AUTOLOAD_SET=$(getLastLineByPrefix "source $KIRA_TOOLS_SRC" /etc/profile 2> /dev/null || echo "-1") + local AUTOLOAD_SET=$(utils getLastLineByPrefix "source $UTILS_DESTINATION" /etc/profile 2> /dev/null || echo "-1") if [[ $AUTOLOAD_SET -lt 0 ]] ; then - echo "source $KIRA_TOOLS_SRC || echo \"ERROR: Failed to load kira utils from $KIRA_TOOLS_SRC\"" >> /etc/profile + echo "source $UTILS_DESTINATION || echo \"ERROR: Failed to load kira utils from '$UTILS_DESTINATION'\"" >> /etc/profile fi - loadGlobEnvs + utils loadGlobEnvs echoInfo "INFO: SUCCESS!, Installed kira bash-utils $(utilsVersion)" fi @@ -936,3 +937,9 @@ EOL return 1 fi } + +# allow to execute finctions directly from file +if declare -f "$1" > /dev/null ; then + # call arguments verbatim + "$@" +fi From 08289ba71bdd81762c0b204e228590426cf1742b Mon Sep 17 00:00:00 2001 From: asmodat Date: Sun, 20 Mar 2022 07:43:06 +0000 Subject: [PATCH 024/140] setup syntax fix --- DEVME.md | 4 ++-- RELEASE.md | 5 +++-- bash-utils/utils.sh | 14 ++++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/DEVME.md b/DEVME.md index 9efaf095..a2fc5b19 100644 --- a/DEVME.md +++ b/DEVME.md @@ -4,8 +4,8 @@ KIRA Tools ## Dependencies ``` -VERSION="v0.0.7.0" && cd /tmp && rm -fv ./utils.sh && \ -CHECKSUM="5f47b6f6e302b9c582c68894b1dfb231ec81c593ca7bc0d21471f440aca1d9ac" && \ +VERSION="v0.0.8.0" && cd /tmp && rm -fv ./utils.sh && \ +CHECKSUM="1cfb806eec03956319668b0a4f02f2fcc956ed9800070cda1870decfe2e6206e" && \ wget https://github.com/KiraCore/tools/releases/download/$VERSION/kira-utils.sh -O ./utils.sh && \ FILE_HASH=$(sha256sum ./utils.sh | awk '{ print $1 }' | xargs || echo -n "") && \ [ "$FILE_HASH" == "$CHECKSUM" ] && chmod -v 555 ./utils.sh && \ diff --git a/RELEASE.md b/RELEASE.md index ef3dfab9..03ae7238 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,5 @@ -Release: `v0.0.7.0` +Release: `v0.0.8.0` Features: -* Added `kira-utils` as `utils` binary accessible globally \ No newline at end of file +* Bugfix kira utils setup +* Bugfix getArch output \ No newline at end of file diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index fc617103..50ce2aa4 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -12,7 +12,7 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" function utilsVersion() { - echo "v0.0.1.2" + echo "v0.1.0.0" } # this is default installation script for utils @@ -33,8 +33,8 @@ function utilsSetup() { return 1 else mkdir -p "/usr/local/bin" - mv -fv "$UTILS_SOURCE" "$UTILS_DESTINATION" - mv -fv "$UTILS_SOURCE" "/usr/local/bin/utils" + cp -fv "$UTILS_SOURCE" "$UTILS_DESTINATION" + cp -fv "$UTILS_SOURCE" "/usr/local/bin/utils" chmod -v 555 $UTILS_DESTINATION "/usr/local/bin/utils" local SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" @@ -261,7 +261,13 @@ function getRamTotal() { function getArch() { local ARCH=$(uname -m) - echo $(([[ "$ARCH" == *"arm"* ]] || [[ "$ARCH" == *"aarch"* ]]) && echo "arm64" || echo "amd64") + if [[ "$ARCH" == *"arm"* ]] || [[ "$ARCH" == *"aarch"* ]] ; then + echo "arm64" + elif [[ "$ARCH" == *"x64"* ]] || [[ "$ARCH" == *"x86_64"* ]] || [[ "$ARCH" == *"amd64"* ]] || [[ "$ARCH" == *"amd"* ]] ; then + echo "amd64" + else + echo "$ARCH" + fi } function tryMkDir { From 978fa447388140f1c187b371b934d13dda1d29f7 Mon Sep 17 00:00:00 2001 From: asmodat Date: Sun, 20 Mar 2022 09:58:06 +0000 Subject: [PATCH 025/140] safeWget better logs --- RELEASE.md | 6 +++--- bash-utils/utils.sh | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 03ae7238..11e14381 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ -Release: `v0.0.8.0` +Release: `v0.0.9-rc.1` Features: -* Bugfix kira utils setup -* Bugfix getArch output \ No newline at end of file +* Improved safeWget output +* File empty check fix \ No newline at end of file diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index 50ce2aa4..742ae3f7 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -12,7 +12,7 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" function utilsVersion() { - echo "v0.1.0.0" + echo "v0.1.0.1" } # this is default installation script for utils @@ -184,19 +184,17 @@ function isPortOpen() { } function fileSize() { - kg_bytes=$(stat -c%s $1 2> /dev/null || echo -n "") - ($(isNaturalNumber "$kg_bytes")) && echo "$kg_bytes" || echo -n "0" + local BYTES=$(stat -c%s $1 2> /dev/null || echo -n "") + ($(isNaturalNumber "$BYTES")) && echo "$BYTES" || echo -n "0" } function isFileEmpty() { - if [ -z "$1" ] || [ ! -f $1 ] || [ ! -s $1 ] ; then echo "true" ; else - kg_PREFIX_AND_SUFFIX=$(echo "$(head -c 64 $1 2>/dev/null || echo '')$(tail -c 64 $1 2>/dev/null || echo '')" | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") - if [ ! -z "$kg_PREFIX_AND_SUFFIX" ] ; then - echo "false" - else - kg_TEXT=$(cat $1 | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") - [ -z "$kg_TEXT" ] && echo "true" || echo "false" - fi + local FILE="$1" + if [ -z "$FILE" ] || [ ! -f "$FILE" ] || [ ! -s "$FILE" ] ; then echo "true" ; else + local TEXT=$(head -c 64 "$FILE" 2>/dev/null | tr -d '\0\011\012\013\014\015\040' 2>/dev/null || echo '') + [ -z "$TEXT" ] && TEXT=$(tail -c 64 "$FILE" 2>/dev/null | tr -d '\0\011\012\013\014\015\040' 2>/dev/null || echo '') + [ -z "$TEXT" ] && TEXT=$(cat $FILE | tr -d '\0\011\012\013\014\015\040' 2>/dev/null || echo -n "") + [ ! -z "$TEXT" ] && echo "false" || echo "true" fi } @@ -239,7 +237,11 @@ function safeWget() { wget "$FILE_URL" -O $OUT_PATH FILE_HASH=$(sha256 $OUT_PATH) - if [ "$FILE_HASH" != "$EXPECTED_HASH" ]; then + + if ($(isFileEmpty $OUT_PATH)) ; then + echoErr "ERROR: Failed download from '$FILE_URL'" + return 1 + elif [ "$FILE_HASH" != "$EXPECTED_HASH" ]; then rm -fv $OUT_PATH || echoErr "ERROR: Failed to delete '$OUT_PATH'" echoErr "ERROR: Safe download filed: '$FILE_URL' -x-> '$OUT_PATH'" echoErr "ERROR: Expected hash: '$EXPECTED_HASH', but got '$FILE_HASH'" From e6347e8d47ed8853c644c2d14425d68ee53f4ed2 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 11 Apr 2022 07:05:30 +0000 Subject: [PATCH 026/140] Adding `setLastLineByPrefixOrAppend` to utils --- .github/workflows/branch.yml | 10 +++++---- RELEASE.md | 10 ++++++--- bash-utils/utils.sh | 39 +++++++++++++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 9bef2eb3..71b097bf 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -4,9 +4,7 @@ on: push: branches: [ feature/*, bugfix/* ] -# git ls-remote | head -1 | sed "s/HEAD//" jobs: - # isolate signing & repo cloning from docker image auto-pr: name: Automated Master Branch PR runs-on: ubuntu-20.04 @@ -40,14 +38,18 @@ jobs: # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f - if: ( !contains(env.TARGET_BRANCH_EXISTS, 'true') && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + if: | + ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && + ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch - if: ( !contains(env.TARGET_BRANCH_EXISTS, 'true') && startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + if: | + ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && + ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} diff --git a/RELEASE.md b/RELEASE.md index 11e14381..741a9878 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,9 @@ -Release: `v0.0.9-rc.1` +Release: `v0.0.10.2` Features: -* Improved safeWget output -* File empty check fix \ No newline at end of file +* Improved `safeWget` output in utils +* File empty check fix in utils +* Added `setLastLineByPrefixOrAppend` to utils +* Added `setFirstLineByPrefix` to utils +* Added `setLastLineByPrefix` to utils +* Fixed branch exists check in workflows \ No newline at end of file diff --git a/bash-utils/utils.sh b/bash-utils/utils.sh index 742ae3f7..de58a4f0 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/utils.sh @@ -12,7 +12,7 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" function utilsVersion() { - echo "v0.1.0.1" + echo "v0.1.1.2" } # this is default installation script for utils @@ -760,10 +760,47 @@ function setLineByNumber() { local INDEX=$1 local TEXT=$2 local FILE=$3 + [ ! -f "$FILE" ] && echoErr "ERROR: File '$FILE' does NOT exist, nothing can be set!" sed -i"" "$INDEX c\ $TEXT" $FILE } +function setNLineByPrefix() { + local INDEX=$1 + local PREFIX=$2 + local TEXT=$3 + local FILE=$4 + local LINE=$(getNLineByPrefix "$INDEX" "$PREFIX" "$FILE") + if [[ $LINE -ge 0 ]] ; then + setLineByNumber "$LINE" "$TEXT" "$FILE" + echo "true" + else + echo "false" + fi +} + +function setLastLineByPrefix() { + setNLineByPrefix "0" "$1" "$2" "$3" +} + +function setFirstLineByPrefix() { + setNLineByPrefix "1" "$1" "$2" "$3" +} + +function setLastLineByPrefixOrAppend() { + local PREFIX=$1 + local TEXT=$2 + local FILE=$3 + [ ! -f "$FILE" ] && echoErr "ERROR: File '$FILE' does NOT exist, nothing can be set!" + local ADDED=$(setLastLineByPrefix "$PREFIX" "$TEXT" "$FILE") + if [ "$ADDED" == "false" ] ; then + echo "$TEXT" >> $FILE + elif [ "$ADDED" != "true" ] ; then + echoErr "ERROR: Failed to set line or apped to '$FILE'" + return 1 + fi +} + function setEnv() { local ENV_NAME=$(delWhitespaces "$1") local ENV_VALUE=$2 From deb5e99b844581349306ccd7971dcc69859cf072 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 10:12:19 +0000 Subject: [PATCH 027/140] adding bip39gen --- .github/workflows/branch.yml | 10 +- .github/workflows/main.yml | 107 +- .github/workflows/spam.yml | 31 +- Makefile | 2 + RELEASE.md | 9 +- bash-utils/Makefile | 2 + bip39gen/Makefile | 11 + bip39gen/README.md | 9 + bip39gen/bip39/.gitignore | 6 + bip39gen/bip39/.golangci.yml | 77 + bip39gen/bip39/Makefile | 10 + bip39gen/bip39/bip39.go | 356 +++ bip39gen/bip39/bip39_test.go | 434 ++++ bip39gen/bip39/example_test.go | 28 + bip39gen/bip39/go.mod | 8 + bip39gen/bip39/go.sum | 10 + bip39gen/bip39/scripts/build.sh | 26 + bip39gen/bip39/scripts/test.sh | 12 + .../bip39/wordlists/chinese_simplified.go | 2071 +++++++++++++++++ .../bip39/wordlists/chinese_traditional.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/czech.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/english.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/french.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/italian.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/japanese.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/korean.go | 2071 +++++++++++++++++ bip39gen/bip39/wordlists/spanish.go | 2071 +++++++++++++++++ bip39gen/go.mod | 17 + bip39gen/go.sum | 26 + bip39gen/main.go | 159 ++ bip39gen/nfpm.yaml | 17 + bip39gen/scripts/build.sh | 27 + bip39gen/scripts/publish.sh | 71 + scripts/build.sh | 6 +- scripts/publish.sh | 9 +- scripts/test.sh | 5 + scripts/version.sh | 6 + tmconnect/Makefile | 2 + 38 files changed, 20067 insertions(+), 65 deletions(-) create mode 100644 bip39gen/Makefile create mode 100644 bip39gen/README.md create mode 100644 bip39gen/bip39/.gitignore create mode 100644 bip39gen/bip39/.golangci.yml create mode 100644 bip39gen/bip39/Makefile create mode 100644 bip39gen/bip39/bip39.go create mode 100644 bip39gen/bip39/bip39_test.go create mode 100644 bip39gen/bip39/example_test.go create mode 100644 bip39gen/bip39/go.mod create mode 100644 bip39gen/bip39/go.sum create mode 100644 bip39gen/bip39/scripts/build.sh create mode 100644 bip39gen/bip39/scripts/test.sh create mode 100644 bip39gen/bip39/wordlists/chinese_simplified.go create mode 100644 bip39gen/bip39/wordlists/chinese_traditional.go create mode 100644 bip39gen/bip39/wordlists/czech.go create mode 100644 bip39gen/bip39/wordlists/english.go create mode 100644 bip39gen/bip39/wordlists/french.go create mode 100644 bip39gen/bip39/wordlists/italian.go create mode 100644 bip39gen/bip39/wordlists/japanese.go create mode 100644 bip39gen/bip39/wordlists/korean.go create mode 100644 bip39gen/bip39/wordlists/spanish.go create mode 100644 bip39gen/go.mod create mode 100644 bip39gen/go.sum create mode 100644 bip39gen/main.go create mode 100644 bip39gen/nfpm.yaml create mode 100644 bip39gen/scripts/build.sh create mode 100644 bip39gen/scripts/publish.sh create mode 100644 scripts/version.sh diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 71b097bf..ab537ca3 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -20,12 +20,12 @@ jobs: - name: Extract branch name on pull request shell: bash run: | - RELEASE_VER="$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '' | xargs)" + RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV SOURCE_BRANCH="$(echo ${GITHUB_REF#refs/heads/} | xargs)" MASTER_REF="$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" - echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV echo "MASTER_REF=$MASTER_REF" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | @@ -39,7 +39,8 @@ jobs: - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f if: | - ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && + ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && + ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -48,7 +49,8 @@ jobs: sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch if: | - ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && + ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && + ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4769b8fe..cc2fbfa5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,32 +6,6 @@ on: pull_request: branches: [ v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] jobs: - # isolate signing & repo cloning from docker image - setup: - name: Repo Setup - runs-on: ubuntu-20.04 - permissions: - contents: read - packages: write - id-token: write - pull-requests: write - steps: - - name: Install cosign - uses: sigstore/cosign-installer@v2.1.0 - with: - cosign-release: 'v1.6.0' - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - - name: Verify repo content - run: | - echo "(current dir): $PWD" && ls -l ./ - cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz - - name: Uploading artifacts - uses: actions/upload-artifact@v3.0.0 - with: - name: tools-src - path: ./src.tar.gz build: name: Repo Test & Build runs-on: ubuntu-20.04 @@ -40,10 +14,11 @@ jobs: packages: write id-token: write pull-requests: write - needs: [setup] container: image: ghcr.io/kiracore/docker/base-image:v0.0.4.0 steps: + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Extract branch name on push if: github.event_name == 'push' shell: bash @@ -59,18 +34,32 @@ jobs: run: | echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - - name: Checking dependency versions + - name: Archive src and setup envs + run: | + WORK_DIR=$PWD + echo "(current dir): $WORK_DIR" && ls -l ./ + cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz + cd $WORK_DIR + RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + if [[ "$RELEASE_VER" =~ $VERSION_REGEX ]] && [[ "$SOURCE_BRANCH" =~ $VERSION_REGEX ]] && [ "$SOURCE_BRANCH" != "$RELEASE_VER" ] ; then + echo "ERROR: Version branch name MUST be the same as the app version, run scripts/version.sh to check app version!" + exit 1 + else + echo "INFO: Variables setup succeeded" + fi + - name: Print debug data before build run: | . /etc/profile && echo "Utils Version: $(utilsVersion)" go version - CDHelper version - flutter --version - dart --version - echo "ENVS: $(env)" - echo "HOME: $HOME" - echo " PWD: $PWD" - echo "Ref.: ${{ env.REF_BRANCH }}" - echo "Base: ${{ env.BASE_REF_BRANCH }}" + echo " Utils Version: $(utilsVersion)" + echo " Source branch: ${{ env.SOURCE_BRANCH }}" + echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" + echo " Event name: ${{ github.event_name }}" + echo " Repository name: ${{ env.REPOSITORY_NAME }}" + echo " Release version: ${{ env.RELEASE_VER }}" + echo " Release exists: ${{ env.RELEASE_EXISTS }}" - name: Download artifacts uses: actions/download-artifact@v3.0.0 with: @@ -80,7 +69,7 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts + chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts chmod -Rv 555 ./bash-utils chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} @@ -95,6 +84,8 @@ jobs: cp -fv ./RELEASE.md ./bin/RELEASE.md chmod -Rv 777 ./bin echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER" >> ./bin/RELEASE.md + echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md @@ -109,6 +100,12 @@ jobs: echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-linux-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " kira-utils.sh: sha256:$(sha256sum ./bin/kira-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . @@ -127,6 +124,10 @@ jobs: id-token: write pull-requests: write steps: + - name: Install cosign + uses: sigstore/cosign-installer@v2.1.0 + with: + cosign-release: 'v1.6.0' - name: Download artifacts uses: actions/download-artifact@v3.0.0 with: @@ -136,7 +137,11 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./deb.tar.gz chmod -Rv 777 ./ - echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV + RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') + echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + REPOSITORY_NAME="${{ github.event.repository.name }}" + echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV # Branch name is also a version of the release # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - name: Extract branch name on push @@ -156,12 +161,12 @@ jobs: echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - name: Print debug data before publishing run: | - echo "Source branch: ${{ env.SOURCE_BRANCH }}" - echo " Dest. branch: ${{ env.DESTINATION_BRANCH }}" - echo " Event name: ${{ github.event_name }}" - echo " Release ver.: ${{ env.RELEASE_VER }}" - echo " Release file:" - cat ./RELEASE.md + echo " Source branch: ${{ env.SOURCE_BRANCH }}" + echo " Dest. branch: ${{ env.DESTINATION_BRANCH }}" + echo " Repo Name: ${{ env.REPOSITORY_NAME }}" + echo " Event name: ${{ github.event_name }}" + echo " Release ver.: ${{ env.RELEASE_VER }}" + echo "Release exists: ${{ env.RELEASE_EXISTS }}" - name: Reject on error # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 @@ -175,6 +180,7 @@ jobs: - name: Publish release if: | github.event_name == 'push' && + ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, 'rc') && !contains(env.SOURCE_BRANCH, '-') ) uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 with: @@ -199,12 +205,19 @@ jobs: ./validator-key-gen-windows-amd64.exe ./validator-key-gen-darwin-arm64.deb ./validator-key-gen-darwin-amd64.deb + ./bip39gen-linux-arm64.deb + ./bip39gen-linux-amd64.deb + ./bip39gen-windows-arm64.exe + ./bip39gen-windows-amd64.exe + ./bip39gen-darwin-arm64.deb + ./bip39gen-darwin-amd64.deb ./kira-utils.sh # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish pre-release if: | github.event_name == 'push' && + ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && contains(env.SOURCE_BRANCH, '-') ) uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 with: @@ -229,6 +242,12 @@ jobs: ./validator-key-gen-windows-amd64.exe ./validator-key-gen-darwin-arm64.deb ./validator-key-gen-darwin-amd64.deb + ./bip39gen-linux-arm64.deb + ./bip39gen-linux-amd64.deb + ./bip39gen-windows-arm64.exe + ./bip39gen-windows-amd64.exe + ./bip39gen-darwin-arm64.deb + ./bip39gen-darwin-amd64.deb ./kira-utils.sh # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index 6da8581a..0447b439 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -26,9 +26,14 @@ jobs: - name: Extract branch name & release version shell: bash run: | - echo "RELEASE_VER=$(grep -Fn -m 1 'Release: ' ./RELEASE.md | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '')" >> $GITHUB_ENV - echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV + VERSION_REGEX="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" + REPOSITORY_NAME=${{ github.event.repository.name }} + RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + SOURCE_BRANCH="$(echo ${{ env.REF_BRANCH }})" && echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV + DESTINATION_BRANCH="$(echo ${{ env.BASE_REF_BRANCH }})" && echo "DESTINATION_BRANCH=$DESTINATION_BRANCH" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + [[ "$SOURCE_BRANCH" =~ $VERSION_REGEX ]] && echo "SOURCE_VERSIONED=true" >> $GITHUB_ENV || echo "SOURCE_VERSIONED=false" >> $GITHUB_ENV + [[ "$DESTINATION_BRANCH" =~ $VERSION_REGEX ]] && echo "DESTINATION_VERSIONED=true" >> $GITHUB_ENV || echo "DESTINATION_VERSIONED=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | echo "Source branch name: ${{ env.SOURCE_BRANCH }}" @@ -43,7 +48,11 @@ jobs: pr-labels: 'invalid' pr-comment: > This repository does not accept pull requests from non version branches - close-pr: true + + --- Please CLOSE this PR after acknowledging the issue --- + close-pr: false + lock-pr: true + pr-lock-reason: 'spam' - name: Reject invalid PRs to version branches that do NOT originate from feature/* or debug/* # ref.: https://github.com/dessant/repo-lockdown uses: dessant/repo-lockdown@0b093279a77b44bbc38e85089b5463dd06b4aea4 @@ -54,7 +63,11 @@ jobs: pr-labels: 'invalid' pr-comment: > This repository does not accept pull requests from feature/* & bugfix/* branches - close-pr: true + + --- Please CLOSE this PR after acknowledging the issue --- + close-pr: false + lock-pr: true + pr-lock-reason: 'spam' - name: Reject invalid PRs to version branches with invalid RELEASE files # ref.: https://github.com/dessant/repo-lockdown uses: dessant/repo-lockdown@0b093279a77b44bbc38e85089b5463dd06b4aea4 @@ -64,5 +77,9 @@ jobs: with: pr-labels: 'invalid' pr-comment: > - The release version (${{ env.RELEASE_VER }}) in the ./RELEASE.md file does NOT match the branch name (${{ env.DESTINATION_BRANCH }}) - close-pr: false \ No newline at end of file + The release version (${{ env.RELEASE_VER }}) does NOT match the branch name (${{ env.DESTINATION_BRANCH }}) + + --- Please CLOSE this PR after acknowledging the issue --- + close-pr: false + lock-pr: true + pr-lock-reason: 'spam' \ No newline at end of file diff --git a/Makefile b/Makefile index 0d48a853..563b7cda 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.PHONY: test build publish + test: ./scripts/test.sh diff --git a/RELEASE.md b/RELEASE.md index 741a9878..c018d950 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,9 +1,2 @@ -Release: `v0.0.10.2` - Features: -* Improved `safeWget` output in utils -* File empty check fix in utils -* Added `setLastLineByPrefixOrAppend` to utils -* Added `setFirstLineByPrefix` to utils -* Added `setLastLineByPrefix` to utils -* Fixed branch exists check in workflows \ No newline at end of file +* Added `bip39gen` CLI tool \ No newline at end of file diff --git a/bash-utils/Makefile b/bash-utils/Makefile index dbaf69a1..84d18513 100644 --- a/bash-utils/Makefile +++ b/bash-utils/Makefile @@ -1,3 +1,5 @@ +.PHONY: test + test: ./scripts/test.sh \ No newline at end of file diff --git a/bip39gen/Makefile b/bip39gen/Makefile new file mode 100644 index 00000000..7952aef9 --- /dev/null +++ b/bip39gen/Makefile @@ -0,0 +1,11 @@ +.PHONY: test build publish + +test: + ./bip39/scripts/test.sh + +build: + ./bip39/scripts/build.sh + ./scripts/build.sh + +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/bip39gen/README.md b/bip39gen/README.md new file mode 100644 index 00000000..bb2ddf9f --- /dev/null +++ b/bip39gen/README.md @@ -0,0 +1,9 @@ +## Mnemonics Generator + +KIRA `bip39gen` CLI tool based on [go-bip39](https://github.com/tyler-smith) library, allowing for generation of mnemonics with external, user provided entropy. If no external entropy is provided then default entropy provided by the `bip39` lib rng gets mixed (XOR'ed) with SHA256 of the UUID for some extra security :) + +### Example + +```bash +bip39gen mnemonic --verbose=true --length=24 --entropy="user provided extra entropy" +``` \ No newline at end of file diff --git a/bip39gen/bip39/.gitignore b/bip39gen/bip39/.gitignore new file mode 100644 index 00000000..ddcde5e7 --- /dev/null +++ b/bip39gen/bip39/.gitignore @@ -0,0 +1,6 @@ +# Editors +.vscode/ +.idea/ + +# Dev artifacts +coverage.out diff --git a/bip39gen/bip39/.golangci.yml b/bip39gen/bip39/.golangci.yml new file mode 100644 index 00000000..5475f336 --- /dev/null +++ b/bip39gen/bip39/.golangci.yml @@ -0,0 +1,77 @@ +run: + max-same-issues: 0 + max-issues-per-linter: 0 + skip-dirs: + - wordlists + +issues: + exclude-rules: + - path: bip39_test\.go + text: "Function 'testVectors' is too long" + linters: + - funlen + - path: (languages|bip39_test|example_test)\.go + linters: + - lll + - path: bip39\.go + text: "ST1005: error strings should not be capitalized" + linters: + - stylecheck + +linters-settings: + dupl: + threshold: 20 + errcheck: + check-type-assertions: false + check-blank: false + goconst: + min-occurrences: 2 + gocyclo: + min-complexity: 7 + misspell: + locale: US + nakedret: + max-func-lines: 0 + unparam: + algo: cha + check-exported: false + +linters: + enable: + - asciicheck + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - funlen + - goconst + - gocognit + - gocritic + - gocyclo + - godot + - godox + - gofmt + - goimports + - golint + - gosimple + - gosec + - govet + - ineffassign + - lll + - megacheck + - maligned + - misspell + - nakedret + - nestif + - prealloc + - scopelint + - staticcheck + - structcheck + - stylecheck + - unconvert + - unparam + - unused + - varcheck + - whitespace + - wsl diff --git a/bip39gen/bip39/Makefile b/bip39gen/bip39/Makefile new file mode 100644 index 00000000..563b7cda --- /dev/null +++ b/bip39gen/bip39/Makefile @@ -0,0 +1,10 @@ +.PHONY: test build publish + +test: + ./scripts/test.sh + +build: + ./scripts/build.sh + +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/bip39gen/bip39/bip39.go b/bip39gen/bip39/bip39.go new file mode 100644 index 00000000..19fbc1df --- /dev/null +++ b/bip39gen/bip39/bip39.go @@ -0,0 +1,356 @@ +// Package bip39 is the Golang implementation of the BIP39 spec. +// +// The official BIP39 spec can be found at +// https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki +package bip39 + +import ( + "crypto/rand" + "crypto/sha256" + "crypto/sha512" + "encoding/binary" + "errors" + "fmt" + "math/big" + "strings" + + "github.com/KiraCore/go-bip39/wordlists" + + "golang.org/x/crypto/pbkdf2" +) + +const Bip39Version = "v1.1.0" + +var ( + // Some bitwise operands for working with big.Ints. + last11BitsMask = big.NewInt(2047) + shift11BitsMask = big.NewInt(2048) + bigOne = big.NewInt(1) + bigTwo = big.NewInt(2) + + // wordLengthChecksumMasksMapping is used to isolate the checksum bits from + //the entropy+checksum byte array. + wordLengthChecksumMasksMapping = map[int]*big.Int{ + 12: big.NewInt(15), + 15: big.NewInt(31), + 18: big.NewInt(63), + 21: big.NewInt(127), + 24: big.NewInt(255), + } + + // wordLengthChecksumShiftMapping is used to lookup the number of operand + // for shifting bits to handle checksums. + wordLengthChecksumShiftMapping = map[int]*big.Int{ + 12: big.NewInt(16), + 15: big.NewInt(8), + 18: big.NewInt(4), + 21: big.NewInt(2), + } + + // wordList is the set of words to use. + wordList []string + + // wordMap is a reverse lookup map for wordList. + wordMap map[string]int +) + +var ( + // ErrInvalidMnemonic is returned when trying to use a malformed mnemonic. + ErrInvalidMnemonic = errors.New("Invalid mnenomic") + + // ErrEntropyLengthInvalid is returned when trying to use an entropy set with + // an invalid size. + ErrEntropyLengthInvalid = errors.New("Entropy length must be [128, 256] and a multiple of 32") + + // ErrValidatedSeedLengthMismatch is returned when a validated seed is not the + // same size as the given seed. This should never happen is present only as a + // sanity assertion. + ErrValidatedSeedLengthMismatch = errors.New("Seed length does not match validated seed length") + + // ErrChecksumIncorrect is returned when entropy has the incorrect checksum. + ErrChecksumIncorrect = errors.New("Checksum incorrect") +) + +func init() { + SetWordList(wordlists.English) +} + +// SetWordList sets the list of words to use for mnemonics. Currently the list +// that is set is used package-wide. +func SetWordList(list []string) { + wordList = list + wordMap = map[string]int{} + + for i, v := range wordList { + wordMap[v] = i + } +} + +// GetWordList gets the list of words to use for mnemonics. +func GetWordList() []string { + return wordList +} + +// GetWordIndex gets word index in wordMap. +func GetWordIndex(word string) (int, bool) { + idx, ok := wordMap[word] + return idx, ok +} + +// NewEntropy will create random entropy bytes +// so long as the requested size bitSize is an appropriate size. +// +// bitSize has to be a multiple 32 and be within the inclusive range of {128, 256}. +func NewEntropy(bitSize int) ([]byte, error) { + if err := validateEntropyBitSize(bitSize); err != nil { + return nil, err + } + + entropy := make([]byte, bitSize/8) + _, _ = rand.Read(entropy) // err is always nil + + return entropy, nil +} + +// EntropyFromMnemonic takes a mnemonic generated by this library, +// and returns the input entropy used to generate the given mnemonic. +// An error is returned if the given mnemonic is invalid. +func EntropyFromMnemonic(mnemonic string) ([]byte, error) { + mnemonicSlice, isValid := splitMnemonicWords(mnemonic) + if !isValid { + return nil, ErrInvalidMnemonic + } + + // Decode the words into a big.Int. + var ( + wordBytes [2]byte + b = big.NewInt(0) + ) + + for _, v := range mnemonicSlice { + index, found := wordMap[v] + if !found { + return nil, fmt.Errorf("word `%v` not found in reverse map", v) + } + + binary.BigEndian.PutUint16(wordBytes[:], uint16(index)) + b.Mul(b, shift11BitsMask) + b.Or(b, big.NewInt(0).SetBytes(wordBytes[:])) + } + + // Build and add the checksum to the big.Int. + checksum := big.NewInt(0) + checksumMask := wordLengthChecksumMasksMapping[len(mnemonicSlice)] + checksum = checksum.And(b, checksumMask) + + b.Div(b, big.NewInt(0).Add(checksumMask, bigOne)) + + // The entropy is the underlying bytes of the big.Int. Any upper bytes of + // all 0's are not returned so we pad the beginning of the slice with empty + // bytes if necessary. + entropy := b.Bytes() + entropy = padByteSlice(entropy, len(mnemonicSlice)/3*4) + + // Generate the checksum and compare with the one we got from the mneomnic. + entropyChecksumBytes := computeChecksum(entropy) + entropyChecksum := big.NewInt(int64(entropyChecksumBytes[0])) + + if l := len(mnemonicSlice); l != 24 { + checksumShift := wordLengthChecksumShiftMapping[l] + entropyChecksum.Div(entropyChecksum, checksumShift) + } + + if checksum.Cmp(entropyChecksum) != 0 { + return nil, ErrChecksumIncorrect + } + + return entropy, nil +} + +// NewMnemonic will return a string consisting of the mnemonic words for +// the given entropy. +// If the provide entropy is invalid, an error will be returned. +func NewMnemonic(entropy []byte) (string, error) { + // Compute some lengths for convenience. + entropyBitLength := len(entropy) * 8 + checksumBitLength := entropyBitLength / 32 + sentenceLength := (entropyBitLength + checksumBitLength) / 11 + + // Validate that the requested size is supported. + err := validateEntropyBitSize(entropyBitLength) + if err != nil { + return "", err + } + + // Add checksum to entropy. + entropy = addChecksum(entropy) + + // Break entropy up into sentenceLength chunks of 11 bits. + // For each word AND mask the rightmost 11 bits and find the word at that index. + // Then bitshift entropy 11 bits right and repeat. + // Add to the last empty slot so we can work with LSBs instead of MSB. + + // Entropy as an int so we can bitmask without worrying about bytes slices. + entropyInt := new(big.Int).SetBytes(entropy) + + // Slice to hold words in. + words := make([]string, sentenceLength) + + // Throw away big.Int for AND masking. + word := big.NewInt(0) + + for i := sentenceLength - 1; i >= 0; i-- { + // Get 11 right most bits and bitshift 11 to the right for next time. + word.And(entropyInt, last11BitsMask) + entropyInt.Div(entropyInt, shift11BitsMask) + + // Get the bytes representing the 11 bits as a 2 byte slice. + wordBytes := padByteSlice(word.Bytes(), 2) + + // Convert bytes to an index and add that word to the list. + words[i] = wordList[binary.BigEndian.Uint16(wordBytes)] + } + + return strings.Join(words, " "), nil +} + +// MnemonicToByteArray takes a mnemonic string and turns it into a byte array +// suitable for creating another mnemonic. +// An error is returned if the mnemonic is invalid. +func MnemonicToByteArray(mnemonic string, raw ...bool) ([]byte, error) { + var ( + mnemonicSlice = strings.Split(mnemonic, " ") + entropyBitSize = len(mnemonicSlice) * 11 + checksumBitSize = entropyBitSize % 32 + fullByteSize = (entropyBitSize-checksumBitSize)/8 + 1 + ) + + // Turn into raw entropy. + rawEntropyBytes, err := EntropyFromMnemonic(mnemonic) + if err != nil { + return nil, err + } + + // If we want the raw entropy then we're done. + if len(raw) > 0 && raw[0] { + return rawEntropyBytes, nil + } + + // Otherwise add the checksum before returning + return padByteSlice(addChecksum(rawEntropyBytes), fullByteSize), nil +} + +// NewSeedWithErrorChecking creates a hashed seed output given the mnemonic string and a password. +// An error is returned if the mnemonic is not convertible to a byte array. +func NewSeedWithErrorChecking(mnemonic string, password string) ([]byte, error) { + _, err := MnemonicToByteArray(mnemonic) + if err != nil { + return nil, err + } + + return NewSeed(mnemonic, password), nil +} + +// NewSeed creates a hashed seed output given a provided string and password. +// No checking is performed to validate that the string provided is a valid mnemonic. +func NewSeed(mnemonic string, password string) []byte { + return pbkdf2.Key([]byte(mnemonic), []byte("mnemonic"+password), 2048, 64, sha512.New) +} + +// IsMnemonicValid attempts to verify that the provided mnemonic is valid. +// Validity is determined by both the number of words being appropriate, +// and that all the words in the mnemonic are present in the word list. +func IsMnemonicValid(mnemonic string) bool { + _, err := EntropyFromMnemonic(mnemonic) + return err == nil +} + +// Appends to data the first (len(data) / 32)bits of the result of sha256(data) +// Currently only supports data up to 32 bytes. +func addChecksum(data []byte) []byte { + // Get first byte of sha256 + hash := computeChecksum(data) + firstChecksumByte := hash[0] + + // len() is in bytes so we divide by 4 + checksumBitLength := uint(len(data) / 4) + + // For each bit of check sum we want we shift the data one the left + // and then set the (new) right most bit equal to checksum bit at that index + // staring from the left + dataBigInt := new(big.Int).SetBytes(data) + + for i := uint(0); i < checksumBitLength; i++ { + // Bitshift 1 left + dataBigInt.Mul(dataBigInt, bigTwo) + + // Set rightmost bit if leftmost checksum bit is set + if firstChecksumByte&(1<<(7-i)) > 0 { + dataBigInt.Or(dataBigInt, bigOne) + } + } + + return dataBigInt.Bytes() +} + +func computeChecksum(data []byte) []byte { + hasher := sha256.New() + _, _ = hasher.Write(data) // This error is guaranteed to be nil + + return hasher.Sum(nil) +} + +// validateEntropyBitSize ensures that entropy is the correct size for being a +// mnemonic. +func validateEntropyBitSize(bitSize int) error { + if (bitSize%32) != 0 || bitSize < 128 || bitSize > 256 { + return ErrEntropyLengthInvalid + } + + return nil +} + +// padByteSlice returns a byte slice of the given size with contents of the +// given slice left padded and any empty spaces filled with 0's. +func padByteSlice(slice []byte, length int) []byte { + offset := length - len(slice) + if offset <= 0 { + return slice + } + + newSlice := make([]byte, length) + copy(newSlice[offset:], slice) + + return newSlice +} + +// compareByteSlices returns true of the byte slices have equal contents and +// returns false otherwise. +func compareByteSlices(a, b []byte) bool { + if len(a) != len(b) { + return false + } + + for i := range a { + if a[i] != b[i] { + return false + } + } + + return true +} + +func splitMnemonicWords(mnemonic string) ([]string, bool) { + // Create a list of all the words in the mnemonic sentence + words := strings.Fields(mnemonic) + + // Get num of words + numOfWords := len(words) + + // The number of words should be 12, 15, 18, 21 or 24 + if numOfWords%3 != 0 || numOfWords < 12 || numOfWords > 24 { + return nil, false + } + + return words, true +} diff --git a/bip39gen/bip39/bip39_test.go b/bip39gen/bip39/bip39_test.go new file mode 100644 index 00000000..82822803 --- /dev/null +++ b/bip39gen/bip39/bip39_test.go @@ -0,0 +1,434 @@ +package bip39 + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "testing" + + "github.com/KiraCore/go-bip39/wordlists" + "github.com/tyler-smith/assert" +) + +type vector struct { + entropy string + mnemonic string + seed string +} + +func TestGetWordList(t *testing.T) { + assertEqualStringsSlices(t, wordlists.English, GetWordList()) +} + +func TestGetWordIndex(t *testing.T) { + for expectedIdx, word := range wordList { + actualIdx, ok := GetWordIndex(word) + assert.True(t, ok) + assertEqual(t, actualIdx, expectedIdx) + } + + for _, word := range []string{"a", "set", "of", "invalid", "words"} { + actualIdx, ok := GetWordIndex(word) + assert.False(t, ok) + assertEqual(t, actualIdx, 0) + } +} + +func TestNewMnemonic(t *testing.T) { + for _, vector := range testVectors() { + entropy, err := hex.DecodeString(vector.entropy) + assert.Nil(t, err) + + mnemonic, err := NewMnemonic(entropy) + assert.Nil(t, err) + assert.EqualString(t, vector.mnemonic, mnemonic) + + _, err = NewSeedWithErrorChecking(mnemonic, "TREZOR") + assert.Nil(t, err) + + seed := NewSeed(mnemonic, "TREZOR") + assert.EqualString(t, vector.seed, hex.EncodeToString(seed)) + } +} + +func TestNewMnemonicInvalidEntropy(t *testing.T) { + _, err := NewMnemonic([]byte{}) + assert.NotNil(t, err) +} + +func TestNewSeedWithErrorCheckingInvalidMnemonics(t *testing.T) { + for _, vector := range badMnemonicSentences() { + _, err := NewSeedWithErrorChecking(vector.mnemonic, "TREZOR") + assert.NotNil(t, err) + } +} + +func TestIsMnemonicValid(t *testing.T) { + for _, vector := range badMnemonicSentences() { + assert.False(t, IsMnemonicValid(vector.mnemonic)) + } + + for _, vector := range testVectors() { + assert.True(t, IsMnemonicValid(vector.mnemonic)) + } +} + +func TestMnemonicToByteArrayWithRawIsEqualToEntropyFromMnemonic(t *testing.T) { + for _, vector := range testVectors() { + rawEntropy, err := MnemonicToByteArray(vector.mnemonic, true) + assert.Nil(t, err) + rawEntropy2, err := EntropyFromMnemonic(vector.mnemonic) + assert.Nil(t, err) + assert.True(t, bytes.Equal(rawEntropy, rawEntropy2)) + } +} + +func TestMnemonicToByteArrayInvalidMnemonics(t *testing.T) { + for _, vector := range badMnemonicSentences() { + _, err := MnemonicToByteArray(vector.mnemonic) + assert.NotNil(t, err) + } + + _, err := MnemonicToByteArray("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon yellow") + assert.NotNil(t, err) + assertEqual(t, err, ErrChecksumIncorrect) + + _, err = MnemonicToByteArray("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon angry") + assert.NotNil(t, err) + assertEqual(t, err, ErrInvalidMnemonic) +} + +func TestNewEntropy(t *testing.T) { + // Good tests. + for i := 128; i <= 256; i += 32 { + _, err := NewEntropy(i) + assert.Nil(t, err) + } + + // Bad Values + for i := 0; i <= 256; i++ { + if i%8 != 0 { + _, err := NewEntropy(i) + assert.NotNil(t, err) + } + } +} + +func TestMnemonicToByteArrayForDifferentArrayLengths(t *testing.T) { + max := 1000 + for i := 0; i < max; i++ { + //16, 20, 24, 28, 32 + length := 16 + (i%5)*4 + seed := make([]byte, length) + + if n, err := rand.Read(seed); err != nil { + t.Errorf("%v", err) + } else if n != length { + t.Errorf("Wrong number of bytes read: %d", n) + } + + mnemonic, err := NewMnemonic(seed) + if err != nil { + t.Errorf("%v", err) + } + + _, err = MnemonicToByteArray(mnemonic) + if err != nil { + t.Errorf("Failed for %x - %v", seed, mnemonic) + } + } +} +func TestPadByteSlice(t *testing.T) { + assertEqualByteSlices(t, []byte{0}, padByteSlice([]byte{}, 1)) + assertEqualByteSlices(t, []byte{0, 1}, padByteSlice([]byte{1}, 2)) + assertEqualByteSlices(t, []byte{1, 1}, padByteSlice([]byte{1, 1}, 2)) + assertEqualByteSlices(t, []byte{1, 1, 1}, padByteSlice([]byte{1, 1, 1}, 2)) +} + +func TestCompareByteSlices(t *testing.T) { + assert.True(t, compareByteSlices([]byte{}, []byte{})) + assert.True(t, compareByteSlices([]byte{1}, []byte{1})) + assert.False(t, compareByteSlices([]byte{1}, []byte{0})) + assert.False(t, compareByteSlices([]byte{1}, []byte{})) + assert.False(t, compareByteSlices([]byte{1}, nil)) +} + +func TestMnemonicToByteArrayForZeroLeadingSeeds(t *testing.T) { + for _, m := range []string{ + "00000000000000000000000000000000", "00a84c51041d49acca66e6160c1fa999", + "00ca45df1673c76537a2020bfed1dafd", "0019d5871c7b81fd83d474ef1c1e1dae", + "00dcb021afb35ffcdd1d032d2056fc86", "0062be7bd09a27288b6cf0eb565ec739", + "00dc705b5efa0adf25b9734226ba60d4", "0017747418d54c6003fa64fade83374b", + "000d44d3ee7c3dfa45e608c65384431b", "008241c1ef976b0323061affe5bf24b9", + "0011527b8c6ddecb9d0c20beccdeb58d", "001c938c503c8f5a2bba2248ff621546", + "0002f90aaf7a8327698f0031b6317c36", "00bff43071ed7e07f77b14f615993bac", + "00da143e00ef17fc63b6fb22dcc2c326", "00ffc6764fb32a354cab1a3ddefb015d", + "0062ef47e0985e8953f24760b7598cdd", "003bf9765064f71d304908d906c065f5", + "00993851503471439d154b3613947474", "00a6aec77e4d16bea80b50a34991aaba", + "007ad0ffe9eae753a483a76af06dfa67", "00091824db9ec19e663bee51d64c83cc", + "00f48ac621f7e3cb39b2012ac3121543", "0072917415cdca24dfa66c4a92c885b4", + "0027ced2b279ea8a91d29364487cdbf4", "00b9c0d37fb10ba272e55842ad812583", + "004b3d0d2b9285946c687a5350479c8c", "00c7c12a37d3a7f8c1532b17c89b724c", + "00f400c5545f06ae17ad00f3041e4e26", "001e290be10df4d209f247ac5878662b", + "00bf0f74568e582a7dd1ee64f792ec8b", "00d2e43ecde6b72b847db1539ed89e23", + "00cecba6678505bb7bfec8ed307251f6", "000aeed1a9edcbb4bc88f610d3ce84eb", + "00d06206aadfc25c2b21805d283f15ae", "00a31789a2ab2d54f8fadd5331010287", + "003493c5f520e8d5c0483e895a121dc9", "004706112800b76001ece2e268bc830e", + "00ab31e28bb5305be56e38337dbfa486", "006872fe85df6b0fa945248e6f9379d1", + "00717e5e375da6934e3cfdf57edaf3bd", "007f1b46e7b9c4c76e77c434b9bccd6b", + "00dc93735aa35def3b9a2ff676560205", "002cd5dcd881a49c7b87714c6a570a76", + "0013b5af9e13fac87e0c505686cfb6bf", "007ab1ec9526b0bc04b64ae65fd42631", + "00abb4e11d8385c1cca905a6a65e9144", "00574fc62a0501ad8afada2e246708c3", + "005207e0a815bb2da6b4c35ec1f2bf52", "00f3460f136fb9700080099cbd62bc18", + "007a591f204c03ca7b93981237112526", "00cfe0befd428f8e5f83a5bfc801472e", + "00987551ac7a879bf0c09b8bc474d9af", "00cadd3ce3d78e49fbc933a85682df3f", + "00bfbf2e346c855ccc360d03281455a1", "004cdf55d429d028f715544ce22d4f31", + "0075c84a7d15e0ac85e1e41025eed23b", "00807dddd61f71725d336cab844d2cb5", + "00422f21b77fe20e367467ed98c18410", "00b44d0ac622907119c626c850a462fd", + "00363f5e7f22fc49f3cd662a28956563", "000fe5837e68397bbf58db9f221bdc4e", + "0056af33835c888ef0c22599686445d3", "00790a8647fd3dfb38b7e2b6f578f2c6", + "00da8d9009675cb7beec930e263014fb", "00d4b384540a5bb54aa760edaa4fb2fe", + "00be9b1479ed680fdd5d91a41eb926d0", "009182347502af97077c40a6e74b4b5c", + "00f5c90ee1c67fa77fd821f8e9fab4f1", "005568f9a2dd6b0c0cc2f5ba3d9cac38", + "008b481f8678577d9cf6aa3f6cd6056b", "00c4323ece5e4fe3b6cd4c5c932931af", + "009791f7550c3798c5a214cb2d0ea773", "008a7baab22481f0ad8167dd9f90d55c", + "00f0e601519aafdc8ff94975e64c946d", "0083b61e0daa9219df59d697c270cd31", + } { + seed, _ := hex.DecodeString(m) + + mnemonic, err := NewMnemonic(seed) + if err != nil { + t.Errorf("%v", err) + } + + if _, err = MnemonicToByteArray(mnemonic); err != nil { + t.Errorf("Failed for %x - %v", seed, mnemonic) + } + } +} +func TestEntropyFromMnemonic128(t *testing.T) { + testEntropyFromMnemonic(t, 128) +} + +func TestEntropyFromMnemonic160(t *testing.T) { + testEntropyFromMnemonic(t, 160) +} + +func TestEntropyFromMnemonic192(t *testing.T) { + testEntropyFromMnemonic(t, 192) +} + +func TestEntropyFromMnemonic224(t *testing.T) { + testEntropyFromMnemonic(t, 224) +} + +func TestEntropyFromMnemonic256(t *testing.T) { + testEntropyFromMnemonic(t, 256) +} + +func TestEntropyFromMnemonicInvalidChecksum(t *testing.T) { + _, err := EntropyFromMnemonic("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon yellow") + assertEqual(t, ErrChecksumIncorrect, err) +} + +func TestEntropyFromMnemonicInvalidMnemonicSize(t *testing.T) { + for _, mnemonic := range []string{ + "a a a a a a a a a a a a a a a a a a a a a a a a a", // Too many words + "a", // Too few + "a a a a a a a a a a a a a a", // Not multiple of 3 + } { + _, err := EntropyFromMnemonic(mnemonic) + assertEqual(t, ErrInvalidMnemonic, err) + } +} + +func testEntropyFromMnemonic(t *testing.T, bitSize int) { + for i := 0; i < 512; i++ { + expectedEntropy, err := NewEntropy(bitSize) + assert.Nil(t, err) + assert.True(t, len(expectedEntropy) != 0) + + mnemonic, err := NewMnemonic(expectedEntropy) + assert.Nil(t, err) + assert.True(t, len(mnemonic) != 0) + + actualEntropy, err := EntropyFromMnemonic(mnemonic) + assert.Nil(t, err) + assertEqualByteSlices(t, expectedEntropy, actualEntropy) + } +} + +func testVectors() []vector { + return []vector{ + { + entropy: "00000000000000000000000000000000", + mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", + seed: "c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04", + }, + { + entropy: "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f", + mnemonic: "legal winner thank year wave sausage worth useful legal winner thank yellow", + seed: "2e8905819b8723fe2c1d161860e5ee1830318dbf49a83bd451cfb8440c28bd6fa457fe1296106559a3c80937a1c1069be3a3a5bd381ee6260e8d9739fce1f607", + }, + { + entropy: "80808080808080808080808080808080", + mnemonic: "letter advice cage absurd amount doctor acoustic avoid letter advice cage above", + seed: "d71de856f81a8acc65e6fc851a38d4d7ec216fd0796d0a6827a3ad6ed5511a30fa280f12eb2e47ed2ac03b5c462a0358d18d69fe4f985ec81778c1b370b652a8", + }, + { + entropy: "ffffffffffffffffffffffffffffffff", + mnemonic: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong", + seed: "ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069", + }, + { + entropy: "000000000000000000000000000000000000000000000000", + mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon agent", + seed: "035895f2f481b1b0f01fcf8c289c794660b289981a78f8106447707fdd9666ca06da5a9a565181599b79f53b844d8a71dd9f439c52a3d7b3e8a79c906ac845fa", + }, + { + entropy: "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f", + mnemonic: "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will", + seed: "f2b94508732bcbacbcc020faefecfc89feafa6649a5491b8c952cede496c214a0c7b3c392d168748f2d4a612bada0753b52a1c7ac53c1e93abd5c6320b9e95dd", + }, + { + entropy: "808080808080808080808080808080808080808080808080", + mnemonic: "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter always", + seed: "107d7c02a5aa6f38c58083ff74f04c607c2d2c0ecc55501dadd72d025b751bc27fe913ffb796f841c49b1d33b610cf0e91d3aa239027f5e99fe4ce9e5088cd65", + }, + { + entropy: "ffffffffffffffffffffffffffffffffffffffffffffffff", + mnemonic: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo when", + seed: "0cd6e5d827bb62eb8fc1e262254223817fd068a74b5b449cc2f667c3f1f985a76379b43348d952e2265b4cd129090758b3e3c2c49103b5051aac2eaeb890a528", + }, + { + entropy: "0000000000000000000000000000000000000000000000000000000000000000", + mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art", + seed: "bda85446c68413707090a52022edd26a1c9462295029f2e60cd7c4f2bbd3097170af7a4d73245cafa9c3cca8d561a7c3de6f5d4a10be8ed2a5e608d68f92fcc8", + }, + { + entropy: "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f", + mnemonic: "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title", + seed: "bc09fca1804f7e69da93c2f2028eb238c227f2e9dda30cd63699232578480a4021b146ad717fbb7e451ce9eb835f43620bf5c514db0f8add49f5d121449d3e87", + }, + { + entropy: "8080808080808080808080808080808080808080808080808080808080808080", + mnemonic: "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless", + seed: "c0c519bd0e91a2ed54357d9d1ebef6f5af218a153624cf4f2da911a0ed8f7a09e2ef61af0aca007096df430022f7a2b6fb91661a9589097069720d015e4e982f", + }, + { + entropy: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + mnemonic: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo vote", + seed: "dd48c104698c30cfe2b6142103248622fb7bb0ff692eebb00089b32d22484e1613912f0a5b694407be899ffd31ed3992c456cdf60f5d4564b8ba3f05a69890ad", + }, + { + entropy: "77c2b00716cec7213839159e404db50d", + mnemonic: "jelly better achieve collect unaware mountain thought cargo oxygen act hood bridge", + seed: "b5b6d0127db1a9d2226af0c3346031d77af31e918dba64287a1b44b8ebf63cdd52676f672a290aae502472cf2d602c051f3e6f18055e84e4c43897fc4e51a6ff", + }, + { + entropy: "b63a9c59a6e641f288ebc103017f1da9f8290b3da6bdef7b", + mnemonic: "renew stay biology evidence goat welcome casual join adapt armor shuffle fault little machine walk stumble urge swap", + seed: "9248d83e06f4cd98debf5b6f010542760df925ce46cf38a1bdb4e4de7d21f5c39366941c69e1bdbf2966e0f6e6dbece898a0e2f0a4c2b3e640953dfe8b7bbdc5", + }, + { + entropy: "3e141609b97933b66a060dcddc71fad1d91677db872031e85f4c015c5e7e8982", + mnemonic: "dignity pass list indicate nasty swamp pool script soccer toe leaf photo multiply desk host tomato cradle drill spread actor shine dismiss champion exotic", + seed: "ff7f3184df8696d8bef94b6c03114dbee0ef89ff938712301d27ed8336ca89ef9635da20af07d4175f2bf5f3de130f39c9d9e8dd0472489c19b1a020a940da67", + }, + { + entropy: "0460ef47585604c5660618db2e6a7e7f", + mnemonic: "afford alter spike radar gate glance object seek swamp infant panel yellow", + seed: "65f93a9f36b6c85cbe634ffc1f99f2b82cbb10b31edc7f087b4f6cb9e976e9faf76ff41f8f27c99afdf38f7a303ba1136ee48a4c1e7fcd3dba7aa876113a36e4", + }, + { + entropy: "72f60ebac5dd8add8d2a25a797102c3ce21bc029c200076f", + mnemonic: "indicate race push merry suffer human cruise dwarf pole review arch keep canvas theme poem divorce alter left", + seed: "3bbf9daa0dfad8229786ace5ddb4e00fa98a044ae4c4975ffd5e094dba9e0bb289349dbe2091761f30f382d4e35c4a670ee8ab50758d2c55881be69e327117ba", + }, + { + entropy: "2c85efc7f24ee4573d2b81a6ec66cee209b2dcbd09d8eddc51e0215b0b68e416", + mnemonic: "clutch control vehicle tonight unusual clog visa ice plunge glimpse recipe series open hour vintage deposit universe tip job dress radar refuse motion taste", + seed: "fe908f96f46668b2d5b37d82f558c77ed0d69dd0e7e043a5b0511c48c2f1064694a956f86360c93dd04052a8899497ce9e985ebe0c8c52b955e6ae86d4ff4449", + }, + { + entropy: "eaebabb2383351fd31d703840b32e9e2", + mnemonic: "turtle front uncle idea crush write shrug there lottery flower risk shell", + seed: "bdfb76a0759f301b0b899a1e3985227e53b3f51e67e3f2a65363caedf3e32fde42a66c404f18d7b05818c95ef3ca1e5146646856c461c073169467511680876c", + }, + { + entropy: "7ac45cfe7722ee6c7ba84fbc2d5bd61b45cb2fe5eb65aa78", + mnemonic: "kiss carry display unusual confirm curtain upgrade antique rotate hello void custom frequent obey nut hole price segment", + seed: "ed56ff6c833c07982eb7119a8f48fd363c4a9b1601cd2de736b01045c5eb8ab4f57b079403485d1c4924f0790dc10a971763337cb9f9c62226f64fff26397c79", + }, + { + entropy: "4fa1a8bc3e6d80ee1316050e862c1812031493212b7ec3f3bb1b08f168cabeef", + mnemonic: "exile ask congress lamp submit jacket era scheme attend cousin alcohol catch course end lucky hurt sentence oven short ball bird grab wing top", + seed: "095ee6f817b4c2cb30a5a797360a81a40ab0f9a4e25ecd672a3f58a0b5ba0687c096a6b14d2c0deb3bdefce4f61d01ae07417d502429352e27695163f7447a8c", + }, + { + entropy: "18ab19a9f54a9274f03e5209a2ac8a91", + mnemonic: "board flee heavy tunnel powder denial science ski answer betray cargo cat", + seed: "6eff1bb21562918509c73cb990260db07c0ce34ff0e3cc4a8cb3276129fbcb300bddfe005831350efd633909f476c45c88253276d9fd0df6ef48609e8bb7dca8", + }, + { + entropy: "18a2e1d81b8ecfb2a333adcb0c17a5b9eb76cc5d05db91a4", + mnemonic: "board blade invite damage undo sun mimic interest slam gaze truly inherit resist great inject rocket museum chief", + seed: "f84521c777a13b61564234bf8f8b62b3afce27fc4062b51bb5e62bdfecb23864ee6ecf07c1d5a97c0834307c5c852d8ceb88e7c97923c0a3b496bedd4e5f88a9", + }, + { + entropy: "15da872c95a13dd738fbf50e427583ad61f18fd99f628c417a61cf8343c90419", + mnemonic: "beyond stage sleep clip because twist token leaf atom beauty genius food business side grid unable middle armed observe pair crouch tonight away coconut", + seed: "b15509eaa2d09d3efd3e006ef42151b30367dc6e3aa5e44caba3fe4d3e352e65101fbdb86a96776b91946ff06f8eac594dc6ee1d3e82a42dfe1b40fef6bcc3fd", + }, + } +} + +func badMnemonicSentences() []vector { + return []vector{ + {mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon"}, + {mnemonic: "legal winner thank year wave sausage worth useful legal winner thank yellow yellow"}, + {mnemonic: "letter advice cage absurd amount doctor acoustic avoid letter advice caged above"}, + {mnemonic: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo, wrong"}, + {mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon"}, + {mnemonic: "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will will will"}, + {mnemonic: "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter always."}, + {mnemonic: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo why"}, + {mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art art"}, + {mnemonic: "legal winner thank year wave sausage worth useful legal winner thanks year wave worth useful legal winner thank year wave sausage worth title"}, + {mnemonic: "letter advice cage absurd amount doctor acoustic avoid letters advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless"}, + {mnemonic: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo voted"}, + {mnemonic: "jello better achieve collect unaware mountain thought cargo oxygen act hood bridge"}, + {mnemonic: "renew, stay, biology, evidence, goat, welcome, casual, join, adapt, armor, shuffle, fault, little, machine, walk, stumble, urge, swap"}, + {mnemonic: "dignity pass list indicate nasty"}, + + // From issue 32 + {mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon letter"}, + } +} + +func assertEqual(t *testing.T, a, b interface{}) { + if a != b { + t.Errorf("Objects not equal, expected `%s` and got `%s`", a, b) + } +} + +func assertEqualStringsSlices(t *testing.T, a, b []string) { + if len(a) != len(b) { + t.Errorf("String slices not equal, expected %v and got %v", a, b) + return + } + + for i := range a { + if a[i] != b[i] { + t.Errorf("String slices not equal, expected %v and got %v", a, b) + return + } + } +} + +func assertEqualByteSlices(t *testing.T, a, b []byte) { + if !bytes.Equal(a, b) { + t.Errorf("Byte slices not equal, expected %v and got %v", a, b) + return + } +} diff --git a/bip39gen/bip39/example_test.go b/bip39gen/bip39/example_test.go new file mode 100644 index 00000000..b4d0b4e2 --- /dev/null +++ b/bip39gen/bip39/example_test.go @@ -0,0 +1,28 @@ +package bip39_test + +import ( + "encoding/hex" + "fmt" + + "github.com/KiraCore/go-bip39" +) + +func ExampleNewMnemonic() { + // the entropy can be any byte slice, generated how pleased, + // as long its bit size is a multiple of 32 and is within + // the inclusive range of {128,256} + entropy, _ := hex.DecodeString("066dca1a2bb7e8a1db2832148ce9933eea0f3ac9548d793112d9a95c9407efad") + + // generate a mnemomic + mnemomic, _ := bip39.NewMnemonic(entropy) + fmt.Println(mnemomic) + // output: + // all hour make first leader extend hole alien behind guard gospel lava path output census museum junior mass reopen famous sing advance salt reform +} + +func ExampleNewSeed() { + seed := bip39.NewSeed("all hour make first leader extend hole alien behind guard gospel lava path output census museum junior mass reopen famous sing advance salt reform", "TREZOR") + fmt.Println(hex.EncodeToString(seed)) + // output: + // 26e975ec644423f4a4c4f4215ef09b4bd7ef924e85d1d17c4cf3f136c2863cf6df0a475045652c57eb5fb41513ca2a2d67722b77e954b4b3fc11f7590449191d +} diff --git a/bip39gen/bip39/go.mod b/bip39gen/bip39/go.mod new file mode 100644 index 00000000..7ee9635a --- /dev/null +++ b/bip39gen/bip39/go.mod @@ -0,0 +1,8 @@ +module github.com/KiraCore/go-bip39 + +go 1.11 + +require ( + github.com/tyler-smith/assert v1.0.1 + golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 +) diff --git a/bip39gen/bip39/go.sum b/bip39gen/bip39/go.sum new file mode 100644 index 00000000..dbe6ea4a --- /dev/null +++ b/bip39gen/bip39/go.sum @@ -0,0 +1,10 @@ +github.com/tyler-smith/assert v1.0.1 h1:AymyVNGyHOAVaDUEo0WouAMB/wwi5NdbJTDb7lsfFGk= +github.com/tyler-smith/assert v1.0.1/go.mod h1:oPc3QyIN2k0t/9Xp0sNhi3suiWuGXzIcdf/dbKQ6QGk= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bip39gen/bip39/scripts/build.sh b/bip39gen/bip39/scripts/build.sh new file mode 100644 index 00000000..9f0818a5 --- /dev/null +++ b/bip39gen/bip39/scripts/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile + +cd ./bip39 || echo "Already in the root dir" + +. ../../bash-utils/utils.sh + +LOCAL_PLATFORM=$(toLower $(uname)) +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +LOCAL_OUT="${GOBIN}/bip39" + +PLATFORM="$1" && [ -z "$PLATFORM" ] && PLATFORM="$LOCAL_PLATFORM" +ARCH="$2" && [ -z "$ARCH" ] && ARCH="$LOCAL_ARCH" +OUTPUT="$3" && [ -z "$OUTPUT" ] && OUTPUT="$LOCAL_OUT" + +CONSTANS_FILE=./bip39.go +VERSION=$(grep -Fn -m 1 'Bip39Version ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: Bip39Version was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old bip39 binary" + +go mod tidy +GO111MODULE=on go mod verify +env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ diff --git a/bip39gen/bip39/scripts/test.sh b/bip39gen/bip39/scripts/test.sh new file mode 100644 index 00000000..ca592107 --- /dev/null +++ b/bip39gen/bip39/scripts/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile + +cd ./bip39 || echo "Already in the root dir" + +. ../../bash-utils/utils.sh + +go test -v -coverprofile=coverage.out ./... +go tool cover -html=coverage.out +go test -v -cover ./... \ No newline at end of file diff --git a/bip39gen/bip39/wordlists/chinese_simplified.go b/bip39gen/bip39/wordlists/chinese_simplified.go new file mode 100644 index 00000000..0ee29727 --- /dev/null +++ b/bip39gen/bip39/wordlists/chinese_simplified.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/chinese_simplified.txt + // $ crc32 chinese_simplified.txt + // e3721bbf + checksum := crc32.ChecksumIEEE([]byte(chineseSimplified)) + if fmt.Sprintf("%x", checksum) != "e3721bbf" { + panic("chineseSimplified checksum invalid") + } +} + +// ChineseSimplified is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/chinese_simplified.txt +var ChineseSimplified = strings.Split(strings.TrimSpace(chineseSimplified), "\n") +var chineseSimplified = `的 +一 +是 +在 +不 +了 +有 +和 +人 +这 +中 +大 +为 +上 +个 +国 +我 +以 +要 +他 +时 +来 +用 +们 +生 +到 +作 +地 +于 +出 +就 +分 +对 +成 +会 +可 +主 +发 +年 +动 +同 +工 +也 +能 +下 +过 +子 +说 +产 +种 +面 +而 +方 +后 +多 +定 +行 +学 +法 +所 +民 +得 +经 +十 +三 +之 +进 +着 +等 +部 +度 +家 +电 +力 +里 +如 +水 +化 +高 +自 +二 +理 +起 +小 +物 +现 +实 +加 +量 +都 +两 +体 +制 +机 +当 +使 +点 +从 +业 +本 +去 +把 +性 +好 +应 +开 +它 +合 +还 +因 +由 +其 +些 +然 +前 +外 +天 +政 +四 +日 +那 +社 +义 +事 +平 +形 +相 +全 +表 +间 +样 +与 +关 +各 +重 +新 +线 +内 +数 +正 +心 +反 +你 +明 +看 +原 +又 +么 +利 +比 +或 +但 +质 +气 +第 +向 +道 +命 +此 +变 +条 +只 +没 +结 +解 +问 +意 +建 +月 +公 +无 +系 +军 +很 +情 +者 +最 +立 +代 +想 +已 +通 +并 +提 +直 +题 +党 +程 +展 +五 +果 +料 +象 +员 +革 +位 +入 +常 +文 +总 +次 +品 +式 +活 +设 +及 +管 +特 +件 +长 +求 +老 +头 +基 +资 +边 +流 +路 +级 +少 +图 +山 +统 +接 +知 +较 +将 +组 +见 +计 +别 +她 +手 +角 +期 +根 +论 +运 +农 +指 +几 +九 +区 +强 +放 +决 +西 +被 +干 +做 +必 +战 +先 +回 +则 +任 +取 +据 +处 +队 +南 +给 +色 +光 +门 +即 +保 +治 +北 +造 +百 +规 +热 +领 +七 +海 +口 +东 +导 +器 +压 +志 +世 +金 +增 +争 +济 +阶 +油 +思 +术 +极 +交 +受 +联 +什 +认 +六 +共 +权 +收 +证 +改 +清 +美 +再 +采 +转 +更 +单 +风 +切 +打 +白 +教 +速 +花 +带 +安 +场 +身 +车 +例 +真 +务 +具 +万 +每 +目 +至 +达 +走 +积 +示 +议 +声 +报 +斗 +完 +类 +八 +离 +华 +名 +确 +才 +科 +张 +信 +马 +节 +话 +米 +整 +空 +元 +况 +今 +集 +温 +传 +土 +许 +步 +群 +广 +石 +记 +需 +段 +研 +界 +拉 +林 +律 +叫 +且 +究 +观 +越 +织 +装 +影 +算 +低 +持 +音 +众 +书 +布 +复 +容 +儿 +须 +际 +商 +非 +验 +连 +断 +深 +难 +近 +矿 +千 +周 +委 +素 +技 +备 +半 +办 +青 +省 +列 +习 +响 +约 +支 +般 +史 +感 +劳 +便 +团 +往 +酸 +历 +市 +克 +何 +除 +消 +构 +府 +称 +太 +准 +精 +值 +号 +率 +族 +维 +划 +选 +标 +写 +存 +候 +毛 +亲 +快 +效 +斯 +院 +查 +江 +型 +眼 +王 +按 +格 +养 +易 +置 +派 +层 +片 +始 +却 +专 +状 +育 +厂 +京 +识 +适 +属 +圆 +包 +火 +住 +调 +满 +县 +局 +照 +参 +红 +细 +引 +听 +该 +铁 +价 +严 +首 +底 +液 +官 +德 +随 +病 +苏 +失 +尔 +死 +讲 +配 +女 +黄 +推 +显 +谈 +罪 +神 +艺 +呢 +席 +含 +企 +望 +密 +批 +营 +项 +防 +举 +球 +英 +氧 +势 +告 +李 +台 +落 +木 +帮 +轮 +破 +亚 +师 +围 +注 +远 +字 +材 +排 +供 +河 +态 +封 +另 +施 +减 +树 +溶 +怎 +止 +案 +言 +士 +均 +武 +固 +叶 +鱼 +波 +视 +仅 +费 +紧 +爱 +左 +章 +早 +朝 +害 +续 +轻 +服 +试 +食 +充 +兵 +源 +判 +护 +司 +足 +某 +练 +差 +致 +板 +田 +降 +黑 +犯 +负 +击 +范 +继 +兴 +似 +余 +坚 +曲 +输 +修 +故 +城 +夫 +够 +送 +笔 +船 +占 +右 +财 +吃 +富 +春 +职 +觉 +汉 +画 +功 +巴 +跟 +虽 +杂 +飞 +检 +吸 +助 +升 +阳 +互 +初 +创 +抗 +考 +投 +坏 +策 +古 +径 +换 +未 +跑 +留 +钢 +曾 +端 +责 +站 +简 +述 +钱 +副 +尽 +帝 +射 +草 +冲 +承 +独 +令 +限 +阿 +宣 +环 +双 +请 +超 +微 +让 +控 +州 +良 +轴 +找 +否 +纪 +益 +依 +优 +顶 +础 +载 +倒 +房 +突 +坐 +粉 +敌 +略 +客 +袁 +冷 +胜 +绝 +析 +块 +剂 +测 +丝 +协 +诉 +念 +陈 +仍 +罗 +盐 +友 +洋 +错 +苦 +夜 +刑 +移 +频 +逐 +靠 +混 +母 +短 +皮 +终 +聚 +汽 +村 +云 +哪 +既 +距 +卫 +停 +烈 +央 +察 +烧 +迅 +境 +若 +印 +洲 +刻 +括 +激 +孔 +搞 +甚 +室 +待 +核 +校 +散 +侵 +吧 +甲 +游 +久 +菜 +味 +旧 +模 +湖 +货 +损 +预 +阻 +毫 +普 +稳 +乙 +妈 +植 +息 +扩 +银 +语 +挥 +酒 +守 +拿 +序 +纸 +医 +缺 +雨 +吗 +针 +刘 +啊 +急 +唱 +误 +训 +愿 +审 +附 +获 +茶 +鲜 +粮 +斤 +孩 +脱 +硫 +肥 +善 +龙 +演 +父 +渐 +血 +欢 +械 +掌 +歌 +沙 +刚 +攻 +谓 +盾 +讨 +晚 +粒 +乱 +燃 +矛 +乎 +杀 +药 +宁 +鲁 +贵 +钟 +煤 +读 +班 +伯 +香 +介 +迫 +句 +丰 +培 +握 +兰 +担 +弦 +蛋 +沉 +假 +穿 +执 +答 +乐 +谁 +顺 +烟 +缩 +征 +脸 +喜 +松 +脚 +困 +异 +免 +背 +星 +福 +买 +染 +井 +概 +慢 +怕 +磁 +倍 +祖 +皇 +促 +静 +补 +评 +翻 +肉 +践 +尼 +衣 +宽 +扬 +棉 +希 +伤 +操 +垂 +秋 +宜 +氢 +套 +督 +振 +架 +亮 +末 +宪 +庆 +编 +牛 +触 +映 +雷 +销 +诗 +座 +居 +抓 +裂 +胞 +呼 +娘 +景 +威 +绿 +晶 +厚 +盟 +衡 +鸡 +孙 +延 +危 +胶 +屋 +乡 +临 +陆 +顾 +掉 +呀 +灯 +岁 +措 +束 +耐 +剧 +玉 +赵 +跳 +哥 +季 +课 +凯 +胡 +额 +款 +绍 +卷 +齐 +伟 +蒸 +殖 +永 +宗 +苗 +川 +炉 +岩 +弱 +零 +杨 +奏 +沿 +露 +杆 +探 +滑 +镇 +饭 +浓 +航 +怀 +赶 +库 +夺 +伊 +灵 +税 +途 +灭 +赛 +归 +召 +鼓 +播 +盘 +裁 +险 +康 +唯 +录 +菌 +纯 +借 +糖 +盖 +横 +符 +私 +努 +堂 +域 +枪 +润 +幅 +哈 +竟 +熟 +虫 +泽 +脑 +壤 +碳 +欧 +遍 +侧 +寨 +敢 +彻 +虑 +斜 +薄 +庭 +纳 +弹 +饲 +伸 +折 +麦 +湿 +暗 +荷 +瓦 +塞 +床 +筑 +恶 +户 +访 +塔 +奇 +透 +梁 +刀 +旋 +迹 +卡 +氯 +遇 +份 +毒 +泥 +退 +洗 +摆 +灰 +彩 +卖 +耗 +夏 +择 +忙 +铜 +献 +硬 +予 +繁 +圈 +雪 +函 +亦 +抽 +篇 +阵 +阴 +丁 +尺 +追 +堆 +雄 +迎 +泛 +爸 +楼 +避 +谋 +吨 +野 +猪 +旗 +累 +偏 +典 +馆 +索 +秦 +脂 +潮 +爷 +豆 +忽 +托 +惊 +塑 +遗 +愈 +朱 +替 +纤 +粗 +倾 +尚 +痛 +楚 +谢 +奋 +购 +磨 +君 +池 +旁 +碎 +骨 +监 +捕 +弟 +暴 +割 +贯 +殊 +释 +词 +亡 +壁 +顿 +宝 +午 +尘 +闻 +揭 +炮 +残 +冬 +桥 +妇 +警 +综 +招 +吴 +付 +浮 +遭 +徐 +您 +摇 +谷 +赞 +箱 +隔 +订 +男 +吹 +园 +纷 +唐 +败 +宋 +玻 +巨 +耕 +坦 +荣 +闭 +湾 +键 +凡 +驻 +锅 +救 +恩 +剥 +凝 +碱 +齿 +截 +炼 +麻 +纺 +禁 +废 +盛 +版 +缓 +净 +睛 +昌 +婚 +涉 +筒 +嘴 +插 +岸 +朗 +庄 +街 +藏 +姑 +贸 +腐 +奴 +啦 +惯 +乘 +伙 +恢 +匀 +纱 +扎 +辩 +耳 +彪 +臣 +亿 +璃 +抵 +脉 +秀 +萨 +俄 +网 +舞 +店 +喷 +纵 +寸 +汗 +挂 +洪 +贺 +闪 +柬 +爆 +烯 +津 +稻 +墙 +软 +勇 +像 +滚 +厘 +蒙 +芳 +肯 +坡 +柱 +荡 +腿 +仪 +旅 +尾 +轧 +冰 +贡 +登 +黎 +削 +钻 +勒 +逃 +障 +氨 +郭 +峰 +币 +港 +伏 +轨 +亩 +毕 +擦 +莫 +刺 +浪 +秘 +援 +株 +健 +售 +股 +岛 +甘 +泡 +睡 +童 +铸 +汤 +阀 +休 +汇 +舍 +牧 +绕 +炸 +哲 +磷 +绩 +朋 +淡 +尖 +启 +陷 +柴 +呈 +徒 +颜 +泪 +稍 +忘 +泵 +蓝 +拖 +洞 +授 +镜 +辛 +壮 +锋 +贫 +虚 +弯 +摩 +泰 +幼 +廷 +尊 +窗 +纲 +弄 +隶 +疑 +氏 +宫 +姐 +震 +瑞 +怪 +尤 +琴 +循 +描 +膜 +违 +夹 +腰 +缘 +珠 +穷 +森 +枝 +竹 +沟 +催 +绳 +忆 +邦 +剩 +幸 +浆 +栏 +拥 +牙 +贮 +礼 +滤 +钠 +纹 +罢 +拍 +咱 +喊 +袖 +埃 +勤 +罚 +焦 +潜 +伍 +墨 +欲 +缝 +姓 +刊 +饱 +仿 +奖 +铝 +鬼 +丽 +跨 +默 +挖 +链 +扫 +喝 +袋 +炭 +污 +幕 +诸 +弧 +励 +梅 +奶 +洁 +灾 +舟 +鉴 +苯 +讼 +抱 +毁 +懂 +寒 +智 +埔 +寄 +届 +跃 +渡 +挑 +丹 +艰 +贝 +碰 +拔 +爹 +戴 +码 +梦 +芽 +熔 +赤 +渔 +哭 +敬 +颗 +奔 +铅 +仲 +虎 +稀 +妹 +乏 +珍 +申 +桌 +遵 +允 +隆 +螺 +仓 +魏 +锐 +晓 +氮 +兼 +隐 +碍 +赫 +拨 +忠 +肃 +缸 +牵 +抢 +博 +巧 +壳 +兄 +杜 +讯 +诚 +碧 +祥 +柯 +页 +巡 +矩 +悲 +灌 +龄 +伦 +票 +寻 +桂 +铺 +圣 +恐 +恰 +郑 +趣 +抬 +荒 +腾 +贴 +柔 +滴 +猛 +阔 +辆 +妻 +填 +撤 +储 +签 +闹 +扰 +紫 +砂 +递 +戏 +吊 +陶 +伐 +喂 +疗 +瓶 +婆 +抚 +臂 +摸 +忍 +虾 +蜡 +邻 +胸 +巩 +挤 +偶 +弃 +槽 +劲 +乳 +邓 +吉 +仁 +烂 +砖 +租 +乌 +舰 +伴 +瓜 +浅 +丙 +暂 +燥 +橡 +柳 +迷 +暖 +牌 +秧 +胆 +详 +簧 +踏 +瓷 +谱 +呆 +宾 +糊 +洛 +辉 +愤 +竞 +隙 +怒 +粘 +乃 +绪 +肩 +籍 +敏 +涂 +熙 +皆 +侦 +悬 +掘 +享 +纠 +醒 +狂 +锁 +淀 +恨 +牲 +霸 +爬 +赏 +逆 +玩 +陵 +祝 +秒 +浙 +貌 +役 +彼 +悉 +鸭 +趋 +凤 +晨 +畜 +辈 +秩 +卵 +署 +梯 +炎 +滩 +棋 +驱 +筛 +峡 +冒 +啥 +寿 +译 +浸 +泉 +帽 +迟 +硅 +疆 +贷 +漏 +稿 +冠 +嫩 +胁 +芯 +牢 +叛 +蚀 +奥 +鸣 +岭 +羊 +凭 +串 +塘 +绘 +酵 +融 +盆 +锡 +庙 +筹 +冻 +辅 +摄 +袭 +筋 +拒 +僚 +旱 +钾 +鸟 +漆 +沈 +眉 +疏 +添 +棒 +穗 +硝 +韩 +逼 +扭 +侨 +凉 +挺 +碗 +栽 +炒 +杯 +患 +馏 +劝 +豪 +辽 +勃 +鸿 +旦 +吏 +拜 +狗 +埋 +辊 +掩 +饮 +搬 +骂 +辞 +勾 +扣 +估 +蒋 +绒 +雾 +丈 +朵 +姆 +拟 +宇 +辑 +陕 +雕 +偿 +蓄 +崇 +剪 +倡 +厅 +咬 +驶 +薯 +刷 +斥 +番 +赋 +奉 +佛 +浇 +漫 +曼 +扇 +钙 +桃 +扶 +仔 +返 +俗 +亏 +腔 +鞋 +棱 +覆 +框 +悄 +叔 +撞 +骗 +勘 +旺 +沸 +孤 +吐 +孟 +渠 +屈 +疾 +妙 +惜 +仰 +狠 +胀 +谐 +抛 +霉 +桑 +岗 +嘛 +衰 +盗 +渗 +脏 +赖 +涌 +甜 +曹 +阅 +肌 +哩 +厉 +烃 +纬 +毅 +昨 +伪 +症 +煮 +叹 +钉 +搭 +茎 +笼 +酷 +偷 +弓 +锥 +恒 +杰 +坑 +鼻 +翼 +纶 +叙 +狱 +逮 +罐 +络 +棚 +抑 +膨 +蔬 +寺 +骤 +穆 +冶 +枯 +册 +尸 +凸 +绅 +坯 +牺 +焰 +轰 +欣 +晋 +瘦 +御 +锭 +锦 +丧 +旬 +锻 +垄 +搜 +扑 +邀 +亭 +酯 +迈 +舒 +脆 +酶 +闲 +忧 +酚 +顽 +羽 +涨 +卸 +仗 +陪 +辟 +惩 +杭 +姚 +肚 +捉 +飘 +漂 +昆 +欺 +吾 +郎 +烷 +汁 +呵 +饰 +萧 +雅 +邮 +迁 +燕 +撒 +姻 +赴 +宴 +烦 +债 +帐 +斑 +铃 +旨 +醇 +董 +饼 +雏 +姿 +拌 +傅 +腹 +妥 +揉 +贤 +拆 +歪 +葡 +胺 +丢 +浩 +徽 +昂 +垫 +挡 +览 +贪 +慰 +缴 +汪 +慌 +冯 +诺 +姜 +谊 +凶 +劣 +诬 +耀 +昏 +躺 +盈 +骑 +乔 +溪 +丛 +卢 +抹 +闷 +咨 +刮 +驾 +缆 +悟 +摘 +铒 +掷 +颇 +幻 +柄 +惠 +惨 +佳 +仇 +腊 +窝 +涤 +剑 +瞧 +堡 +泼 +葱 +罩 +霍 +捞 +胎 +苍 +滨 +俩 +捅 +湘 +砍 +霞 +邵 +萄 +疯 +淮 +遂 +熊 +粪 +烘 +宿 +档 +戈 +驳 +嫂 +裕 +徙 +箭 +捐 +肠 +撑 +晒 +辨 +殿 +莲 +摊 +搅 +酱 +屏 +疫 +哀 +蔡 +堵 +沫 +皱 +畅 +叠 +阁 +莱 +敲 +辖 +钩 +痕 +坝 +巷 +饿 +祸 +丘 +玄 +溜 +曰 +逻 +彭 +尝 +卿 +妨 +艇 +吞 +韦 +怨 +矮 +歇 +` diff --git a/bip39gen/bip39/wordlists/chinese_traditional.go b/bip39gen/bip39/wordlists/chinese_traditional.go new file mode 100644 index 00000000..83812cee --- /dev/null +++ b/bip39gen/bip39/wordlists/chinese_traditional.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/chinese_traditional.txt + // $ crc32 chinese_traditional.txt + // 3c20b443 + checksum := crc32.ChecksumIEEE([]byte(chineseTraditional)) + if fmt.Sprintf("%x", checksum) != "3c20b443" { + panic("chineseTraditional checksum invalid") + } +} + +// ChineseTraditional is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/chinese_traditional.txt +var ChineseTraditional = strings.Split(strings.TrimSpace(chineseTraditional), "\n") +var chineseTraditional = `的 +一 +是 +在 +不 +了 +有 +和 +人 +這 +中 +大 +為 +上 +個 +國 +我 +以 +要 +他 +時 +來 +用 +們 +生 +到 +作 +地 +於 +出 +就 +分 +對 +成 +會 +可 +主 +發 +年 +動 +同 +工 +也 +能 +下 +過 +子 +說 +產 +種 +面 +而 +方 +後 +多 +定 +行 +學 +法 +所 +民 +得 +經 +十 +三 +之 +進 +著 +等 +部 +度 +家 +電 +力 +裡 +如 +水 +化 +高 +自 +二 +理 +起 +小 +物 +現 +實 +加 +量 +都 +兩 +體 +制 +機 +當 +使 +點 +從 +業 +本 +去 +把 +性 +好 +應 +開 +它 +合 +還 +因 +由 +其 +些 +然 +前 +外 +天 +政 +四 +日 +那 +社 +義 +事 +平 +形 +相 +全 +表 +間 +樣 +與 +關 +各 +重 +新 +線 +內 +數 +正 +心 +反 +你 +明 +看 +原 +又 +麼 +利 +比 +或 +但 +質 +氣 +第 +向 +道 +命 +此 +變 +條 +只 +沒 +結 +解 +問 +意 +建 +月 +公 +無 +系 +軍 +很 +情 +者 +最 +立 +代 +想 +已 +通 +並 +提 +直 +題 +黨 +程 +展 +五 +果 +料 +象 +員 +革 +位 +入 +常 +文 +總 +次 +品 +式 +活 +設 +及 +管 +特 +件 +長 +求 +老 +頭 +基 +資 +邊 +流 +路 +級 +少 +圖 +山 +統 +接 +知 +較 +將 +組 +見 +計 +別 +她 +手 +角 +期 +根 +論 +運 +農 +指 +幾 +九 +區 +強 +放 +決 +西 +被 +幹 +做 +必 +戰 +先 +回 +則 +任 +取 +據 +處 +隊 +南 +給 +色 +光 +門 +即 +保 +治 +北 +造 +百 +規 +熱 +領 +七 +海 +口 +東 +導 +器 +壓 +志 +世 +金 +增 +爭 +濟 +階 +油 +思 +術 +極 +交 +受 +聯 +什 +認 +六 +共 +權 +收 +證 +改 +清 +美 +再 +採 +轉 +更 +單 +風 +切 +打 +白 +教 +速 +花 +帶 +安 +場 +身 +車 +例 +真 +務 +具 +萬 +每 +目 +至 +達 +走 +積 +示 +議 +聲 +報 +鬥 +完 +類 +八 +離 +華 +名 +確 +才 +科 +張 +信 +馬 +節 +話 +米 +整 +空 +元 +況 +今 +集 +溫 +傳 +土 +許 +步 +群 +廣 +石 +記 +需 +段 +研 +界 +拉 +林 +律 +叫 +且 +究 +觀 +越 +織 +裝 +影 +算 +低 +持 +音 +眾 +書 +布 +复 +容 +兒 +須 +際 +商 +非 +驗 +連 +斷 +深 +難 +近 +礦 +千 +週 +委 +素 +技 +備 +半 +辦 +青 +省 +列 +習 +響 +約 +支 +般 +史 +感 +勞 +便 +團 +往 +酸 +歷 +市 +克 +何 +除 +消 +構 +府 +稱 +太 +準 +精 +值 +號 +率 +族 +維 +劃 +選 +標 +寫 +存 +候 +毛 +親 +快 +效 +斯 +院 +查 +江 +型 +眼 +王 +按 +格 +養 +易 +置 +派 +層 +片 +始 +卻 +專 +狀 +育 +廠 +京 +識 +適 +屬 +圓 +包 +火 +住 +調 +滿 +縣 +局 +照 +參 +紅 +細 +引 +聽 +該 +鐵 +價 +嚴 +首 +底 +液 +官 +德 +隨 +病 +蘇 +失 +爾 +死 +講 +配 +女 +黃 +推 +顯 +談 +罪 +神 +藝 +呢 +席 +含 +企 +望 +密 +批 +營 +項 +防 +舉 +球 +英 +氧 +勢 +告 +李 +台 +落 +木 +幫 +輪 +破 +亞 +師 +圍 +注 +遠 +字 +材 +排 +供 +河 +態 +封 +另 +施 +減 +樹 +溶 +怎 +止 +案 +言 +士 +均 +武 +固 +葉 +魚 +波 +視 +僅 +費 +緊 +愛 +左 +章 +早 +朝 +害 +續 +輕 +服 +試 +食 +充 +兵 +源 +判 +護 +司 +足 +某 +練 +差 +致 +板 +田 +降 +黑 +犯 +負 +擊 +范 +繼 +興 +似 +餘 +堅 +曲 +輸 +修 +故 +城 +夫 +夠 +送 +筆 +船 +佔 +右 +財 +吃 +富 +春 +職 +覺 +漢 +畫 +功 +巴 +跟 +雖 +雜 +飛 +檢 +吸 +助 +昇 +陽 +互 +初 +創 +抗 +考 +投 +壞 +策 +古 +徑 +換 +未 +跑 +留 +鋼 +曾 +端 +責 +站 +簡 +述 +錢 +副 +盡 +帝 +射 +草 +衝 +承 +獨 +令 +限 +阿 +宣 +環 +雙 +請 +超 +微 +讓 +控 +州 +良 +軸 +找 +否 +紀 +益 +依 +優 +頂 +礎 +載 +倒 +房 +突 +坐 +粉 +敵 +略 +客 +袁 +冷 +勝 +絕 +析 +塊 +劑 +測 +絲 +協 +訴 +念 +陳 +仍 +羅 +鹽 +友 +洋 +錯 +苦 +夜 +刑 +移 +頻 +逐 +靠 +混 +母 +短 +皮 +終 +聚 +汽 +村 +雲 +哪 +既 +距 +衛 +停 +烈 +央 +察 +燒 +迅 +境 +若 +印 +洲 +刻 +括 +激 +孔 +搞 +甚 +室 +待 +核 +校 +散 +侵 +吧 +甲 +遊 +久 +菜 +味 +舊 +模 +湖 +貨 +損 +預 +阻 +毫 +普 +穩 +乙 +媽 +植 +息 +擴 +銀 +語 +揮 +酒 +守 +拿 +序 +紙 +醫 +缺 +雨 +嗎 +針 +劉 +啊 +急 +唱 +誤 +訓 +願 +審 +附 +獲 +茶 +鮮 +糧 +斤 +孩 +脫 +硫 +肥 +善 +龍 +演 +父 +漸 +血 +歡 +械 +掌 +歌 +沙 +剛 +攻 +謂 +盾 +討 +晚 +粒 +亂 +燃 +矛 +乎 +殺 +藥 +寧 +魯 +貴 +鐘 +煤 +讀 +班 +伯 +香 +介 +迫 +句 +豐 +培 +握 +蘭 +擔 +弦 +蛋 +沉 +假 +穿 +執 +答 +樂 +誰 +順 +煙 +縮 +徵 +臉 +喜 +松 +腳 +困 +異 +免 +背 +星 +福 +買 +染 +井 +概 +慢 +怕 +磁 +倍 +祖 +皇 +促 +靜 +補 +評 +翻 +肉 +踐 +尼 +衣 +寬 +揚 +棉 +希 +傷 +操 +垂 +秋 +宜 +氫 +套 +督 +振 +架 +亮 +末 +憲 +慶 +編 +牛 +觸 +映 +雷 +銷 +詩 +座 +居 +抓 +裂 +胞 +呼 +娘 +景 +威 +綠 +晶 +厚 +盟 +衡 +雞 +孫 +延 +危 +膠 +屋 +鄉 +臨 +陸 +顧 +掉 +呀 +燈 +歲 +措 +束 +耐 +劇 +玉 +趙 +跳 +哥 +季 +課 +凱 +胡 +額 +款 +紹 +卷 +齊 +偉 +蒸 +殖 +永 +宗 +苗 +川 +爐 +岩 +弱 +零 +楊 +奏 +沿 +露 +桿 +探 +滑 +鎮 +飯 +濃 +航 +懷 +趕 +庫 +奪 +伊 +靈 +稅 +途 +滅 +賽 +歸 +召 +鼓 +播 +盤 +裁 +險 +康 +唯 +錄 +菌 +純 +借 +糖 +蓋 +橫 +符 +私 +努 +堂 +域 +槍 +潤 +幅 +哈 +竟 +熟 +蟲 +澤 +腦 +壤 +碳 +歐 +遍 +側 +寨 +敢 +徹 +慮 +斜 +薄 +庭 +納 +彈 +飼 +伸 +折 +麥 +濕 +暗 +荷 +瓦 +塞 +床 +築 +惡 +戶 +訪 +塔 +奇 +透 +梁 +刀 +旋 +跡 +卡 +氯 +遇 +份 +毒 +泥 +退 +洗 +擺 +灰 +彩 +賣 +耗 +夏 +擇 +忙 +銅 +獻 +硬 +予 +繁 +圈 +雪 +函 +亦 +抽 +篇 +陣 +陰 +丁 +尺 +追 +堆 +雄 +迎 +泛 +爸 +樓 +避 +謀 +噸 +野 +豬 +旗 +累 +偏 +典 +館 +索 +秦 +脂 +潮 +爺 +豆 +忽 +托 +驚 +塑 +遺 +愈 +朱 +替 +纖 +粗 +傾 +尚 +痛 +楚 +謝 +奮 +購 +磨 +君 +池 +旁 +碎 +骨 +監 +捕 +弟 +暴 +割 +貫 +殊 +釋 +詞 +亡 +壁 +頓 +寶 +午 +塵 +聞 +揭 +炮 +殘 +冬 +橋 +婦 +警 +綜 +招 +吳 +付 +浮 +遭 +徐 +您 +搖 +谷 +贊 +箱 +隔 +訂 +男 +吹 +園 +紛 +唐 +敗 +宋 +玻 +巨 +耕 +坦 +榮 +閉 +灣 +鍵 +凡 +駐 +鍋 +救 +恩 +剝 +凝 +鹼 +齒 +截 +煉 +麻 +紡 +禁 +廢 +盛 +版 +緩 +淨 +睛 +昌 +婚 +涉 +筒 +嘴 +插 +岸 +朗 +莊 +街 +藏 +姑 +貿 +腐 +奴 +啦 +慣 +乘 +夥 +恢 +勻 +紗 +扎 +辯 +耳 +彪 +臣 +億 +璃 +抵 +脈 +秀 +薩 +俄 +網 +舞 +店 +噴 +縱 +寸 +汗 +掛 +洪 +賀 +閃 +柬 +爆 +烯 +津 +稻 +牆 +軟 +勇 +像 +滾 +厘 +蒙 +芳 +肯 +坡 +柱 +盪 +腿 +儀 +旅 +尾 +軋 +冰 +貢 +登 +黎 +削 +鑽 +勒 +逃 +障 +氨 +郭 +峰 +幣 +港 +伏 +軌 +畝 +畢 +擦 +莫 +刺 +浪 +秘 +援 +株 +健 +售 +股 +島 +甘 +泡 +睡 +童 +鑄 +湯 +閥 +休 +匯 +舍 +牧 +繞 +炸 +哲 +磷 +績 +朋 +淡 +尖 +啟 +陷 +柴 +呈 +徒 +顏 +淚 +稍 +忘 +泵 +藍 +拖 +洞 +授 +鏡 +辛 +壯 +鋒 +貧 +虛 +彎 +摩 +泰 +幼 +廷 +尊 +窗 +綱 +弄 +隸 +疑 +氏 +宮 +姐 +震 +瑞 +怪 +尤 +琴 +循 +描 +膜 +違 +夾 +腰 +緣 +珠 +窮 +森 +枝 +竹 +溝 +催 +繩 +憶 +邦 +剩 +幸 +漿 +欄 +擁 +牙 +貯 +禮 +濾 +鈉 +紋 +罷 +拍 +咱 +喊 +袖 +埃 +勤 +罰 +焦 +潛 +伍 +墨 +欲 +縫 +姓 +刊 +飽 +仿 +獎 +鋁 +鬼 +麗 +跨 +默 +挖 +鏈 +掃 +喝 +袋 +炭 +污 +幕 +諸 +弧 +勵 +梅 +奶 +潔 +災 +舟 +鑑 +苯 +訟 +抱 +毀 +懂 +寒 +智 +埔 +寄 +屆 +躍 +渡 +挑 +丹 +艱 +貝 +碰 +拔 +爹 +戴 +碼 +夢 +芽 +熔 +赤 +漁 +哭 +敬 +顆 +奔 +鉛 +仲 +虎 +稀 +妹 +乏 +珍 +申 +桌 +遵 +允 +隆 +螺 +倉 +魏 +銳 +曉 +氮 +兼 +隱 +礙 +赫 +撥 +忠 +肅 +缸 +牽 +搶 +博 +巧 +殼 +兄 +杜 +訊 +誠 +碧 +祥 +柯 +頁 +巡 +矩 +悲 +灌 +齡 +倫 +票 +尋 +桂 +鋪 +聖 +恐 +恰 +鄭 +趣 +抬 +荒 +騰 +貼 +柔 +滴 +猛 +闊 +輛 +妻 +填 +撤 +儲 +簽 +鬧 +擾 +紫 +砂 +遞 +戲 +吊 +陶 +伐 +餵 +療 +瓶 +婆 +撫 +臂 +摸 +忍 +蝦 +蠟 +鄰 +胸 +鞏 +擠 +偶 +棄 +槽 +勁 +乳 +鄧 +吉 +仁 +爛 +磚 +租 +烏 +艦 +伴 +瓜 +淺 +丙 +暫 +燥 +橡 +柳 +迷 +暖 +牌 +秧 +膽 +詳 +簧 +踏 +瓷 +譜 +呆 +賓 +糊 +洛 +輝 +憤 +競 +隙 +怒 +粘 +乃 +緒 +肩 +籍 +敏 +塗 +熙 +皆 +偵 +懸 +掘 +享 +糾 +醒 +狂 +鎖 +淀 +恨 +牲 +霸 +爬 +賞 +逆 +玩 +陵 +祝 +秒 +浙 +貌 +役 +彼 +悉 +鴨 +趨 +鳳 +晨 +畜 +輩 +秩 +卵 +署 +梯 +炎 +灘 +棋 +驅 +篩 +峽 +冒 +啥 +壽 +譯 +浸 +泉 +帽 +遲 +矽 +疆 +貸 +漏 +稿 +冠 +嫩 +脅 +芯 +牢 +叛 +蝕 +奧 +鳴 +嶺 +羊 +憑 +串 +塘 +繪 +酵 +融 +盆 +錫 +廟 +籌 +凍 +輔 +攝 +襲 +筋 +拒 +僚 +旱 +鉀 +鳥 +漆 +沈 +眉 +疏 +添 +棒 +穗 +硝 +韓 +逼 +扭 +僑 +涼 +挺 +碗 +栽 +炒 +杯 +患 +餾 +勸 +豪 +遼 +勃 +鴻 +旦 +吏 +拜 +狗 +埋 +輥 +掩 +飲 +搬 +罵 +辭 +勾 +扣 +估 +蔣 +絨 +霧 +丈 +朵 +姆 +擬 +宇 +輯 +陝 +雕 +償 +蓄 +崇 +剪 +倡 +廳 +咬 +駛 +薯 +刷 +斥 +番 +賦 +奉 +佛 +澆 +漫 +曼 +扇 +鈣 +桃 +扶 +仔 +返 +俗 +虧 +腔 +鞋 +棱 +覆 +框 +悄 +叔 +撞 +騙 +勘 +旺 +沸 +孤 +吐 +孟 +渠 +屈 +疾 +妙 +惜 +仰 +狠 +脹 +諧 +拋 +黴 +桑 +崗 +嘛 +衰 +盜 +滲 +臟 +賴 +湧 +甜 +曹 +閱 +肌 +哩 +厲 +烴 +緯 +毅 +昨 +偽 +症 +煮 +嘆 +釘 +搭 +莖 +籠 +酷 +偷 +弓 +錐 +恆 +傑 +坑 +鼻 +翼 +綸 +敘 +獄 +逮 +罐 +絡 +棚 +抑 +膨 +蔬 +寺 +驟 +穆 +冶 +枯 +冊 +屍 +凸 +紳 +坯 +犧 +焰 +轟 +欣 +晉 +瘦 +禦 +錠 +錦 +喪 +旬 +鍛 +壟 +搜 +撲 +邀 +亭 +酯 +邁 +舒 +脆 +酶 +閒 +憂 +酚 +頑 +羽 +漲 +卸 +仗 +陪 +闢 +懲 +杭 +姚 +肚 +捉 +飄 +漂 +昆 +欺 +吾 +郎 +烷 +汁 +呵 +飾 +蕭 +雅 +郵 +遷 +燕 +撒 +姻 +赴 +宴 +煩 +債 +帳 +斑 +鈴 +旨 +醇 +董 +餅 +雛 +姿 +拌 +傅 +腹 +妥 +揉 +賢 +拆 +歪 +葡 +胺 +丟 +浩 +徽 +昂 +墊 +擋 +覽 +貪 +慰 +繳 +汪 +慌 +馮 +諾 +姜 +誼 +兇 +劣 +誣 +耀 +昏 +躺 +盈 +騎 +喬 +溪 +叢 +盧 +抹 +悶 +諮 +刮 +駕 +纜 +悟 +摘 +鉺 +擲 +頗 +幻 +柄 +惠 +慘 +佳 +仇 +臘 +窩 +滌 +劍 +瞧 +堡 +潑 +蔥 +罩 +霍 +撈 +胎 +蒼 +濱 +倆 +捅 +湘 +砍 +霞 +邵 +萄 +瘋 +淮 +遂 +熊 +糞 +烘 +宿 +檔 +戈 +駁 +嫂 +裕 +徙 +箭 +捐 +腸 +撐 +曬 +辨 +殿 +蓮 +攤 +攪 +醬 +屏 +疫 +哀 +蔡 +堵 +沫 +皺 +暢 +疊 +閣 +萊 +敲 +轄 +鉤 +痕 +壩 +巷 +餓 +禍 +丘 +玄 +溜 +曰 +邏 +彭 +嘗 +卿 +妨 +艇 +吞 +韋 +怨 +矮 +歇 +` diff --git a/bip39gen/bip39/wordlists/czech.go b/bip39gen/bip39/wordlists/czech.go new file mode 100644 index 00000000..284dcf18 --- /dev/null +++ b/bip39gen/bip39/wordlists/czech.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/czech.txt + // $ crc32 czech.txt + // d1b5fda0 + checksum := crc32.ChecksumIEEE([]byte(czech)) + if fmt.Sprintf("%x", checksum) != "d1b5fda0" { + panic("czech checksum invalid") + } +} + +// Czech is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/czech.txt +var Czech = strings.Split(strings.TrimSpace(czech), "\n") +var czech = `abdikace +abeceda +adresa +agrese +akce +aktovka +alej +alkohol +amputace +ananas +andulka +anekdota +anketa +antika +anulovat +archa +arogance +asfalt +asistent +aspirace +astma +astronom +atlas +atletika +atol +autobus +azyl +babka +bachor +bacil +baculka +badatel +bageta +bagr +bahno +bakterie +balada +baletka +balkon +balonek +balvan +balza +bambus +bankomat +barbar +baret +barman +baroko +barva +baterka +batoh +bavlna +bazalka +bazilika +bazuka +bedna +beran +beseda +bestie +beton +bezinka +bezmoc +beztak +bicykl +bidlo +biftek +bikiny +bilance +biograf +biolog +bitva +bizon +blahobyt +blatouch +blecha +bledule +blesk +blikat +blizna +blokovat +bloudit +blud +bobek +bobr +bodlina +bodnout +bohatost +bojkot +bojovat +bokorys +bolest +borec +borovice +bota +boubel +bouchat +bouda +boule +bourat +boxer +bradavka +brambora +branka +bratr +brepta +briketa +brko +brloh +bronz +broskev +brunetka +brusinka +brzda +brzy +bublina +bubnovat +buchta +buditel +budka +budova +bufet +bujarost +bukvice +buldok +bulva +bunda +bunkr +burza +butik +buvol +buzola +bydlet +bylina +bytovka +bzukot +capart +carevna +cedr +cedule +cejch +cejn +cela +celer +celkem +celnice +cenina +cennost +cenovka +centrum +cenzor +cestopis +cetka +chalupa +chapadlo +charita +chata +chechtat +chemie +chichot +chirurg +chlad +chleba +chlubit +chmel +chmura +chobot +chochol +chodba +cholera +chomout +chopit +choroba +chov +chrapot +chrlit +chrt +chrup +chtivost +chudina +chutnat +chvat +chvilka +chvost +chyba +chystat +chytit +cibule +cigareta +cihelna +cihla +cinkot +cirkus +cisterna +citace +citrus +cizinec +cizost +clona +cokoliv +couvat +ctitel +ctnost +cudnost +cuketa +cukr +cupot +cvaknout +cval +cvik +cvrkot +cyklista +daleko +dareba +datel +datum +dcera +debata +dechovka +decibel +deficit +deflace +dekl +dekret +demokrat +deprese +derby +deska +detektiv +dikobraz +diktovat +dioda +diplom +disk +displej +divadlo +divoch +dlaha +dlouho +dluhopis +dnes +dobro +dobytek +docent +dochutit +dodnes +dohled +dohoda +dohra +dojem +dojnice +doklad +dokola +doktor +dokument +dolar +doleva +dolina +doma +dominant +domluvit +domov +donutit +dopad +dopis +doplnit +doposud +doprovod +dopustit +dorazit +dorost +dort +dosah +doslov +dostatek +dosud +dosyta +dotaz +dotek +dotknout +doufat +doutnat +dovozce +dozadu +doznat +dozorce +drahota +drak +dramatik +dravec +draze +drdol +drobnost +drogerie +drozd +drsnost +drtit +drzost +duben +duchovno +dudek +duha +duhovka +dusit +dusno +dutost +dvojice +dvorec +dynamit +ekolog +ekonomie +elektron +elipsa +email +emise +emoce +empatie +epizoda +epocha +epopej +epos +esej +esence +eskorta +eskymo +etiketa +euforie +evoluce +exekuce +exkurze +expedice +exploze +export +extrakt +facka +fajfka +fakulta +fanatik +fantazie +farmacie +favorit +fazole +federace +fejeton +fenka +fialka +figurant +filozof +filtr +finance +finta +fixace +fjord +flanel +flirt +flotila +fond +fosfor +fotbal +fotka +foton +frakce +freska +fronta +fukar +funkce +fyzika +galeje +garant +genetika +geolog +gilotina +glazura +glejt +golem +golfista +gotika +graf +gramofon +granule +grep +gril +grog +groteska +guma +hadice +hadr +hala +halenka +hanba +hanopis +harfa +harpuna +havran +hebkost +hejkal +hejno +hejtman +hektar +helma +hematom +herec +herna +heslo +hezky +historik +hladovka +hlasivky +hlava +hledat +hlen +hlodavec +hloh +hloupost +hltat +hlubina +hluchota +hmat +hmota +hmyz +hnis +hnojivo +hnout +hoblina +hoboj +hoch +hodiny +hodlat +hodnota +hodovat +hojnost +hokej +holinka +holka +holub +homole +honitba +honorace +horal +horda +horizont +horko +horlivec +hormon +hornina +horoskop +horstvo +hospoda +hostina +hotovost +houba +houf +houpat +houska +hovor +hradba +hranice +hravost +hrazda +hrbolek +hrdina +hrdlo +hrdost +hrnek +hrobka +hromada +hrot +hrouda +hrozen +hrstka +hrubost +hryzat +hubenost +hubnout +hudba +hukot +humr +husita +hustota +hvozd +hybnost +hydrant +hygiena +hymna +hysterik +idylka +ihned +ikona +iluze +imunita +infekce +inflace +inkaso +inovace +inspekce +internet +invalida +investor +inzerce +ironie +jablko +jachta +jahoda +jakmile +jakost +jalovec +jantar +jarmark +jaro +jasan +jasno +jatka +javor +jazyk +jedinec +jedle +jednatel +jehlan +jekot +jelen +jelito +jemnost +jenom +jepice +jeseter +jevit +jezdec +jezero +jinak +jindy +jinoch +jiskra +jistota +jitrnice +jizva +jmenovat +jogurt +jurta +kabaret +kabel +kabinet +kachna +kadet +kadidlo +kahan +kajak +kajuta +kakao +kaktus +kalamita +kalhoty +kalibr +kalnost +kamera +kamkoliv +kamna +kanibal +kanoe +kantor +kapalina +kapela +kapitola +kapka +kaple +kapota +kapr +kapusta +kapybara +karamel +karotka +karton +kasa +katalog +katedra +kauce +kauza +kavalec +kazajka +kazeta +kazivost +kdekoliv +kdesi +kedluben +kemp +keramika +kino +klacek +kladivo +klam +klapot +klasika +klaun +klec +klenba +klepat +klesnout +klid +klima +klisna +klobouk +klokan +klopa +kloub +klubovna +klusat +kluzkost +kmen +kmitat +kmotr +kniha +knot +koalice +koberec +kobka +kobliha +kobyla +kocour +kohout +kojenec +kokos +koktejl +kolaps +koleda +kolize +kolo +komando +kometa +komik +komnata +komora +kompas +komunita +konat +koncept +kondice +konec +konfese +kongres +konina +konkurs +kontakt +konzerva +kopanec +kopie +kopnout +koprovka +korbel +korektor +kormidlo +koroptev +korpus +koruna +koryto +korzet +kosatec +kostka +kotel +kotleta +kotoul +koukat +koupelna +kousek +kouzlo +kovboj +koza +kozoroh +krabice +krach +krajina +kralovat +krasopis +kravata +kredit +krejcar +kresba +kreveta +kriket +kritik +krize +krkavec +krmelec +krmivo +krocan +krok +kronika +kropit +kroupa +krovka +krtek +kruhadlo +krupice +krutost +krvinka +krychle +krypta +krystal +kryt +kudlanka +kufr +kujnost +kukla +kulajda +kulich +kulka +kulomet +kultura +kuna +kupodivu +kurt +kurzor +kutil +kvalita +kvasinka +kvestor +kynolog +kyselina +kytara +kytice +kytka +kytovec +kyvadlo +labrador +lachtan +ladnost +laik +lakomec +lamela +lampa +lanovka +lasice +laso +lastura +latinka +lavina +lebka +leckdy +leden +lednice +ledovka +ledvina +legenda +legie +legrace +lehce +lehkost +lehnout +lektvar +lenochod +lentilka +lepenka +lepidlo +letadlo +letec +letmo +letokruh +levhart +levitace +levobok +libra +lichotka +lidojed +lidskost +lihovina +lijavec +lilek +limetka +linie +linka +linoleum +listopad +litina +litovat +lobista +lodivod +logika +logoped +lokalita +loket +lomcovat +lopata +lopuch +lord +losos +lotr +loudal +louh +louka +louskat +lovec +lstivost +lucerna +lucifer +lump +lusk +lustrace +lvice +lyra +lyrika +lysina +madam +madlo +magistr +mahagon +majetek +majitel +majorita +makak +makovice +makrela +malba +malina +malovat +malvice +maminka +mandle +manko +marnost +masakr +maskot +masopust +matice +matrika +maturita +mazanec +mazivo +mazlit +mazurka +mdloba +mechanik +meditace +medovina +melasa +meloun +mentolka +metla +metoda +metr +mezera +migrace +mihnout +mihule +mikina +mikrofon +milenec +milimetr +milost +mimika +mincovna +minibar +minomet +minulost +miska +mistr +mixovat +mladost +mlha +mlhovina +mlok +mlsat +mluvit +mnich +mnohem +mobil +mocnost +modelka +modlitba +mohyla +mokro +molekula +momentka +monarcha +monokl +monstrum +montovat +monzun +mosaz +moskyt +most +motivace +motorka +motyka +moucha +moudrost +mozaika +mozek +mozol +mramor +mravenec +mrkev +mrtvola +mrzet +mrzutost +mstitel +mudrc +muflon +mulat +mumie +munice +muset +mutace +muzeum +muzikant +myslivec +mzda +nabourat +nachytat +nadace +nadbytek +nadhoz +nadobro +nadpis +nahlas +nahnat +nahodile +nahradit +naivita +najednou +najisto +najmout +naklonit +nakonec +nakrmit +nalevo +namazat +namluvit +nanometr +naoko +naopak +naostro +napadat +napevno +naplnit +napnout +naposled +naprosto +narodit +naruby +narychlo +nasadit +nasekat +naslepo +nastat +natolik +navenek +navrch +navzdory +nazvat +nebe +nechat +necky +nedaleko +nedbat +neduh +negace +nehet +nehoda +nejen +nejprve +neklid +nelibost +nemilost +nemoc +neochota +neonka +nepokoj +nerost +nerv +nesmysl +nesoulad +netvor +neuron +nevina +nezvykle +nicota +nijak +nikam +nikdy +nikl +nikterak +nitro +nocleh +nohavice +nominace +nora +norek +nositel +nosnost +nouze +noviny +novota +nozdra +nuda +nudle +nuget +nutit +nutnost +nutrie +nymfa +obal +obarvit +obava +obdiv +obec +obehnat +obejmout +obezita +obhajoba +obilnice +objasnit +objekt +obklopit +oblast +oblek +obliba +obloha +obluda +obnos +obohatit +obojek +obout +obrazec +obrna +obruba +obrys +obsah +obsluha +obstarat +obuv +obvaz +obvinit +obvod +obvykle +obyvatel +obzor +ocas +ocel +ocenit +ochladit +ochota +ochrana +ocitnout +odboj +odbyt +odchod +odcizit +odebrat +odeslat +odevzdat +odezva +odhadce +odhodit +odjet +odjinud +odkaz +odkoupit +odliv +odluka +odmlka +odolnost +odpad +odpis +odplout +odpor +odpustit +odpykat +odrazka +odsoudit +odstup +odsun +odtok +odtud +odvaha +odveta +odvolat +odvracet +odznak +ofina +ofsajd +ohlas +ohnisko +ohrada +ohrozit +ohryzek +okap +okenice +oklika +okno +okouzlit +okovy +okrasa +okres +okrsek +okruh +okupant +okurka +okusit +olejnina +olizovat +omak +omeleta +omezit +omladina +omlouvat +omluva +omyl +onehdy +opakovat +opasek +operace +opice +opilost +opisovat +opora +opozice +opravdu +oproti +orbital +orchestr +orgie +orlice +orloj +ortel +osada +oschnout +osika +osivo +oslava +oslepit +oslnit +oslovit +osnova +osoba +osolit +ospalec +osten +ostraha +ostuda +ostych +osvojit +oteplit +otisk +otop +otrhat +otrlost +otrok +otruby +otvor +ovanout +ovar +oves +ovlivnit +ovoce +oxid +ozdoba +pachatel +pacient +padouch +pahorek +pakt +palanda +palec +palivo +paluba +pamflet +pamlsek +panenka +panika +panna +panovat +panstvo +pantofle +paprika +parketa +parodie +parta +paruka +paryba +paseka +pasivita +pastelka +patent +patrona +pavouk +pazneht +pazourek +pecka +pedagog +pejsek +peklo +peloton +penalta +pendrek +penze +periskop +pero +pestrost +petarda +petice +petrolej +pevnina +pexeso +pianista +piha +pijavice +pikle +piknik +pilina +pilnost +pilulka +pinzeta +pipeta +pisatel +pistole +pitevna +pivnice +pivovar +placenta +plakat +plamen +planeta +plastika +platit +plavidlo +plaz +plech +plemeno +plenta +ples +pletivo +plevel +plivat +plnit +plno +plocha +plodina +plomba +plout +pluk +plyn +pobavit +pobyt +pochod +pocit +poctivec +podat +podcenit +podepsat +podhled +podivit +podklad +podmanit +podnik +podoba +podpora +podraz +podstata +podvod +podzim +poezie +pohanka +pohnutka +pohovor +pohroma +pohyb +pointa +pojistka +pojmout +pokazit +pokles +pokoj +pokrok +pokuta +pokyn +poledne +polibek +polknout +poloha +polynom +pomalu +pominout +pomlka +pomoc +pomsta +pomyslet +ponechat +ponorka +ponurost +popadat +popel +popisek +poplach +poprosit +popsat +popud +poradce +porce +porod +porucha +poryv +posadit +posed +posila +poskok +poslanec +posoudit +pospolu +postava +posudek +posyp +potah +potkan +potlesk +potomek +potrava +potupa +potvora +poukaz +pouto +pouzdro +povaha +povidla +povlak +povoz +povrch +povstat +povyk +povzdech +pozdrav +pozemek +poznatek +pozor +pozvat +pracovat +prahory +praktika +prales +praotec +praporek +prase +pravda +princip +prkno +probudit +procento +prodej +profese +prohra +projekt +prolomit +promile +pronikat +propad +prorok +prosba +proton +proutek +provaz +prskavka +prsten +prudkost +prut +prvek +prvohory +psanec +psovod +pstruh +ptactvo +puberta +puch +pudl +pukavec +puklina +pukrle +pult +pumpa +punc +pupen +pusa +pusinka +pustina +putovat +putyka +pyramida +pysk +pytel +racek +rachot +radiace +radnice +radon +raft +ragby +raketa +rakovina +rameno +rampouch +rande +rarach +rarita +rasovna +rastr +ratolest +razance +razidlo +reagovat +reakce +recept +redaktor +referent +reflex +rejnok +reklama +rekord +rekrut +rektor +reputace +revize +revma +revolver +rezerva +riskovat +riziko +robotika +rodokmen +rohovka +rokle +rokoko +romaneto +ropovod +ropucha +rorejs +rosol +rostlina +rotmistr +rotoped +rotunda +roubenka +roucho +roup +roura +rovina +rovnice +rozbor +rozchod +rozdat +rozeznat +rozhodce +rozinka +rozjezd +rozkaz +rozloha +rozmar +rozpad +rozruch +rozsah +roztok +rozum +rozvod +rubrika +ruchadlo +rukavice +rukopis +ryba +rybolov +rychlost +rydlo +rypadlo +rytina +ryzost +sadista +sahat +sako +samec +samizdat +samota +sanitka +sardinka +sasanka +satelit +sazba +sazenice +sbor +schovat +sebranka +secese +sedadlo +sediment +sedlo +sehnat +sejmout +sekera +sekta +sekunda +sekvoje +semeno +seno +servis +sesadit +seshora +seskok +seslat +sestra +sesuv +sesypat +setba +setina +setkat +setnout +setrvat +sever +seznam +shoda +shrnout +sifon +silnice +sirka +sirotek +sirup +situace +skafandr +skalisko +skanzen +skaut +skeptik +skica +skladba +sklenice +sklo +skluz +skoba +skokan +skoro +skripta +skrz +skupina +skvost +skvrna +slabika +sladidlo +slanina +slast +slavnost +sledovat +slepec +sleva +slezina +slib +slina +sliznice +slon +sloupek +slovo +sluch +sluha +slunce +slupka +slza +smaragd +smetana +smilstvo +smlouva +smog +smrad +smrk +smrtka +smutek +smysl +snad +snaha +snob +sobota +socha +sodovka +sokol +sopka +sotva +souboj +soucit +soudce +souhlas +soulad +soumrak +souprava +soused +soutok +souviset +spalovna +spasitel +spis +splav +spodek +spojenec +spolu +sponzor +spornost +spousta +sprcha +spustit +sranda +sraz +srdce +srna +srnec +srovnat +srpen +srst +srub +stanice +starosta +statika +stavba +stehno +stezka +stodola +stolek +stopa +storno +stoupat +strach +stres +strhnout +strom +struna +studna +stupnice +stvol +styk +subjekt +subtropy +suchar +sudost +sukno +sundat +sunout +surikata +surovina +svah +svalstvo +svetr +svatba +svazek +svisle +svitek +svoboda +svodidlo +svorka +svrab +sykavka +sykot +synek +synovec +sypat +sypkost +syrovost +sysel +sytost +tabletka +tabule +tahoun +tajemno +tajfun +tajga +tajit +tajnost +taktika +tamhle +tampon +tancovat +tanec +tanker +tapeta +tavenina +tazatel +technika +tehdy +tekutina +telefon +temnota +tendence +tenista +tenor +teplota +tepna +teprve +terapie +termoska +textil +ticho +tiskopis +titulek +tkadlec +tkanina +tlapka +tleskat +tlukot +tlupa +tmel +toaleta +topinka +topol +torzo +touha +toulec +tradice +traktor +tramp +trasa +traverza +trefit +trest +trezor +trhavina +trhlina +trochu +trojice +troska +trouba +trpce +trpitel +trpkost +trubec +truchlit +truhlice +trus +trvat +tudy +tuhnout +tuhost +tundra +turista +turnaj +tuzemsko +tvaroh +tvorba +tvrdost +tvrz +tygr +tykev +ubohost +uboze +ubrat +ubrousek +ubrus +ubytovna +ucho +uctivost +udivit +uhradit +ujednat +ujistit +ujmout +ukazatel +uklidnit +uklonit +ukotvit +ukrojit +ulice +ulita +ulovit +umyvadlo +unavit +uniforma +uniknout +upadnout +uplatnit +uplynout +upoutat +upravit +uran +urazit +usednout +usilovat +usmrtit +usnadnit +usnout +usoudit +ustlat +ustrnout +utahovat +utkat +utlumit +utonout +utopenec +utrousit +uvalit +uvolnit +uvozovka +uzdravit +uzel +uzenina +uzlina +uznat +vagon +valcha +valoun +vana +vandal +vanilka +varan +varhany +varovat +vcelku +vchod +vdova +vedro +vegetace +vejce +velbloud +veletrh +velitel +velmoc +velryba +venkov +veranda +verze +veselka +veskrze +vesnice +vespodu +vesta +veterina +veverka +vibrace +vichr +videohra +vidina +vidle +vila +vinice +viset +vitalita +vize +vizitka +vjezd +vklad +vkus +vlajka +vlak +vlasec +vlevo +vlhkost +vliv +vlnovka +vloupat +vnucovat +vnuk +voda +vodivost +vodoznak +vodstvo +vojensky +vojna +vojsko +volant +volba +volit +volno +voskovka +vozidlo +vozovna +vpravo +vrabec +vracet +vrah +vrata +vrba +vrcholek +vrhat +vrstva +vrtule +vsadit +vstoupit +vstup +vtip +vybavit +vybrat +vychovat +vydat +vydra +vyfotit +vyhledat +vyhnout +vyhodit +vyhradit +vyhubit +vyjasnit +vyjet +vyjmout +vyklopit +vykonat +vylekat +vymazat +vymezit +vymizet +vymyslet +vynechat +vynikat +vynutit +vypadat +vyplatit +vypravit +vypustit +vyrazit +vyrovnat +vyrvat +vyslovit +vysoko +vystavit +vysunout +vysypat +vytasit +vytesat +vytratit +vyvinout +vyvolat +vyvrhel +vyzdobit +vyznat +vzadu +vzbudit +vzchopit +vzdor +vzduch +vzdychat +vzestup +vzhledem +vzkaz +vzlykat +vznik +vzorek +vzpoura +vztah +vztek +xylofon +zabrat +zabydlet +zachovat +zadarmo +zadusit +zafoukat +zahltit +zahodit +zahrada +zahynout +zajatec +zajet +zajistit +zaklepat +zakoupit +zalepit +zamezit +zamotat +zamyslet +zanechat +zanikat +zaplatit +zapojit +zapsat +zarazit +zastavit +zasunout +zatajit +zatemnit +zatknout +zaujmout +zavalit +zavelet +zavinit +zavolat +zavrtat +zazvonit +zbavit +zbrusu +zbudovat +zbytek +zdaleka +zdarma +zdatnost +zdivo +zdobit +zdroj +zdvih +zdymadlo +zelenina +zeman +zemina +zeptat +zezadu +zezdola +zhatit +zhltnout +zhluboka +zhotovit +zhruba +zima +zimnice +zjemnit +zklamat +zkoumat +zkratka +zkumavka +zlato +zlehka +zloba +zlom +zlost +zlozvyk +zmapovat +zmar +zmatek +zmije +zmizet +zmocnit +zmodrat +zmrzlina +zmutovat +znak +znalost +znamenat +znovu +zobrazit +zotavit +zoubek +zoufale +zplodit +zpomalit +zprava +zprostit +zprudka +zprvu +zrada +zranit +zrcadlo +zrnitost +zrno +zrovna +zrychlit +zrzavost +zticha +ztratit +zubovina +zubr +zvednout +zvenku +zvesela +zvon +zvrat +zvukovod +zvyk +` diff --git a/bip39gen/bip39/wordlists/english.go b/bip39gen/bip39/wordlists/english.go new file mode 100644 index 00000000..f69e8a47 --- /dev/null +++ b/bip39gen/bip39/wordlists/english.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt + // $ crc32 english.txt + // c1dbd296 + checksum := crc32.ChecksumIEEE([]byte(english)) + if fmt.Sprintf("%x", checksum) != "c1dbd296" { + panic("english checksum invalid") + } +} + +// English is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt +var English = strings.Split(strings.TrimSpace(english), "\n") +var english = `abandon +ability +able +about +above +absent +absorb +abstract +absurd +abuse +access +accident +account +accuse +achieve +acid +acoustic +acquire +across +act +action +actor +actress +actual +adapt +add +addict +address +adjust +admit +adult +advance +advice +aerobic +affair +afford +afraid +again +age +agent +agree +ahead +aim +air +airport +aisle +alarm +album +alcohol +alert +alien +all +alley +allow +almost +alone +alpha +already +also +alter +always +amateur +amazing +among +amount +amused +analyst +anchor +ancient +anger +angle +angry +animal +ankle +announce +annual +another +answer +antenna +antique +anxiety +any +apart +apology +appear +apple +approve +april +arch +arctic +area +arena +argue +arm +armed +armor +army +around +arrange +arrest +arrive +arrow +art +artefact +artist +artwork +ask +aspect +assault +asset +assist +assume +asthma +athlete +atom +attack +attend +attitude +attract +auction +audit +august +aunt +author +auto +autumn +average +avocado +avoid +awake +aware +away +awesome +awful +awkward +axis +baby +bachelor +bacon +badge +bag +balance +balcony +ball +bamboo +banana +banner +bar +barely +bargain +barrel +base +basic +basket +battle +beach +bean +beauty +because +become +beef +before +begin +behave +behind +believe +below +belt +bench +benefit +best +betray +better +between +beyond +bicycle +bid +bike +bind +biology +bird +birth +bitter +black +blade +blame +blanket +blast +bleak +bless +blind +blood +blossom +blouse +blue +blur +blush +board +boat +body +boil +bomb +bone +bonus +book +boost +border +boring +borrow +boss +bottom +bounce +box +boy +bracket +brain +brand +brass +brave +bread +breeze +brick +bridge +brief +bright +bring +brisk +broccoli +broken +bronze +broom +brother +brown +brush +bubble +buddy +budget +buffalo +build +bulb +bulk +bullet +bundle +bunker +burden +burger +burst +bus +business +busy +butter +buyer +buzz +cabbage +cabin +cable +cactus +cage +cake +call +calm +camera +camp +can +canal +cancel +candy +cannon +canoe +canvas +canyon +capable +capital +captain +car +carbon +card +cargo +carpet +carry +cart +case +cash +casino +castle +casual +cat +catalog +catch +category +cattle +caught +cause +caution +cave +ceiling +celery +cement +census +century +cereal +certain +chair +chalk +champion +change +chaos +chapter +charge +chase +chat +cheap +check +cheese +chef +cherry +chest +chicken +chief +child +chimney +choice +choose +chronic +chuckle +chunk +churn +cigar +cinnamon +circle +citizen +city +civil +claim +clap +clarify +claw +clay +clean +clerk +clever +click +client +cliff +climb +clinic +clip +clock +clog +close +cloth +cloud +clown +club +clump +cluster +clutch +coach +coast +coconut +code +coffee +coil +coin +collect +color +column +combine +come +comfort +comic +common +company +concert +conduct +confirm +congress +connect +consider +control +convince +cook +cool +copper +copy +coral +core +corn +correct +cost +cotton +couch +country +couple +course +cousin +cover +coyote +crack +cradle +craft +cram +crane +crash +crater +crawl +crazy +cream +credit +creek +crew +cricket +crime +crisp +critic +crop +cross +crouch +crowd +crucial +cruel +cruise +crumble +crunch +crush +cry +crystal +cube +culture +cup +cupboard +curious +current +curtain +curve +cushion +custom +cute +cycle +dad +damage +damp +dance +danger +daring +dash +daughter +dawn +day +deal +debate +debris +decade +december +decide +decline +decorate +decrease +deer +defense +define +defy +degree +delay +deliver +demand +demise +denial +dentist +deny +depart +depend +deposit +depth +deputy +derive +describe +desert +design +desk +despair +destroy +detail +detect +develop +device +devote +diagram +dial +diamond +diary +dice +diesel +diet +differ +digital +dignity +dilemma +dinner +dinosaur +direct +dirt +disagree +discover +disease +dish +dismiss +disorder +display +distance +divert +divide +divorce +dizzy +doctor +document +dog +doll +dolphin +domain +donate +donkey +donor +door +dose +double +dove +draft +dragon +drama +drastic +draw +dream +dress +drift +drill +drink +drip +drive +drop +drum +dry +duck +dumb +dune +during +dust +dutch +duty +dwarf +dynamic +eager +eagle +early +earn +earth +easily +east +easy +echo +ecology +economy +edge +edit +educate +effort +egg +eight +either +elbow +elder +electric +elegant +element +elephant +elevator +elite +else +embark +embody +embrace +emerge +emotion +employ +empower +empty +enable +enact +end +endless +endorse +enemy +energy +enforce +engage +engine +enhance +enjoy +enlist +enough +enrich +enroll +ensure +enter +entire +entry +envelope +episode +equal +equip +era +erase +erode +erosion +error +erupt +escape +essay +essence +estate +eternal +ethics +evidence +evil +evoke +evolve +exact +example +excess +exchange +excite +exclude +excuse +execute +exercise +exhaust +exhibit +exile +exist +exit +exotic +expand +expect +expire +explain +expose +express +extend +extra +eye +eyebrow +fabric +face +faculty +fade +faint +faith +fall +false +fame +family +famous +fan +fancy +fantasy +farm +fashion +fat +fatal +father +fatigue +fault +favorite +feature +february +federal +fee +feed +feel +female +fence +festival +fetch +fever +few +fiber +fiction +field +figure +file +film +filter +final +find +fine +finger +finish +fire +firm +first +fiscal +fish +fit +fitness +fix +flag +flame +flash +flat +flavor +flee +flight +flip +float +flock +floor +flower +fluid +flush +fly +foam +focus +fog +foil +fold +follow +food +foot +force +forest +forget +fork +fortune +forum +forward +fossil +foster +found +fox +fragile +frame +frequent +fresh +friend +fringe +frog +front +frost +frown +frozen +fruit +fuel +fun +funny +furnace +fury +future +gadget +gain +galaxy +gallery +game +gap +garage +garbage +garden +garlic +garment +gas +gasp +gate +gather +gauge +gaze +general +genius +genre +gentle +genuine +gesture +ghost +giant +gift +giggle +ginger +giraffe +girl +give +glad +glance +glare +glass +glide +glimpse +globe +gloom +glory +glove +glow +glue +goat +goddess +gold +good +goose +gorilla +gospel +gossip +govern +gown +grab +grace +grain +grant +grape +grass +gravity +great +green +grid +grief +grit +grocery +group +grow +grunt +guard +guess +guide +guilt +guitar +gun +gym +habit +hair +half +hammer +hamster +hand +happy +harbor +hard +harsh +harvest +hat +have +hawk +hazard +head +health +heart +heavy +hedgehog +height +hello +helmet +help +hen +hero +hidden +high +hill +hint +hip +hire +history +hobby +hockey +hold +hole +holiday +hollow +home +honey +hood +hope +horn +horror +horse +hospital +host +hotel +hour +hover +hub +huge +human +humble +humor +hundred +hungry +hunt +hurdle +hurry +hurt +husband +hybrid +ice +icon +idea +identify +idle +ignore +ill +illegal +illness +image +imitate +immense +immune +impact +impose +improve +impulse +inch +include +income +increase +index +indicate +indoor +industry +infant +inflict +inform +inhale +inherit +initial +inject +injury +inmate +inner +innocent +input +inquiry +insane +insect +inside +inspire +install +intact +interest +into +invest +invite +involve +iron +island +isolate +issue +item +ivory +jacket +jaguar +jar +jazz +jealous +jeans +jelly +jewel +job +join +joke +journey +joy +judge +juice +jump +jungle +junior +junk +just +kangaroo +keen +keep +ketchup +key +kick +kid +kidney +kind +kingdom +kiss +kit +kitchen +kite +kitten +kiwi +knee +knife +knock +know +lab +label +labor +ladder +lady +lake +lamp +language +laptop +large +later +latin +laugh +laundry +lava +law +lawn +lawsuit +layer +lazy +leader +leaf +learn +leave +lecture +left +leg +legal +legend +leisure +lemon +lend +length +lens +leopard +lesson +letter +level +liar +liberty +library +license +life +lift +light +like +limb +limit +link +lion +liquid +list +little +live +lizard +load +loan +lobster +local +lock +logic +lonely +long +loop +lottery +loud +lounge +love +loyal +lucky +luggage +lumber +lunar +lunch +luxury +lyrics +machine +mad +magic +magnet +maid +mail +main +major +make +mammal +man +manage +mandate +mango +mansion +manual +maple +marble +march +margin +marine +market +marriage +mask +mass +master +match +material +math +matrix +matter +maximum +maze +meadow +mean +measure +meat +mechanic +medal +media +melody +melt +member +memory +mention +menu +mercy +merge +merit +merry +mesh +message +metal +method +middle +midnight +milk +million +mimic +mind +minimum +minor +minute +miracle +mirror +misery +miss +mistake +mix +mixed +mixture +mobile +model +modify +mom +moment +monitor +monkey +monster +month +moon +moral +more +morning +mosquito +mother +motion +motor +mountain +mouse +move +movie +much +muffin +mule +multiply +muscle +museum +mushroom +music +must +mutual +myself +mystery +myth +naive +name +napkin +narrow +nasty +nation +nature +near +neck +need +negative +neglect +neither +nephew +nerve +nest +net +network +neutral +never +news +next +nice +night +noble +noise +nominee +noodle +normal +north +nose +notable +note +nothing +notice +novel +now +nuclear +number +nurse +nut +oak +obey +object +oblige +obscure +observe +obtain +obvious +occur +ocean +october +odor +off +offer +office +often +oil +okay +old +olive +olympic +omit +once +one +onion +online +only +open +opera +opinion +oppose +option +orange +orbit +orchard +order +ordinary +organ +orient +original +orphan +ostrich +other +outdoor +outer +output +outside +oval +oven +over +own +owner +oxygen +oyster +ozone +pact +paddle +page +pair +palace +palm +panda +panel +panic +panther +paper +parade +parent +park +parrot +party +pass +patch +path +patient +patrol +pattern +pause +pave +payment +peace +peanut +pear +peasant +pelican +pen +penalty +pencil +people +pepper +perfect +permit +person +pet +phone +photo +phrase +physical +piano +picnic +picture +piece +pig +pigeon +pill +pilot +pink +pioneer +pipe +pistol +pitch +pizza +place +planet +plastic +plate +play +please +pledge +pluck +plug +plunge +poem +poet +point +polar +pole +police +pond +pony +pool +popular +portion +position +possible +post +potato +pottery +poverty +powder +power +practice +praise +predict +prefer +prepare +present +pretty +prevent +price +pride +primary +print +priority +prison +private +prize +problem +process +produce +profit +program +project +promote +proof +property +prosper +protect +proud +provide +public +pudding +pull +pulp +pulse +pumpkin +punch +pupil +puppy +purchase +purity +purpose +purse +push +put +puzzle +pyramid +quality +quantum +quarter +question +quick +quit +quiz +quote +rabbit +raccoon +race +rack +radar +radio +rail +rain +raise +rally +ramp +ranch +random +range +rapid +rare +rate +rather +raven +raw +razor +ready +real +reason +rebel +rebuild +recall +receive +recipe +record +recycle +reduce +reflect +reform +refuse +region +regret +regular +reject +relax +release +relief +rely +remain +remember +remind +remove +render +renew +rent +reopen +repair +repeat +replace +report +require +rescue +resemble +resist +resource +response +result +retire +retreat +return +reunion +reveal +review +reward +rhythm +rib +ribbon +rice +rich +ride +ridge +rifle +right +rigid +ring +riot +ripple +risk +ritual +rival +river +road +roast +robot +robust +rocket +romance +roof +rookie +room +rose +rotate +rough +round +route +royal +rubber +rude +rug +rule +run +runway +rural +sad +saddle +sadness +safe +sail +salad +salmon +salon +salt +salute +same +sample +sand +satisfy +satoshi +sauce +sausage +save +say +scale +scan +scare +scatter +scene +scheme +school +science +scissors +scorpion +scout +scrap +screen +script +scrub +sea +search +season +seat +second +secret +section +security +seed +seek +segment +select +sell +seminar +senior +sense +sentence +series +service +session +settle +setup +seven +shadow +shaft +shallow +share +shed +shell +sheriff +shield +shift +shine +ship +shiver +shock +shoe +shoot +shop +short +shoulder +shove +shrimp +shrug +shuffle +shy +sibling +sick +side +siege +sight +sign +silent +silk +silly +silver +similar +simple +since +sing +siren +sister +situate +six +size +skate +sketch +ski +skill +skin +skirt +skull +slab +slam +sleep +slender +slice +slide +slight +slim +slogan +slot +slow +slush +small +smart +smile +smoke +smooth +snack +snake +snap +sniff +snow +soap +soccer +social +sock +soda +soft +solar +soldier +solid +solution +solve +someone +song +soon +sorry +sort +soul +sound +soup +source +south +space +spare +spatial +spawn +speak +special +speed +spell +spend +sphere +spice +spider +spike +spin +spirit +split +spoil +sponsor +spoon +sport +spot +spray +spread +spring +spy +square +squeeze +squirrel +stable +stadium +staff +stage +stairs +stamp +stand +start +state +stay +steak +steel +stem +step +stereo +stick +still +sting +stock +stomach +stone +stool +story +stove +strategy +street +strike +strong +struggle +student +stuff +stumble +style +subject +submit +subway +success +such +sudden +suffer +sugar +suggest +suit +summer +sun +sunny +sunset +super +supply +supreme +sure +surface +surge +surprise +surround +survey +suspect +sustain +swallow +swamp +swap +swarm +swear +sweet +swift +swim +swing +switch +sword +symbol +symptom +syrup +system +table +tackle +tag +tail +talent +talk +tank +tape +target +task +taste +tattoo +taxi +teach +team +tell +ten +tenant +tennis +tent +term +test +text +thank +that +theme +then +theory +there +they +thing +this +thought +three +thrive +throw +thumb +thunder +ticket +tide +tiger +tilt +timber +time +tiny +tip +tired +tissue +title +toast +tobacco +today +toddler +toe +together +toilet +token +tomato +tomorrow +tone +tongue +tonight +tool +tooth +top +topic +topple +torch +tornado +tortoise +toss +total +tourist +toward +tower +town +toy +track +trade +traffic +tragic +train +transfer +trap +trash +travel +tray +treat +tree +trend +trial +tribe +trick +trigger +trim +trip +trophy +trouble +truck +true +truly +trumpet +trust +truth +try +tube +tuition +tumble +tuna +tunnel +turkey +turn +turtle +twelve +twenty +twice +twin +twist +two +type +typical +ugly +umbrella +unable +unaware +uncle +uncover +under +undo +unfair +unfold +unhappy +uniform +unique +unit +universe +unknown +unlock +until +unusual +unveil +update +upgrade +uphold +upon +upper +upset +urban +urge +usage +use +used +useful +useless +usual +utility +vacant +vacuum +vague +valid +valley +valve +van +vanish +vapor +various +vast +vault +vehicle +velvet +vendor +venture +venue +verb +verify +version +very +vessel +veteran +viable +vibrant +vicious +victory +video +view +village +vintage +violin +virtual +virus +visa +visit +visual +vital +vivid +vocal +voice +void +volcano +volume +vote +voyage +wage +wagon +wait +walk +wall +walnut +want +warfare +warm +warrior +wash +wasp +waste +water +wave +way +wealth +weapon +wear +weasel +weather +web +wedding +weekend +weird +welcome +west +wet +whale +what +wheat +wheel +when +where +whip +whisper +wide +width +wife +wild +will +win +window +wine +wing +wink +winner +winter +wire +wisdom +wise +wish +witness +wolf +woman +wonder +wood +wool +word +work +world +worry +worth +wrap +wreck +wrestle +wrist +write +wrong +yard +year +yellow +you +young +youth +zebra +zero +zone +zoo +` diff --git a/bip39gen/bip39/wordlists/french.go b/bip39gen/bip39/wordlists/french.go new file mode 100644 index 00000000..1ae685d3 --- /dev/null +++ b/bip39gen/bip39/wordlists/french.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/french.txt + // $ crc32 french.txt + // 3e56b216 + checksum := crc32.ChecksumIEEE([]byte(french)) + if fmt.Sprintf("%x", checksum) != "3e56b216" { + panic("french checksum invalid") + } +} + +// French is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/french.txt +var French = strings.Split(strings.TrimSpace(french), "\n") +var french = `abaisser +abandon +abdiquer +abeille +abolir +aborder +aboutir +aboyer +abrasif +abreuver +abriter +abroger +abrupt +absence +absolu +absurde +abusif +abyssal +académie +acajou +acarien +accabler +accepter +acclamer +accolade +accroche +accuser +acerbe +achat +acheter +aciduler +acier +acompte +acquérir +acronyme +acteur +actif +actuel +adepte +adéquat +adhésif +adjectif +adjuger +admettre +admirer +adopter +adorer +adoucir +adresse +adroit +adulte +adverbe +aérer +aéronef +affaire +affecter +affiche +affreux +affubler +agacer +agencer +agile +agiter +agrafer +agréable +agrume +aider +aiguille +ailier +aimable +aisance +ajouter +ajuster +alarmer +alchimie +alerte +algèbre +algue +aliéner +aliment +alléger +alliage +allouer +allumer +alourdir +alpaga +altesse +alvéole +amateur +ambigu +ambre +aménager +amertume +amidon +amiral +amorcer +amour +amovible +amphibie +ampleur +amusant +analyse +anaphore +anarchie +anatomie +ancien +anéantir +angle +angoisse +anguleux +animal +annexer +annonce +annuel +anodin +anomalie +anonyme +anormal +antenne +antidote +anxieux +apaiser +apéritif +aplanir +apologie +appareil +appeler +apporter +appuyer +aquarium +aqueduc +arbitre +arbuste +ardeur +ardoise +argent +arlequin +armature +armement +armoire +armure +arpenter +arracher +arriver +arroser +arsenic +artériel +article +aspect +asphalte +aspirer +assaut +asservir +assiette +associer +assurer +asticot +astre +astuce +atelier +atome +atrium +atroce +attaque +attentif +attirer +attraper +aubaine +auberge +audace +audible +augurer +aurore +automne +autruche +avaler +avancer +avarice +avenir +averse +aveugle +aviateur +avide +avion +aviser +avoine +avouer +avril +axial +axiome +badge +bafouer +bagage +baguette +baignade +balancer +balcon +baleine +balisage +bambin +bancaire +bandage +banlieue +bannière +banquier +barbier +baril +baron +barque +barrage +bassin +bastion +bataille +bateau +batterie +baudrier +bavarder +belette +bélier +belote +bénéfice +berceau +berger +berline +bermuda +besace +besogne +bétail +beurre +biberon +bicycle +bidule +bijou +bilan +bilingue +billard +binaire +biologie +biopsie +biotype +biscuit +bison +bistouri +bitume +bizarre +blafard +blague +blanchir +blessant +blinder +blond +bloquer +blouson +bobard +bobine +boire +boiser +bolide +bonbon +bondir +bonheur +bonifier +bonus +bordure +borne +botte +boucle +boueux +bougie +boulon +bouquin +bourse +boussole +boutique +boxeur +branche +brasier +brave +brebis +brèche +breuvage +bricoler +brigade +brillant +brioche +brique +brochure +broder +bronzer +brousse +broyeur +brume +brusque +brutal +bruyant +buffle +buisson +bulletin +bureau +burin +bustier +butiner +butoir +buvable +buvette +cabanon +cabine +cachette +cadeau +cadre +caféine +caillou +caisson +calculer +calepin +calibre +calmer +calomnie +calvaire +camarade +caméra +camion +campagne +canal +caneton +canon +cantine +canular +capable +caporal +caprice +capsule +capter +capuche +carabine +carbone +caresser +caribou +carnage +carotte +carreau +carton +cascade +casier +casque +cassure +causer +caution +cavalier +caverne +caviar +cédille +ceinture +céleste +cellule +cendrier +censurer +central +cercle +cérébral +cerise +cerner +cerveau +cesser +chagrin +chaise +chaleur +chambre +chance +chapitre +charbon +chasseur +chaton +chausson +chavirer +chemise +chenille +chéquier +chercher +cheval +chien +chiffre +chignon +chimère +chiot +chlorure +chocolat +choisir +chose +chouette +chrome +chute +cigare +cigogne +cimenter +cinéma +cintrer +circuler +cirer +cirque +citerne +citoyen +citron +civil +clairon +clameur +claquer +classe +clavier +client +cligner +climat +clivage +cloche +clonage +cloporte +cobalt +cobra +cocasse +cocotier +coder +codifier +coffre +cogner +cohésion +coiffer +coincer +colère +colibri +colline +colmater +colonel +combat +comédie +commande +compact +concert +conduire +confier +congeler +connoter +consonne +contact +convexe +copain +copie +corail +corbeau +cordage +corniche +corpus +correct +cortège +cosmique +costume +coton +coude +coupure +courage +couteau +couvrir +coyote +crabe +crainte +cravate +crayon +créature +créditer +crémeux +creuser +crevette +cribler +crier +cristal +critère +croire +croquer +crotale +crucial +cruel +crypter +cubique +cueillir +cuillère +cuisine +cuivre +culminer +cultiver +cumuler +cupide +curatif +curseur +cyanure +cycle +cylindre +cynique +daigner +damier +danger +danseur +dauphin +débattre +débiter +déborder +débrider +débutant +décaler +décembre +déchirer +décider +déclarer +décorer +décrire +décupler +dédale +déductif +déesse +défensif +défiler +défrayer +dégager +dégivrer +déglutir +dégrafer +déjeuner +délice +déloger +demander +demeurer +démolir +dénicher +dénouer +dentelle +dénuder +départ +dépenser +déphaser +déplacer +déposer +déranger +dérober +désastre +descente +désert +désigner +désobéir +dessiner +destrier +détacher +détester +détourer +détresse +devancer +devenir +deviner +devoir +diable +dialogue +diamant +dicter +différer +digérer +digital +digne +diluer +dimanche +diminuer +dioxyde +directif +diriger +discuter +disposer +dissiper +distance +divertir +diviser +docile +docteur +dogme +doigt +domaine +domicile +dompter +donateur +donjon +donner +dopamine +dortoir +dorure +dosage +doseur +dossier +dotation +douanier +double +douceur +douter +doyen +dragon +draper +dresser +dribbler +droiture +duperie +duplexe +durable +durcir +dynastie +éblouir +écarter +écharpe +échelle +éclairer +éclipse +éclore +écluse +école +économie +écorce +écouter +écraser +écrémer +écrivain +écrou +écume +écureuil +édifier +éduquer +effacer +effectif +effigie +effort +effrayer +effusion +égaliser +égarer +éjecter +élaborer +élargir +électron +élégant +éléphant +élève +éligible +élitisme +éloge +élucider +éluder +emballer +embellir +embryon +émeraude +émission +emmener +émotion +émouvoir +empereur +employer +emporter +emprise +émulsion +encadrer +enchère +enclave +encoche +endiguer +endosser +endroit +enduire +énergie +enfance +enfermer +enfouir +engager +engin +englober +énigme +enjamber +enjeu +enlever +ennemi +ennuyeux +enrichir +enrobage +enseigne +entasser +entendre +entier +entourer +entraver +énumérer +envahir +enviable +envoyer +enzyme +éolien +épaissir +épargne +épatant +épaule +épicerie +épidémie +épier +épilogue +épine +épisode +épitaphe +époque +épreuve +éprouver +épuisant +équerre +équipe +ériger +érosion +erreur +éruption +escalier +espadon +espèce +espiègle +espoir +esprit +esquiver +essayer +essence +essieu +essorer +estime +estomac +estrade +étagère +étaler +étanche +étatique +éteindre +étendoir +éternel +éthanol +éthique +ethnie +étirer +étoffer +étoile +étonnant +étourdir +étrange +étroit +étude +euphorie +évaluer +évasion +éventail +évidence +éviter +évolutif +évoquer +exact +exagérer +exaucer +exceller +excitant +exclusif +excuse +exécuter +exemple +exercer +exhaler +exhorter +exigence +exiler +exister +exotique +expédier +explorer +exposer +exprimer +exquis +extensif +extraire +exulter +fable +fabuleux +facette +facile +facture +faiblir +falaise +fameux +famille +farceur +farfelu +farine +farouche +fasciner +fatal +fatigue +faucon +fautif +faveur +favori +fébrile +féconder +fédérer +félin +femme +fémur +fendoir +féodal +fermer +féroce +ferveur +festival +feuille +feutre +février +fiasco +ficeler +fictif +fidèle +figure +filature +filetage +filière +filleul +filmer +filou +filtrer +financer +finir +fiole +firme +fissure +fixer +flairer +flamme +flasque +flatteur +fléau +flèche +fleur +flexion +flocon +flore +fluctuer +fluide +fluvial +folie +fonderie +fongible +fontaine +forcer +forgeron +formuler +fortune +fossile +foudre +fougère +fouiller +foulure +fourmi +fragile +fraise +franchir +frapper +frayeur +frégate +freiner +frelon +frémir +frénésie +frère +friable +friction +frisson +frivole +froid +fromage +frontal +frotter +fruit +fugitif +fuite +fureur +furieux +furtif +fusion +futur +gagner +galaxie +galerie +gambader +garantir +gardien +garnir +garrigue +gazelle +gazon +géant +gélatine +gélule +gendarme +général +génie +genou +gentil +géologie +géomètre +géranium +germe +gestuel +geyser +gibier +gicler +girafe +givre +glace +glaive +glisser +globe +gloire +glorieux +golfeur +gomme +gonfler +gorge +gorille +goudron +gouffre +goulot +goupille +gourmand +goutte +graduel +graffiti +graine +grand +grappin +gratuit +gravir +grenat +griffure +griller +grimper +grogner +gronder +grotte +groupe +gruger +grutier +gruyère +guépard +guerrier +guide +guimauve +guitare +gustatif +gymnaste +gyrostat +habitude +hachoir +halte +hameau +hangar +hanneton +haricot +harmonie +harpon +hasard +hélium +hématome +herbe +hérisson +hermine +héron +hésiter +heureux +hiberner +hibou +hilarant +histoire +hiver +homard +hommage +homogène +honneur +honorer +honteux +horde +horizon +horloge +hormone +horrible +houleux +housse +hublot +huileux +humain +humble +humide +humour +hurler +hydromel +hygiène +hymne +hypnose +idylle +ignorer +iguane +illicite +illusion +image +imbiber +imiter +immense +immobile +immuable +impact +impérial +implorer +imposer +imprimer +imputer +incarner +incendie +incident +incliner +incolore +indexer +indice +inductif +inédit +ineptie +inexact +infini +infliger +informer +infusion +ingérer +inhaler +inhiber +injecter +injure +innocent +inoculer +inonder +inscrire +insecte +insigne +insolite +inspirer +instinct +insulter +intact +intense +intime +intrigue +intuitif +inutile +invasion +inventer +inviter +invoquer +ironique +irradier +irréel +irriter +isoler +ivoire +ivresse +jaguar +jaillir +jambe +janvier +jardin +jauger +jaune +javelot +jetable +jeton +jeudi +jeunesse +joindre +joncher +jongler +joueur +jouissif +journal +jovial +joyau +joyeux +jubiler +jugement +junior +jupon +juriste +justice +juteux +juvénile +kayak +kimono +kiosque +label +labial +labourer +lacérer +lactose +lagune +laine +laisser +laitier +lambeau +lamelle +lampe +lanceur +langage +lanterne +lapin +largeur +larme +laurier +lavabo +lavoir +lecture +légal +léger +légume +lessive +lettre +levier +lexique +lézard +liasse +libérer +libre +licence +licorne +liège +lièvre +ligature +ligoter +ligue +limer +limite +limonade +limpide +linéaire +lingot +lionceau +liquide +lisière +lister +lithium +litige +littoral +livreur +logique +lointain +loisir +lombric +loterie +louer +lourd +loutre +louve +loyal +lubie +lucide +lucratif +lueur +lugubre +luisant +lumière +lunaire +lundi +luron +lutter +luxueux +machine +magasin +magenta +magique +maigre +maillon +maintien +mairie +maison +majorer +malaxer +maléfice +malheur +malice +mallette +mammouth +mandater +maniable +manquant +manteau +manuel +marathon +marbre +marchand +mardi +maritime +marqueur +marron +marteler +mascotte +massif +matériel +matière +matraque +maudire +maussade +mauve +maximal +méchant +méconnu +médaille +médecin +méditer +méduse +meilleur +mélange +mélodie +membre +mémoire +menacer +mener +menhir +mensonge +mentor +mercredi +mérite +merle +messager +mesure +métal +météore +méthode +métier +meuble +miauler +microbe +miette +mignon +migrer +milieu +million +mimique +mince +minéral +minimal +minorer +minute +miracle +miroiter +missile +mixte +mobile +moderne +moelleux +mondial +moniteur +monnaie +monotone +monstre +montagne +monument +moqueur +morceau +morsure +mortier +moteur +motif +mouche +moufle +moulin +mousson +mouton +mouvant +multiple +munition +muraille +murène +murmure +muscle +muséum +musicien +mutation +muter +mutuel +myriade +myrtille +mystère +mythique +nageur +nappe +narquois +narrer +natation +nation +nature +naufrage +nautique +navire +nébuleux +nectar +néfaste +négation +négliger +négocier +neige +nerveux +nettoyer +neurone +neutron +neveu +niche +nickel +nitrate +niveau +noble +nocif +nocturne +noirceur +noisette +nomade +nombreux +nommer +normatif +notable +notifier +notoire +nourrir +nouveau +novateur +novembre +novice +nuage +nuancer +nuire +nuisible +numéro +nuptial +nuque +nutritif +obéir +objectif +obliger +obscur +observer +obstacle +obtenir +obturer +occasion +occuper +océan +octobre +octroyer +octupler +oculaire +odeur +odorant +offenser +officier +offrir +ogive +oiseau +oisillon +olfactif +olivier +ombrage +omettre +onctueux +onduler +onéreux +onirique +opale +opaque +opérer +opinion +opportun +opprimer +opter +optique +orageux +orange +orbite +ordonner +oreille +organe +orgueil +orifice +ornement +orque +ortie +osciller +osmose +ossature +otarie +ouragan +ourson +outil +outrager +ouvrage +ovation +oxyde +oxygène +ozone +paisible +palace +palmarès +palourde +palper +panache +panda +pangolin +paniquer +panneau +panorama +pantalon +papaye +papier +papoter +papyrus +paradoxe +parcelle +paresse +parfumer +parler +parole +parrain +parsemer +partager +parure +parvenir +passion +pastèque +paternel +patience +patron +pavillon +pavoiser +payer +paysage +peigne +peintre +pelage +pélican +pelle +pelouse +peluche +pendule +pénétrer +pénible +pensif +pénurie +pépite +péplum +perdrix +perforer +période +permuter +perplexe +persil +perte +peser +pétale +petit +pétrir +peuple +pharaon +phobie +phoque +photon +phrase +physique +piano +pictural +pièce +pierre +pieuvre +pilote +pinceau +pipette +piquer +pirogue +piscine +piston +pivoter +pixel +pizza +placard +plafond +plaisir +planer +plaque +plastron +plateau +pleurer +plexus +pliage +plomb +plonger +pluie +plumage +pochette +poésie +poète +pointe +poirier +poisson +poivre +polaire +policier +pollen +polygone +pommade +pompier +ponctuel +pondérer +poney +portique +position +posséder +posture +potager +poteau +potion +pouce +poulain +poumon +pourpre +poussin +pouvoir +prairie +pratique +précieux +prédire +préfixe +prélude +prénom +présence +prétexte +prévoir +primitif +prince +prison +priver +problème +procéder +prodige +profond +progrès +proie +projeter +prologue +promener +propre +prospère +protéger +prouesse +proverbe +prudence +pruneau +psychose +public +puceron +puiser +pulpe +pulsar +punaise +punitif +pupitre +purifier +puzzle +pyramide +quasar +querelle +question +quiétude +quitter +quotient +racine +raconter +radieux +ragondin +raideur +raisin +ralentir +rallonge +ramasser +rapide +rasage +ratisser +ravager +ravin +rayonner +réactif +réagir +réaliser +réanimer +recevoir +réciter +réclamer +récolter +recruter +reculer +recycler +rédiger +redouter +refaire +réflexe +réformer +refrain +refuge +régalien +région +réglage +régulier +réitérer +rejeter +rejouer +relatif +relever +relief +remarque +remède +remise +remonter +remplir +remuer +renard +renfort +renifler +renoncer +rentrer +renvoi +replier +reporter +reprise +reptile +requin +réserve +résineux +résoudre +respect +rester +résultat +rétablir +retenir +réticule +retomber +retracer +réunion +réussir +revanche +revivre +révolte +révulsif +richesse +rideau +rieur +rigide +rigoler +rincer +riposter +risible +risque +rituel +rival +rivière +rocheux +romance +rompre +ronce +rondin +roseau +rosier +rotatif +rotor +rotule +rouge +rouille +rouleau +routine +royaume +ruban +rubis +ruche +ruelle +rugueux +ruiner +ruisseau +ruser +rustique +rythme +sabler +saboter +sabre +sacoche +safari +sagesse +saisir +salade +salive +salon +saluer +samedi +sanction +sanglier +sarcasme +sardine +saturer +saugrenu +saumon +sauter +sauvage +savant +savonner +scalpel +scandale +scélérat +scénario +sceptre +schéma +science +scinder +score +scrutin +sculpter +séance +sécable +sécher +secouer +sécréter +sédatif +séduire +seigneur +séjour +sélectif +semaine +sembler +semence +séminal +sénateur +sensible +sentence +séparer +séquence +serein +sergent +sérieux +serrure +sérum +service +sésame +sévir +sevrage +sextuple +sidéral +siècle +siéger +siffler +sigle +signal +silence +silicium +simple +sincère +sinistre +siphon +sirop +sismique +situer +skier +social +socle +sodium +soigneux +soldat +soleil +solitude +soluble +sombre +sommeil +somnoler +sonde +songeur +sonnette +sonore +sorcier +sortir +sosie +sottise +soucieux +soudure +souffle +soulever +soupape +source +soutirer +souvenir +spacieux +spatial +spécial +sphère +spiral +stable +station +sternum +stimulus +stipuler +strict +studieux +stupeur +styliste +sublime +substrat +subtil +subvenir +succès +sucre +suffixe +suggérer +suiveur +sulfate +superbe +supplier +surface +suricate +surmener +surprise +sursaut +survie +suspect +syllabe +symbole +symétrie +synapse +syntaxe +système +tabac +tablier +tactile +tailler +talent +talisman +talonner +tambour +tamiser +tangible +tapis +taquiner +tarder +tarif +tartine +tasse +tatami +tatouage +taupe +taureau +taxer +témoin +temporel +tenaille +tendre +teneur +tenir +tension +terminer +terne +terrible +tétine +texte +thème +théorie +thérapie +thorax +tibia +tiède +timide +tirelire +tiroir +tissu +titane +titre +tituber +toboggan +tolérant +tomate +tonique +tonneau +toponyme +torche +tordre +tornade +torpille +torrent +torse +tortue +totem +toucher +tournage +tousser +toxine +traction +trafic +tragique +trahir +train +trancher +travail +trèfle +tremper +trésor +treuil +triage +tribunal +tricoter +trilogie +triomphe +tripler +triturer +trivial +trombone +tronc +tropical +troupeau +tuile +tulipe +tumulte +tunnel +turbine +tuteur +tutoyer +tuyau +tympan +typhon +typique +tyran +ubuesque +ultime +ultrason +unanime +unifier +union +unique +unitaire +univers +uranium +urbain +urticant +usage +usine +usuel +usure +utile +utopie +vacarme +vaccin +vagabond +vague +vaillant +vaincre +vaisseau +valable +valise +vallon +valve +vampire +vanille +vapeur +varier +vaseux +vassal +vaste +vecteur +vedette +végétal +véhicule +veinard +véloce +vendredi +vénérer +venger +venimeux +ventouse +verdure +vérin +vernir +verrou +verser +vertu +veston +vétéran +vétuste +vexant +vexer +viaduc +viande +victoire +vidange +vidéo +vignette +vigueur +vilain +village +vinaigre +violon +vipère +virement +virtuose +virus +visage +viseur +vision +visqueux +visuel +vital +vitesse +viticole +vitrine +vivace +vivipare +vocation +voguer +voile +voisin +voiture +volaille +volcan +voltiger +volume +vorace +vortex +voter +vouloir +voyage +voyelle +wagon +xénon +yacht +zèbre +zénith +zeste +zoologie +` diff --git a/bip39gen/bip39/wordlists/italian.go b/bip39gen/bip39/wordlists/italian.go new file mode 100644 index 00000000..32cd2cf6 --- /dev/null +++ b/bip39gen/bip39/wordlists/italian.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/italian.txt + // $ crc32 italian.txt + // 2fc7d07e + checksum := crc32.ChecksumIEEE([]byte(italian)) + if fmt.Sprintf("%x", checksum) != "2fc7d07e" { + panic("italian checksum invalid") + } +} + +// Italian is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/italian.txt +var Italian = strings.Split(strings.TrimSpace(italian), "\n") +var italian = `abaco +abbaglio +abbinato +abete +abisso +abolire +abrasivo +abrogato +accadere +accenno +accusato +acetone +achille +acido +acqua +acre +acrilico +acrobata +acuto +adagio +addebito +addome +adeguato +aderire +adipe +adottare +adulare +affabile +affetto +affisso +affranto +aforisma +afoso +africano +agave +agente +agevole +aggancio +agire +agitare +agonismo +agricolo +agrumeto +aguzzo +alabarda +alato +albatro +alberato +albo +albume +alce +alcolico +alettone +alfa +algebra +aliante +alibi +alimento +allagato +allegro +allievo +allodola +allusivo +almeno +alogeno +alpaca +alpestre +altalena +alterno +alticcio +altrove +alunno +alveolo +alzare +amalgama +amanita +amarena +ambito +ambrato +ameba +america +ametista +amico +ammasso +ammenda +ammirare +ammonito +amore +ampio +ampliare +amuleto +anacardo +anagrafe +analista +anarchia +anatra +anca +ancella +ancora +andare +andrea +anello +angelo +angolare +angusto +anima +annegare +annidato +anno +annuncio +anonimo +anticipo +anzi +apatico +apertura +apode +apparire +appetito +appoggio +approdo +appunto +aprile +arabica +arachide +aragosta +araldica +arancio +aratura +arazzo +arbitro +archivio +ardito +arenile +argento +argine +arguto +aria +armonia +arnese +arredato +arringa +arrosto +arsenico +arso +artefice +arzillo +asciutto +ascolto +asepsi +asettico +asfalto +asino +asola +aspirato +aspro +assaggio +asse +assoluto +assurdo +asta +astenuto +astice +astratto +atavico +ateismo +atomico +atono +attesa +attivare +attorno +attrito +attuale +ausilio +austria +autista +autonomo +autunno +avanzato +avere +avvenire +avviso +avvolgere +azione +azoto +azzimo +azzurro +babele +baccano +bacino +baco +badessa +badilata +bagnato +baita +balcone +baldo +balena +ballata +balzano +bambino +bandire +baraonda +barbaro +barca +baritono +barlume +barocco +basilico +basso +batosta +battuto +baule +bava +bavosa +becco +beffa +belgio +belva +benda +benevole +benigno +benzina +bere +berlina +beta +bibita +bici +bidone +bifido +biga +bilancia +bimbo +binocolo +biologo +bipede +bipolare +birbante +birra +biscotto +bisesto +bisnonno +bisonte +bisturi +bizzarro +blando +blatta +bollito +bonifico +bordo +bosco +botanico +bottino +bozzolo +braccio +bradipo +brama +branca +bravura +bretella +brevetto +brezza +briglia +brillante +brindare +broccolo +brodo +bronzina +brullo +bruno +bubbone +buca +budino +buffone +buio +bulbo +buono +burlone +burrasca +bussola +busta +cadetto +caduco +calamaro +calcolo +calesse +calibro +calmo +caloria +cambusa +camerata +camicia +cammino +camola +campale +canapa +candela +cane +canino +canotto +cantina +capace +capello +capitolo +capogiro +cappero +capra +capsula +carapace +carcassa +cardo +carisma +carovana +carretto +cartolina +casaccio +cascata +caserma +caso +cassone +castello +casuale +catasta +catena +catrame +cauto +cavillo +cedibile +cedrata +cefalo +celebre +cellulare +cena +cenone +centesimo +ceramica +cercare +certo +cerume +cervello +cesoia +cespo +ceto +chela +chiaro +chicca +chiedere +chimera +china +chirurgo +chitarra +ciao +ciclismo +cifrare +cigno +cilindro +ciottolo +circa +cirrosi +citrico +cittadino +ciuffo +civetta +civile +classico +clinica +cloro +cocco +codardo +codice +coerente +cognome +collare +colmato +colore +colposo +coltivato +colza +coma +cometa +commando +comodo +computer +comune +conciso +condurre +conferma +congelare +coniuge +connesso +conoscere +consumo +continuo +convegno +coperto +copione +coppia +copricapo +corazza +cordata +coricato +cornice +corolla +corpo +corredo +corsia +cortese +cosmico +costante +cottura +covato +cratere +cravatta +creato +credere +cremoso +crescita +creta +criceto +crinale +crisi +critico +croce +cronaca +crostata +cruciale +crusca +cucire +cuculo +cugino +cullato +cupola +curatore +cursore +curvo +cuscino +custode +dado +daino +dalmata +damerino +daniela +dannoso +danzare +datato +davanti +davvero +debutto +decennio +deciso +declino +decollo +decreto +dedicato +definito +deforme +degno +delegare +delfino +delirio +delta +demenza +denotato +dentro +deposito +derapata +derivare +deroga +descritto +deserto +desiderio +desumere +detersivo +devoto +diametro +dicembre +diedro +difeso +diffuso +digerire +digitale +diluvio +dinamico +dinnanzi +dipinto +diploma +dipolo +diradare +dire +dirotto +dirupo +disagio +discreto +disfare +disgelo +disposto +distanza +disumano +dito +divano +divelto +dividere +divorato +doblone +docente +doganale +dogma +dolce +domato +domenica +dominare +dondolo +dono +dormire +dote +dottore +dovuto +dozzina +drago +druido +dubbio +dubitare +ducale +duna +duomo +duplice +duraturo +ebano +eccesso +ecco +eclissi +economia +edera +edicola +edile +editoria +educare +egemonia +egli +egoismo +egregio +elaborato +elargire +elegante +elencato +eletto +elevare +elfico +elica +elmo +elsa +eluso +emanato +emblema +emesso +emiro +emotivo +emozione +empirico +emulo +endemico +enduro +energia +enfasi +enoteca +entrare +enzima +epatite +epilogo +episodio +epocale +eppure +equatore +erario +erba +erboso +erede +eremita +erigere +ermetico +eroe +erosivo +errante +esagono +esame +esanime +esaudire +esca +esempio +esercito +esibito +esigente +esistere +esito +esofago +esortato +esoso +espanso +espresso +essenza +esso +esteso +estimare +estonia +estroso +esultare +etilico +etnico +etrusco +etto +euclideo +europa +evaso +evidenza +evitato +evoluto +evviva +fabbrica +faccenda +fachiro +falco +famiglia +fanale +fanfara +fango +fantasma +fare +farfalla +farinoso +farmaco +fascia +fastoso +fasullo +faticare +fato +favoloso +febbre +fecola +fede +fegato +felpa +feltro +femmina +fendere +fenomeno +fermento +ferro +fertile +fessura +festivo +fetta +feudo +fiaba +fiducia +fifa +figurato +filo +finanza +finestra +finire +fiore +fiscale +fisico +fiume +flacone +flamenco +flebo +flemma +florido +fluente +fluoro +fobico +focaccia +focoso +foderato +foglio +folata +folclore +folgore +fondente +fonetico +fonia +fontana +forbito +forchetta +foresta +formica +fornaio +foro +fortezza +forzare +fosfato +fosso +fracasso +frana +frassino +fratello +freccetta +frenata +fresco +frigo +frollino +fronde +frugale +frutta +fucilata +fucsia +fuggente +fulmine +fulvo +fumante +fumetto +fumoso +fune +funzione +fuoco +furbo +furgone +furore +fuso +futile +gabbiano +gaffe +galateo +gallina +galoppo +gambero +gamma +garanzia +garbo +garofano +garzone +gasdotto +gasolio +gastrico +gatto +gaudio +gazebo +gazzella +geco +gelatina +gelso +gemello +gemmato +gene +genitore +gennaio +genotipo +gergo +ghepardo +ghiaccio +ghisa +giallo +gilda +ginepro +giocare +gioiello +giorno +giove +girato +girone +gittata +giudizio +giurato +giusto +globulo +glutine +gnomo +gobba +golf +gomito +gommone +gonfio +gonna +governo +gracile +grado +grafico +grammo +grande +grattare +gravoso +grazia +greca +gregge +grifone +grigio +grinza +grotta +gruppo +guadagno +guaio +guanto +guardare +gufo +guidare +ibernato +icona +identico +idillio +idolo +idra +idrico +idrogeno +igiene +ignaro +ignorato +ilare +illeso +illogico +illudere +imballo +imbevuto +imbocco +imbuto +immane +immerso +immolato +impacco +impeto +impiego +importo +impronta +inalare +inarcare +inattivo +incanto +incendio +inchino +incisivo +incluso +incontro +incrocio +incubo +indagine +india +indole +inedito +infatti +infilare +inflitto +ingaggio +ingegno +inglese +ingordo +ingrosso +innesco +inodore +inoltrare +inondato +insano +insetto +insieme +insonnia +insulina +intasato +intero +intonaco +intuito +inumidire +invalido +invece +invito +iperbole +ipnotico +ipotesi +ippica +iride +irlanda +ironico +irrigato +irrorare +isolato +isotopo +isterico +istituto +istrice +italia +iterare +labbro +labirinto +lacca +lacerato +lacrima +lacuna +laddove +lago +lampo +lancetta +lanterna +lardoso +larga +laringe +lastra +latenza +latino +lattuga +lavagna +lavoro +legale +leggero +lembo +lentezza +lenza +leone +lepre +lesivo +lessato +lesto +letterale +leva +levigato +libero +lido +lievito +lilla +limatura +limitare +limpido +lineare +lingua +liquido +lira +lirica +lisca +lite +litigio +livrea +locanda +lode +logica +lombare +londra +longevo +loquace +lorenzo +loto +lotteria +luce +lucidato +lumaca +luminoso +lungo +lupo +luppolo +lusinga +lusso +lutto +macabro +macchina +macero +macinato +madama +magico +maglia +magnete +magro +maiolica +malafede +malgrado +malinteso +malsano +malto +malumore +mana +mancia +mandorla +mangiare +manifesto +mannaro +manovra +mansarda +mantide +manubrio +mappa +maratona +marcire +maretta +marmo +marsupio +maschera +massaia +mastino +materasso +matricola +mattone +maturo +mazurca +meandro +meccanico +mecenate +medesimo +meditare +mega +melassa +melis +melodia +meninge +meno +mensola +mercurio +merenda +merlo +meschino +mese +messere +mestolo +metallo +metodo +mettere +miagolare +mica +micelio +michele +microbo +midollo +miele +migliore +milano +milite +mimosa +minerale +mini +minore +mirino +mirtillo +miscela +missiva +misto +misurare +mitezza +mitigare +mitra +mittente +mnemonico +modello +modifica +modulo +mogano +mogio +mole +molosso +monastero +monco +mondina +monetario +monile +monotono +monsone +montato +monviso +mora +mordere +morsicato +mostro +motivato +motosega +motto +movenza +movimento +mozzo +mucca +mucosa +muffa +mughetto +mugnaio +mulatto +mulinello +multiplo +mummia +munto +muovere +murale +musa +muscolo +musica +mutevole +muto +nababbo +nafta +nanometro +narciso +narice +narrato +nascere +nastrare +naturale +nautica +naviglio +nebulosa +necrosi +negativo +negozio +nemmeno +neofita +neretto +nervo +nessuno +nettuno +neutrale +neve +nevrotico +nicchia +ninfa +nitido +nobile +nocivo +nodo +nome +nomina +nordico +normale +norvegese +nostrano +notare +notizia +notturno +novella +nucleo +nulla +numero +nuovo +nutrire +nuvola +nuziale +oasi +obbedire +obbligo +obelisco +oblio +obolo +obsoleto +occasione +occhio +occidente +occorrere +occultare +ocra +oculato +odierno +odorare +offerta +offrire +offuscato +oggetto +oggi +ognuno +olandese +olfatto +oliato +oliva +ologramma +oltre +omaggio +ombelico +ombra +omega +omissione +ondoso +onere +onice +onnivoro +onorevole +onta +operato +opinione +opposto +oracolo +orafo +ordine +orecchino +orefice +orfano +organico +origine +orizzonte +orma +ormeggio +ornativo +orologio +orrendo +orribile +ortensia +ortica +orzata +orzo +osare +oscurare +osmosi +ospedale +ospite +ossa +ossidare +ostacolo +oste +otite +otre +ottagono +ottimo +ottobre +ovale +ovest +ovino +oviparo +ovocito +ovunque +ovviare +ozio +pacchetto +pace +pacifico +padella +padrone +paese +paga +pagina +palazzina +palesare +pallido +palo +palude +pandoro +pannello +paolo +paonazzo +paprica +parabola +parcella +parere +pargolo +pari +parlato +parola +partire +parvenza +parziale +passivo +pasticca +patacca +patologia +pattume +pavone +peccato +pedalare +pedonale +peggio +peloso +penare +pendice +penisola +pennuto +penombra +pensare +pentola +pepe +pepita +perbene +percorso +perdonato +perforare +pergamena +periodo +permesso +perno +perplesso +persuaso +pertugio +pervaso +pesatore +pesista +peso +pestifero +petalo +pettine +petulante +pezzo +piacere +pianta +piattino +piccino +picozza +piega +pietra +piffero +pigiama +pigolio +pigro +pila +pilifero +pillola +pilota +pimpante +pineta +pinna +pinolo +pioggia +piombo +piramide +piretico +pirite +pirolisi +pitone +pizzico +placebo +planare +plasma +platano +plenario +pochezza +poderoso +podismo +poesia +poggiare +polenta +poligono +pollice +polmonite +polpetta +polso +poltrona +polvere +pomice +pomodoro +ponte +popoloso +porfido +poroso +porpora +porre +portata +posa +positivo +possesso +postulato +potassio +potere +pranzo +prassi +pratica +precluso +predica +prefisso +pregiato +prelievo +premere +prenotare +preparato +presenza +pretesto +prevalso +prima +principe +privato +problema +procura +produrre +profumo +progetto +prolunga +promessa +pronome +proposta +proroga +proteso +prova +prudente +prugna +prurito +psiche +pubblico +pudica +pugilato +pugno +pulce +pulito +pulsante +puntare +pupazzo +pupilla +puro +quadro +qualcosa +quasi +querela +quota +raccolto +raddoppio +radicale +radunato +raffica +ragazzo +ragione +ragno +ramarro +ramingo +ramo +randagio +rantolare +rapato +rapina +rappreso +rasatura +raschiato +rasente +rassegna +rastrello +rata +ravveduto +reale +recepire +recinto +recluta +recondito +recupero +reddito +redimere +regalato +registro +regola +regresso +relazione +remare +remoto +renna +replica +reprimere +reputare +resa +residente +responso +restauro +rete +retina +retorica +rettifica +revocato +riassunto +ribadire +ribelle +ribrezzo +ricarica +ricco +ricevere +riciclato +ricordo +ricreduto +ridicolo +ridurre +rifasare +riflesso +riforma +rifugio +rigare +rigettato +righello +rilassato +rilevato +rimanere +rimbalzo +rimedio +rimorchio +rinascita +rincaro +rinforzo +rinnovo +rinomato +rinsavito +rintocco +rinuncia +rinvenire +riparato +ripetuto +ripieno +riportare +ripresa +ripulire +risata +rischio +riserva +risibile +riso +rispetto +ristoro +risultato +risvolto +ritardo +ritegno +ritmico +ritrovo +riunione +riva +riverso +rivincita +rivolto +rizoma +roba +robotico +robusto +roccia +roco +rodaggio +rodere +roditore +rogito +rollio +romantico +rompere +ronzio +rosolare +rospo +rotante +rotondo +rotula +rovescio +rubizzo +rubrica +ruga +rullino +rumine +rumoroso +ruolo +rupe +russare +rustico +sabato +sabbiare +sabotato +sagoma +salasso +saldatura +salgemma +salivare +salmone +salone +saltare +saluto +salvo +sapere +sapido +saporito +saraceno +sarcasmo +sarto +sassoso +satellite +satira +satollo +saturno +savana +savio +saziato +sbadiglio +sbalzo +sbancato +sbarra +sbattere +sbavare +sbendare +sbirciare +sbloccato +sbocciato +sbrinare +sbruffone +sbuffare +scabroso +scadenza +scala +scambiare +scandalo +scapola +scarso +scatenare +scavato +scelto +scenico +scettro +scheda +schiena +sciarpa +scienza +scindere +scippo +sciroppo +scivolo +sclerare +scodella +scolpito +scomparto +sconforto +scoprire +scorta +scossone +scozzese +scriba +scrollare +scrutinio +scuderia +scultore +scuola +scuro +scusare +sdebitare +sdoganare +seccatura +secondo +sedano +seggiola +segnalato +segregato +seguito +selciato +selettivo +sella +selvaggio +semaforo +sembrare +seme +seminato +sempre +senso +sentire +sepolto +sequenza +serata +serbato +sereno +serio +serpente +serraglio +servire +sestina +setola +settimana +sfacelo +sfaldare +sfamato +sfarzoso +sfaticato +sfera +sfida +sfilato +sfinge +sfocato +sfoderare +sfogo +sfoltire +sforzato +sfratto +sfruttato +sfuggito +sfumare +sfuso +sgabello +sgarbato +sgonfiare +sgorbio +sgrassato +sguardo +sibilo +siccome +sierra +sigla +signore +silenzio +sillaba +simbolo +simpatico +simulato +sinfonia +singolo +sinistro +sino +sintesi +sinusoide +sipario +sisma +sistole +situato +slitta +slogatura +sloveno +smarrito +smemorato +smentito +smeraldo +smilzo +smontare +smottato +smussato +snellire +snervato +snodo +sobbalzo +sobrio +soccorso +sociale +sodale +soffitto +sogno +soldato +solenne +solido +sollazzo +solo +solubile +solvente +somatico +somma +sonda +sonetto +sonnifero +sopire +soppeso +sopra +sorgere +sorpasso +sorriso +sorso +sorteggio +sorvolato +sospiro +sosta +sottile +spada +spalla +spargere +spatola +spavento +spazzola +specie +spedire +spegnere +spelatura +speranza +spessore +spettrale +spezzato +spia +spigoloso +spillato +spinoso +spirale +splendido +sportivo +sposo +spranga +sprecare +spronato +spruzzo +spuntino +squillo +sradicare +srotolato +stabile +stacco +staffa +stagnare +stampato +stantio +starnuto +stasera +statuto +stelo +steppa +sterzo +stiletto +stima +stirpe +stivale +stizzoso +stonato +storico +strappo +stregato +stridulo +strozzare +strutto +stuccare +stufo +stupendo +subentro +succoso +sudore +suggerito +sugo +sultano +suonare +superbo +supporto +surgelato +surrogato +sussurro +sutura +svagare +svedese +sveglio +svelare +svenuto +svezia +sviluppo +svista +svizzera +svolta +svuotare +tabacco +tabulato +tacciare +taciturno +tale +talismano +tampone +tannino +tara +tardivo +targato +tariffa +tarpare +tartaruga +tasto +tattico +taverna +tavolata +tazza +teca +tecnico +telefono +temerario +tempo +temuto +tendone +tenero +tensione +tentacolo +teorema +terme +terrazzo +terzetto +tesi +tesserato +testato +tetro +tettoia +tifare +tigella +timbro +tinto +tipico +tipografo +tiraggio +tiro +titanio +titolo +titubante +tizio +tizzone +toccare +tollerare +tolto +tombola +tomo +tonfo +tonsilla +topazio +topologia +toppa +torba +tornare +torrone +tortora +toscano +tossire +tostatura +totano +trabocco +trachea +trafila +tragedia +tralcio +tramonto +transito +trapano +trarre +trasloco +trattato +trave +treccia +tremolio +trespolo +tributo +tricheco +trifoglio +trillo +trincea +trio +tristezza +triturato +trivella +tromba +trono +troppo +trottola +trovare +truccato +tubatura +tuffato +tulipano +tumulto +tunisia +turbare +turchino +tuta +tutela +ubicato +uccello +uccisore +udire +uditivo +uffa +ufficio +uguale +ulisse +ultimato +umano +umile +umorismo +uncinetto +ungere +ungherese +unicorno +unificato +unisono +unitario +unte +uovo +upupa +uragano +urgenza +urlo +usanza +usato +uscito +usignolo +usuraio +utensile +utilizzo +utopia +vacante +vaccinato +vagabondo +vagliato +valanga +valgo +valico +valletta +valoroso +valutare +valvola +vampata +vangare +vanitoso +vano +vantaggio +vanvera +vapore +varano +varcato +variante +vasca +vedetta +vedova +veduto +vegetale +veicolo +velcro +velina +velluto +veloce +venato +vendemmia +vento +verace +verbale +vergogna +verifica +vero +verruca +verticale +vescica +vessillo +vestale +veterano +vetrina +vetusto +viandante +vibrante +vicenda +vichingo +vicinanza +vidimare +vigilia +vigneto +vigore +vile +villano +vimini +vincitore +viola +vipera +virgola +virologo +virulento +viscoso +visione +vispo +vissuto +visura +vita +vitello +vittima +vivanda +vivido +viziare +voce +voga +volatile +volere +volpe +voragine +vulcano +zampogna +zanna +zappato +zattera +zavorra +zefiro +zelante +zelo +zenzero +zerbino +zibetto +zinco +zircone +zitto +zolla +zotico +zucchero +zufolo +zulu +zuppa +` diff --git a/bip39gen/bip39/wordlists/japanese.go b/bip39gen/bip39/wordlists/japanese.go new file mode 100644 index 00000000..23a76a34 --- /dev/null +++ b/bip39gen/bip39/wordlists/japanese.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/japanese.txt + // $ crc32 japanese.txt + // 0acc1419 + checksum := crc32.ChecksumIEEE([]byte(japanese)) + if fmt.Sprintf("%x", checksum) != "acc1419" { + panic(fmt.Sprintf("japanese checksum invalid: %x", checksum)) + } +} + +// Japanese is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/japanese.txt +var Japanese = strings.Split(strings.TrimSpace(japanese), "\n") +var japanese = `あいこくしん +あいさつ +あいだ +あおぞら +あかちゃん +あきる +あけがた +あける +あこがれる +あさい +あさひ +あしあと +あじわう +あずかる +あずき +あそぶ +あたえる +あたためる +あたりまえ +あたる +あつい +あつかう +あっしゅく +あつまり +あつめる +あてな +あてはまる +あひる +あぶら +あぶる +あふれる +あまい +あまど +あまやかす +あまり +あみもの +あめりか +あやまる +あゆむ +あらいぐま +あらし +あらすじ +あらためる +あらゆる +あらわす +ありがとう +あわせる +あわてる +あんい +あんがい +あんこ +あんぜん +あんてい +あんない +あんまり +いいだす +いおん +いがい +いがく +いきおい +いきなり +いきもの +いきる +いくじ +いくぶん +いけばな +いけん +いこう +いこく +いこつ +いさましい +いさん +いしき +いじゅう +いじょう +いじわる +いずみ +いずれ +いせい +いせえび +いせかい +いせき +いぜん +いそうろう +いそがしい +いだい +いだく +いたずら +いたみ +いたりあ +いちおう +いちじ +いちど +いちば +いちぶ +いちりゅう +いつか +いっしゅん +いっせい +いっそう +いったん +いっち +いってい +いっぽう +いてざ +いてん +いどう +いとこ +いない +いなか +いねむり +いのち +いのる +いはつ +いばる +いはん +いびき +いひん +いふく +いへん +いほう +いみん +いもうと +いもたれ +いもり +いやがる +いやす +いよかん +いよく +いらい +いらすと +いりぐち +いりょう +いれい +いれもの +いれる +いろえんぴつ +いわい +いわう +いわかん +いわば +いわゆる +いんげんまめ +いんさつ +いんしょう +いんよう +うえき +うえる +うおざ +うがい +うかぶ +うかべる +うきわ +うくらいな +うくれれ +うけたまわる +うけつけ +うけとる +うけもつ +うける +うごかす +うごく +うこん +うさぎ +うしなう +うしろがみ +うすい +うすぎ +うすぐらい +うすめる +うせつ +うちあわせ +うちがわ +うちき +うちゅう +うっかり +うつくしい +うったえる +うつる +うどん +うなぎ +うなじ +うなずく +うなる +うねる +うのう +うぶげ +うぶごえ +うまれる +うめる +うもう +うやまう +うよく +うらがえす +うらぐち +うらない +うりあげ +うりきれ +うるさい +うれしい +うれゆき +うれる +うろこ +うわき +うわさ +うんこう +うんちん +うんてん +うんどう +えいえん +えいが +えいきょう +えいご +えいせい +えいぶん +えいよう +えいわ +えおり +えがお +えがく +えきたい +えくせる +えしゃく +えすて +えつらん +えのぐ +えほうまき +えほん +えまき +えもじ +えもの +えらい +えらぶ +えりあ +えんえん +えんかい +えんぎ +えんげき +えんしゅう +えんぜつ +えんそく +えんちょう +えんとつ +おいかける +おいこす +おいしい +おいつく +おうえん +おうさま +おうじ +おうせつ +おうたい +おうふく +おうべい +おうよう +おえる +おおい +おおう +おおどおり +おおや +おおよそ +おかえり +おかず +おがむ +おかわり +おぎなう +おきる +おくさま +おくじょう +おくりがな +おくる +おくれる +おこす +おこなう +おこる +おさえる +おさない +おさめる +おしいれ +おしえる +おじぎ +おじさん +おしゃれ +おそらく +おそわる +おたがい +おたく +おだやか +おちつく +おっと +おつり +おでかけ +おとしもの +おとなしい +おどり +おどろかす +おばさん +おまいり +おめでとう +おもいで +おもう +おもたい +おもちゃ +おやつ +おやゆび +およぼす +おらんだ +おろす +おんがく +おんけい +おんしゃ +おんせん +おんだん +おんちゅう +おんどけい +かあつ +かいが +がいき +がいけん +がいこう +かいさつ +かいしゃ +かいすいよく +かいぜん +かいぞうど +かいつう +かいてん +かいとう +かいふく +がいへき +かいほう +かいよう +がいらい +かいわ +かえる +かおり +かかえる +かがく +かがし +かがみ +かくご +かくとく +かざる +がぞう +かたい +かたち +がちょう +がっきゅう +がっこう +がっさん +がっしょう +かなざわし +かのう +がはく +かぶか +かほう +かほご +かまう +かまぼこ +かめれおん +かゆい +かようび +からい +かるい +かろう +かわく +かわら +がんか +かんけい +かんこう +かんしゃ +かんそう +かんたん +かんち +がんばる +きあい +きあつ +きいろ +ぎいん +きうい +きうん +きえる +きおう +きおく +きおち +きおん +きかい +きかく +きかんしゃ +ききて +きくばり +きくらげ +きけんせい +きこう +きこえる +きこく +きさい +きさく +きさま +きさらぎ +ぎじかがく +ぎしき +ぎじたいけん +ぎじにってい +ぎじゅつしゃ +きすう +きせい +きせき +きせつ +きそう +きぞく +きぞん +きたえる +きちょう +きつえん +ぎっちり +きつつき +きつね +きてい +きどう +きどく +きない +きなが +きなこ +きぬごし +きねん +きのう +きのした +きはく +きびしい +きひん +きふく +きぶん +きぼう +きほん +きまる +きみつ +きむずかしい +きめる +きもだめし +きもち +きもの +きゃく +きやく +ぎゅうにく +きよう +きょうりゅう +きらい +きらく +きりん +きれい +きれつ +きろく +ぎろん +きわめる +ぎんいろ +きんかくじ +きんじょ +きんようび +ぐあい +くいず +くうかん +くうき +くうぐん +くうこう +ぐうせい +くうそう +ぐうたら +くうふく +くうぼ +くかん +くきょう +くげん +ぐこう +くさい +くさき +くさばな +くさる +くしゃみ +くしょう +くすのき +くすりゆび +くせげ +くせん +ぐたいてき +くださる +くたびれる +くちこみ +くちさき +くつした +ぐっすり +くつろぐ +くとうてん +くどく +くなん +くねくね +くのう +くふう +くみあわせ +くみたてる +くめる +くやくしょ +くらす +くらべる +くるま +くれる +くろう +くわしい +ぐんかん +ぐんしょく +ぐんたい +ぐんて +けあな +けいかく +けいけん +けいこ +けいさつ +げいじゅつ +けいたい +げいのうじん +けいれき +けいろ +けおとす +けおりもの +げきか +げきげん +げきだん +げきちん +げきとつ +げきは +げきやく +げこう +げこくじょう +げざい +けさき +げざん +けしき +けしごむ +けしょう +げすと +けたば +けちゃっぷ +けちらす +けつあつ +けつい +けつえき +けっこん +けつじょ +けっせき +けってい +けつまつ +げつようび +げつれい +けつろん +げどく +けとばす +けとる +けなげ +けなす +けなみ +けぬき +げねつ +けねん +けはい +げひん +けぶかい +げぼく +けまり +けみかる +けむし +けむり +けもの +けらい +けろけろ +けわしい +けんい +けんえつ +けんお +けんか +げんき +けんげん +けんこう +けんさく +けんしゅう +けんすう +げんそう +けんちく +けんてい +けんとう +けんない +けんにん +げんぶつ +けんま +けんみん +けんめい +けんらん +けんり +こあくま +こいぬ +こいびと +ごうい +こうえん +こうおん +こうかん +ごうきゅう +ごうけい +こうこう +こうさい +こうじ +こうすい +ごうせい +こうそく +こうたい +こうちゃ +こうつう +こうてい +こうどう +こうない +こうはい +ごうほう +ごうまん +こうもく +こうりつ +こえる +こおり +ごかい +ごがつ +ごかん +こくご +こくさい +こくとう +こくない +こくはく +こぐま +こけい +こける +ここのか +こころ +こさめ +こしつ +こすう +こせい +こせき +こぜん +こそだて +こたい +こたえる +こたつ +こちょう +こっか +こつこつ +こつばん +こつぶ +こてい +こてん +ことがら +ことし +ことば +ことり +こなごな +こねこね +このまま +このみ +このよ +ごはん +こひつじ +こふう +こふん +こぼれる +ごまあぶら +こまかい +ごますり +こまつな +こまる +こむぎこ +こもじ +こもち +こもの +こもん +こやく +こやま +こゆう +こゆび +こよい +こよう +こりる +これくしょん +ころっけ +こわもて +こわれる +こんいん +こんかい +こんき +こんしゅう +こんすい +こんだて +こんとん +こんなん +こんびに +こんぽん +こんまけ +こんや +こんれい +こんわく +ざいえき +さいかい +さいきん +ざいげん +ざいこ +さいしょ +さいせい +ざいたく +ざいちゅう +さいてき +ざいりょう +さうな +さかいし +さがす +さかな +さかみち +さがる +さぎょう +さくし +さくひん +さくら +さこく +さこつ +さずかる +ざせき +さたん +さつえい +ざつおん +ざっか +ざつがく +さっきょく +ざっし +さつじん +ざっそう +さつたば +さつまいも +さてい +さといも +さとう +さとおや +さとし +さとる +さのう +さばく +さびしい +さべつ +さほう +さほど +さます +さみしい +さみだれ +さむけ +さめる +さやえんどう +さゆう +さよう +さよく +さらだ +ざるそば +さわやか +さわる +さんいん +さんか +さんきゃく +さんこう +さんさい +ざんしょ +さんすう +さんせい +さんそ +さんち +さんま +さんみ +さんらん +しあい +しあげ +しあさって +しあわせ +しいく +しいん +しうち +しえい +しおけ +しかい +しかく +じかん +しごと +しすう +じだい +したうけ +したぎ +したて +したみ +しちょう +しちりん +しっかり +しつじ +しつもん +してい +してき +してつ +じてん +じどう +しなぎれ +しなもの +しなん +しねま +しねん +しのぐ +しのぶ +しはい +しばかり +しはつ +しはらい +しはん +しひょう +しふく +じぶん +しへい +しほう +しほん +しまう +しまる +しみん +しむける +じむしょ +しめい +しめる +しもん +しゃいん +しゃうん +しゃおん +じゃがいも +しやくしょ +しゃくほう +しゃけん +しゃこ +しゃざい +しゃしん +しゃせん +しゃそう +しゃたい +しゃちょう +しゃっきん +じゃま +しゃりん +しゃれい +じゆう +じゅうしょ +しゅくはく +じゅしん +しゅっせき +しゅみ +しゅらば +じゅんばん +しょうかい +しょくたく +しょっけん +しょどう +しょもつ +しらせる +しらべる +しんか +しんこう +じんじゃ +しんせいじ +しんちく +しんりん +すあげ +すあし +すあな +ずあん +すいえい +すいか +すいとう +ずいぶん +すいようび +すうがく +すうじつ +すうせん +すおどり +すきま +すくう +すくない +すける +すごい +すこし +ずさん +すずしい +すすむ +すすめる +すっかり +ずっしり +ずっと +すてき +すてる +すねる +すのこ +すはだ +すばらしい +ずひょう +ずぶぬれ +すぶり +すふれ +すべて +すべる +ずほう +すぼん +すまい +すめし +すもう +すやき +すらすら +するめ +すれちがう +すろっと +すわる +すんぜん +すんぽう +せあぶら +せいかつ +せいげん +せいじ +せいよう +せおう +せかいかん +せきにん +せきむ +せきゆ +せきらんうん +せけん +せこう +せすじ +せたい +せたけ +せっかく +せっきゃく +ぜっく +せっけん +せっこつ +せっさたくま +せつぞく +せつだん +せつでん +せっぱん +せつび +せつぶん +せつめい +せつりつ +せなか +せのび +せはば +せびろ +せぼね +せまい +せまる +せめる +せもたれ +せりふ +ぜんあく +せんい +せんえい +せんか +せんきょ +せんく +せんげん +ぜんご +せんさい +せんしゅ +せんすい +せんせい +せんぞ +せんたく +せんちょう +せんてい +せんとう +せんぬき +せんねん +せんぱい +ぜんぶ +ぜんぽう +せんむ +せんめんじょ +せんもん +せんやく +せんゆう +せんよう +ぜんら +ぜんりゃく +せんれい +せんろ +そあく +そいとげる +そいね +そうがんきょう +そうき +そうご +そうしん +そうだん +そうなん +そうび +そうめん +そうり +そえもの +そえん +そがい +そげき +そこう +そこそこ +そざい +そしな +そせい +そせん +そそぐ +そだてる +そつう +そつえん +そっかん +そつぎょう +そっけつ +そっこう +そっせん +そっと +そとがわ +そとづら +そなえる +そなた +そふぼ +そぼく +そぼろ +そまつ +そまる +そむく +そむりえ +そめる +そもそも +そよかぜ +そらまめ +そろう +そんかい +そんけい +そんざい +そんしつ +そんぞく +そんちょう +ぞんび +ぞんぶん +そんみん +たあい +たいいん +たいうん +たいえき +たいおう +だいがく +たいき +たいぐう +たいけん +たいこ +たいざい +だいじょうぶ +だいすき +たいせつ +たいそう +だいたい +たいちょう +たいてい +だいどころ +たいない +たいねつ +たいのう +たいはん +だいひょう +たいふう +たいへん +たいほ +たいまつばな +たいみんぐ +たいむ +たいめん +たいやき +たいよう +たいら +たいりょく +たいる +たいわん +たうえ +たえる +たおす +たおる +たおれる +たかい +たかね +たきび +たくさん +たこく +たこやき +たさい +たしざん +だじゃれ +たすける +たずさわる +たそがれ +たたかう +たたく +ただしい +たたみ +たちばな +だっかい +だっきゃく +だっこ +だっしゅつ +だったい +たてる +たとえる +たなばた +たにん +たぬき +たのしみ +たはつ +たぶん +たべる +たぼう +たまご +たまる +だむる +ためいき +ためす +ためる +たもつ +たやすい +たよる +たらす +たりきほんがん +たりょう +たりる +たると +たれる +たれんと +たろっと +たわむれる +だんあつ +たんい +たんおん +たんか +たんき +たんけん +たんご +たんさん +たんじょうび +だんせい +たんそく +たんたい +だんち +たんてい +たんとう +だんな +たんにん +だんねつ +たんのう +たんぴん +だんぼう +たんまつ +たんめい +だんれつ +だんろ +だんわ +ちあい +ちあん +ちいき +ちいさい +ちえん +ちかい +ちから +ちきゅう +ちきん +ちけいず +ちけん +ちこく +ちさい +ちしき +ちしりょう +ちせい +ちそう +ちたい +ちたん +ちちおや +ちつじょ +ちてき +ちてん +ちぬき +ちぬり +ちのう +ちひょう +ちへいせん +ちほう +ちまた +ちみつ +ちみどろ +ちめいど +ちゃんこなべ +ちゅうい +ちゆりょく +ちょうし +ちょさくけん +ちらし +ちらみ +ちりがみ +ちりょう +ちるど +ちわわ +ちんたい +ちんもく +ついか +ついたち +つうか +つうじょう +つうはん +つうわ +つかう +つかれる +つくね +つくる +つけね +つける +つごう +つたえる +つづく +つつじ +つつむ +つとめる +つながる +つなみ +つねづね +つのる +つぶす +つまらない +つまる +つみき +つめたい +つもり +つもる +つよい +つるぼ +つるみく +つわもの +つわり +てあし +てあて +てあみ +ていおん +ていか +ていき +ていけい +ていこく +ていさつ +ていし +ていせい +ていたい +ていど +ていねい +ていひょう +ていへん +ていぼう +てうち +ておくれ +てきとう +てくび +でこぼこ +てさぎょう +てさげ +てすり +てそう +てちがい +てちょう +てつがく +てつづき +でっぱ +てつぼう +てつや +でぬかえ +てぬき +てぬぐい +てのひら +てはい +てぶくろ +てふだ +てほどき +てほん +てまえ +てまきずし +てみじか +てみやげ +てらす +てれび +てわけ +てわたし +でんあつ +てんいん +てんかい +てんき +てんぐ +てんけん +てんごく +てんさい +てんし +てんすう +でんち +てんてき +てんとう +てんない +てんぷら +てんぼうだい +てんめつ +てんらんかい +でんりょく +でんわ +どあい +といれ +どうかん +とうきゅう +どうぐ +とうし +とうむぎ +とおい +とおか +とおく +とおす +とおる +とかい +とかす +ときおり +ときどき +とくい +とくしゅう +とくてん +とくに +とくべつ +とけい +とける +とこや +とさか +としょかん +とそう +とたん +とちゅう +とっきゅう +とっくん +とつぜん +とつにゅう +とどける +ととのえる +とない +となえる +となり +とのさま +とばす +どぶがわ +とほう +とまる +とめる +ともだち +ともる +どようび +とらえる +とんかつ +どんぶり +ないかく +ないこう +ないしょ +ないす +ないせん +ないそう +なおす +ながい +なくす +なげる +なこうど +なさけ +なたでここ +なっとう +なつやすみ +ななおし +なにごと +なにもの +なにわ +なのか +なふだ +なまいき +なまえ +なまみ +なみだ +なめらか +なめる +なやむ +ならう +ならび +ならぶ +なれる +なわとび +なわばり +にあう +にいがた +にうけ +におい +にかい +にがて +にきび +にくしみ +にくまん +にげる +にさんかたんそ +にしき +にせもの +にちじょう +にちようび +にっか +にっき +にっけい +にっこう +にっさん +にっしょく +にっすう +にっせき +にってい +になう +にほん +にまめ +にもつ +にやり +にゅういん +にりんしゃ +にわとり +にんい +にんか +にんき +にんげん +にんしき +にんずう +にんそう +にんたい +にんち +にんてい +にんにく +にんぷ +にんまり +にんむ +にんめい +にんよう +ぬいくぎ +ぬかす +ぬぐいとる +ぬぐう +ぬくもり +ぬすむ +ぬまえび +ぬめり +ぬらす +ぬんちゃく +ねあげ +ねいき +ねいる +ねいろ +ねぐせ +ねくたい +ねくら +ねこぜ +ねこむ +ねさげ +ねすごす +ねそべる +ねだん +ねつい +ねっしん +ねつぞう +ねったいぎょ +ねぶそく +ねふだ +ねぼう +ねほりはほり +ねまき +ねまわし +ねみみ +ねむい +ねむたい +ねもと +ねらう +ねわざ +ねんいり +ねんおし +ねんかん +ねんきん +ねんぐ +ねんざ +ねんし +ねんちゃく +ねんど +ねんぴ +ねんぶつ +ねんまつ +ねんりょう +ねんれい +のいず +のおづま +のがす +のきなみ +のこぎり +のこす +のこる +のせる +のぞく +のぞむ +のたまう +のちほど +のっく +のばす +のはら +のべる +のぼる +のみもの +のやま +のらいぬ +のらねこ +のりもの +のりゆき +のれん +のんき +ばあい +はあく +ばあさん +ばいか +ばいく +はいけん +はいご +はいしん +はいすい +はいせん +はいそう +はいち +ばいばい +はいれつ +はえる +はおる +はかい +ばかり +はかる +はくしゅ +はけん +はこぶ +はさみ +はさん +はしご +ばしょ +はしる +はせる +ぱそこん +はそん +はたん +はちみつ +はつおん +はっかく +はづき +はっきり +はっくつ +はっけん +はっこう +はっさん +はっしん +はったつ +はっちゅう +はってん +はっぴょう +はっぽう +はなす +はなび +はにかむ +はぶらし +はみがき +はむかう +はめつ +はやい +はやし +はらう +はろうぃん +はわい +はんい +はんえい +はんおん +はんかく +はんきょう +ばんぐみ +はんこ +はんしゃ +はんすう +はんだん +ぱんち +ぱんつ +はんてい +はんとし +はんのう +はんぱ +はんぶん +はんぺん +はんぼうき +はんめい +はんらん +はんろん +ひいき +ひうん +ひえる +ひかく +ひかり +ひかる +ひかん +ひくい +ひけつ +ひこうき +ひこく +ひさい +ひさしぶり +ひさん +びじゅつかん +ひしょ +ひそか +ひそむ +ひたむき +ひだり +ひたる +ひつぎ +ひっこし +ひっし +ひつじゅひん +ひっす +ひつぜん +ぴったり +ぴっちり +ひつよう +ひてい +ひとごみ +ひなまつり +ひなん +ひねる +ひはん +ひびく +ひひょう +ひほう +ひまわり +ひまん +ひみつ +ひめい +ひめじし +ひやけ +ひやす +ひよう +びょうき +ひらがな +ひらく +ひりつ +ひりょう +ひるま +ひるやすみ +ひれい +ひろい +ひろう +ひろき +ひろゆき +ひんかく +ひんけつ +ひんこん +ひんしゅ +ひんそう +ぴんち +ひんぱん +びんぼう +ふあん +ふいうち +ふうけい +ふうせん +ぷうたろう +ふうとう +ふうふ +ふえる +ふおん +ふかい +ふきん +ふくざつ +ふくぶくろ +ふこう +ふさい +ふしぎ +ふじみ +ふすま +ふせい +ふせぐ +ふそく +ぶたにく +ふたん +ふちょう +ふつう +ふつか +ふっかつ +ふっき +ふっこく +ぶどう +ふとる +ふとん +ふのう +ふはい +ふひょう +ふへん +ふまん +ふみん +ふめつ +ふめん +ふよう +ふりこ +ふりる +ふるい +ふんいき +ぶんがく +ぶんぐ +ふんしつ +ぶんせき +ふんそう +ぶんぽう +へいあん +へいおん +へいがい +へいき +へいげん +へいこう +へいさ +へいしゃ +へいせつ +へいそ +へいたく +へいてん +へいねつ +へいわ +へきが +へこむ +べにいろ +べにしょうが +へらす +へんかん +べんきょう +べんごし +へんさい +へんたい +べんり +ほあん +ほいく +ぼうぎょ +ほうこく +ほうそう +ほうほう +ほうもん +ほうりつ +ほえる +ほおん +ほかん +ほきょう +ぼきん +ほくろ +ほけつ +ほけん +ほこう +ほこる +ほしい +ほしつ +ほしゅ +ほしょう +ほせい +ほそい +ほそく +ほたて +ほたる +ぽちぶくろ +ほっきょく +ほっさ +ほったん +ほとんど +ほめる +ほんい +ほんき +ほんけ +ほんしつ +ほんやく +まいにち +まかい +まかせる +まがる +まける +まこと +まさつ +まじめ +ますく +まぜる +まつり +まとめ +まなぶ +まぬけ +まねく +まほう +まもる +まゆげ +まよう +まろやか +まわす +まわり +まわる +まんが +まんきつ +まんぞく +まんなか +みいら +みうち +みえる +みがく +みかた +みかん +みけん +みこん +みじかい +みすい +みすえる +みせる +みっか +みつかる +みつける +みてい +みとめる +みなと +みなみかさい +みねらる +みのう +みのがす +みほん +みもと +みやげ +みらい +みりょく +みわく +みんか +みんぞく +むいか +むえき +むえん +むかい +むかう +むかえ +むかし +むぎちゃ +むける +むげん +むさぼる +むしあつい +むしば +むじゅん +むしろ +むすう +むすこ +むすぶ +むすめ +むせる +むせん +むちゅう +むなしい +むのう +むやみ +むよう +むらさき +むりょう +むろん +めいあん +めいうん +めいえん +めいかく +めいきょく +めいさい +めいし +めいそう +めいぶつ +めいれい +めいわく +めぐまれる +めざす +めした +めずらしい +めだつ +めまい +めやす +めんきょ +めんせき +めんどう +もうしあげる +もうどうけん +もえる +もくし +もくてき +もくようび +もちろん +もどる +もらう +もんく +もんだい +やおや +やける +やさい +やさしい +やすい +やすたろう +やすみ +やせる +やそう +やたい +やちん +やっと +やっぱり +やぶる +やめる +ややこしい +やよい +やわらかい +ゆうき +ゆうびんきょく +ゆうべ +ゆうめい +ゆけつ +ゆしゅつ +ゆせん +ゆそう +ゆたか +ゆちゃく +ゆでる +ゆにゅう +ゆびわ +ゆらい +ゆれる +ようい +ようか +ようきゅう +ようじ +ようす +ようちえん +よかぜ +よかん +よきん +よくせい +よくぼう +よけい +よごれる +よさん +よしゅう +よそう +よそく +よっか +よてい +よどがわく +よねつ +よやく +よゆう +よろこぶ +よろしい +らいう +らくがき +らくご +らくさつ +らくだ +らしんばん +らせん +らぞく +らたい +らっか +られつ +りえき +りかい +りきさく +りきせつ +りくぐん +りくつ +りけん +りこう +りせい +りそう +りそく +りてん +りねん +りゆう +りゅうがく +りよう +りょうり +りょかん +りょくちゃ +りょこう +りりく +りれき +りろん +りんご +るいけい +るいさい +るいじ +るいせき +るすばん +るりがわら +れいかん +れいぎ +れいせい +れいぞうこ +れいとう +れいぼう +れきし +れきだい +れんあい +れんけい +れんこん +れんさい +れんしゅう +れんぞく +れんらく +ろうか +ろうご +ろうじん +ろうそく +ろくが +ろこつ +ろじうら +ろしゅつ +ろせん +ろてん +ろめん +ろれつ +ろんぎ +ろんぱ +ろんぶん +ろんり +わかす +わかめ +わかやま +わかれる +わしつ +わじまし +わすれもの +わらう +われる +` diff --git a/bip39gen/bip39/wordlists/korean.go b/bip39gen/bip39/wordlists/korean.go new file mode 100644 index 00000000..1d317756 --- /dev/null +++ b/bip39gen/bip39/wordlists/korean.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/korean.txt + // $ crc32 korean.txt + // 4ef461eb + checksum := crc32.ChecksumIEEE([]byte(korean)) + if fmt.Sprintf("%x", checksum) != "4ef461eb" { + panic("korean checksum invalid") + } +} + +// Korean is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/korean.txt +var Korean = strings.Split(strings.TrimSpace(korean), "\n") +var korean = `가격 +가끔 +가난 +가능 +가득 +가르침 +가뭄 +가방 +가상 +가슴 +가운데 +가을 +가이드 +가입 +가장 +가정 +가족 +가죽 +각오 +각자 +간격 +간부 +간섭 +간장 +간접 +간판 +갈등 +갈비 +갈색 +갈증 +감각 +감기 +감소 +감수성 +감자 +감정 +갑자기 +강남 +강당 +강도 +강력히 +강변 +강북 +강사 +강수량 +강아지 +강원도 +강의 +강제 +강조 +같이 +개구리 +개나리 +개방 +개별 +개선 +개성 +개인 +객관적 +거실 +거액 +거울 +거짓 +거품 +걱정 +건강 +건물 +건설 +건조 +건축 +걸음 +검사 +검토 +게시판 +게임 +겨울 +견해 +결과 +결국 +결론 +결석 +결승 +결심 +결정 +결혼 +경계 +경고 +경기 +경력 +경복궁 +경비 +경상도 +경영 +경우 +경쟁 +경제 +경주 +경찰 +경치 +경향 +경험 +계곡 +계단 +계란 +계산 +계속 +계약 +계절 +계층 +계획 +고객 +고구려 +고궁 +고급 +고등학생 +고무신 +고민 +고양이 +고장 +고전 +고집 +고춧가루 +고통 +고향 +곡식 +골목 +골짜기 +골프 +공간 +공개 +공격 +공군 +공급 +공기 +공동 +공무원 +공부 +공사 +공식 +공업 +공연 +공원 +공장 +공짜 +공책 +공통 +공포 +공항 +공휴일 +과목 +과일 +과장 +과정 +과학 +관객 +관계 +관광 +관념 +관람 +관련 +관리 +관습 +관심 +관점 +관찰 +광경 +광고 +광장 +광주 +괴로움 +굉장히 +교과서 +교문 +교복 +교실 +교양 +교육 +교장 +교직 +교통 +교환 +교훈 +구경 +구름 +구멍 +구별 +구분 +구석 +구성 +구속 +구역 +구입 +구청 +구체적 +국가 +국기 +국내 +국립 +국물 +국민 +국수 +국어 +국왕 +국적 +국제 +국회 +군대 +군사 +군인 +궁극적 +권리 +권위 +권투 +귀국 +귀신 +규정 +규칙 +균형 +그날 +그냥 +그늘 +그러나 +그룹 +그릇 +그림 +그제서야 +그토록 +극복 +극히 +근거 +근교 +근래 +근로 +근무 +근본 +근원 +근육 +근처 +글씨 +글자 +금강산 +금고 +금년 +금메달 +금액 +금연 +금요일 +금지 +긍정적 +기간 +기관 +기념 +기능 +기독교 +기둥 +기록 +기름 +기법 +기본 +기분 +기쁨 +기숙사 +기술 +기억 +기업 +기온 +기운 +기원 +기적 +기준 +기침 +기혼 +기획 +긴급 +긴장 +길이 +김밥 +김치 +김포공항 +깍두기 +깜빡 +깨달음 +깨소금 +껍질 +꼭대기 +꽃잎 +나들이 +나란히 +나머지 +나물 +나침반 +나흘 +낙엽 +난방 +날개 +날씨 +날짜 +남녀 +남대문 +남매 +남산 +남자 +남편 +남학생 +낭비 +낱말 +내년 +내용 +내일 +냄비 +냄새 +냇물 +냉동 +냉면 +냉방 +냉장고 +넥타이 +넷째 +노동 +노란색 +노력 +노인 +녹음 +녹차 +녹화 +논리 +논문 +논쟁 +놀이 +농구 +농담 +농민 +농부 +농업 +농장 +농촌 +높이 +눈동자 +눈물 +눈썹 +뉴욕 +느낌 +늑대 +능동적 +능력 +다방 +다양성 +다음 +다이어트 +다행 +단계 +단골 +단독 +단맛 +단순 +단어 +단위 +단점 +단체 +단추 +단편 +단풍 +달걀 +달러 +달력 +달리 +닭고기 +담당 +담배 +담요 +담임 +답변 +답장 +당근 +당분간 +당연히 +당장 +대규모 +대낮 +대단히 +대답 +대도시 +대략 +대량 +대륙 +대문 +대부분 +대신 +대응 +대장 +대전 +대접 +대중 +대책 +대출 +대충 +대통령 +대학 +대한민국 +대합실 +대형 +덩어리 +데이트 +도대체 +도덕 +도둑 +도망 +도서관 +도심 +도움 +도입 +도자기 +도저히 +도전 +도중 +도착 +독감 +독립 +독서 +독일 +독창적 +동화책 +뒷모습 +뒷산 +딸아이 +마누라 +마늘 +마당 +마라톤 +마련 +마무리 +마사지 +마약 +마요네즈 +마을 +마음 +마이크 +마중 +마지막 +마찬가지 +마찰 +마흔 +막걸리 +막내 +막상 +만남 +만두 +만세 +만약 +만일 +만점 +만족 +만화 +많이 +말기 +말씀 +말투 +맘대로 +망원경 +매년 +매달 +매력 +매번 +매스컴 +매일 +매장 +맥주 +먹이 +먼저 +먼지 +멀리 +메일 +며느리 +며칠 +면담 +멸치 +명단 +명령 +명예 +명의 +명절 +명칭 +명함 +모금 +모니터 +모델 +모든 +모범 +모습 +모양 +모임 +모조리 +모집 +모퉁이 +목걸이 +목록 +목사 +목소리 +목숨 +목적 +목표 +몰래 +몸매 +몸무게 +몸살 +몸속 +몸짓 +몸통 +몹시 +무관심 +무궁화 +무더위 +무덤 +무릎 +무슨 +무엇 +무역 +무용 +무조건 +무지개 +무척 +문구 +문득 +문법 +문서 +문제 +문학 +문화 +물가 +물건 +물결 +물고기 +물론 +물리학 +물음 +물질 +물체 +미국 +미디어 +미사일 +미술 +미역 +미용실 +미움 +미인 +미팅 +미혼 +민간 +민족 +민주 +믿음 +밀가루 +밀리미터 +밑바닥 +바가지 +바구니 +바나나 +바늘 +바닥 +바닷가 +바람 +바이러스 +바탕 +박물관 +박사 +박수 +반대 +반드시 +반말 +반발 +반성 +반응 +반장 +반죽 +반지 +반찬 +받침 +발가락 +발걸음 +발견 +발달 +발레 +발목 +발바닥 +발생 +발음 +발자국 +발전 +발톱 +발표 +밤하늘 +밥그릇 +밥맛 +밥상 +밥솥 +방금 +방면 +방문 +방바닥 +방법 +방송 +방식 +방안 +방울 +방지 +방학 +방해 +방향 +배경 +배꼽 +배달 +배드민턴 +백두산 +백색 +백성 +백인 +백제 +백화점 +버릇 +버섯 +버튼 +번개 +번역 +번지 +번호 +벌금 +벌레 +벌써 +범위 +범인 +범죄 +법률 +법원 +법적 +법칙 +베이징 +벨트 +변경 +변동 +변명 +변신 +변호사 +변화 +별도 +별명 +별일 +병실 +병아리 +병원 +보관 +보너스 +보라색 +보람 +보름 +보상 +보안 +보자기 +보장 +보전 +보존 +보통 +보편적 +보험 +복도 +복사 +복숭아 +복습 +볶음 +본격적 +본래 +본부 +본사 +본성 +본인 +본질 +볼펜 +봉사 +봉지 +봉투 +부근 +부끄러움 +부담 +부동산 +부문 +부분 +부산 +부상 +부엌 +부인 +부작용 +부장 +부정 +부족 +부지런히 +부친 +부탁 +부품 +부회장 +북부 +북한 +분노 +분량 +분리 +분명 +분석 +분야 +분위기 +분필 +분홍색 +불고기 +불과 +불교 +불꽃 +불만 +불법 +불빛 +불안 +불이익 +불행 +브랜드 +비극 +비난 +비닐 +비둘기 +비디오 +비로소 +비만 +비명 +비밀 +비바람 +비빔밥 +비상 +비용 +비율 +비중 +비타민 +비판 +빌딩 +빗물 +빗방울 +빗줄기 +빛깔 +빨간색 +빨래 +빨리 +사건 +사계절 +사나이 +사냥 +사람 +사랑 +사립 +사모님 +사물 +사방 +사상 +사생활 +사설 +사슴 +사실 +사업 +사용 +사월 +사장 +사전 +사진 +사촌 +사춘기 +사탕 +사투리 +사흘 +산길 +산부인과 +산업 +산책 +살림 +살인 +살짝 +삼계탕 +삼국 +삼십 +삼월 +삼촌 +상관 +상금 +상대 +상류 +상반기 +상상 +상식 +상업 +상인 +상자 +상점 +상처 +상추 +상태 +상표 +상품 +상황 +새벽 +색깔 +색연필 +생각 +생명 +생물 +생방송 +생산 +생선 +생신 +생일 +생활 +서랍 +서른 +서명 +서민 +서비스 +서양 +서울 +서적 +서점 +서쪽 +서클 +석사 +석유 +선거 +선물 +선배 +선생 +선수 +선원 +선장 +선전 +선택 +선풍기 +설거지 +설날 +설렁탕 +설명 +설문 +설사 +설악산 +설치 +설탕 +섭씨 +성공 +성당 +성명 +성별 +성인 +성장 +성적 +성질 +성함 +세금 +세미나 +세상 +세월 +세종대왕 +세탁 +센터 +센티미터 +셋째 +소규모 +소극적 +소금 +소나기 +소년 +소득 +소망 +소문 +소설 +소속 +소아과 +소용 +소원 +소음 +소중히 +소지품 +소질 +소풍 +소형 +속담 +속도 +속옷 +손가락 +손길 +손녀 +손님 +손등 +손목 +손뼉 +손실 +손질 +손톱 +손해 +솔직히 +솜씨 +송아지 +송이 +송편 +쇠고기 +쇼핑 +수건 +수년 +수단 +수돗물 +수동적 +수면 +수명 +수박 +수상 +수석 +수술 +수시로 +수업 +수염 +수영 +수입 +수준 +수집 +수출 +수컷 +수필 +수학 +수험생 +수화기 +숙녀 +숙소 +숙제 +순간 +순서 +순수 +순식간 +순위 +숟가락 +술병 +술집 +숫자 +스님 +스물 +스스로 +스승 +스웨터 +스위치 +스케이트 +스튜디오 +스트레스 +스포츠 +슬쩍 +슬픔 +습관 +습기 +승객 +승리 +승부 +승용차 +승진 +시각 +시간 +시골 +시금치 +시나리오 +시댁 +시리즈 +시멘트 +시민 +시부모 +시선 +시설 +시스템 +시아버지 +시어머니 +시월 +시인 +시일 +시작 +시장 +시절 +시점 +시중 +시즌 +시집 +시청 +시합 +시험 +식구 +식기 +식당 +식량 +식료품 +식물 +식빵 +식사 +식생활 +식초 +식탁 +식품 +신고 +신규 +신념 +신문 +신발 +신비 +신사 +신세 +신용 +신제품 +신청 +신체 +신화 +실감 +실내 +실력 +실례 +실망 +실수 +실습 +실시 +실장 +실정 +실질적 +실천 +실체 +실컷 +실태 +실패 +실험 +실현 +심리 +심부름 +심사 +심장 +심정 +심판 +쌍둥이 +씨름 +씨앗 +아가씨 +아나운서 +아드님 +아들 +아쉬움 +아스팔트 +아시아 +아울러 +아저씨 +아줌마 +아직 +아침 +아파트 +아프리카 +아픔 +아홉 +아흔 +악기 +악몽 +악수 +안개 +안경 +안과 +안내 +안녕 +안동 +안방 +안부 +안주 +알루미늄 +알코올 +암시 +암컷 +압력 +앞날 +앞문 +애인 +애정 +액수 +앨범 +야간 +야단 +야옹 +약간 +약국 +약속 +약수 +약점 +약품 +약혼녀 +양념 +양력 +양말 +양배추 +양주 +양파 +어둠 +어려움 +어른 +어젯밤 +어쨌든 +어쩌다가 +어쩐지 +언니 +언덕 +언론 +언어 +얼굴 +얼른 +얼음 +얼핏 +엄마 +업무 +업종 +업체 +엉덩이 +엉망 +엉터리 +엊그제 +에너지 +에어컨 +엔진 +여건 +여고생 +여관 +여군 +여권 +여대생 +여덟 +여동생 +여든 +여론 +여름 +여섯 +여성 +여왕 +여인 +여전히 +여직원 +여학생 +여행 +역사 +역시 +역할 +연결 +연구 +연극 +연기 +연락 +연설 +연세 +연속 +연습 +연애 +연예인 +연인 +연장 +연주 +연출 +연필 +연합 +연휴 +열기 +열매 +열쇠 +열심히 +열정 +열차 +열흘 +염려 +엽서 +영국 +영남 +영상 +영양 +영역 +영웅 +영원히 +영하 +영향 +영혼 +영화 +옆구리 +옆방 +옆집 +예감 +예금 +예방 +예산 +예상 +예선 +예술 +예습 +예식장 +예약 +예전 +예절 +예정 +예컨대 +옛날 +오늘 +오락 +오랫동안 +오렌지 +오로지 +오른발 +오븐 +오십 +오염 +오월 +오전 +오직 +오징어 +오페라 +오피스텔 +오히려 +옥상 +옥수수 +온갖 +온라인 +온몸 +온종일 +온통 +올가을 +올림픽 +올해 +옷차림 +와이셔츠 +와인 +완성 +완전 +왕비 +왕자 +왜냐하면 +왠지 +외갓집 +외국 +외로움 +외삼촌 +외출 +외침 +외할머니 +왼발 +왼손 +왼쪽 +요금 +요일 +요즘 +요청 +용기 +용서 +용어 +우산 +우선 +우승 +우연히 +우정 +우체국 +우편 +운동 +운명 +운반 +운전 +운행 +울산 +울음 +움직임 +웃어른 +웃음 +워낙 +원고 +원래 +원서 +원숭이 +원인 +원장 +원피스 +월급 +월드컵 +월세 +월요일 +웨이터 +위반 +위법 +위성 +위원 +위험 +위협 +윗사람 +유난히 +유럽 +유명 +유물 +유산 +유적 +유치원 +유학 +유행 +유형 +육군 +육상 +육십 +육체 +은행 +음력 +음료 +음반 +음성 +음식 +음악 +음주 +의견 +의논 +의문 +의복 +의식 +의심 +의외로 +의욕 +의원 +의학 +이것 +이곳 +이념 +이놈 +이달 +이대로 +이동 +이렇게 +이력서 +이론적 +이름 +이민 +이발소 +이별 +이불 +이빨 +이상 +이성 +이슬 +이야기 +이용 +이웃 +이월 +이윽고 +이익 +이전 +이중 +이튿날 +이틀 +이혼 +인간 +인격 +인공 +인구 +인근 +인기 +인도 +인류 +인물 +인생 +인쇄 +인연 +인원 +인재 +인종 +인천 +인체 +인터넷 +인하 +인형 +일곱 +일기 +일단 +일대 +일등 +일반 +일본 +일부 +일상 +일생 +일손 +일요일 +일월 +일정 +일종 +일주일 +일찍 +일체 +일치 +일행 +일회용 +임금 +임무 +입대 +입력 +입맛 +입사 +입술 +입시 +입원 +입장 +입학 +자가용 +자격 +자극 +자동 +자랑 +자부심 +자식 +자신 +자연 +자원 +자율 +자전거 +자정 +자존심 +자판 +작가 +작년 +작성 +작업 +작용 +작은딸 +작품 +잔디 +잔뜩 +잔치 +잘못 +잠깐 +잠수함 +잠시 +잠옷 +잠자리 +잡지 +장관 +장군 +장기간 +장래 +장례 +장르 +장마 +장면 +장모 +장미 +장비 +장사 +장소 +장식 +장애인 +장인 +장점 +장차 +장학금 +재능 +재빨리 +재산 +재생 +재작년 +재정 +재채기 +재판 +재학 +재활용 +저것 +저고리 +저곳 +저녁 +저런 +저렇게 +저번 +저울 +저절로 +저축 +적극 +적당히 +적성 +적용 +적응 +전개 +전공 +전기 +전달 +전라도 +전망 +전문 +전반 +전부 +전세 +전시 +전용 +전자 +전쟁 +전주 +전철 +전체 +전통 +전혀 +전후 +절대 +절망 +절반 +절약 +절차 +점검 +점수 +점심 +점원 +점점 +점차 +접근 +접시 +접촉 +젓가락 +정거장 +정도 +정류장 +정리 +정말 +정면 +정문 +정반대 +정보 +정부 +정비 +정상 +정성 +정오 +정원 +정장 +정지 +정치 +정확히 +제공 +제과점 +제대로 +제목 +제발 +제법 +제삿날 +제안 +제일 +제작 +제주도 +제출 +제품 +제한 +조각 +조건 +조금 +조깅 +조명 +조미료 +조상 +조선 +조용히 +조절 +조정 +조직 +존댓말 +존재 +졸업 +졸음 +종교 +종로 +종류 +종소리 +종업원 +종종 +종합 +좌석 +죄인 +주관적 +주름 +주말 +주머니 +주먹 +주문 +주민 +주방 +주변 +주식 +주인 +주일 +주장 +주전자 +주택 +준비 +줄거리 +줄기 +줄무늬 +중간 +중계방송 +중국 +중년 +중단 +중독 +중반 +중부 +중세 +중소기업 +중순 +중앙 +중요 +중학교 +즉석 +즉시 +즐거움 +증가 +증거 +증권 +증상 +증세 +지각 +지갑 +지경 +지극히 +지금 +지급 +지능 +지름길 +지리산 +지방 +지붕 +지식 +지역 +지우개 +지원 +지적 +지점 +지진 +지출 +직선 +직업 +직원 +직장 +진급 +진동 +진로 +진료 +진리 +진짜 +진찰 +진출 +진통 +진행 +질문 +질병 +질서 +짐작 +집단 +집안 +집중 +짜증 +찌꺼기 +차남 +차라리 +차량 +차림 +차별 +차선 +차츰 +착각 +찬물 +찬성 +참가 +참기름 +참새 +참석 +참여 +참외 +참조 +찻잔 +창가 +창고 +창구 +창문 +창밖 +창작 +창조 +채널 +채점 +책가방 +책방 +책상 +책임 +챔피언 +처벌 +처음 +천국 +천둥 +천장 +천재 +천천히 +철도 +철저히 +철학 +첫날 +첫째 +청년 +청바지 +청소 +청춘 +체계 +체력 +체온 +체육 +체중 +체험 +초등학생 +초반 +초밥 +초상화 +초순 +초여름 +초원 +초저녁 +초점 +초청 +초콜릿 +촛불 +총각 +총리 +총장 +촬영 +최근 +최상 +최선 +최신 +최악 +최종 +추석 +추억 +추진 +추천 +추측 +축구 +축소 +축제 +축하 +출근 +출발 +출산 +출신 +출연 +출입 +출장 +출판 +충격 +충고 +충돌 +충분히 +충청도 +취업 +취직 +취향 +치약 +친구 +친척 +칠십 +칠월 +칠판 +침대 +침묵 +침실 +칫솔 +칭찬 +카메라 +카운터 +칼국수 +캐릭터 +캠퍼스 +캠페인 +커튼 +컨디션 +컬러 +컴퓨터 +코끼리 +코미디 +콘서트 +콜라 +콤플렉스 +콩나물 +쾌감 +쿠데타 +크림 +큰길 +큰딸 +큰소리 +큰아들 +큰어머니 +큰일 +큰절 +클래식 +클럽 +킬로 +타입 +타자기 +탁구 +탁자 +탄생 +태권도 +태양 +태풍 +택시 +탤런트 +터널 +터미널 +테니스 +테스트 +테이블 +텔레비전 +토론 +토마토 +토요일 +통계 +통과 +통로 +통신 +통역 +통일 +통장 +통제 +통증 +통합 +통화 +퇴근 +퇴원 +퇴직금 +튀김 +트럭 +특급 +특별 +특성 +특수 +특징 +특히 +튼튼히 +티셔츠 +파란색 +파일 +파출소 +판결 +판단 +판매 +판사 +팔십 +팔월 +팝송 +패션 +팩스 +팩시밀리 +팬티 +퍼센트 +페인트 +편견 +편의 +편지 +편히 +평가 +평균 +평생 +평소 +평양 +평일 +평화 +포스터 +포인트 +포장 +포함 +표면 +표정 +표준 +표현 +품목 +품질 +풍경 +풍속 +풍습 +프랑스 +프린터 +플라스틱 +피곤 +피망 +피아노 +필름 +필수 +필요 +필자 +필통 +핑계 +하느님 +하늘 +하드웨어 +하룻밤 +하반기 +하숙집 +하순 +하여튼 +하지만 +하천 +하품 +하필 +학과 +학교 +학급 +학기 +학년 +학력 +학번 +학부모 +학비 +학생 +학술 +학습 +학용품 +학원 +학위 +학자 +학점 +한계 +한글 +한꺼번에 +한낮 +한눈 +한동안 +한때 +한라산 +한마디 +한문 +한번 +한복 +한식 +한여름 +한쪽 +할머니 +할아버지 +할인 +함께 +함부로 +합격 +합리적 +항공 +항구 +항상 +항의 +해결 +해군 +해답 +해당 +해물 +해석 +해설 +해수욕장 +해안 +핵심 +핸드백 +햄버거 +햇볕 +햇살 +행동 +행복 +행사 +행운 +행위 +향기 +향상 +향수 +허락 +허용 +헬기 +현관 +현금 +현대 +현상 +현실 +현장 +현재 +현지 +혈액 +협력 +형부 +형사 +형수 +형식 +형제 +형태 +형편 +혜택 +호기심 +호남 +호랑이 +호박 +호텔 +호흡 +혹시 +홀로 +홈페이지 +홍보 +홍수 +홍차 +화면 +화분 +화살 +화요일 +화장 +화학 +확보 +확인 +확장 +확정 +환갑 +환경 +환영 +환율 +환자 +활기 +활동 +활발히 +활용 +활짝 +회견 +회관 +회복 +회색 +회원 +회장 +회전 +횟수 +횡단보도 +효율적 +후반 +후춧가루 +훈련 +훨씬 +휴식 +휴일 +흉내 +흐름 +흑백 +흑인 +흔적 +흔히 +흥미 +흥분 +희곡 +희망 +희생 +흰색 +힘껏 +` diff --git a/bip39gen/bip39/wordlists/spanish.go b/bip39gen/bip39/wordlists/spanish.go new file mode 100644 index 00000000..ad76da97 --- /dev/null +++ b/bip39gen/bip39/wordlists/spanish.go @@ -0,0 +1,2071 @@ +package wordlists + +import ( + "fmt" + "hash/crc32" + "strings" +) + +func init() { + // Ensure word list is correct + // $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/spanish.txt + // $ crc32 spanish.txt + // 266e4f3d + checksum := crc32.ChecksumIEEE([]byte(spanish)) + if fmt.Sprintf("%x", checksum) != "266e4f3d" { + panic("spanish checksum invalid") + } +} + +// Spanish is a slice of mnemonic words taken from the bip39 specification +// https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/spanish.txt +var Spanish = strings.Split(strings.TrimSpace(spanish), "\n") +var spanish = `ábaco +abdomen +abeja +abierto +abogado +abono +aborto +abrazo +abrir +abuelo +abuso +acabar +academia +acceso +acción +aceite +acelga +acento +aceptar +ácido +aclarar +acné +acoger +acoso +activo +acto +actriz +actuar +acudir +acuerdo +acusar +adicto +admitir +adoptar +adorno +aduana +adulto +aéreo +afectar +afición +afinar +afirmar +ágil +agitar +agonía +agosto +agotar +agregar +agrio +agua +agudo +águila +aguja +ahogo +ahorro +aire +aislar +ajedrez +ajeno +ajuste +alacrán +alambre +alarma +alba +álbum +alcalde +aldea +alegre +alejar +alerta +aleta +alfiler +alga +algodón +aliado +aliento +alivio +alma +almeja +almíbar +altar +alteza +altivo +alto +altura +alumno +alzar +amable +amante +amapola +amargo +amasar +ámbar +ámbito +ameno +amigo +amistad +amor +amparo +amplio +ancho +anciano +ancla +andar +andén +anemia +ángulo +anillo +ánimo +anís +anotar +antena +antiguo +antojo +anual +anular +anuncio +añadir +añejo +año +apagar +aparato +apetito +apio +aplicar +apodo +aporte +apoyo +aprender +aprobar +apuesta +apuro +arado +araña +arar +árbitro +árbol +arbusto +archivo +arco +arder +ardilla +arduo +área +árido +aries +armonía +arnés +aroma +arpa +arpón +arreglo +arroz +arruga +arte +artista +asa +asado +asalto +ascenso +asegurar +aseo +asesor +asiento +asilo +asistir +asno +asombro +áspero +astilla +astro +astuto +asumir +asunto +atajo +ataque +atar +atento +ateo +ático +atleta +átomo +atraer +atroz +atún +audaz +audio +auge +aula +aumento +ausente +autor +aval +avance +avaro +ave +avellana +avena +avestruz +avión +aviso +ayer +ayuda +ayuno +azafrán +azar +azote +azúcar +azufre +azul +baba +babor +bache +bahía +baile +bajar +balanza +balcón +balde +bambú +banco +banda +baño +barba +barco +barniz +barro +báscula +bastón +basura +batalla +batería +batir +batuta +baúl +bazar +bebé +bebida +bello +besar +beso +bestia +bicho +bien +bingo +blanco +bloque +blusa +boa +bobina +bobo +boca +bocina +boda +bodega +boina +bola +bolero +bolsa +bomba +bondad +bonito +bono +bonsái +borde +borrar +bosque +bote +botín +bóveda +bozal +bravo +brazo +brecha +breve +brillo +brinco +brisa +broca +broma +bronce +brote +bruja +brusco +bruto +buceo +bucle +bueno +buey +bufanda +bufón +búho +buitre +bulto +burbuja +burla +burro +buscar +butaca +buzón +caballo +cabeza +cabina +cabra +cacao +cadáver +cadena +caer +café +caída +caimán +caja +cajón +cal +calamar +calcio +caldo +calidad +calle +calma +calor +calvo +cama +cambio +camello +camino +campo +cáncer +candil +canela +canguro +canica +canto +caña +cañón +caoba +caos +capaz +capitán +capote +captar +capucha +cara +carbón +cárcel +careta +carga +cariño +carne +carpeta +carro +carta +casa +casco +casero +caspa +castor +catorce +catre +caudal +causa +cazo +cebolla +ceder +cedro +celda +célebre +celoso +célula +cemento +ceniza +centro +cerca +cerdo +cereza +cero +cerrar +certeza +césped +cetro +chacal +chaleco +champú +chancla +chapa +charla +chico +chiste +chivo +choque +choza +chuleta +chupar +ciclón +ciego +cielo +cien +cierto +cifra +cigarro +cima +cinco +cine +cinta +ciprés +circo +ciruela +cisne +cita +ciudad +clamor +clan +claro +clase +clave +cliente +clima +clínica +cobre +cocción +cochino +cocina +coco +código +codo +cofre +coger +cohete +cojín +cojo +cola +colcha +colegio +colgar +colina +collar +colmo +columna +combate +comer +comida +cómodo +compra +conde +conejo +conga +conocer +consejo +contar +copa +copia +corazón +corbata +corcho +cordón +corona +correr +coser +cosmos +costa +cráneo +cráter +crear +crecer +creído +crema +cría +crimen +cripta +crisis +cromo +crónica +croqueta +crudo +cruz +cuadro +cuarto +cuatro +cubo +cubrir +cuchara +cuello +cuento +cuerda +cuesta +cueva +cuidar +culebra +culpa +culto +cumbre +cumplir +cuna +cuneta +cuota +cupón +cúpula +curar +curioso +curso +curva +cutis +dama +danza +dar +dardo +dátil +deber +débil +década +decir +dedo +defensa +definir +dejar +delfín +delgado +delito +demora +denso +dental +deporte +derecho +derrota +desayuno +deseo +desfile +desnudo +destino +desvío +detalle +detener +deuda +día +diablo +diadema +diamante +diana +diario +dibujo +dictar +diente +dieta +diez +difícil +digno +dilema +diluir +dinero +directo +dirigir +disco +diseño +disfraz +diva +divino +doble +doce +dolor +domingo +don +donar +dorado +dormir +dorso +dos +dosis +dragón +droga +ducha +duda +duelo +dueño +dulce +dúo +duque +durar +dureza +duro +ébano +ebrio +echar +eco +ecuador +edad +edición +edificio +editor +educar +efecto +eficaz +eje +ejemplo +elefante +elegir +elemento +elevar +elipse +élite +elixir +elogio +eludir +embudo +emitir +emoción +empate +empeño +empleo +empresa +enano +encargo +enchufe +encía +enemigo +enero +enfado +enfermo +engaño +enigma +enlace +enorme +enredo +ensayo +enseñar +entero +entrar +envase +envío +época +equipo +erizo +escala +escena +escolar +escribir +escudo +esencia +esfera +esfuerzo +espada +espejo +espía +esposa +espuma +esquí +estar +este +estilo +estufa +etapa +eterno +ética +etnia +evadir +evaluar +evento +evitar +exacto +examen +exceso +excusa +exento +exigir +exilio +existir +éxito +experto +explicar +exponer +extremo +fábrica +fábula +fachada +fácil +factor +faena +faja +falda +fallo +falso +faltar +fama +familia +famoso +faraón +farmacia +farol +farsa +fase +fatiga +fauna +favor +fax +febrero +fecha +feliz +feo +feria +feroz +fértil +fervor +festín +fiable +fianza +fiar +fibra +ficción +ficha +fideo +fiebre +fiel +fiera +fiesta +figura +fijar +fijo +fila +filete +filial +filtro +fin +finca +fingir +finito +firma +flaco +flauta +flecha +flor +flota +fluir +flujo +flúor +fobia +foca +fogata +fogón +folio +folleto +fondo +forma +forro +fortuna +forzar +fosa +foto +fracaso +frágil +franja +frase +fraude +freír +freno +fresa +frío +frito +fruta +fuego +fuente +fuerza +fuga +fumar +función +funda +furgón +furia +fusil +fútbol +futuro +gacela +gafas +gaita +gajo +gala +galería +gallo +gamba +ganar +gancho +ganga +ganso +garaje +garza +gasolina +gastar +gato +gavilán +gemelo +gemir +gen +género +genio +gente +geranio +gerente +germen +gesto +gigante +gimnasio +girar +giro +glaciar +globo +gloria +gol +golfo +goloso +golpe +goma +gordo +gorila +gorra +gota +goteo +gozar +grada +gráfico +grano +grasa +gratis +grave +grieta +grillo +gripe +gris +grito +grosor +grúa +grueso +grumo +grupo +guante +guapo +guardia +guerra +guía +guiño +guion +guiso +guitarra +gusano +gustar +haber +hábil +hablar +hacer +hacha +hada +hallar +hamaca +harina +haz +hazaña +hebilla +hebra +hecho +helado +helio +hembra +herir +hermano +héroe +hervir +hielo +hierro +hígado +higiene +hijo +himno +historia +hocico +hogar +hoguera +hoja +hombre +hongo +honor +honra +hora +hormiga +horno +hostil +hoyo +hueco +huelga +huerta +hueso +huevo +huida +huir +humano +húmedo +humilde +humo +hundir +huracán +hurto +icono +ideal +idioma +ídolo +iglesia +iglú +igual +ilegal +ilusión +imagen +imán +imitar +impar +imperio +imponer +impulso +incapaz +índice +inerte +infiel +informe +ingenio +inicio +inmenso +inmune +innato +insecto +instante +interés +íntimo +intuir +inútil +invierno +ira +iris +ironía +isla +islote +jabalí +jabón +jamón +jarabe +jardín +jarra +jaula +jazmín +jefe +jeringa +jinete +jornada +joroba +joven +joya +juerga +jueves +juez +jugador +jugo +juguete +juicio +junco +jungla +junio +juntar +júpiter +jurar +justo +juvenil +juzgar +kilo +koala +labio +lacio +lacra +lado +ladrón +lagarto +lágrima +laguna +laico +lamer +lámina +lámpara +lana +lancha +langosta +lanza +lápiz +largo +larva +lástima +lata +látex +latir +laurel +lavar +lazo +leal +lección +leche +lector +leer +legión +legumbre +lejano +lengua +lento +leña +león +leopardo +lesión +letal +letra +leve +leyenda +libertad +libro +licor +líder +lidiar +lienzo +liga +ligero +lima +límite +limón +limpio +lince +lindo +línea +lingote +lino +linterna +líquido +liso +lista +litera +litio +litro +llaga +llama +llanto +llave +llegar +llenar +llevar +llorar +llover +lluvia +lobo +loción +loco +locura +lógica +logro +lombriz +lomo +lonja +lote +lucha +lucir +lugar +lujo +luna +lunes +lupa +lustro +luto +luz +maceta +macho +madera +madre +maduro +maestro +mafia +magia +mago +maíz +maldad +maleta +malla +malo +mamá +mambo +mamut +manco +mando +manejar +manga +maniquí +manjar +mano +manso +manta +mañana +mapa +máquina +mar +marco +marea +marfil +margen +marido +mármol +marrón +martes +marzo +masa +máscara +masivo +matar +materia +matiz +matriz +máximo +mayor +mazorca +mecha +medalla +medio +médula +mejilla +mejor +melena +melón +memoria +menor +mensaje +mente +menú +mercado +merengue +mérito +mes +mesón +meta +meter +método +metro +mezcla +miedo +miel +miembro +miga +mil +milagro +militar +millón +mimo +mina +minero +mínimo +minuto +miope +mirar +misa +miseria +misil +mismo +mitad +mito +mochila +moción +moda +modelo +moho +mojar +molde +moler +molino +momento +momia +monarca +moneda +monja +monto +moño +morada +morder +moreno +morir +morro +morsa +mortal +mosca +mostrar +motivo +mover +móvil +mozo +mucho +mudar +mueble +muela +muerte +muestra +mugre +mujer +mula +muleta +multa +mundo +muñeca +mural +muro +músculo +museo +musgo +música +muslo +nácar +nación +nadar +naipe +naranja +nariz +narrar +nasal +natal +nativo +natural +náusea +naval +nave +navidad +necio +néctar +negar +negocio +negro +neón +nervio +neto +neutro +nevar +nevera +nicho +nido +niebla +nieto +niñez +niño +nítido +nivel +nobleza +noche +nómina +noria +norma +norte +nota +noticia +novato +novela +novio +nube +nuca +núcleo +nudillo +nudo +nuera +nueve +nuez +nulo +número +nutria +oasis +obeso +obispo +objeto +obra +obrero +observar +obtener +obvio +oca +ocaso +océano +ochenta +ocho +ocio +ocre +octavo +octubre +oculto +ocupar +ocurrir +odiar +odio +odisea +oeste +ofensa +oferta +oficio +ofrecer +ogro +oído +oír +ojo +ola +oleada +olfato +olivo +olla +olmo +olor +olvido +ombligo +onda +onza +opaco +opción +ópera +opinar +oponer +optar +óptica +opuesto +oración +orador +oral +órbita +orca +orden +oreja +órgano +orgía +orgullo +oriente +origen +orilla +oro +orquesta +oruga +osadía +oscuro +osezno +oso +ostra +otoño +otro +oveja +óvulo +óxido +oxígeno +oyente +ozono +pacto +padre +paella +página +pago +país +pájaro +palabra +palco +paleta +pálido +palma +paloma +palpar +pan +panal +pánico +pantera +pañuelo +papá +papel +papilla +paquete +parar +parcela +pared +parir +paro +párpado +parque +párrafo +parte +pasar +paseo +pasión +paso +pasta +pata +patio +patria +pausa +pauta +pavo +payaso +peatón +pecado +pecera +pecho +pedal +pedir +pegar +peine +pelar +peldaño +pelea +peligro +pellejo +pelo +peluca +pena +pensar +peñón +peón +peor +pepino +pequeño +pera +percha +perder +pereza +perfil +perico +perla +permiso +perro +persona +pesa +pesca +pésimo +pestaña +pétalo +petróleo +pez +pezuña +picar +pichón +pie +piedra +pierna +pieza +pijama +pilar +piloto +pimienta +pino +pintor +pinza +piña +piojo +pipa +pirata +pisar +piscina +piso +pista +pitón +pizca +placa +plan +plata +playa +plaza +pleito +pleno +plomo +pluma +plural +pobre +poco +poder +podio +poema +poesía +poeta +polen +policía +pollo +polvo +pomada +pomelo +pomo +pompa +poner +porción +portal +posada +poseer +posible +poste +potencia +potro +pozo +prado +precoz +pregunta +premio +prensa +preso +previo +primo +príncipe +prisión +privar +proa +probar +proceso +producto +proeza +profesor +programa +prole +promesa +pronto +propio +próximo +prueba +público +puchero +pudor +pueblo +puerta +puesto +pulga +pulir +pulmón +pulpo +pulso +puma +punto +puñal +puño +pupa +pupila +puré +quedar +queja +quemar +querer +queso +quieto +química +quince +quitar +rábano +rabia +rabo +ración +radical +raíz +rama +rampa +rancho +rango +rapaz +rápido +rapto +rasgo +raspa +rato +rayo +raza +razón +reacción +realidad +rebaño +rebote +recaer +receta +rechazo +recoger +recreo +recto +recurso +red +redondo +reducir +reflejo +reforma +refrán +refugio +regalo +regir +regla +regreso +rehén +reino +reír +reja +relato +relevo +relieve +relleno +reloj +remar +remedio +remo +rencor +rendir +renta +reparto +repetir +reposo +reptil +res +rescate +resina +respeto +resto +resumen +retiro +retorno +retrato +reunir +revés +revista +rey +rezar +rico +riego +rienda +riesgo +rifa +rígido +rigor +rincón +riñón +río +riqueza +risa +ritmo +rito +rizo +roble +roce +rociar +rodar +rodeo +rodilla +roer +rojizo +rojo +romero +romper +ron +ronco +ronda +ropa +ropero +rosa +rosca +rostro +rotar +rubí +rubor +rudo +rueda +rugir +ruido +ruina +ruleta +rulo +rumbo +rumor +ruptura +ruta +rutina +sábado +saber +sabio +sable +sacar +sagaz +sagrado +sala +saldo +salero +salir +salmón +salón +salsa +salto +salud +salvar +samba +sanción +sandía +sanear +sangre +sanidad +sano +santo +sapo +saque +sardina +sartén +sastre +satán +sauna +saxofón +sección +seco +secreto +secta +sed +seguir +seis +sello +selva +semana +semilla +senda +sensor +señal +señor +separar +sepia +sequía +ser +serie +sermón +servir +sesenta +sesión +seta +setenta +severo +sexo +sexto +sidra +siesta +siete +siglo +signo +sílaba +silbar +silencio +silla +símbolo +simio +sirena +sistema +sitio +situar +sobre +socio +sodio +sol +solapa +soldado +soledad +sólido +soltar +solución +sombra +sondeo +sonido +sonoro +sonrisa +sopa +soplar +soporte +sordo +sorpresa +sorteo +sostén +sótano +suave +subir +suceso +sudor +suegra +suelo +sueño +suerte +sufrir +sujeto +sultán +sumar +superar +suplir +suponer +supremo +sur +surco +sureño +surgir +susto +sutil +tabaco +tabique +tabla +tabú +taco +tacto +tajo +talar +talco +talento +talla +talón +tamaño +tambor +tango +tanque +tapa +tapete +tapia +tapón +taquilla +tarde +tarea +tarifa +tarjeta +tarot +tarro +tarta +tatuaje +tauro +taza +tazón +teatro +techo +tecla +técnica +tejado +tejer +tejido +tela +teléfono +tema +temor +templo +tenaz +tender +tener +tenis +tenso +teoría +terapia +terco +término +ternura +terror +tesis +tesoro +testigo +tetera +texto +tez +tibio +tiburón +tiempo +tienda +tierra +tieso +tigre +tijera +tilde +timbre +tímido +timo +tinta +tío +típico +tipo +tira +tirón +titán +títere +título +tiza +toalla +tobillo +tocar +tocino +todo +toga +toldo +tomar +tono +tonto +topar +tope +toque +tórax +torero +tormenta +torneo +toro +torpedo +torre +torso +tortuga +tos +tosco +toser +tóxico +trabajo +tractor +traer +tráfico +trago +traje +tramo +trance +trato +trauma +trazar +trébol +tregua +treinta +tren +trepar +tres +tribu +trigo +tripa +triste +triunfo +trofeo +trompa +tronco +tropa +trote +trozo +truco +trueno +trufa +tubería +tubo +tuerto +tumba +tumor +túnel +túnica +turbina +turismo +turno +tutor +ubicar +úlcera +umbral +unidad +unir +universo +uno +untar +uña +urbano +urbe +urgente +urna +usar +usuario +útil +utopía +uva +vaca +vacío +vacuna +vagar +vago +vaina +vajilla +vale +válido +valle +valor +válvula +vampiro +vara +variar +varón +vaso +vecino +vector +vehículo +veinte +vejez +vela +velero +veloz +vena +vencer +venda +veneno +vengar +venir +venta +venus +ver +verano +verbo +verde +vereda +verja +verso +verter +vía +viaje +vibrar +vicio +víctima +vida +vídeo +vidrio +viejo +viernes +vigor +vil +villa +vinagre +vino +viñedo +violín +viral +virgo +virtud +visor +víspera +vista +vitamina +viudo +vivaz +vivero +vivir +vivo +volcán +volumen +volver +voraz +votar +voto +voz +vuelo +vulgar +yacer +yate +yegua +yema +yerno +yeso +yodo +yoga +yogur +zafiro +zanja +zapato +zarza +zona +zorro +zumo +zurdo +` diff --git a/bip39gen/go.mod b/bip39gen/go.mod new file mode 100644 index 00000000..18f24064 --- /dev/null +++ b/bip39gen/go.mod @@ -0,0 +1,17 @@ +module bip32cli + +go 1.17 + +require ( + github.com/KiraCore/go-bip39 v1.1.0 + github.com/google/uuid v1.3.0 + github.com/spf13/cobra v1.4.0 +) + +require ( + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect +) + +replace github.com/KiraCore/go-bip39 v1.1.0 => ./bip39 diff --git a/bip39gen/go.sum b/bip39gen/go.sum new file mode 100644 index 00000000..911a2376 --- /dev/null +++ b/bip39gen/go.sum @@ -0,0 +1,26 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/tyler-smith/assert v1.0.1 h1:AymyVNGyHOAVaDUEo0WouAMB/wwi5NdbJTDb7lsfFGk= +github.com/tyler-smith/assert v1.0.1/go.mod h1:oPc3QyIN2k0t/9Xp0sNhi3suiWuGXzIcdf/dbKQ6QGk= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/bip39gen/main.go b/bip39gen/main.go new file mode 100644 index 00000000..27706137 --- /dev/null +++ b/bip39gen/main.go @@ -0,0 +1,159 @@ +package main + +import ( + "encoding/hex" + "fmt" + "os" + "strconv" + "strings" + "time" + + "crypto/sha256" + + "github.com/KiraCore/go-bip39" + + "github.com/google/uuid" + "github.com/spf13/cobra" +) + +var ( + entropy string + length string + verbose bool +) + +type response struct { + Code int + Result string +} + +const codeSuccess int = 0 +const codeFail int = 1 +const Bip39GenVersion = "v0.0.1.1" + +func makeTimestamp() int64 { + return time.Now().UnixNano() / int64(time.Millisecond) +} + +func main() { + // bip39gen mnemonic --length=24 --entropy="" + + var rootCmd = &cobra.Command{ + Use: "bip39gen [sub]", + Short: "Bip39 Mnemonic Generator", + } + + var mnemonicCommand = &cobra.Command{ + Use: "mnemonic [options]", + Short: "mnemonic", + Long: "Generate mnemonic words", + RunE: cmdMnemonic, + } + + var versionCommand = &cobra.Command{ + Use: "version", + Short: "version", + Long: "Get bip39gen version", + RunE: cmdVersion, + } + + mnemonicCommand.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, " print explicit output") + mnemonicCommand.PersistentFlags().StringVarP(&length, "length", "l", "24", " number of mnemonic words") + mnemonicCommand.PersistentFlags().StringVarP(&entropy, "entropy", "e", "", " user provided external randomness") + + rootCmd.AddCommand(mnemonicCommand) + rootCmd.AddCommand(versionCommand) + + rootCmd.Execute() +} + +func cmdVersion(cmd *cobra.Command, args []string) error { + fmt.Print(Bip39GenVersion) + return nil +} + +func cmdMnemonic(cmd *cobra.Command, args []string) error { + + iLength, errLength := strconv.ParseInt(length, 10, 0) + + if verbose == true { + fmt.Println("Mnemonic Length: " + strconv.Itoa(int(iLength))) + fmt.Println(" User Entropy: " + entropy) + } + + // bip39gen mnemonic --verbose=true --length=24 + if errLength != nil || (iLength%3) != 0 || iLength < 12 || iLength > 24 { + response{ + Code: codeFail, + Result: "Invalid mnemonic length, must be divisible by 3, longer or equal 12 and smaller or equal 24", + }.printResponse() + + return nil + } + + bits := int((iLength * 32) / 3) + + if verbose == true { + fmt.Println(" Entropy Bits: " + strconv.Itoa(int(bits))) + } + + if (bits%32) != 0 || bits < 128 || bits > 256 { + response{ + Code: codeFail, + Result: "Failed entropy generations, bits count must be divisible by 32 and within inclusive range of {128, 256}", + }.printResponse() + + return nil + } + + hasher := sha256.New() + seed, _ := bip39.NewEntropy(bits) + + if verbose == true { + fmt.Println(" Default Seed: " + hex.EncodeToString(seed)) + } + + for i := 0; i < len(seed); { + entropy := uuid.New().String() + entropy + hasher.Write([]byte(entropy)) + shaResult := hasher.Sum(nil) + for i2 := 0; i2 < 32 && i < len(seed); i2++ { + seed[i] = seed[i] ^ shaResult[i2] + i++ + } + } + + if verbose == true { + fmt.Println(" Final Seed: " + hex.EncodeToString(seed)) + } + + mnemonic, _ := bip39.NewMnemonic(seed) + + if verbose == true { + fmt.Println("Output Mnemonic: " + mnemonic) + fmt.Println("") + } + + var words = strings.Split(mnemonic, " ") + + if len(words) != int(iLength) { + response{ + Code: codeFail, + Result: "Generation failed, incorrect number of output words, expected " + strconv.Itoa(int(iLength)) + " but got " + strconv.Itoa(len(words)), + }.printResponse() + + return nil + } + + response{ + Code: codeSuccess, + Result: mnemonic, + }.printResponse() + + return nil +} + +func (log response) printResponse() { + fmt.Println(log.Result) + os.Exit(log.Code) +} diff --git a/bip39gen/nfpm.yaml b/bip39gen/nfpm.yaml new file mode 100644 index 00000000..ed42ea24 --- /dev/null +++ b/bip39gen/nfpm.yaml @@ -0,0 +1,17 @@ +name: "bip39gen" +arch: "${ARCH}" +platform: "${PLATFORM}" +version: "${VERSION}" +section: "default" +priority: "extra" +replaces: +- bip39gen +provides: +- bip39gen +maintainer: "KIRA " +description: "BIP39GEN is a KIRA CLI tool enabling enabling generation of secure bip39 mnemonics" +homepage: "https://github.com/KiraCore/tools" +license: "AGPL-3.0 license" +contents: +- src: ${SOURCE} + dst: ./bin/ diff --git a/bip39gen/scripts/build.sh b/bip39gen/scripts/build.sh new file mode 100644 index 00000000..ef91f5e9 --- /dev/null +++ b/bip39gen/scripts/build.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile +. ../bash-utils/utils.sh + +LOCAL_PLATFORM=$(toLower $(uname)) +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +LOCAL_OUT="${GOBIN}/bip39gen" + +PLATFORM="$1" && [ -z "$PLATFORM" ] && PLATFORM="$LOCAL_PLATFORM" +ARCH="$2" && [ -z "$ARCH" ] && ARCH="$LOCAL_ARCH" +OUTPUT="$3" && [ -z "$OUTPUT" ] && OUTPUT="$LOCAL_OUT" + +CONSTANS_FILE=./main.go +VERSION=$(grep -Fn -m 1 'Bip39GenVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: Bip39GenVersion was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old bip39gen binary" + +go mod tidy +GO111MODULE=on go mod verify +env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ + +( [ "$PLATFORM" == "$LOCAL_PLATFORM" ] && [ "$ARCH" == "$LOCAL_ARCH" ] && [ -f $OUTPUT ] ) && \ + echoInfo "INFO: Sucessfully built bip39gen $($OUTPUT version)" || echoInfo "INFO: Sucessfully built bip39gen to '$OUTPUT'" + diff --git a/bip39gen/scripts/publish.sh b/bip39gen/scripts/publish.sh new file mode 100644 index 00000000..a77661b7 --- /dev/null +++ b/bip39gen/scripts/publish.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +set -e +set -x +. /etc/profile +. ../bash-utils/utils.sh + +go mod tidy +GO111MODULE=on go mod verify + +PKG_CONFIG_FILE=./nfpm.yaml + +function pcgConfigure() { + local ARCH="$1" + local VERSION="$2" + local PLATFORM="$3" + local SOURCE="$4" + local CONFIG="$5" + SOURCE=${SOURCE//"/"/"\/"} + sed -i"" "s/\${ARCH}/$ARCH/" $CONFIG + sed -i"" "s/\${VERSION}/$VERSION/" $CONFIG + sed -i"" "s/\${PLATFORM}/$PLATFORM/" $CONFIG + sed -i"" "s/\${SOURCE}/$SOURCE/" $CONFIG +} + +BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") +( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" + +CONSTANS_FILE=./main.go +VERSION=$(grep -Fn -m 1 'Bip39GenVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: Bip39GenVersion was NOT found in '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +function pcgRelease() { + local ARCH="$1" && ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]' ) + local VERSION="$2" && VERSION=$(echo "$VERSION" | tr '[:upper:]' '[:lower:]' ) + local PLATFORM="$3" && PLATFORM=$(echo "$PLATFORM" | tr '[:upper:]' '[:lower:]' ) + + local BIN_PATH=./bin/$ARCH/$PLATFORM + local RELEASE_DIR=./bin/deb/$PLATFORM + + mkdir -p $BIN_PATH $RELEASE_DIR + + echoInfo "INFO: Building $ARCH package for $PLATFORM..." + + TMP_PKG_CONFIG_FILE=./nfpm_${ARCH}_${PLATFORM}.yaml + rm -rfv $TMP_PKG_CONFIG_FILE && cp -v $PKG_CONFIG_FILE $TMP_PKG_CONFIG_FILE + + if [ "$PLATFORM" != "windows" ] ; then + local RELEASE_PATH="${RELEASE_DIR}/bip39gen_${VERSION}_${ARCH}.deb" + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/bip39gen" + pcgConfigure "$ARCH" "$VERSION" "$PLATFORM" "$BIN_PATH" $TMP_PKG_CONFIG_FILE + nfpm pkg --packager deb --target "$RELEASE_PATH" -f $TMP_PKG_CONFIG_FILE + cp -fv "$RELEASE_PATH" ./bin/bip39gen-${PLATFORM}-${ARCH}.deb + else + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/bip39gen.exe" + # deb is not supported on windows, simply copy the executables + cp -fv $BIN_PATH/bip39gen.exe ./bin/bip39gen-${PLATFORM}-${ARCH}.exe + fi +} + +rm -rfv ./bin + +# NOTE: To see available build architectures, run: go tool dist list +pcgRelease "amd64" "$VERSION" "linux" +pcgRelease "amd64" "$VERSION" "darwin" +pcgRelease "amd64" "$VERSION" "windows" +pcgRelease "arm64" "$VERSION" "linux" +pcgRelease "arm64" "$VERSION" "darwin" +pcgRelease "arm64" "$VERSION" "windows" + +rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb +echoInfo "INFO: Sucessfully published bip39gen deb packages into ./bin" diff --git a/scripts/build.sh b/scripts/build.sh index 37ed4f3d..aa31b6be 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -17,5 +17,9 @@ cd ./validator-key-gen make build cd $WORKDIR +cd ./bip39gen +make build +cd $WORKDIR + -echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), validator-key-gen $(validator-key-gen --version)" \ No newline at end of file +echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), validator-key-gen $(validator-key-gen --version), bip39gen $(bip39gen version)" \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index ba2e3514..c1444004 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -27,14 +27,21 @@ cd ./validator-key-gen make publish cd $WORKDIR +# Publish bip39gen +cd ./bip39gen +make publish +cd $WORKDIR + # Copy all binaries to bin directory mkdir -p ./bin cp -rfv ./tmconnect/bin/* ./bin cp -rfv ./tmkms-key-import/bin/* ./bin cp -rfv ./validator-key-gen/bin/* ./bin +cp -rfv ./bip39gen/bin/* ./bin cp -rfv ./bash-utils/utils.sh ./bin/kira-utils.sh rm -rfv ./tmconnect/bin/* rm -rfv ./tmkms-key-import/bin/* -rm -rfv ./validator-key-gen/bin/* \ No newline at end of file +rm -rfv ./validator-key-gen/bin/* +rm -rfv ./bip39gen/bin/* \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh index 9815d607..6f4e0d4a 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -13,4 +13,9 @@ cd ./bash-utils make test cd $WORKDIR +# Test utils +cd ./bip39gen +make test +cd $WORKDIR + echoInfo "SUCCESS: Testing finished" \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100644 index 00000000..a9ad03de --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -e +set -x + +echo "v0.0.11.3" + diff --git a/tmconnect/Makefile b/tmconnect/Makefile index 975c36c8..ed048d3a 100644 --- a/tmconnect/Makefile +++ b/tmconnect/Makefile @@ -1,3 +1,5 @@ +.PHONY: install start build publish + install: go.sum go install . From 61b827e177de72f3d5a730d4a38279c664d0211e Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 10:23:09 +0000 Subject: [PATCH 028/140] update docker version --- .github/workflows/main.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc2fbfa5..931bece4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.0.4.0 + image: ghcr.io/kiracore/docker/base-image:v0.9.0.0 steps: - name: Checkout repository uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 @@ -60,10 +60,6 @@ jobs: echo " Repository name: ${{ env.REPOSITORY_NAME }}" echo " Release version: ${{ env.RELEASE_VER }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" - - name: Download artifacts - uses: actions/download-artifact@v3.0.0 - with: - name: tools-src - name: Testing & Building TOOLS run: | echo "(current dir): $PWD" && ls -l ./ From e2e92e25f3bc8f750c460a9e13a18a754b44531b Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 10:28:34 +0000 Subject: [PATCH 029/140] make version script executable --- .github/workflows/branch.yml | 1 + .github/workflows/main.yml | 1 + .github/workflows/spam.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index ab537ca3..3d16324b 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -20,6 +20,7 @@ jobs: - name: Extract branch name on pull request shell: bash run: | + chmod -Rv 555 ./scripts RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV SOURCE_BRANCH="$(echo ${GITHUB_REF#refs/heads/} | xargs)" MASTER_REF="$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 931bece4..d76abed2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,7 @@ jobs: echo "(current dir): $WORK_DIR" && ls -l ./ cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR + chmod -Rv 555 ./scripts RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index 0447b439..442c2c25 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -26,6 +26,7 @@ jobs: - name: Extract branch name & release version shell: bash run: | + chmod -Rv 555 ./scripts VERSION_REGEX="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" REPOSITORY_NAME=${{ github.event.repository.name }} RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV From ba8e8f6cc5895a28b813c5eefd3635fba8ad808c Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 10:33:48 +0000 Subject: [PATCH 030/140] syntax --- .github/workflows/branch.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 3d16324b..ae2ed76d 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -21,21 +21,23 @@ jobs: shell: bash run: | chmod -Rv 555 ./scripts - RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV - SOURCE_BRANCH="$(echo ${GITHUB_REF#refs/heads/} | xargs)" - MASTER_REF="$(git ls-remote https://github.com/kiracore/${{ github.event.repository.name }} | head -1 | sed 's/HEAD//')" - echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV - echo "MASTER_REF=$MASTER_REF" >> $GITHUB_ENV + RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV + echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | - echo "Source branch: ${{ env.SOURCE_BRANCH }}" - echo " Master ref.: ${{ env.MASTER_REF }}" - echo " Release ver.: ${{ env.RELEASE_VER }}" - echo " Event name: ${{ github.event_name }}" - echo " Repo. name: ${{ github.event.repository.name }}" - echo "Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" + echo "Repository name: ${{ env.REPOSITORY_NAME }}" + echo " Source branch: ${{ env.SOURCE_BRANCH }}" + echo " Default branch: ${{ env.DEFAULT_BRANCH }}" + echo " Master refer.: ${{ env.MASTER_REF }}" + echo "Release version: ${{ env.RELEASE_VER }}" + echo " Release exists: ${{ env.RELEASE_EXISTS }}" + echo " Event name: ${{ github.event_name }}" + echo " Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 - name: Create version branch from master uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f From b3122ef67d4e1dc7435fc546cb5edfe9ccd9442a Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 16:24:16 +0000 Subject: [PATCH 031/140] safeWget cashing --- .github/workflows/main.yml | 10 +-- DEVME.md | 14 +-- RELEASE.md | 3 +- bash-utils/README.md | 8 +- bash-utils/{utils.sh => bash-utils.sh} | 117 +++++++++++++++---------- bash-utils/scripts/test.sh | 7 +- bip39gen/bip39/scripts/build.sh | 5 +- bip39gen/bip39/scripts/test.sh | 5 +- bip39gen/scripts/build.sh | 6 +- bip39gen/scripts/publish.sh | 6 +- scripts/build.sh | 8 +- scripts/publish.sh | 8 +- scripts/test.sh | 6 +- scripts/version.sh | 5 +- tmconnect/scripts/build.sh | 6 +- tmconnect/scripts/publish.sh | 6 +- tmkms-key-import/scripts/publish.sh | 6 +- validator-key-gen/scripts/build.sh | 6 +- validator-key-gen/scripts/publish.sh | 6 +- 19 files changed, 145 insertions(+), 93 deletions(-) rename bash-utils/{utils.sh => bash-utils.sh} (89%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d76abed2..72b36fe6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,9 +52,9 @@ jobs: fi - name: Print debug data before build run: | - . /etc/profile && echo "Utils Version: $(utilsVersion)" + . /etc/profile go version - echo " Utils Version: $(utilsVersion)" + echo "Bash Utils Version: " && $(utilsVersion) echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" @@ -103,7 +103,7 @@ jobs: echo " bip39gen-linux-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " kira-utils.sh: sha256:$(sha256sum ./bin/kira-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . - name: Uploading artifacts @@ -208,7 +208,7 @@ jobs: ./bip39gen-windows-amd64.exe ./bip39gen-darwin-arm64.deb ./bip39gen-darwin-amd64.deb - ./kira-utils.sh + ./bash-utils.sh # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish pre-release @@ -245,7 +245,7 @@ jobs: ./bip39gen-windows-amd64.exe ./bip39gen-darwin-arm64.deb ./bip39gen-darwin-amd64.deb - ./kira-utils.sh + ./bash-utils.sh # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 diff --git a/DEVME.md b/DEVME.md index a2fc5b19..59927471 100644 --- a/DEVME.md +++ b/DEVME.md @@ -4,14 +4,14 @@ KIRA Tools ## Dependencies ``` -VERSION="v0.0.8.0" && cd /tmp && rm -fv ./utils.sh && \ +VERSION="v0.0.8.0" && cd /tmp && rm -fv ./bash-utils.sh && \ CHECKSUM="1cfb806eec03956319668b0a4f02f2fcc956ed9800070cda1870decfe2e6206e" && \ -wget https://github.com/KiraCore/tools/releases/download/$VERSION/kira-utils.sh -O ./utils.sh && \ - FILE_HASH=$(sha256sum ./utils.sh | awk '{ print $1 }' | xargs || echo -n "") && \ - [ "$FILE_HASH" == "$CHECKSUM" ] && chmod -v 555 ./utils.sh && \ - ./utils.sh utilsSetup ./utils.sh "/var/kiraglob" && . /etc/profile && \ - utils loadGlobEnvs && utils echoInfo "SUCCESS: kira-utils $(utils utilsVersion) were installed!" || \ - echo "ERROR: Invalid checksum '$FILE_HASH' or utilsSetup failed" +wget https://github.com/KiraCore/tools/releases/download/$VERSION/bash-utils.sh -O ./bash-utils.sh && \ + FILE_HASH=$(sha256sum ./bash-utils.sh | awk '{ print $1 }' | xargs || echo -n "") && \ + [ "$FILE_HASH" == "$CHECKSUM" ] && chmod -v 555 ./bash-utils.sh && \ + ./bash-utils.sh bashUtilsSetup "/var/kiraglob" && . /etc/profile && \ + bash-utils loadGlobEnvs && utils echoInfo "SUCCESS: bash-utils $(bash-utils bashUtilsVersion) were installed!" || \ + echo "ERROR: Invalid checksum '$FILE_HASH' or bashUtilsSetup failed" ``` ## Build diff --git a/RELEASE.md b/RELEASE.md index c018d950..7b057e3e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,2 +1,3 @@ Features: -* Added `bip39gen` CLI tool \ No newline at end of file +* Improved `safeWget` to utilize cache & speed up downloads +* renamed `utils` to `bash-utils` \ No newline at end of file diff --git a/bash-utils/README.md b/bash-utils/README.md index 7d04af95..2b361e37 100644 --- a/bash-utils/README.md +++ b/bash-utils/README.md @@ -5,12 +5,12 @@ The ultimate collection of various bash-shell function to make access to various ### Local Setup ``` -./utils.sh utilsSetup ./utils.sh "/var/kiraglob" +./bash-utils.sh utilsSetup "/var/kiraglob" ``` ### Remote Setup ``` -cd /tmp && rm -fv ./utils.sh && \ - wget https://raw.githubusercontent.com/KiraCore/tools/latest/bash-utils/utils.sh -O ./utils.sh && \ - chmod -v 555 ./utils && ./utils.sh utilsSetup ./utils.sh "/var/kiraglob" +cd /tmp && rm -fv ./bash-utils.sh && \ + wget https://raw.githubusercontent.com/KiraCore/tools/latest/bash-utils/bash-utils.sh -O ./bash-utils.sh && \ + chmod -v 555 ./bash-utils.sh && ./bash-utils.sh bashUtilsSetup "/var/kiraglob" ``` diff --git a/bash-utils/utils.sh b/bash-utils/bash-utils.sh similarity index 89% rename from bash-utils/utils.sh rename to bash-utils/bash-utils.sh index de58a4f0..af072518 100644 --- a/bash-utils/utils.sh +++ b/bash-utils/bash-utils.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# QUICK EDIT: FILE="/usr/local/bin/kira-utils.sh" && rm $FILE && nano $FILE && chmod 555 $FILE +# QUICK EDIT: FILE="/usr/local/bin/bash-utils.sh" && rm $FILE && nano $FILE && chmod 555 $FILE # NOTE: For this script to work properly the KIRA_GLOBS_DIR env variable should be set to "/var/kiraglob" or equivalent & the directory should exist REGEX_DNS="^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$" REGEX_IP="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$" @@ -11,58 +11,73 @@ REGEX_PUBLIC_IP='^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(? /dev/null || bash-utils bashUtilsSetup "version" } # this is default installation script for utils -# ./utils.sh utilsSetup ./utils.sh "/var/kiraglob" -function utilsSetup() { - local UTILS_SOURCE="$1" - local GLOBS_DIR="$2" - local UTILS_DESTINATION="/usr/local/bin/kira-utils.sh" - - if [ -z "$GLOBS_DIR" ] ; then - [ -z "$KIRA_GLOBS_DIR" ] && KIRA_GLOBS_DIR="/var/kiraglob" +# ./bash-utils.sh bashUtilsSetup "/var/kiraglob" +function bashUtilsSetup() { + local BASH_UTILS_VERSION="v0.1.2.3" + if [ "$1" == "version" ] ; then + echo "$BASH_UTILS_VERSION" + return 0 else - KIRA_GLOBS_DIR=$GLOBS_DIR - fi + local GLOBS_DIR="$1" - if [ ! -f $UTILS_SOURCE ] ; then - echoErr "ERROR: utils source was NOT found" - return 1 - else - mkdir -p "/usr/local/bin" - cp -fv "$UTILS_SOURCE" "$UTILS_DESTINATION" - cp -fv "$UTILS_SOURCE" "/usr/local/bin/utils" - chmod -v 555 $UTILS_DESTINATION "/usr/local/bin/utils" - - local SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" - local USERNAME="${USER}" && [ "$USERNAME" == "root" ] && USERNAME="" - local LOGNAME=$(logname 2> /dev/null echo "") && [ "$LOGNAME" == "root" ] && LOGNAME="" + local UTILS_SOURCE=$(realpath "$0") + local VERSION=$($UTILS_SOURCE bashUtilsVersion || echo '') + local UTILS_DESTINATION="/usr/local/bin/bash-utils.sh" + + if [ -z "$GLOBS_DIR" ] ; then + [ -z "$KIRA_GLOBS_DIR" ] && KIRA_GLOBS_DIR="/var/kiraglob" + else + KIRA_GLOBS_DIR=$GLOBS_DIR + fi - local TARGET="/$LOGNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - TARGET="/$USERNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - TARGET="/$SUDOUSER/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - TARGET="/root/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - TARGET=~/.bashrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - TARGET=~/.zshrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - TARGET=~/.profile && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + if [ "$VERSION" != "$BASH_UTILS_VERSION" ] ; then + bash-utils echoErr "ERROR: Self check version mismatch, expected '$BASH_UTILS_VERSION', but got '$VERSION'" + return 1 + elif [ "$UTILS_SOURCE" == "$UTILS_DESTINATION" ] ; then + bash-utils echoErr "ERROR: Installation source script and destination can't be the same" + return 1 + elif [ ! -f $UTILS_SOURCE ] ; then + bash-utils echoErr "ERROR: utils source was NOT found" + return 1 + else + mkdir -p "/usr/local/bin" + cp -fv "$UTILS_SOURCE" "$UTILS_DESTINATION" + cp -fv "$UTILS_SOURCE" "/usr/local/bin/bash-utils" + chmod -v 555 $UTILS_DESTINATION "/usr/local/bin/bash-utils" - mkdir -p $KIRA_GLOBS_DIR + local SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" + local USERNAME="${USER}" && [ "$USERNAME" == "root" ] && USERNAME="" + local LOGNAME=$(logname 2> /dev/null echo "") && [ "$LOGNAME" == "root" ] && LOGNAME="" - utils setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" - utils setGlobEnv KIRA_TOOLS_SRC "$UTILS_DESTINATION" + local TARGET="/$LOGNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET="/$USERNAME/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET="/$SUDOUSER/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET="/root/.bashrc" && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET=~/.bashrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET=~/.zshrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" + TARGET=~/.profile && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - local AUTOLOAD_SET=$(utils getLastLineByPrefix "source $UTILS_DESTINATION" /etc/profile 2> /dev/null || echo "-1") + mkdir -p $KIRA_GLOBS_DIR - if [[ $AUTOLOAD_SET -lt 0 ]] ; then - echo "source $UTILS_DESTINATION || echo \"ERROR: Failed to load kira utils from '$UTILS_DESTINATION'\"" >> /etc/profile - fi + bash-utils setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" + bash-utils setGlobEnv KIRA_TOOLS_SRC "$UTILS_DESTINATION" + + local AUTOLOAD_SET=$(bash-utils getLastLineByPrefix "source $UTILS_DESTINATION" /etc/profile 2> /dev/null || echo "-1") + + if [[ $AUTOLOAD_SET -lt 0 ]] ; then + echo "source $UTILS_DESTINATION || echo \"ERROR: Failed to load kira bash-utils from '$UTILS_DESTINATION'\"" >> /etc/profile + fi - utils loadGlobEnvs + bash-utils loadGlobEnvs - echoInfo "INFO: SUCCESS!, Installed kira bash-utils $(utilsVersion)" + echoInfo "INFO: SUCCESS!, Installed kira bash-utils $(bashUtilsVersion)" + fi fi } @@ -233,13 +248,25 @@ function safeWget() { local OUT_PATH=$1 local FILE_URL=$2 local EXPECTED_HASH=$3 - rm -fv $OUT_PATH + local OUT_NAME=$(basename $OUT_PATH) + local TMP_DIR=/tmp/downloads + local TMP_PATH="$TMP_DIR/$OUT_NAME" - wget "$FILE_URL" -O $OUT_PATH - FILE_HASH=$(sha256 $OUT_PATH) + mkdir -p $TMP_DIR + local FILE_HASH=$(sha256 $TMP_PATH) + + if [ "$FILE_HASH" == "$EXPECTED_HASH" ] && [ ! -z "$EXPECTED_HASH" ]; then + echoInfo "INFO: No need to download, file with the hash '$FILE_HASH' was already found in the '$TMP_DIR' directory" + [ "$TMP_PATH" != "$OUT_PATH" ] && cp -fv $TMP_PATH $OUT_PATH + else + rm -fv $OUT_PATH + wget "$FILE_URL" -O $TMP_PATH + [ "$TMP_PATH" != "$OUT_PATH" ] && cp -fv $TMP_PATH $OUT_PATH + FILE_HASH=$(sha256 $OUT_PATH) + fi if ($(isFileEmpty $OUT_PATH)) ; then - echoErr "ERROR: Failed download from '$FILE_URL'" + echoErr "ERROR: Failed download from '$FILE_URL', file is exmpty or was NOT found!" return 1 elif [ "$FILE_HASH" != "$EXPECTED_HASH" ]; then rm -fv $OUT_PATH || echoErr "ERROR: Failed to delete '$OUT_PATH'" diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 094cb661..2d379061 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -1,10 +1,13 @@ #!/usr/bin/env bash set -e +set +x +. /etc/profile +. ./bash-utils/bash-utils.sh set -x -. ./utils.sh + timerStart -echoInfo "INFO: Starting bash-utils $(utilsVersion) testing..." +echoInfo "INFO: Starting bash-utils $(bashUtilsVersion) testing..." sleep 2 diff --git a/bip39gen/bip39/scripts/build.sh b/bip39gen/bip39/scripts/build.sh index 9f0818a5..f7dd8362 100644 --- a/bip39gen/bip39/scripts/build.sh +++ b/bip39gen/bip39/scripts/build.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile +set -x cd ./bip39 || echo "Already in the root dir" -. ../../bash-utils/utils.sh +. ../../bash-utils/bash-utils.sh LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") diff --git a/bip39gen/bip39/scripts/test.sh b/bip39gen/bip39/scripts/test.sh index ca592107..f59aa9bb 100644 --- a/bip39gen/bip39/scripts/test.sh +++ b/bip39gen/bip39/scripts/test.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile +set -x cd ./bip39 || echo "Already in the root dir" -. ../../bash-utils/utils.sh +. ../../bash-utils/bash-utils.sh go test -v -coverprofile=coverage.out ./... go tool cover -html=coverage.out diff --git a/bip39gen/scripts/build.sh b/bip39gen/scripts/build.sh index ef91f5e9..3c4d1236 100644 --- a/bip39gen/scripts/build.sh +++ b/bip39gen/scripts/build.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") diff --git a/bip39gen/scripts/publish.sh b/bip39gen/scripts/publish.sh index a77661b7..ab1b314f 100644 --- a/bip39gen/scripts/publish.sh +++ b/bip39gen/scripts/publish.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh go mod tidy GO111MODULE=on go mod verify diff --git a/scripts/build.sh b/scripts/build.sh index aa31b6be..fdb91ca3 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,12 +1,14 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ./bash-utils/utils.sh +set -x + +. ./bash-utils/bash-utils.sh WORKDIR=$PWD -echoInfo "INFO: KIRA utils, latest version $(utilsVersion)" +echoInfo "INFO: KIRA utils, latest version $(bashUtilsVersion)" # Build `tmconnect` cd ./tmconnect diff --git a/scripts/publish.sh b/scripts/publish.sh index c1444004..d8fb1a7b 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ./bash-utils/utils.sh +set -x + +. ./bash-utils/bash-utils.sh WORKDIR=$PWD @@ -39,7 +41,7 @@ cp -rfv ./tmconnect/bin/* ./bin cp -rfv ./tmkms-key-import/bin/* ./bin cp -rfv ./validator-key-gen/bin/* ./bin cp -rfv ./bip39gen/bin/* ./bin -cp -rfv ./bash-utils/utils.sh ./bin/kira-utils.sh +cp -rfv ./bash-utils/bash-utils.sh ./bin/bash-utils.sh rm -rfv ./tmconnect/bin/* rm -rfv ./tmkms-key-import/bin/* diff --git a/scripts/test.sh b/scripts/test.sh index 6f4e0d4a..2dbd0175 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ./bash-utils/utils.sh +set -x + +. ./bash-utils/bash-utils.sh WORKDIR=$PWD diff --git a/scripts/version.sh b/scripts/version.sh index a9ad03de..fad511d8 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash set -e -set -x - -echo "v0.0.11.3" +set +x +echo "v0.0.12.4" diff --git a/tmconnect/scripts/build.sh b/tmconnect/scripts/build.sh index 40c30480..9913bd20 100644 --- a/tmconnect/scripts/build.sh +++ b/tmconnect/scripts/build.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") diff --git a/tmconnect/scripts/publish.sh b/tmconnect/scripts/publish.sh index c511cb29..7bb36c47 100644 --- a/tmconnect/scripts/publish.sh +++ b/tmconnect/scripts/publish.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh go mod tidy GO111MODULE=on go mod verify diff --git a/tmkms-key-import/scripts/publish.sh b/tmkms-key-import/scripts/publish.sh index 6754c4a3..c46bf95d 100644 --- a/tmkms-key-import/scripts/publish.sh +++ b/tmkms-key-import/scripts/publish.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh LOCAL_PLATFORM="$(uname)" && LOCAL_PLATFORM="$(echo "$LOCAL_PLATFORM" | tr '[:upper:]' '[:lower:]' )" LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") diff --git a/validator-key-gen/scripts/build.sh b/validator-key-gen/scripts/build.sh index af0a9e17..b70797d4 100644 --- a/validator-key-gen/scripts/build.sh +++ b/validator-key-gen/scripts/build.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") diff --git a/validator-key-gen/scripts/publish.sh b/validator-key-gen/scripts/publish.sh index d4d9f50c..d1538811 100644 --- a/validator-key-gen/scripts/publish.sh +++ b/validator-key-gen/scripts/publish.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -e -set -x +set +x . /etc/profile -. ../bash-utils/utils.sh +set -x + +. ../bash-utils/bash-utils.sh go mod tidy GO111MODULE=on go mod verify From 93c176868c065c6126e33eec5ef28a674e641a52 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 16:33:24 +0000 Subject: [PATCH 032/140] load self utils --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72b36fe6..e4b98d4d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,13 +34,14 @@ jobs: run: | echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - - name: Archive src and setup envs + - name: Archive src, install latest bash-utils and setup envs run: | WORK_DIR=$PWD echo "(current dir): $WORK_DIR" && ls -l ./ cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR chmod -Rv 555 ./scripts + ./bash-utils/bash-utils.sh bashUtilsSetup RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV @@ -54,7 +55,7 @@ jobs: run: | . /etc/profile go version - echo "Bash Utils Version: " && $(utilsVersion) + echo "Bash Utils Version: " && $(bashUtilsVersion) echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" From ed4789ef8c6055909ff6fe5db0348b7bd55bdea7 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 18:56:12 +0000 Subject: [PATCH 033/140] publish pre-release and signatures --- .github/workflows/main.yml | 111 +++++++++++++++++++------------------ README.md | 28 ++++++++++ 2 files changed, 84 insertions(+), 55 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4b98d4d..167b3f5b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,7 @@ jobs: echo "(current dir): $WORK_DIR" && ls -l ./ cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR - chmod -Rv 555 ./scripts + chmod -Rv 555 ./scripts ./bash-utils/bash-utils.sh ./bash-utils/bash-utils.sh bashUtilsSetup RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV @@ -92,18 +92,18 @@ jobs: echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-linux-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf deb.tar.gz -C ./bin . @@ -122,10 +122,11 @@ jobs: id-token: write pull-requests: write steps: + # ref.: https://github.com/sigstore/cosign-installer, v2.2.0 - name: Install cosign - uses: sigstore/cosign-installer@v2.1.0 + uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605 with: - cosign-release: 'v1.6.0' + cosign-release: 'v1.7.2' - name: Download artifacts uses: actions/download-artifact@v3.0.0 with: @@ -140,14 +141,15 @@ jobs: REPOSITORY_NAME="${{ github.event.repository.name }}" echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + [[ "$RELEASE_VER" == *"-rc"* ]] && echo "PRE_RELEASE=true" >> $GITHUB_ENV || echo "PRE_RELEASE=false" >> $GITHUB_ENV # Branch name is also a version of the release # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - name: Extract branch name on push if: github.event_name == 'push' shell: bash run: | - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - name: Extract branch name on pull request if: github.event_name == 'pull_request' env: @@ -155,8 +157,8 @@ jobs: BASE_REF_BRANCH: ${{ github.base_ref }} shell: bash run: | - echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV - name: Print debug data before publishing run: | echo " Source branch: ${{ env.SOURCE_BRANCH }}" @@ -165,6 +167,7 @@ jobs: echo " Event name: ${{ github.event_name }}" echo " Release ver.: ${{ env.RELEASE_VER }}" echo "Release exists: ${{ env.RELEASE_EXISTS }}" + echo " Pre-release: ${{ env.PRE_RELEASE }}" - name: Reject on error # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 @@ -173,80 +176,78 @@ jobs: spam_label: "Build Errors" close_spam_prs: "yes" access_token: ${{ secrets.GITHUB_TOKEN }} - # ref: https://github.com/softprops/action-gh-release, v0.1.14 - # Release on merge only (push action) - this should run only once - - name: Publish release + - name: Signing release files if: | github.event_name == 'push' && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, 'rc') && !contains(env.SOURCE_BRANCH, '-') ) - uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 - with: - body_path: RELEASE.md - tag_name: ${{ env.SOURCE_BRANCH }} - name: ${{ env.SOURCE_BRANCH }} - prerelease: false - draft: false - fail_on_unmatched_files: true - files: | - ./tmconnect-linux-amd64.deb - ./tmconnect-linux-arm64.deb - ./tmconnect-darwin-amd64.deb - ./tmconnect-darwin-arm64.deb - ./tmconnect-windows-amd64.exe - ./tmconnect-windows-arm64.exe - ./tmkms-key-import-linux-amd64 - ./tmkms-key-import-linux-arm64 - ./validator-key-gen-linux-arm64.deb - ./validator-key-gen-linux-amd64.deb - ./validator-key-gen-windows-arm64.exe - ./validator-key-gen-windows-amd64.exe - ./validator-key-gen-darwin-arm64.deb - ./validator-key-gen-darwin-amd64.deb - ./bip39gen-linux-arm64.deb - ./bip39gen-linux-amd64.deb - ./bip39gen-windows-arm64.exe - ./bip39gen-windows-amd64.exe - ./bip39gen-darwin-arm64.deb - ./bip39gen-darwin-amd64.deb - ./bash-utils.sh + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') + shell: bash + env: + KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} + COSIGN_EXPERIMENTAL: "true" + COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} + run: | + mkdir -p ./.secrets + echo "$KEY" > ./.secrets/cosign.key + for FILE in *.*; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=./.secrets/cosign.key --output=./${FILE_NAME}.sig ./$FILE_NAME; done # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - - name: Publish pre-release + - name: Publish release if: | github.event_name == 'push' && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && contains(env.SOURCE_BRANCH, '-') ) + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 with: body_path: RELEASE.md tag_name: ${{ env.SOURCE_BRANCH }} name: ${{ env.SOURCE_BRANCH }} - prerelease: true + prerelease: ${{ env.PRE_RELEASE }} draft: false fail_on_unmatched_files: true files: | ./tmconnect-linux-amd64.deb + ./tmconnect-linux-amd64.deb.sig ./tmconnect-linux-arm64.deb + ./tmconnect-linux-arm64.deb.sig ./tmconnect-darwin-amd64.deb + ./tmconnect-darwin-amd64.deb.sig ./tmconnect-darwin-arm64.deb + ./tmconnect-darwin-arm64.deb.sig ./tmconnect-windows-amd64.exe + ./tmconnect-windows-amd64.exe.sig ./tmconnect-windows-arm64.exe + ./tmconnect-windows-arm64.exe.sig ./tmkms-key-import-linux-amd64 + ./tmkms-key-import-linux-amd64.sig ./tmkms-key-import-linux-arm64 - ./validator-key-gen-linux-arm64.deb + ./tmkms-key-import-linux-arm64.sig ./validator-key-gen-linux-amd64.deb - ./validator-key-gen-windows-arm64.exe + ./validator-key-gen-linux-amd64.deb.sig + ./validator-key-gen-linux-arm64.deb + ./validator-key-gen-linux-arm64.deb.sig ./validator-key-gen-windows-amd64.exe - ./validator-key-gen-darwin-arm64.deb + ./validator-key-gen-windows-amd64.exe.sig + ./validator-key-gen-windows-arm64.exe + ./validator-key-gen-windows-arm64.exe.sig ./validator-key-gen-darwin-amd64.deb - ./bip39gen-linux-arm64.deb + ./validator-key-gen-darwin-amd64.deb.sig + ./validator-key-gen-darwin-arm64.deb + ./validator-key-gen-darwin-arm64.deb.sig ./bip39gen-linux-amd64.deb - ./bip39gen-windows-arm64.exe + ./bip39gen-linux-amd64.deb.sig + ./bip39gen-linux-arm64.deb + ./bip39gen-linux-arm64.deb.sig ./bip39gen-windows-amd64.exe - ./bip39gen-darwin-arm64.deb + ./bip39gen-windows-amd64.exe.sig + ./bip39gen-windows-arm64.exe + ./bip39gen-windows-arm64.exe.sig ./bip39gen-darwin-amd64.deb + ./bip39gen-darwin-amd64.deb.sig + ./bip39gen-darwin-arm64.deb + ./bip39gen-darwin-arm64.deb.sig ./bash-utils.sh + ./bash-utils.sh.sig # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 diff --git a/README.md b/README.md index 22d2e5e9..7cbf21d4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,30 @@ # tools KIRA Network - useful tools & scripts + + +## Signatures + +All files in KIRA repositories are always signed with [cosign](https://github.com/sigstore/cosign/releases) + +Cosign requires simple initial setup of the signer keys described more precisely [here](https://dev.to/n3wt0n/sign-your-container-images-with-cosign-github-actions-and-github-container-registry-3mni) + +```bash +# install cosign +if [[ "$(uname -m)" == *"ar"* ]] ; then ARCH="arm64"; else ARCH="amd64" ; fi && echo $ARCH && \ +PLATFORM=$(uname) && FILE=$(echo "cosign-${PLATFORM}-${ARCH}" | tr '[:upper:]' '[:lower:]') && \ + wget https://github.com/sigstore/cosign/releases/download/v1.7.2/$FILE && chmod +x -v ./$FILE && \ + mv -fv ./$FILE /usr/local/bin/cosign && cosign version + +# save KIRA public cosign key +cat > ./cosign.pub << EOL +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/IrzBQYeMwvKa44/DF/HB7XDpnE+ +f+mU9F/Qbfq25bBWV2+NlYMJv3KvKHNtu3Jknt6yizZjUV4b8WGfKBzFYw== +-----END PUBLIC KEY----- +EOL + +# download desired files and the corresponding .sig file from: https://github.com/KiraCore/tools/releases + +# verify signature of downloaded files +cosign verify-blob --key=./cosign.pub --signature=./.sig ./ +``` From bba32e45facd0cd16c296680cf7fc3f466362721 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 18:57:53 +0000 Subject: [PATCH 034/140] syntax --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 167b3f5b..93a785d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -180,7 +180,7 @@ jobs: if: | github.event_name == 'push' && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') + ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) shell: bash env: KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} From 6570178ed409d10ebe9615593352dbf1e6576f98 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 19:15:25 +0000 Subject: [PATCH 035/140] inline utils setup in verbose mode --- .github/workflows/main.yml | 4 +++- bash-utils/scripts/test.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93a785d8..63f5aab2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,9 @@ jobs: cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR chmod -Rv 555 ./scripts ./bash-utils/bash-utils.sh - ./bash-utils/bash-utils.sh bashUtilsSetup + set -x + . ./bash-utils/bash-utils.sh bashUtilsSetup + set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 2d379061..d31c5390 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -46,4 +46,4 @@ if [[ $(timerSpan) -lt 3 ]] ; then exit 1 fi -echoInfo "INFO: Successsfully executed all kira-utils test cases, elapsed $(prettyTime $(timerSpan))" +echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" From 2b9e59d2554af8ffb9c054d979ec44d8084176c3 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 19:30:54 +0000 Subject: [PATCH 036/140] refactor --- bash-utils/bash-utils.sh | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index af072518..780271d9 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -25,7 +25,6 @@ function bashUtilsSetup() { return 0 else local GLOBS_DIR="$1" - local UTILS_SOURCE=$(realpath "$0") local VERSION=$($UTILS_SOURCE bashUtilsVersion || echo '') local UTILS_DESTINATION="/usr/local/bin/bash-utils.sh" @@ -42,7 +41,7 @@ function bashUtilsSetup() { elif [ "$UTILS_SOURCE" == "$UTILS_DESTINATION" ] ; then bash-utils echoErr "ERROR: Installation source script and destination can't be the same" return 1 - elif [ ! -f $UTILS_SOURCE ] ; then + elif [ ! -f "$UTILS_SOURCE" ] ; then bash-utils echoErr "ERROR: utils source was NOT found" return 1 else @@ -63,7 +62,7 @@ function bashUtilsSetup() { TARGET=~/.zshrc && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" TARGET=~/.profile && [ -f $TARGET ] && chmod 777 $TARGET && echoInfo "INFO: /etc/profile executable target set to $TARGET" - mkdir -p $KIRA_GLOBS_DIR + mkdir -p "$KIRA_GLOBS_DIR" bash-utils setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" bash-utils setGlobEnv KIRA_TOOLS_SRC "$UTILS_DESTINATION" @@ -128,9 +127,9 @@ function isPublicIp() { function isDnsOrIp() { if ($(isNullOrEmpty "$1")) ; then echo "false" ; else - kg_var="false" && ($(isDns "$1")) && kg_var="true" - [ "$kg_var" != "true" ] && ($(isIp "$1")) && kg_var="true" - echo $kg_var + local VAR="false" && ($(isDns "$1")) && VAR="true" + [ "$VAR" != "true" ] && ($(isIp "$1")) && VAR="true" + echo $VAR fi } @@ -171,10 +170,10 @@ function isPort() { } function isMnemonic() { - kg_mnem=$(echo "$1" | xargs 2> /dev/null || echo -n "") - kg_count=$(echo "$kg_mnem" | wc -w 2> /dev/null || echo -n "") - (! $(isNaturalNumber $kg_count)) && kg_count=0 - if (( $kg_count % 3 == 0 )) && [[ $kg_count -ge 12 ]] ; then echo "true" ; else echo "false" ; fi + local MNEMONIC=$(echo "$1" | xargs 2> /dev/null || echo -n "") + local COUNT=$(echo "$MNEMONIC" | wc -w 2> /dev/null || echo -n "") + (! $(isNaturalNumber $COUNT)) && COUNT=0 + if (( $COUNT % 3 == 0 )) && [[ $COUNT -ge 12 ]] ; then echo "true" ; else echo "false" ; fi } function isVersion { @@ -182,19 +181,21 @@ function isVersion { } function date2unix() { - kg_date_tmp="$*" && kg_date_tmp=$(echo "$kg_date_tmp" | xargs 2> /dev/null || echo -n "") - if (! $(isNullOrWhitespaces "$kg_date_tmp")) && (! $(isNaturalNumber $kg_date_tmp)) ; then - kg_date_tmp=$(date -d "$kg_date_tmp" +"%s" 2> /dev/null || echo "0") + local DATE_TMP="$*" && DATE_TMP=$(echo "$DATE_TMP" | xargs 2> /dev/null || echo -n "") + if (! $(isNullOrWhitespaces "$DATE_TMP")) && (! $(isNaturalNumber $DATE_TMP)) ; then + DATE_TMP=$(date -d "$DATE_TMP" +"%s" 2> /dev/null || echo "0") fi - ($(isNaturalNumber "$kg_date_tmp")) && echo "$kg_date_tmp" || echo "0" + ($(isNaturalNumber "$DATE_TMP")) && echo "$DATE_TMP" || echo "0" } function isPortOpen() { - kg_addr=$1 && kg_port=$2 && kg_timeout=$3 - (! $(isNaturalNumber $kg_timeout)) && kg_timeout=1 - if (! $(isDnsOrIp $kg_addr)) || (! $(isPort $kg_port)) ; then echo "false" - elif timeout $kg_timeout nc -z $kg_addr $kg_port ; then echo "true" + local ADDRESS=$1 + local PORT=$2 + local TIMEOUT=$3 + (! $(isNaturalNumber $TIMEOUT)) && TIMEOUT=1 + if (! $(isDnsOrIp $ADDRESS)) || (! $(isPort $PORT)) ; then echo "false" + elif timeout $TIMEOUT nc -z $ADDRESS $PORT ; then echo "true" else echo "false" ; fi } @@ -314,7 +315,7 @@ function tryMkDir { fi fi - if [ "$(toLower "$1")"== "-v" ] ; then + if [ "$(toLower "$1")" == "-v" ] ; then [ ! -d "$kg_var" ] && mkdir -p "$var" 2> /dev/null || : [ -d "$kg_var" ] && echo "created directory '$kg_var'" || echo "failed to create direcotry '$kg_var'" elif [ ! -d "$kg_var" ] ; then From 483bbac54cd3486e737b94dea3753b07fad3f017 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 19:40:10 +0000 Subject: [PATCH 037/140] do not load in-line --- .github/workflows/main.yml | 6 ++++-- bash-utils/bash-utils.sh | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63f5aab2..4f7c9e3b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,9 +40,11 @@ jobs: echo "(current dir): $WORK_DIR" && ls -l ./ cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR - chmod -Rv 555 ./scripts ./bash-utils/bash-utils.sh + chmod -Rv 555 ./scripts ./bash-utils set -x - . ./bash-utils/bash-utils.sh bashUtilsSetup + cd ./bash-utils + ./bash-utils.sh bashUtilsSetup + cd $WORK_DIR set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 780271d9..6781657f 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -35,6 +35,8 @@ function bashUtilsSetup() { KIRA_GLOBS_DIR=$GLOBS_DIR fi + echo "INFO: Loaded utils from '$UTILS_SOURCE', installing bash-utils & setting up glob dir in '$KIRA_GLOBS_DIR'..." + if [ "$VERSION" != "$BASH_UTILS_VERSION" ] ; then bash-utils echoErr "ERROR: Self check version mismatch, expected '$BASH_UTILS_VERSION', but got '$VERSION'" return 1 From 4b7d2e2a85a730e8abe7cd29f5ec784e6b67ef30 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 19:52:22 +0000 Subject: [PATCH 038/140] add bin dir to path --- .github/workflows/main.yml | 3 +++ bash-utils/bash-utils.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f7c9e3b..0a09450b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,6 +44,9 @@ jobs: set -x cd ./bash-utils ./bash-utils.sh bashUtilsSetup + . /etc/profile + cat /etc/profile + echo "Bash Utils Version: " && $(bashUtilsVersion) cd $WORK_DIR set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 6781657f..b275b288 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -50,7 +50,7 @@ function bashUtilsSetup() { mkdir -p "/usr/local/bin" cp -fv "$UTILS_SOURCE" "$UTILS_DESTINATION" cp -fv "$UTILS_SOURCE" "/usr/local/bin/bash-utils" - chmod -v 555 $UTILS_DESTINATION "/usr/local/bin/bash-utils" + chmod -v 555 "$UTILS_DESTINATION" "/usr/local/bin/bash-utils" local SUDOUSER="${SUDO_USER}" && [ "$SUDOUSER" == "root" ] && SUDOUSER="" local USERNAME="${USER}" && [ "$USERNAME" == "root" ] && USERNAME="" @@ -68,6 +68,7 @@ function bashUtilsSetup() { bash-utils setGlobEnv KIRA_GLOBS_DIR "$KIRA_GLOBS_DIR" bash-utils setGlobEnv KIRA_TOOLS_SRC "$UTILS_DESTINATION" + bash-utils setGlobPath "/usr/local/bin" local AUTOLOAD_SET=$(bash-utils getLastLineByPrefix "source $UTILS_DESTINATION" /etc/profile 2> /dev/null || echo "-1") From c5d66c520727119aba2551f72d1cb4c3d2a22102 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 12 Apr 2022 20:25:01 +0000 Subject: [PATCH 039/140] ignore utils setup --- .github/workflows/main.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a09450b..f5a2a86b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,13 +41,6 @@ jobs: cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR chmod -Rv 555 ./scripts ./bash-utils - set -x - cd ./bash-utils - ./bash-utils.sh bashUtilsSetup - . /etc/profile - cat /etc/profile - echo "Bash Utils Version: " && $(bashUtilsVersion) - cd $WORK_DIR set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV @@ -62,7 +55,6 @@ jobs: run: | . /etc/profile go version - echo "Bash Utils Version: " && $(bashUtilsVersion) echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" From 2796f7ce201ee5498ac27c320492c28438713e48 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 04:53:03 +0000 Subject: [PATCH 040/140] wipe cosign key after signing --- .github/workflows/main.yml | 8 ++++---- bash-utils/scripts/test.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f5a2a86b..fbe80065 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -183,12 +183,11 @@ jobs: shell: bash env: KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} - COSIGN_EXPERIMENTAL: "true" COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} run: | - mkdir -p ./.secrets - echo "$KEY" > ./.secrets/cosign.key - for FILE in *.*; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=./.secrets/cosign.key --output=./${FILE_NAME}.sig ./$FILE_NAME; done + echo "$KEY" > ../cosign.key + for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../cosign.key --output=./${FILE_NAME}.sig ./$FILE_NAME; done + rm -fv ../cosign.key # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish release @@ -258,6 +257,7 @@ jobs: - name: Cleanup all resources shell: bash run: | + rm -fv ../cosign.key rm -rfv ./* echo "(current dir): $PWD" && ls -l ./ # ref.: https://github.com/actions/checkout, v3.0.0 diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index d31c5390..0c278c5a 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -2,9 +2,9 @@ set -e set +x . /etc/profile -. ./bash-utils/bash-utils.sh set -x +. ./bash-utils.sh timerStart echoInfo "INFO: Starting bash-utils $(bashUtilsVersion) testing..." From d61c529d9df513b793a0d108e281de0163d655ba Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 05:16:35 +0000 Subject: [PATCH 041/140] ensure absolute version result --- .github/workflows/branch.yml | 4 +++- scripts/version.sh | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index ae2ed76d..6d0ac7bc 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -21,7 +21,9 @@ jobs: shell: bash run: | chmod -Rv 555 ./scripts - RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + set +x + RELEASE_VER=$(./scripts/version.sh | xargs) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + set -x REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV diff --git a/scripts/version.sh b/scripts/version.sh index fad511d8..5cfee400 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,5 +1,2 @@ #!/usr/bin/env bash -set -e -set +x - -echo "v0.0.12.4" +echo "v0.0.12.4" \ No newline at end of file From 09d3ffb73106c34b58905bcf9797584f498e0cc1 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 05:23:54 +0000 Subject: [PATCH 042/140] check both remotes & origin --- .github/workflows/branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 6d0ac7bc..2c7a8814 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -29,7 +29,7 @@ jobs: echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - git show-branch "remotes/origin/$RELEASE_VER" && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV + ( git show-branch "origin/$RELEASE_VER" || git show-branch "remotes/origin/$RELEASE_VER" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | echo "Repository name: ${{ env.REPOSITORY_NAME }}" From 480deaacaec5fb6262d4449f3fcdc34083540afb Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 05:35:47 +0000 Subject: [PATCH 043/140] list all remote branches --- .github/workflows/branch.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 2c7a8814..4a036c7c 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -14,16 +14,18 @@ jobs: id-token: write pull-requests: write steps: - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - - name: Extract branch name on pull request + # ref.: https://github.com/actions/checkout, v2.4.0 + - name: Checkout repository & extract branch names + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + with: + fetch-depth: 0 shell: bash run: | - chmod -Rv 555 ./scripts - set +x - RELEASE_VER=$(./scripts/version.sh | xargs) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV set -x + git branch -r -l + echo "(current dir): $PWD" && ls -l ./ + chmod -Rv 555 ./scripts + RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV From 73203590e589d1b713a3431e75cc10e4c2a6605f Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 05:39:11 +0000 Subject: [PATCH 044/140] syntax --- .github/workflows/branch.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 4a036c7c..81de6bc3 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -1,4 +1,4 @@ -name: Create version branch +name: Create version branch & PR /* -> version on: push: @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 with: fetch-depth: 0 + - name: Extract branch name on pull request shell: bash run: | set -x From 73febf544a3865a21aee903fcd9ebacd0ea2863b Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 05:46:06 +0000 Subject: [PATCH 045/140] refactor --- .github/workflows/main.yml | 23 ++++++++++++++--------- .github/workflows/master.yml | 24 +++++++++++++++--------- .github/workflows/spam.yml | 8 +++++--- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fbe80065..658d6c26 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,14 +17,17 @@ jobs: container: image: ghcr.io/kiracore/docker/base-image:v0.9.0.0 steps: - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + # ref.: https://github.com/actions/checkout, v2.4.0 + - name: Checkout repository & extract branch names + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + with: + fetch-depth: 0 - name: Extract branch name on push if: github.event_name == 'push' shell: bash run: | - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - name: Extract branch name on pull request if: github.event_name == 'pull_request' env: @@ -32,8 +35,8 @@ jobs: BASE_REF_BRANCH: ${{ github.base_ref }} shell: bash run: | - echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }} | tr / -)" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }} | tr / -)" >> $GITHUB_ENV + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV - name: Archive src, install latest bash-utils and setup envs run: | WORK_DIR=$PWD @@ -260,9 +263,11 @@ jobs: rm -fv ../cosign.key rm -rfv ./* echo "(current dir): $PWD" && ls -l ./ - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + # ref.: https://github.com/actions/checkout, v2.4.0 + - name: Checkout repository & extract branch names + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + with: + fetch-depth: 0 - name: Create PR from a version branch to latest # ref: https://github.com/repo-sync/pull-request if: | diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 5fbdad2c..d65da2ea 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,26 +16,32 @@ jobs: id-token: write pull-requests: write steps: + # ref.: https://github.com/actions/checkout, v2.4.0 + - name: Checkout repository & extract branch names + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + with: + fetch-depth: 0 - name: Extract branch name on pull request shell: bash run: | - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + set -x + git branch -r -l + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV - name: Print debug data before publishing run: | - echo "Source branch: ${{ env.SOURCE_BRANCH }}" - echo " Event name: ${{ github.event_name }}" - echo " Repo. name: ${{ github.event.repository.name }}" - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + echo " Source branch: ${{ env.DEFAULT_BRANCH }}" + echo "Default branch: ${{ env.SOURCE_BRANCH }}" + echo " Event name: ${{ github.event_name }}" + echo " Repo. name: ${{ github.event.repository.name }}" - name: Create PR from a version branch to master after version branch push if: startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, '-') && !contains(env.SOURCE_BRANCH, 'rc') uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} - destination_branch: ${{ github.event.repository.default_branch }} - pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ github.event.repository.default_branch }}" + destination_branch: ${{ env.DEFAULT_BRANCH}} + pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ env.DEFAULT_BRANCH }}" pr_label: "kira-automation" pr_assignee: "asmodat" pr_allow_empty: true \ No newline at end of file diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index 442c2c25..a0d3e0ae 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -18,9 +18,11 @@ jobs: REF_BRANCH: ${{ github.event.pull_request.head.ref }} BASE_REF_BRANCH: ${{ github.base_ref }} steps: - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + # ref.: https://github.com/actions/checkout, v2.4.0 + - name: Checkout repository & extract branch names + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + with: + fetch-depth: 0 # Branch name is also a version of the release # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - name: Extract branch name & release version From ce5245bbcd231477d8276568c4e0ece2e63e7b6c Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 09:43:41 +0000 Subject: [PATCH 046/140] added safeWget sig verification --- .github/workflows/main.yml | 21 +++++++---- .github/workflows/master.yml | 1 + README.md | 20 +++++++++- bash-utils/bash-utils.sh | 71 ++++++++++++++++++++++++++++++++++-- bash-utils/scripts/test.sh | 31 ++++++++++++++++ scripts/version.sh | 2 +- 6 files changed, 132 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 658d6c26..0a06c7cb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -189,7 +189,7 @@ jobs: COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} run: | echo "$KEY" > ../cosign.key - for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../cosign.key --output=./${FILE_NAME}.sig ./$FILE_NAME; done + for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done rm -fv ../cosign.key # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once @@ -249,6 +249,14 @@ jobs: ./bip39gen-darwin-arm64.deb.sig ./bash-utils.sh ./bash-utils.sh.sig + - name: Cleanup all resources + if: always() + shell: bash + run: | + shred -vzn 3 ../cosign.key || echo "WARNING: Failed to shred key file" + rm -fv ../cosign.key + rm -rfv ./* + echo "(current dir): $PWD" && ls -l ./ # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 @@ -257,17 +265,16 @@ jobs: ( env.SOURCE_BRANCH == env.RELEASE_VER || env.DESTINATION_BRANCH == env.RELEASE_VER ) with: github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Cleanup all resources - shell: bash - run: | - rm -fv ../cosign.key - rm -rfv ./* - echo "(current dir): $PWD" && ls -l ./ # ref.: https://github.com/actions/checkout, v2.4.0 - name: Checkout repository & extract branch names uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 with: fetch-depth: 0 + - name: Allow workspace interactions + shell: bash + run: | + set -x + git config --global --add safe.directory /github/workspace - name: Create PR from a version branch to latest # ref: https://github.com/repo-sync/pull-request if: | diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d65da2ea..c6aaf402 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -26,6 +26,7 @@ jobs: run: | set -x git branch -r -l + git config --global --add safe.directory /github/workspace echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV - name: Print debug data before publishing diff --git a/README.md b/README.md index 7cbf21d4..f11b344e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # tools KIRA Network - useful tools & scripts - ## Signatures All files in KIRA repositories are always signed with [cosign](https://github.com/sigstore/cosign/releases) @@ -10,9 +9,10 @@ Cosign requires simple initial setup of the signer keys described more precisely ```bash # install cosign +COSIGN_VERSION="v1.7.2" && \ if [[ "$(uname -m)" == *"ar"* ]] ; then ARCH="arm64"; else ARCH="amd64" ; fi && echo $ARCH && \ PLATFORM=$(uname) && FILE=$(echo "cosign-${PLATFORM}-${ARCH}" | tr '[:upper:]' '[:lower:]') && \ - wget https://github.com/sigstore/cosign/releases/download/v1.7.2/$FILE && chmod +x -v ./$FILE && \ + wget https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/$FILE && chmod +x -v ./$FILE && \ mv -fv ./$FILE /usr/local/bin/cosign && cosign version # save KIRA public cosign key @@ -28,3 +28,19 @@ EOL # verify signature of downloaded files cosign verify-blob --key=./cosign.pub --signature=./.sig ./ ``` + +## bash-utils + +KIRA bash-utils is a general purpose tool for simplifying scripts & commands + +```bash +# one line install +TOOLS_VERSION="v0.0.12.4" && mkdir -p /usr/keys && FILE_NAME="bash-utils.sh" && \ + if [ -z "$KIRA_COSIGN_PUB" ] ; then KIRA_COSIGN_PUB=/usr/keys/kira-cosign.pub ; fi && \ + echo -e "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/IrzBQYeMwvKa44/DF/HB7XDpnE+\nf+mU9F/Qbfq25bBWV2+NlYMJv3KvKHNtu3Jknt6yizZjUV4b8WGfKBzFYw==\n-----END PUBLIC KEY-----" > $KIRA_COSIGN_PUB && \ + wget "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/${FILE_NAME}" -O ./$FILE_NAME && \ + wget "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/${FILE_NAME}.sig" -O ./${FILE_NAME}.sig && \ + cosign verify-blob --key="$KIRA_COSIGN_PUB" --signature=./${FILE_NAME}.sig ./$FILE_NAME && \ + chmod -v 555 ./$FILE_NAME && ./$FILE_NAME bashUtilsSetup "/var/kiraglob" && . /etc/profile && \ + echoInfo "Installed bash-utils $(bashUtilsVersion)" +``` diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index b275b288..1c7ce2c9 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -5,6 +5,8 @@ REGEX_DNS="^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$" REGEX_IP="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$" REGEX_NODE_ID="^[a-f0-9]{40}$" REGEX_TXHASH="^[a-fA-F0-9]{64}$" +REGEX_SHA256="^[a-fA-F0-9]{64}$" +REGEX_MD5="^[a-fA-F0-9]{32}$" REGEX_INTEGER="^-?[0-9]+$" REGEX_NUMBER="^[+-]?([0-9]*[.])?([0-9]+)?$" REGEX_PUBLIC_IP='^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(?.sig" URL must exist +# safeWget +# safeWget function safeWget() { local OUT_PATH=$1 local FILE_URL=$2 local EXPECTED_HASH=$3 + local OUT_NAME=$(basename $OUT_PATH) local TMP_DIR=/tmp/downloads local TMP_PATH="$TMP_DIR/$OUT_NAME" - mkdir -p $TMP_DIR + local SIG_URL="${FILE_URL}.sig" + local TMP_PATH_SIG="$TMP_DIR/${OUT_NAME}.sig" + + mkdir -p "$TMP_DIR" + rm -fv "$TMP_PATH_SIG" + local FILE_HASH=$(sha256 $TMP_PATH) + + local COSIGN_PUB_KEY="" + if (! $(isSHA256 "$EXPECTED_HASH")) ; then + COSIGN_PUB_KEY="$EXPECTED_HASH" && EXPECTED_HASH="" + if ($(isCommand cosign)) && (! $(isFileEmpty $COSIGN_PUB_KEY)) ; then + echoWarn "WARNING: Checksum was not provided, checking if a signature file is available..." + # assume pubkey was provided instead of checksum + wget "$SIG_URL" -O $TMP_PATH_SIG + else + echoErr "ERROR: Cosign tool is not installed or public key was not found in '$COSIGN_PUB_KEY'" + return 1 + fi + fi + + local COSIGN_VERIFIED="false" + if (! $(isFileEmpty $COSIGN_PUB_KEY)) && (! $(isFileEmpty $TMP_PATH)) ; then + echoInfo "INFO: Using cosign to verify temporary file integrity..." + COSIGN_VERIFIED="true" + cosign verify-blob --key="$COSIGN_PUB_KEY" --signature="$TMP_PATH_SIG" "$TMP_PATH" || COSIGN_VERIFIED="false" + + if [ "$COSIGN_VERIFIED" == "true" ] ; then + echoInfo "INFO: Cosign successfully verified integrity of an already existing temporary file" + EXPECTED_HASH="$FILE_HASH" + else + echoInfo "INFO: Cosign failed to verify temporary file integrity" + EXPECTED_HASH="" + fi + fi - if [ "$FILE_HASH" == "$EXPECTED_HASH" ] && [ ! -z "$EXPECTED_HASH" ]; then + if [ "$FILE_HASH" == "$EXPECTED_HASH" ] && ($(isSHA256 "$EXPECTED_HASH")); then echoInfo "INFO: No need to download, file with the hash '$FILE_HASH' was already found in the '$TMP_DIR' directory" [ "$TMP_PATH" != "$OUT_PATH" ] && cp -fv $TMP_PATH $OUT_PATH else @@ -269,10 +317,25 @@ function safeWget() { FILE_HASH=$(sha256 $OUT_PATH) fi + COSIGN_VERIFIED="false" + if (! $(isFileEmpty $COSIGN_PUB_KEY)) && (! $(isFileEmpty $OUT_PATH)) ; then + echoInfo "INFO: Using cosign to verify final file integrity..." + COSIGN_VERIFIED="true" + cosign verify-blob --key="$COSIGN_PUB_KEY" --signature="$TMP_PATH_SIG" "$OUT_PATH" || COSIGN_VERIFIED="false" + + if [ "$COSIGN_VERIFIED" == "true" ] ; then + echoInfo "INFO: Cosign successfully verified integrity of downloaded file" + EXPECTED_HASH="$FILE_HASH" + else + echoInfo "INFO: Cosign failed to verify integrity of downloaded file" + EXPECTED_HASH="cosign" + fi + fi + if ($(isFileEmpty $OUT_PATH)) ; then echoErr "ERROR: Failed download from '$FILE_URL', file is exmpty or was NOT found!" return 1 - elif [ "$FILE_HASH" != "$EXPECTED_HASH" ]; then + elif [ "$FILE_HASH" != "$EXPECTED_HASH" ] || (! $(isSHA256 "$EXPECTED_HASH")) ; then rm -fv $OUT_PATH || echoErr "ERROR: Failed to delete '$OUT_PATH'" echoErr "ERROR: Safe download filed: '$FILE_URL' -x-> '$OUT_PATH'" echoErr "ERROR: Expected hash: '$EXPECTED_HASH', but got '$FILE_HASH'" diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 0c278c5a..43e793eb 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -46,4 +46,35 @@ if [[ $(timerSpan) -lt 3 ]] ; then exit 1 fi +# testing SHA & MD5 +TEST_FILE=/tmp/testfile.tmp +echo "Hello World" > $TEST_FILE +FILE_SHA256=$(sha256 $TEST_FILE) && EXPECTED_FILE_SHA256="d2a84f4b8b650937ec8f73cd8be2c74add5a911ba64df27458ed8229da804a26" +FILE_MD5=$(md5 $TEST_FILE) && EXPECTED_FILE_MD5="e59ff97941044f85df5297e1c302d260" + +if (!$(isSHA256 $FILE_SHA256)) || [ "$FILE_SHA256" != "$EXPECTED_FILE_SHA256" ] ; then + echoErr "ERROR: Expected '$TEST_FILE' sha256 to be '$EXPECTED_FILE_SHA256', but got '$FILE_SHA256'" + exit 1 +fi + +if (!$(isMD5 $FILE_MD5)) || [ "$FILE_MD5" != "$EXPECTED_FILE_MD5" ] ; then + echoErr "ERROR: Expected '$TEST_FILE' md5 to be '$EXPECTED_FILE_MD5', but got '$FILE_SHA256'" + exit 1 +fi + +# hash of non existent file should be empty string +rm -fv $TEST_FILE +FILE_SHA256=$(sha256 $TEST_FILE) && EXPECTED_FILE_SHA256="" +FILE_MD5=$(md5 $TEST_FILE) && EXPECTED_FILE_MD5="" + +if ($(isSHA256 "$FILE_MD5")) || [ "$FILE_SHA256" != "$EXPECTED_FILE_SHA256" ] ; then + echoErr "ERROR: Expected '$TEST_FILE' sha256 to be '$EXPECTED_FILE_SHA256', but got '$FILE_SHA256'" + exit 1 +fi + +if ($(isMD5 "$FILE_MD5")) || [ "$FILE_MD5" != "$EXPECTED_FILE_MD5" ] ; then + echoErr "ERROR: Expected '$TEST_FILE' md5 to be '$EXPECTED_FILE_MD5', but got '$FILE_SHA256'" + exit 1 +fi + echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index 5cfee400..93675e9a 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.0.12.4" \ No newline at end of file +echo "v0.1.0.5" \ No newline at end of file From 7921802dfd98f400815cc4b15fd86550bdf4fee0 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 09:48:12 +0000 Subject: [PATCH 047/140] add dir --- .github/workflows/branch.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 81de6bc3..1f3de31a 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -24,6 +24,7 @@ jobs: run: | set -x git branch -r -l + git config --global --add safe.directory /github/workspace echo "(current dir): $PWD" && ls -l ./ chmod -Rv 555 ./scripts RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV From a3798fe56758b3710d0924d24f3a6b1a54226a8b Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 10:06:13 +0000 Subject: [PATCH 048/140] update version --- scripts/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/version.sh b/scripts/version.sh index 93675e9a..0e055a29 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.0.5" \ No newline at end of file +echo "v0.1.0.6" \ No newline at end of file From 00eb395ef5d1be42e9f97f5c8fe112e4e9a64c35 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Apr 2022 10:30:53 +0000 Subject: [PATCH 049/140] Fix broken PR module --- .github/pull-request/entrypoint.sh | 103 +++++++++++++++++++++++++++++ .github/workflows/branch.yml | 7 +- .github/workflows/main.yml | 4 +- .github/workflows/master.yml | 3 +- scripts/version.sh | 2 +- 5 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 .github/pull-request/entrypoint.sh diff --git a/.github/pull-request/entrypoint.sh b/.github/pull-request/entrypoint.sh new file mode 100644 index 00000000..d59f655f --- /dev/null +++ b/.github/pull-request/entrypoint.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +if [[ -z "$GITHUB_TOKEN" ]]; then + echo "Set the GITHUB_TOKEN environment variable." + exit 1 +fi + +if [[ ! -z "$INPUT_SOURCE_BRANCH" ]]; then + SOURCE_BRANCH="$INPUT_SOURCE_BRANCH" +elif [[ ! -z "$GITHUB_REF" ]]; then + SOURCE_BRANCH=${GITHUB_REF/refs\/heads\//} # Remove branch prefix +else + echo "Set the INPUT_SOURCE_BRANCH environment variable or trigger from a branch." + exit 1 +fi + +DESTINATION_BRANCH="${INPUT_DESTINATION_BRANCH:-"master"}" + +# Fix for the unsafe repo error: https://github.com/repo-sync/pull-request/issues/84 +git config --global --add safe.directory /github/workspace + +# Github actions no longer auto set the username and GITHUB_TOKEN +git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@${GITHUB_SERVER_URL#https://}/$GITHUB_REPOSITORY" + +# Pull all branches references down locally so subsequent commands can see them +git fetch origin '+refs/heads/*:refs/heads/*' --update-head-ok + +# Print out all branches +git --no-pager branch -a -vv + +if [ "$(git rev-parse --revs-only "$SOURCE_BRANCH")" = "$(git rev-parse --revs-only "$DESTINATION_BRANCH")" ]; then + echo "Source and destination branches are the same." + exit 0 +fi + +# Do not proceed if there are no file differences, this avoids PRs with just a merge commit and no content +LINES_CHANGED=$(git diff --name-only "$DESTINATION_BRANCH" "$SOURCE_BRANCH" -- | wc -l | awk '{print $1}') +if [[ "$LINES_CHANGED" = "0" ]] && [[ ! "$INPUT_PR_ALLOW_EMPTY" == "true" ]]; then + echo "No file changes detected between source and destination branches." + exit 0 +fi + + +# Workaround for `hub` auth error https://github.com/github/hub/issues/2149#issuecomment-513214342 +export GITHUB_USER="$GITHUB_ACTOR" + +PR_ARG="$INPUT_PR_TITLE" +if [[ ! -z "$PR_ARG" ]]; then + PR_ARG="-m \"$PR_ARG\"" + + if [[ ! -z "$INPUT_PR_TEMPLATE" ]]; then + sed -i 's/`/\\`/g; s/\$/\\\$/g' "$INPUT_PR_TEMPLATE" + PR_ARG="$PR_ARG -m \"$(echo -e "$(cat "$INPUT_PR_TEMPLATE")")\"" + elif [[ ! -z "$INPUT_PR_BODY" ]]; then + PR_ARG="$PR_ARG -m \"$INPUT_PR_BODY\"" + fi +fi + +if [[ ! -z "$INPUT_PR_REVIEWER" ]]; then + PR_ARG="$PR_ARG -r \"$INPUT_PR_REVIEWER\"" +fi + +if [[ ! -z "$INPUT_PR_ASSIGNEE" ]]; then + PR_ARG="$PR_ARG -a \"$INPUT_PR_ASSIGNEE\"" +fi + +if [[ ! -z "$INPUT_PR_LABEL" ]]; then + PR_ARG="$PR_ARG -l \"$INPUT_PR_LABEL\"" +fi + +if [[ ! -z "$INPUT_PR_MILESTONE" ]]; then + PR_ARG="$PR_ARG -M \"$INPUT_PR_MILESTONE\"" +fi + +if [[ "$INPUT_PR_DRAFT" == "true" ]]; then + PR_ARG="$PR_ARG -d" +fi + +COMMAND="hub pull-request \ + -b $DESTINATION_BRANCH \ + -h $SOURCE_BRANCH \ + --no-edit \ + $PR_ARG \ + || true" + +echo "$COMMAND" + +PR_URL=$(sh -c "$COMMAND") +if [[ "$?" != "0" ]]; then + exit 1 +fi + +echo ${PR_URL} +echo "::set-output name=pr_url::${PR_URL}" +echo "::set-output name=pr_number::${PR_URL##*/}" +if [[ "$LINES_CHANGED" = "0" ]]; then + echo "::set-output name=has_changed_files::false" +else + echo "::set-output name=has_changed_files::true" +fi \ No newline at end of file diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 1f3de31a..c5062969 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -44,9 +44,9 @@ jobs: echo " Release exists: ${{ env.RELEASE_EXISTS }}" echo " Event name: ${{ github.event_name }}" echo " Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" - # ref.: https://github.com/peterjgrainger/action-create-branch, v2.0.1 + # ref.: https://github.com/peterjgrainger/action-create-branch, v2.2.0 - name: Create version branch from master - uses: peterjgrainger/action-create-branch@40d33f921267ca130cbacc770f41fc7c501a420f + uses: peterjgrainger/action-create-branch@c2800a3a9edbba2218da6861fa46496cf8f3195a if: | ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && @@ -57,11 +57,12 @@ jobs: branch: ${{ env.RELEASE_VER }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch + # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead + uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 if: | ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) - uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a06c7cb..78f9e00f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -276,11 +276,11 @@ jobs: set -x git config --global --add safe.directory /github/workspace - name: Create PR from a version branch to latest - # ref: https://github.com/repo-sync/pull-request + # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead + uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 if: | github.event_name == 'push' && ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) - uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index c6aaf402..bb4c2f93 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -36,8 +36,9 @@ jobs: echo " Event name: ${{ github.event_name }}" echo " Repo. name: ${{ github.event.repository.name }}" - name: Create PR from a version branch to master after version branch push + # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead + uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 if: startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, '-') && !contains(env.SOURCE_BRANCH, 'rc') - uses: repo-sync/pull-request@5ba2c80b97c87b9174c1548141b7acd80f6376e1 with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} diff --git a/scripts/version.sh b/scripts/version.sh index 0e055a29..daf4b496 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.0.6" \ No newline at end of file +echo "v0.1.0.7" \ No newline at end of file From 574bbb62d06157540212a8f61c13b86b67fc9c02 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 16 Apr 2022 11:41:13 +0000 Subject: [PATCH 050/140] Build tools on dedicated platforms --- .github/pull-request/entrypoint.sh | 103 ------------ .github/workflows/branch.yml | 14 +- .github/workflows/main.yml | 227 ++++++++++++++++++++------- .github/workflows/master.yml | 16 +- .github/workflows/spam.yml | 13 +- bip39gen/scripts/publish.sh | 11 +- scripts/version.sh | 2 +- tmconnect/scripts/publish.sh | 11 +- tmkms-key-import/scripts/publish.sh | 8 +- tmkms-key-import/start.sh | 2 +- validator-key-gen/scripts/publish.sh | 11 +- 11 files changed, 216 insertions(+), 202 deletions(-) delete mode 100644 .github/pull-request/entrypoint.sh diff --git a/.github/pull-request/entrypoint.sh b/.github/pull-request/entrypoint.sh deleted file mode 100644 index d59f655f..00000000 --- a/.github/pull-request/entrypoint.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -if [[ -z "$GITHUB_TOKEN" ]]; then - echo "Set the GITHUB_TOKEN environment variable." - exit 1 -fi - -if [[ ! -z "$INPUT_SOURCE_BRANCH" ]]; then - SOURCE_BRANCH="$INPUT_SOURCE_BRANCH" -elif [[ ! -z "$GITHUB_REF" ]]; then - SOURCE_BRANCH=${GITHUB_REF/refs\/heads\//} # Remove branch prefix -else - echo "Set the INPUT_SOURCE_BRANCH environment variable or trigger from a branch." - exit 1 -fi - -DESTINATION_BRANCH="${INPUT_DESTINATION_BRANCH:-"master"}" - -# Fix for the unsafe repo error: https://github.com/repo-sync/pull-request/issues/84 -git config --global --add safe.directory /github/workspace - -# Github actions no longer auto set the username and GITHUB_TOKEN -git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@${GITHUB_SERVER_URL#https://}/$GITHUB_REPOSITORY" - -# Pull all branches references down locally so subsequent commands can see them -git fetch origin '+refs/heads/*:refs/heads/*' --update-head-ok - -# Print out all branches -git --no-pager branch -a -vv - -if [ "$(git rev-parse --revs-only "$SOURCE_BRANCH")" = "$(git rev-parse --revs-only "$DESTINATION_BRANCH")" ]; then - echo "Source and destination branches are the same." - exit 0 -fi - -# Do not proceed if there are no file differences, this avoids PRs with just a merge commit and no content -LINES_CHANGED=$(git diff --name-only "$DESTINATION_BRANCH" "$SOURCE_BRANCH" -- | wc -l | awk '{print $1}') -if [[ "$LINES_CHANGED" = "0" ]] && [[ ! "$INPUT_PR_ALLOW_EMPTY" == "true" ]]; then - echo "No file changes detected between source and destination branches." - exit 0 -fi - - -# Workaround for `hub` auth error https://github.com/github/hub/issues/2149#issuecomment-513214342 -export GITHUB_USER="$GITHUB_ACTOR" - -PR_ARG="$INPUT_PR_TITLE" -if [[ ! -z "$PR_ARG" ]]; then - PR_ARG="-m \"$PR_ARG\"" - - if [[ ! -z "$INPUT_PR_TEMPLATE" ]]; then - sed -i 's/`/\\`/g; s/\$/\\\$/g' "$INPUT_PR_TEMPLATE" - PR_ARG="$PR_ARG -m \"$(echo -e "$(cat "$INPUT_PR_TEMPLATE")")\"" - elif [[ ! -z "$INPUT_PR_BODY" ]]; then - PR_ARG="$PR_ARG -m \"$INPUT_PR_BODY\"" - fi -fi - -if [[ ! -z "$INPUT_PR_REVIEWER" ]]; then - PR_ARG="$PR_ARG -r \"$INPUT_PR_REVIEWER\"" -fi - -if [[ ! -z "$INPUT_PR_ASSIGNEE" ]]; then - PR_ARG="$PR_ARG -a \"$INPUT_PR_ASSIGNEE\"" -fi - -if [[ ! -z "$INPUT_PR_LABEL" ]]; then - PR_ARG="$PR_ARG -l \"$INPUT_PR_LABEL\"" -fi - -if [[ ! -z "$INPUT_PR_MILESTONE" ]]; then - PR_ARG="$PR_ARG -M \"$INPUT_PR_MILESTONE\"" -fi - -if [[ "$INPUT_PR_DRAFT" == "true" ]]; then - PR_ARG="$PR_ARG -d" -fi - -COMMAND="hub pull-request \ - -b $DESTINATION_BRANCH \ - -h $SOURCE_BRANCH \ - --no-edit \ - $PR_ARG \ - || true" - -echo "$COMMAND" - -PR_URL=$(sh -c "$COMMAND") -if [[ "$?" != "0" ]]; then - exit 1 -fi - -echo ${PR_URL} -echo "::set-output name=pr_url::${PR_URL}" -echo "::set-output name=pr_number::${PR_URL##*/}" -if [[ "$LINES_CHANGED" = "0" ]]; then - echo "::set-output name=has_changed_files::false" -else - echo "::set-output name=has_changed_files::true" -fi \ No newline at end of file diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index c5062969..750e7089 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -14,17 +14,19 @@ jobs: id-token: write pull-requests: write steps: - # ref.: https://github.com/actions/checkout, v2.4.0 - - name: Checkout repository & extract branch names - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - with: - fetch-depth: 0 + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Extract branch name on pull request shell: bash run: | set -x git branch -r -l - git config --global --add safe.directory /github/workspace echo "(current dir): $PWD" && ls -l ./ chmod -Rv 555 ./scripts RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78f9e00f..600a2be4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build, Release & Publish +name: Build, Test & Publish on: push: @@ -6,22 +6,25 @@ on: pull_request: branches: [ v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] jobs: - build: - name: Repo Test & Build - runs-on: ubuntu-20.04 + build-amd64: + name: AMD64 - Repo Test & Build + runs-on: github-actions-amd64-runner-2 permissions: contents: read packages: write id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.9.0.0 + image: ghcr.io/kiracore/docker/base-image:v0.9.3-rc.3@sha256:ae4cbe04ad2befb265bc9696d001447a8453eb8cd5786bd439d66fa854b3e572 steps: - # ref.: https://github.com/actions/checkout, v2.4.0 - - name: Checkout repository & extract branch names - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - with: - fetch-depth: 0 + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Extract branch name on push if: github.event_name == 'push' shell: bash @@ -82,42 +85,148 @@ jobs: make publish touch ./RELEASE.md cp -fv ./RELEASE.md ./bin/RELEASE.md + cp -fv ./src.tar.gz ./bin/source-code.tar.gz chmod -Rv 777 ./bin + echo -e "\n\r### Platform Neutral Releases\n\r\`\`\`" >> ./bin/RELEASE.md echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e " Release Versions: $RELEASE_VER" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER | Any OS" >> ./bin/RELEASE.md + echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md + echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " source-code.tar.gz: sha256:$(sha256sum ./bin/source-code.tar.gz | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo -e "\`\`\`" >> ./bin/RELEASE.md + echo -e "\n\r### AMD64 Releases\n\r\`\`\`" >> ./bin/RELEASE.md + echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER | AMD64" >> ./bin/RELEASE.md echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-linux-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo -e "\`\`\`" >> ./bin/RELEASE.md + tar -czvf tools-bin-amd64.tar.gz -C ./bin . + - name: Uploading artifacts + uses: actions/upload-artifact@v3.0.0 + with: + name: tools-bin-amd64 + path: ./tools-bin-amd64.tar.gz + build-arm64: + name: ARM64 - Repo Test & Build + runs-on: github-actions-arm64-runner-1 + needs: [build-amd64] + permissions: + contents: read + packages: write + id-token: write + pull-requests: write + container: + image: ghcr.io/kiracore/docker/base-image:v0.9.3-rc.3@sha256:077c3d5e07c2766027af5e92338a25ffcf8688a2be79e3aa9eae9598650e716a + steps: + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + + - name: Extract branch name on push + if: github.event_name == 'push' + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + - name: Extract branch name on pull request + if: github.event_name == 'pull_request' + env: + REF_BRANCH: ${{ github.event.pull_request.head.ref }} + BASE_REF_BRANCH: ${{ github.base_ref }} + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV + - name: Setup ENV variables + run: | + WORK_DIR=$PWD + echo "(current dir): $WORK_DIR" && ls -l ./ + cd $WORK_DIR + chmod -Rv 555 ./scripts ./bash-utils + set +x + RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + if [[ "$RELEASE_VER" =~ $VERSION_REGEX ]] && [[ "$SOURCE_BRANCH" =~ $VERSION_REGEX ]] && [ "$SOURCE_BRANCH" != "$RELEASE_VER" ] ; then + echo "ERROR: Version branch name MUST be the same as the app version, run scripts/version.sh to check app version!" + exit 1 + else + echo "INFO: Variables setup succeeded" + fi + rm ./RELEASE.md + - name: Print debug data before build + run: | + . /etc/profile + go version + echo " Source branch: ${{ env.SOURCE_BRANCH }}" + echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" + echo " Event name: ${{ github.event_name }}" + echo " Repository name: ${{ env.REPOSITORY_NAME }}" + echo " Release version: ${{ env.RELEASE_VER }}" + echo " Release exists: ${{ env.RELEASE_EXISTS }}" + - name: Download AMD64 artifacts + # ref.: https://github.com/actions/download-artifact, v3.0.0 + uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 + with: + name: tools-bin-amd64 + - name: Testing & Building TOOLS + run: | + echo "(current dir): $PWD" && ls -l ./ + chmod -Rv 555 ./scripts + chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts + chmod -Rv 555 ./bash-utils + chmod -Rv 666 ./RELEASE.md + export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} + make test + make build + tmconnect version + - name: Publishing TOOLS binaries + shell: bash + run: | + make publish + cd ./bin + tar xvf ./tools-bin-amd64.tar.gz + chmod -Rv 555 ./bin + chmod -v 666 ./bin/RELEASE.md + echo -e "\n\r### AMD64 Releases\n\r\`\`\`" >> ./bin/RELEASE.md + echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER | ARM64" >> ./bin/RELEASE.md + echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md + echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md - tar -czvf deb.tar.gz -C ./bin . + tar -czvf tools-bin-arm64.tar.gz -C ./bin . - name: Uploading artifacts uses: actions/upload-artifact@v3.0.0 with: - name: tools-bin-deb - path: ./deb.tar.gz + name: tools-bin-arm64 + path: ./tools-bin-arm64.tar.gz release: name: Create Release runs-on: ubuntu-20.04 - needs: [build] + needs: [build-arm64] permissions: contents: write packages: write @@ -129,15 +238,21 @@ jobs: uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605 with: cosign-release: 'v1.7.2' - - name: Download artifacts - uses: actions/download-artifact@v3.0.0 + - name: Download AMD64 artifacts + # ref.: https://github.com/actions/download-artifact, v3.0.0 + uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 + with: + name: tools-bin-amd64 + - name: Download ARM64 artifacts + # ref.: https://github.com/actions/download-artifact, v3.0.0 + uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 with: - name: tools-bin-deb + name: tools-bin-arm64 - name: Inspecting & organizing artifacts run: | echo "(current dir): $PWD" && ls -l ./ - tar xvf ./deb.tar.gz - chmod -Rv 777 ./ + tar xvf ./tools-bin-arm64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ + tar xvf ./tools-bin-amd64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" @@ -209,46 +324,48 @@ jobs: files: | ./tmconnect-linux-amd64.deb ./tmconnect-linux-amd64.deb.sig - ./tmconnect-linux-arm64.deb - ./tmconnect-linux-arm64.deb.sig ./tmconnect-darwin-amd64.deb ./tmconnect-darwin-amd64.deb.sig - ./tmconnect-darwin-arm64.deb - ./tmconnect-darwin-arm64.deb.sig ./tmconnect-windows-amd64.exe ./tmconnect-windows-amd64.exe.sig - ./tmconnect-windows-arm64.exe - ./tmconnect-windows-arm64.exe.sig ./tmkms-key-import-linux-amd64 ./tmkms-key-import-linux-amd64.sig - ./tmkms-key-import-linux-arm64 - ./tmkms-key-import-linux-arm64.sig ./validator-key-gen-linux-amd64.deb ./validator-key-gen-linux-amd64.deb.sig - ./validator-key-gen-linux-arm64.deb - ./validator-key-gen-linux-arm64.deb.sig ./validator-key-gen-windows-amd64.exe ./validator-key-gen-windows-amd64.exe.sig - ./validator-key-gen-windows-arm64.exe - ./validator-key-gen-windows-arm64.exe.sig ./validator-key-gen-darwin-amd64.deb ./validator-key-gen-darwin-amd64.deb.sig - ./validator-key-gen-darwin-arm64.deb - ./validator-key-gen-darwin-arm64.deb.sig ./bip39gen-linux-amd64.deb ./bip39gen-linux-amd64.deb.sig - ./bip39gen-linux-arm64.deb - ./bip39gen-linux-arm64.deb.sig ./bip39gen-windows-amd64.exe ./bip39gen-windows-amd64.exe.sig - ./bip39gen-windows-arm64.exe - ./bip39gen-windows-arm64.exe.sig ./bip39gen-darwin-amd64.deb ./bip39gen-darwin-amd64.deb.sig + ./tmconnect-linux-arm64.deb + ./tmconnect-linux-arm64.deb.sig + ./tmconnect-darwin-arm64.deb + ./tmconnect-darwin-arm64.deb.sig + ./tmconnect-windows-arm64.exe + ./tmconnect-windows-arm64.exe.sig + ./tmkms-key-import-linux-arm64 + ./tmkms-key-import-linux-arm64.sig + ./validator-key-gen-linux-arm64.deb + ./validator-key-gen-linux-arm64.deb.sig + ./validator-key-gen-windows-arm64.exe + ./validator-key-gen-windows-arm64.exe.sig + ./validator-key-gen-darwin-arm64.deb + ./validator-key-gen-darwin-arm64.deb.sig + ./bip39gen-linux-arm64.deb + ./bip39gen-linux-arm64.deb.sig + ./bip39gen-windows-arm64.exe + ./bip39gen-windows-arm64.exe.sig ./bip39gen-darwin-arm64.deb ./bip39gen-darwin-arm64.deb.sig ./bash-utils.sh ./bash-utils.sh.sig + ./source-code.tar.gz + ./source-code.tar.gz.sig - name: Cleanup all resources if: always() shell: bash @@ -265,16 +382,14 @@ jobs: ( env.SOURCE_BRANCH == env.RELEASE_VER || env.DESTINATION_BRANCH == env.RELEASE_VER ) with: github-token: "${{ secrets.GITHUB_TOKEN }}" - # ref.: https://github.com/actions/checkout, v2.4.0 - - name: Checkout repository & extract branch names - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - with: - fetch-depth: 0 - - name: Allow workspace interactions - shell: bash + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory run: | - set -x git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Create PR from a version branch to latest # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index bb4c2f93..fd659a8a 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,17 +16,19 @@ jobs: id-token: write pull-requests: write steps: - # ref.: https://github.com/actions/checkout, v2.4.0 - - name: Checkout repository & extract branch names - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - with: - fetch-depth: 0 + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Extract branch name on pull request shell: bash run: | set -x git branch -r -l - git config --global --add safe.directory /github/workspace echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV - name: Print debug data before publishing @@ -38,7 +40,7 @@ jobs: - name: Create PR from a version branch to master after version branch push # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 - if: startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') && !contains(env.SOURCE_BRANCH, '-') && !contains(env.SOURCE_BRANCH, 'rc') + if: startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index a0d3e0ae..8dd102d3 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -18,11 +18,14 @@ jobs: REF_BRANCH: ${{ github.event.pull_request.head.ref }} BASE_REF_BRANCH: ${{ github.base_ref }} steps: - # ref.: https://github.com/actions/checkout, v2.4.0 - - name: Checkout repository & extract branch names - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - with: - fetch-depth: 0 + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # Branch name is also a version of the release # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - name: Extract branch name & release version diff --git a/bip39gen/scripts/publish.sh b/bip39gen/scripts/publish.sh index ab1b314f..bf011bf1 100644 --- a/bip39gen/scripts/publish.sh +++ b/bip39gen/scripts/publish.sh @@ -6,6 +6,8 @@ set -x . ../bash-utils/bash-utils.sh +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") + go mod tidy GO111MODULE=on go mod verify @@ -62,12 +64,9 @@ function pcgRelease() { rm -rfv ./bin # NOTE: To see available build architectures, run: go tool dist list -pcgRelease "amd64" "$VERSION" "linux" -pcgRelease "amd64" "$VERSION" "darwin" -pcgRelease "amd64" "$VERSION" "windows" -pcgRelease "arm64" "$VERSION" "linux" -pcgRelease "arm64" "$VERSION" "darwin" -pcgRelease "arm64" "$VERSION" "windows" +pcgRelease "$LOCAL_ARCH" "$VERSION" "linux" +pcgRelease "$LOCAL_ARCH" "$VERSION" "darwin" +pcgRelease "$LOCAL_ARCH" "$VERSION" "windows" rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb echoInfo "INFO: Sucessfully published bip39gen deb packages into ./bin" diff --git a/scripts/version.sh b/scripts/version.sh index daf4b496..b07882a7 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.0.7" \ No newline at end of file +echo "v0.1.1-rc.10" \ No newline at end of file diff --git a/tmconnect/scripts/publish.sh b/tmconnect/scripts/publish.sh index 7bb36c47..684bfcd0 100644 --- a/tmconnect/scripts/publish.sh +++ b/tmconnect/scripts/publish.sh @@ -6,6 +6,8 @@ set -x . ../bash-utils/bash-utils.sh +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") + go mod tidy GO111MODULE=on go mod verify @@ -62,12 +64,9 @@ function pcgRelease() { rm -rfv ./bin # NOTE: To see available build architectures, run: go tool dist list -pcgRelease "amd64" "$VERSION" "linux" -pcgRelease "amd64" "$VERSION" "darwin" -pcgRelease "amd64" "$VERSION" "windows" -pcgRelease "arm64" "$VERSION" "linux" -pcgRelease "arm64" "$VERSION" "darwin" -pcgRelease "arm64" "$VERSION" "windows" +pcgRelease "$LOCAL_ARCH" "$VERSION" "linux" +pcgRelease "$LOCAL_ARCH" "$VERSION" "darwin" +pcgRelease "$LOCAL_ARCH" "$VERSION" "windows" rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb echoInfo "INFO: Sucessfully published tmconnect deb packages into ./bin" diff --git a/tmkms-key-import/scripts/publish.sh b/tmkms-key-import/scripts/publish.sh index c46bf95d..effaa1b5 100644 --- a/tmkms-key-import/scripts/publish.sh +++ b/tmkms-key-import/scripts/publish.sh @@ -55,13 +55,11 @@ function pcgRelease() { rm -rfv $WORKDIR $SPECDIR $DISTDIR __pycache__ } -pcgRelease "amd64" "$VERSION" "linux" -pcgRelease "arm64" "$VERSION" "linux" +# NOTE: Pyinstaller ONLY creates releases for the architecrutes it runs on, the binary will fail on the incompatible arch !!! +pcgRelease "$LOCAL_ARCH" "$VERSION" "linux" LOCAL_BIN="tmkms-key-import-${LOCAL_PLATFORM}-${LOCAL_ARCH}" [ -f $LOCAL_BIN ] && ./bin/tmkms-key-import-${LOCAL_PLATFORM}-${LOCAL_ARCH} version -cd $BASEDIR - - # cd ./tmkms-key-import \ No newline at end of file +cd $BASEDIR \ No newline at end of file diff --git a/tmkms-key-import/start.sh b/tmkms-key-import/start.sh index a4769270..ba0ec3f4 100755 --- a/tmkms-key-import/start.sh +++ b/tmkms-key-import/start.sh @@ -7,7 +7,7 @@ SECRET__KMS_KEY_OUT=$3 NODE_KEY_OUT=$4 NODE_ID_OUT=$5 -[ -z "$MNEMONIC" ] && MNEMONIC=$(hd-wallet-derive --gen-words=24 --gen-key --format=jsonpretty -g | jq '.[0].mnemonic') +[ -z "$MNEMONIC" ] && MNEMONIC=$(bip39gen mnemonic --verbose=false --length=24) [ -z "$PRIV_VALIDATOR_KEY_OUT" ] && PRIV_VALIDATOR_KEY_OUT="$PWD/priv_validator_key.json" [ -z "$SECRET__KMS_KEY_OUT" ] && SECRET__KMS_KEY_OUT="$PWD/signing.key" diff --git a/validator-key-gen/scripts/publish.sh b/validator-key-gen/scripts/publish.sh index d1538811..281cefc8 100644 --- a/validator-key-gen/scripts/publish.sh +++ b/validator-key-gen/scripts/publish.sh @@ -6,6 +6,8 @@ set -x . ../bash-utils/bash-utils.sh +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") + go mod tidy GO111MODULE=on go mod verify @@ -62,12 +64,9 @@ function pcgRelease() { rm -rfv ./bin # NOTE: To see available build architectures, run: go tool dist list -pcgRelease "amd64" "$VERSION" "linux" -pcgRelease "amd64" "$VERSION" "darwin" -pcgRelease "amd64" "$VERSION" "windows" -pcgRelease "arm64" "$VERSION" "linux" -pcgRelease "arm64" "$VERSION" "darwin" -pcgRelease "arm64" "$VERSION" "windows" +pcgRelease "$LOCAL_ARCH" "$VERSION" "linux" +pcgRelease "$LOCAL_ARCH" "$VERSION" "darwin" +pcgRelease "$LOCAL_ARCH" "$VERSION" "windows" rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb echoInfo "INFO: Sucessfully published validator-key-gen deb packages into ./bin" From 557a11450cb70db9d3f273649ed88964e11928dd Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 16 Apr 2022 11:47:13 +0000 Subject: [PATCH 051/140] run on self hosted --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 600a2be4..226be942 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ on: jobs: build-amd64: name: AMD64 - Repo Test & Build - runs-on: github-actions-amd64-runner-2 + runs-on: [ self-hosted, github-actions-amd64-runner-2 ] permissions: contents: read packages: write @@ -117,7 +117,7 @@ jobs: path: ./tools-bin-amd64.tar.gz build-arm64: name: ARM64 - Repo Test & Build - runs-on: github-actions-arm64-runner-1 + runs-on: [ self-hosted, github-actions-arm64-runner-1 ] needs: [build-amd64] permissions: contents: read From 4d307815fe10f924a3319d00eea27ad7f20216b9 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 16 Apr 2022 15:15:36 +0000 Subject: [PATCH 052/140] refactor --- .github/workflows/main.yml | 44 +++++++++++--------------------- scripts/test.sh | 7 ++++- tmkms-key-import/Makefile | 8 +++++- tmkms-key-import/scripts/test.sh | 12 +++++++++ 4 files changed, 40 insertions(+), 31 deletions(-) create mode 100644 tmkms-key-import/scripts/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 226be942..244c2afa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,29 +86,6 @@ jobs: touch ./RELEASE.md cp -fv ./RELEASE.md ./bin/RELEASE.md cp -fv ./src.tar.gz ./bin/source-code.tar.gz - chmod -Rv 777 ./bin - echo -e "\n\r### Platform Neutral Releases\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e " Release Versions: $RELEASE_VER | Any OS" >> ./bin/RELEASE.md - echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md - echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " source-code.tar.gz: sha256:$(sha256sum ./bin/source-code.tar.gz | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo -e "\`\`\`" >> ./bin/RELEASE.md - echo -e "\n\r### AMD64 Releases\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e " Release Versions: $RELEASE_VER | AMD64" >> ./bin/RELEASE.md - echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md - echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " validator-key-gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-linux-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf tools-bin-amd64.tar.gz -C ./bin . - name: Uploading artifacts uses: actions/upload-artifact@v3.0.0 @@ -198,24 +175,33 @@ jobs: shell: bash run: | make publish - cd ./bin - tar xvf ./tools-bin-amd64.tar.gz - chmod -Rv 555 ./bin - chmod -v 666 ./bin/RELEASE.md - echo -e "\n\r### AMD64 Releases\n\r\`\`\`" >> ./bin/RELEASE.md + cd ./bin && tar xvf ./tools-bin-amd64.tar.gz && cd .. + chmod -Rv 555 ./bin && chmod -v 666 ./bin/RELEASE.md echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e " Release Versions: $RELEASE_VER | ARM64" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER | AMD64" >> ./bin/RELEASE.md echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md + echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-linux-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-linux-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmconnect-windows-amd64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-windows-arm64.exe: sha256:$(sha256sum ./bin/tmconnect-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " tmkms-key-import-linux-amd64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-amd64 | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmkms-key-import-linux-arm64: sha256:$(sha256sum ./bin/tmkms-key-import-linux-arm64 | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " validator-key-gen-linux-amd64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " validator-key-gen-linux-arm64.deb: sha256:$(sha256sum ./bin/validator-key-gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "validator-key-gen-windows-amd64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo "validator-key-gen-windows-arm64.exe: sha256:$(sha256sum ./bin/validator-key-gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-darwin-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-darwin-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-linux-amd64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " source-code.tar.gz: sha256:$(sha256sum ./bin/source-code.tar.gz | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md tar -czvf tools-bin-arm64.tar.gz -C ./bin . - name: Uploading artifacts diff --git a/scripts/test.sh b/scripts/test.sh index 2dbd0175..e19405b8 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -15,9 +15,14 @@ cd ./bash-utils make test cd $WORKDIR -# Test utils +# Test mnemonic generator cd ./bip39gen make test cd $WORKDIR +# Test tm key importer +cd ./tmkms-key-import +make test +cd $WORKDIR + echoInfo "SUCCESS: Testing finished" \ No newline at end of file diff --git a/tmkms-key-import/Makefile b/tmkms-key-import/Makefile index 605e4452..724fc263 100644 --- a/tmkms-key-import/Makefile +++ b/tmkms-key-import/Makefile @@ -1,2 +1,8 @@ +.PHONY: test publish + publish: - ./scripts/publish.sh \ No newline at end of file + ./scripts/publish.sh + +test: + ./scripts/publish.sh + ./scripts/test.sh \ No newline at end of file diff --git a/tmkms-key-import/scripts/test.sh b/tmkms-key-import/scripts/test.sh new file mode 100644 index 00000000..9b1911c4 --- /dev/null +++ b/tmkms-key-import/scripts/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e +set +x +. /etc/profile +set -x + +. ../bash-utils/bash-utils.sh + +LOCAL_PLATFORM="$(uname)" && LOCAL_PLATFORM="$(echo "$LOCAL_PLATFORM" | tr '[:upper:]' '[:lower:]' )" +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") + +./bin/tmkms-key-import-${LOCAL_PLATFORM}-${LOCAL_ARCH} version From 0bc65e1332563da9cb642b51822eaf620fe7e263 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 16 Apr 2022 18:38:06 +0000 Subject: [PATCH 053/140] do not remove readme file --- .github/workflows/main.yml | 7 +------ RELEASE.md | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 244c2afa..29b3954b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -112,7 +112,6 @@ jobs: # ref.: https://github.com/actions/checkout, v3.0.0 - name: Checkout repository uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - - name: Extract branch name on push if: github.event_name == 'push' shell: bash @@ -144,7 +143,6 @@ jobs: else echo "INFO: Variables setup succeeded" fi - rm ./RELEASE.md - name: Print debug data before build run: | . /etc/profile @@ -163,10 +161,7 @@ jobs: - name: Testing & Building TOOLS run: | echo "(current dir): $PWD" && ls -l ./ - chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts - chmod -Rv 555 ./bash-utils - chmod -Rv 666 ./RELEASE.md + chmod -Rv 555 ./scripts ./bash-utils ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make test make build diff --git a/RELEASE.md b/RELEASE.md index 7b057e3e..17527bb4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,2 @@ Features: -* Improved `safeWget` to utilize cache & speed up downloads -* renamed `utils` to `bash-utils` \ No newline at end of file +* Fixed ARM64 releases with dedicated workers \ No newline at end of file From 8ca6e514ddeab762188a82f638a640c36f1f5b03 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 16 Apr 2022 18:48:46 +0000 Subject: [PATCH 054/140] extract to specific directory --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 29b3954b..f0f347e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -170,7 +170,7 @@ jobs: shell: bash run: | make publish - cd ./bin && tar xvf ./tools-bin-amd64.tar.gz && cd .. + tar xvf ./tools-bin-amd64.tar.gz -C ./bin chmod -Rv 555 ./bin && chmod -v 666 ./bin/RELEASE.md echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md echo -e " Release Versions: $RELEASE_VER | AMD64" >> ./bin/RELEASE.md From 0b796b54e2985a5338a5aaed7a7ad8ffb8365583 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 16 Apr 2022 19:02:10 +0000 Subject: [PATCH 055/140] set correct release version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f0f347e3..d81f277b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -173,7 +173,7 @@ jobs: tar xvf ./tools-bin-amd64.tar.gz -C ./bin chmod -Rv 555 ./bin && chmod -v 666 ./bin/RELEASE.md echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e " Release Versions: $RELEASE_VER | AMD64" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER" >> ./bin/RELEASE.md echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md echo " tmconnect-darwin-amd64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " tmconnect-darwin-arm64.deb: sha256:$(sha256sum ./bin/tmconnect-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md From 73843d96ab7d508dcd1ddd2ce7f20b48a26395ae Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 23 Apr 2022 10:38:09 +0000 Subject: [PATCH 056/140] add multi hash check for safeWget --- RELEASE.md | 3 +- bash-utils/bash-utils.sh | 48 +++++++++++++++++++++++++------- bash-utils/scripts/test.sh | 57 ++++++++++++++++++++++++++++++++++++-- scripts/version.sh | 2 +- 4 files changed, 96 insertions(+), 14 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 17527bb4..cfd28916 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,2 +1,3 @@ Features: -* Fixed ARM64 releases with dedicated workers \ No newline at end of file +* Added `getPlatform` to bash-utils +* Added multi-hash check support to `safeWget` in bash-utils \ No newline at end of file diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 1c7ce2c9..62975261 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.1.2.4" + local BASH_UTILS_VERSION="v0.1.3.5" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -262,6 +262,7 @@ function md5() { # In the case where cosign verification is used the ".sig" URL must exist # safeWget # safeWget +# safeWget ,,... function safeWget() { local OUT_PATH=$1 local FILE_URL=$2 @@ -269,7 +270,7 @@ function safeWget() { local OUT_NAME=$(basename $OUT_PATH) local TMP_DIR=/tmp/downloads - local TMP_PATH="$TMP_DIR/$OUT_NAME" + local TMP_PATH="$TMP_DIR/${OUT_NAME}" local SIG_URL="${FILE_URL}.sig" local TMP_PATH_SIG="$TMP_DIR/${OUT_NAME}.sig" @@ -279,8 +280,10 @@ function safeWget() { local FILE_HASH=$(sha256 $TMP_PATH) + readarray -td, EXPECTED_HASH_ARR <<<"$EXPECTED_HASH"; declare -p EXPECTED_HASH_ARR; + local COSIGN_PUB_KEY="" - if (! $(isSHA256 "$EXPECTED_HASH")) ; then + if (! $(isSHA256 "${EXPECTED_HASH_ARR[0]}")) ; then COSIGN_PUB_KEY="$EXPECTED_HASH" && EXPECTED_HASH="" if ($(isCommand cosign)) && (! $(isFileEmpty $COSIGN_PUB_KEY)) ; then echoWarn "WARNING: Checksum was not provided, checking if a signature file is available..." @@ -290,6 +293,8 @@ function safeWget() { echoErr "ERROR: Cosign tool is not installed or public key was not found in '$COSIGN_PUB_KEY'" return 1 fi + else + echoInfo "INFO: One of the following checksums will be used to verify file integrity: '${EXPECTED_HASH_ARR[*]}'" fi local COSIGN_VERIFIED="false" @@ -306,11 +311,19 @@ function safeWget() { EXPECTED_HASH="" fi fi + + local EXPECTED_HASH_ARR=($(echo "$EXPECTED_HASH" | tr ',' '\n')) + local HASH_MATCH="false" + for hash in "${EXPECTED_HASH_ARR[@]}" ; do + if [ "$FILE_HASH" == "$hash" ] && ($(isSHA256 "$hash")); then + HASH_MATCH="true" + echoInfo "INFO: No need to download, file with the hash '$FILE_HASH' was already found in the '$TMP_DIR' directory" + [ "$TMP_PATH" != "$OUT_PATH" ] && cp -fv $TMP_PATH $OUT_PATH + break + fi + done - if [ "$FILE_HASH" == "$EXPECTED_HASH" ] && ($(isSHA256 "$EXPECTED_HASH")); then - echoInfo "INFO: No need to download, file with the hash '$FILE_HASH' was already found in the '$TMP_DIR' directory" - [ "$TMP_PATH" != "$OUT_PATH" ] && cp -fv $TMP_PATH $OUT_PATH - else + if [ "$HASH_MATCH" == "false" ] ; then rm -fv $OUT_PATH wget "$FILE_URL" -O $TMP_PATH [ "$TMP_PATH" != "$OUT_PATH" ] && cp -fv $TMP_PATH $OUT_PATH @@ -318,7 +331,9 @@ function safeWget() { fi COSIGN_VERIFIED="false" - if (! $(isFileEmpty $COSIGN_PUB_KEY)) && (! $(isFileEmpty $OUT_PATH)) ; then + if [ "$HASH_MATCH" == "false" ] && (! $(isFileEmpty $COSIGN_PUB_KEY)) && (! $(isFileEmpty $OUT_PATH)) ; then + + echoInfo "INFO: Using cosign to verify final file integrity..." COSIGN_VERIFIED="true" cosign verify-blob --key="$COSIGN_PUB_KEY" --signature="$TMP_PATH_SIG" "$OUT_PATH" || COSIGN_VERIFIED="false" @@ -332,13 +347,22 @@ function safeWget() { fi fi + EXPECTED_HASH_ARR=($(echo "$EXPECTED_HASH" | tr ',' '\n')) + HASH_MATCH="false" + for hash in "${EXPECTED_HASH_ARR[@]}" ; do + if [ "$FILE_HASH" == "$hash" ] && ($(isSHA256 "$hash")) ; then + HASH_MATCH="true" + break + fi + done + if ($(isFileEmpty $OUT_PATH)) ; then echoErr "ERROR: Failed download from '$FILE_URL', file is exmpty or was NOT found!" return 1 - elif [ "$FILE_HASH" != "$EXPECTED_HASH" ] || (! $(isSHA256 "$EXPECTED_HASH")) ; then + elif [ "$HASH_MATCH" != "true" ] ; then rm -fv $OUT_PATH || echoErr "ERROR: Failed to delete '$OUT_PATH'" echoErr "ERROR: Safe download filed: '$FILE_URL' -x-> '$OUT_PATH'" - echoErr "ERROR: Expected hash: '$EXPECTED_HASH', but got '$FILE_HASH'" + echoErr "ERROR: Expected hash (one of): '${EXPECTED_HASH_ARR[*]}', but got '$FILE_HASH'" return 1 else echoInfo "INFO: Safe download suceeded: '$FILE_URL' ---> '$(realpath $OUT_PATH)'" @@ -366,6 +390,10 @@ function getArch() { fi } +function getPlatform() { + echo "$(delWhitespaces $(toLower $(uname)))" +} + function tryMkDir { for kg_var in "$@" ; do kg_var=$(echo "$kg_var" | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 43e793eb..19cb5872 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -46,7 +46,8 @@ if [[ $(timerSpan) -lt 3 ]] ; then exit 1 fi -# testing SHA & MD5 +################################################################# +echoWarn "TEST: SHA & MD5" TEST_FILE=/tmp/testfile.tmp echo "Hello World" > $TEST_FILE FILE_SHA256=$(sha256 $TEST_FILE) && EXPECTED_FILE_SHA256="d2a84f4b8b650937ec8f73cd8be2c74add5a911ba64df27458ed8229da804a26" @@ -62,7 +63,8 @@ if (!$(isMD5 $FILE_MD5)) || [ "$FILE_MD5" != "$EXPECTED_FILE_MD5" ] ; then exit 1 fi -# hash of non existent file should be empty string +################################################################# +echoWarn "TEST: hash of non existent file should be empty string" rm -fv $TEST_FILE FILE_SHA256=$(sha256 $TEST_FILE) && EXPECTED_FILE_SHA256="" FILE_MD5=$(md5 $TEST_FILE) && EXPECTED_FILE_MD5="" @@ -77,4 +79,55 @@ if ($(isMD5 "$FILE_MD5")) || [ "$FILE_MD5" != "$EXPECTED_FILE_MD5" ] ; then exit 1 fi +BIN_DEST="/usr/local/bin/validator-key-gen" && \ + safeWget ./validator-key-gen.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/validator-key-gen-linux-${ARCHITECURE}.deb" \ + "$KIRA_COSIGN_PUB" && dpkg-deb -x ./validator-key-gen.deb ./validator-key-gen && \ + cp -fv "$KIRA_BIN/validator-key-gen/bin/validator-key-gen" $BIN_DEST && chmod -v 755 $BIN_DEST + +################################################################# +echoWarn "TEST: safeWget" + +timerStart safeWget_TEST + +safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ + "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" +safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ + "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" + +safeWget_TEST_elaped1=$(timerSpan safeWget_TEST) +timerStart safeWget_TEST + +sleep 1 + +safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ + "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" +safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ + "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" + +safeWget_TEST_elaped2=$(timerSpan safeWget_TEST) + +if [ $safeWget_TEST_elaped1 -le $safeWget_TEST_elaped2 ] ; then + echoErr "ERROR: Expected second safeWget ($safeWget_TEST_elaped2) to take much less time then the first one ($safeWget_TEST_elaped1)" + exit 1 +fi + +chmod 755 /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 +cosign_$(getArch) version + +cat > ./release-cosign.pub << EOL +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhyQCx0E9wQWSFI9ULGwy3BuRklnt +IqozONbbdbqz11hlRJy9c7SG+hdcFl9jE9uE/dwtuwU2MqU9T/cN0YkWww== +-----END PUBLIC KEY----- +EOL + +safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ + ./release-cosign.pub +safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ + ./release-cosign.pub + +cosign_$(getArch) version + +rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 + echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index b07882a7..bc48a55e 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.1-rc.10" \ No newline at end of file +echo "v0.1.2-rc.11" \ No newline at end of file From 694f536c35721e9b1be591166bce54017123767d Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 23 Apr 2022 10:53:59 +0000 Subject: [PATCH 057/140] wipe tmp downloads --- bash-utils/scripts/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 19cb5872..6f39bc38 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -86,6 +86,8 @@ BIN_DEST="/usr/local/bin/validator-key-gen" && \ ################################################################# echoWarn "TEST: safeWget" +rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 +rm -rfv /tmp/downloads timerStart safeWget_TEST @@ -128,6 +130,4 @@ safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/release cosign_$(getArch) version -rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 - echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" From 50eaf76164abc0e9f0ba5385d57ea5faa106d3a4 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 23 Apr 2022 11:08:23 +0000 Subject: [PATCH 058/140] refactor --- bash-utils/scripts/test.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 6f39bc38..84834d1c 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -79,11 +79,6 @@ if ($(isMD5 "$FILE_MD5")) || [ "$FILE_MD5" != "$EXPECTED_FILE_MD5" ] ; then exit 1 fi -BIN_DEST="/usr/local/bin/validator-key-gen" && \ - safeWget ./validator-key-gen.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/validator-key-gen-linux-${ARCHITECURE}.deb" \ - "$KIRA_COSIGN_PUB" && dpkg-deb -x ./validator-key-gen.deb ./validator-key-gen && \ - cp -fv "$KIRA_BIN/validator-key-gen/bin/validator-key-gen" $BIN_DEST && chmod -v 755 $BIN_DEST - ################################################################# echoWarn "TEST: safeWget" rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 @@ -91,9 +86,9 @@ rm -rfv /tmp/downloads timerStart safeWget_TEST -safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ +safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-arm64" \ "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" -safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ +safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-amd64" \ "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" safeWget_TEST_elaped1=$(timerSpan safeWget_TEST) @@ -101,9 +96,9 @@ timerStart safeWget_TEST sleep 1 -safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ +safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-arm64" \ "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" -safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ +safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-amd64" \ "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" safeWget_TEST_elaped2=$(timerSpan safeWget_TEST) @@ -128,6 +123,7 @@ safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/release safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ ./release-cosign.pub +chmod 755 /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 cosign_$(getArch) version echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" From 086da2c6bd0629bfa2e3365a12ee2dec8faf9fb7 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 23 Apr 2022 11:10:24 +0000 Subject: [PATCH 059/140] do NOT time potentially parallel tasks --- bash-utils/scripts/test.sh | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 84834d1c..ad5253e9 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -84,30 +84,11 @@ echoWarn "TEST: safeWget" rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 rm -rfv /tmp/downloads -timerStart safeWget_TEST - safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-arm64" \ "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-amd64" \ "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" -safeWget_TEST_elaped1=$(timerSpan safeWget_TEST) -timerStart safeWget_TEST - -sleep 1 - -safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-arm64" \ - "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" -safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-amd64" \ - "2448231e6bde13722aad7a17ac00789d187615a24c7f82739273ea589a42c94b,80f80f3ef5b9ded92aa39a9dd8e028f5b942a3b6964f24c47b35e7f6e4d18907" - -safeWget_TEST_elaped2=$(timerSpan safeWget_TEST) - -if [ $safeWget_TEST_elaped1 -le $safeWget_TEST_elaped2 ] ; then - echoErr "ERROR: Expected second safeWget ($safeWget_TEST_elaped2) to take much less time then the first one ($safeWget_TEST_elaped1)" - exit 1 -fi - chmod 755 /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 cosign_$(getArch) version @@ -118,6 +99,8 @@ IqozONbbdbqz11hlRJy9c7SG+hdcFl9jE9uE/dwtuwU2MqU9T/cN0YkWww== -----END PUBLIC KEY----- EOL +rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 + safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ ./release-cosign.pub safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ From 5aedd6efda7d5208deec3f47cd7d134ba6c1a9f4 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 23 Apr 2022 14:02:56 +0000 Subject: [PATCH 060/140] safeWget re-download on url change --- RELEASE.md | 3 +-- bash-utils/bash-utils.sh | 5 +++-- bash-utils/scripts/test.sh | 4 ++-- scripts/version.sh | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index cfd28916..14250baa 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,2 @@ Features: -* Added `getPlatform` to bash-utils -* Added multi-hash check support to `safeWget` in bash-utils \ No newline at end of file +* safeWget will now store files in /tmp/downloads with names as MD5 of the URL link to ensure that files get re-downloaded if URL changes \ No newline at end of file diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 62975261..24c67ce8 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.1.3.5" + local BASH_UTILS_VERSION="v0.1.4.6" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -268,7 +268,8 @@ function safeWget() { local FILE_URL=$2 local EXPECTED_HASH=$3 - local OUT_NAME=$(basename $OUT_PATH) + # we need to use MD5 for TMP files to ensure that we download the file again if URL changes + local OUT_NAME=$(echo "$OUT_PATH" | md5) local TMP_DIR=/tmp/downloads local TMP_PATH="$TMP_DIR/${OUT_NAME}" diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index ad5253e9..ff018584 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -101,9 +101,9 @@ EOL rm -fv /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 -safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-arm64" \ +safeWget /usr/local/bin/cosign_arm64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-arm64" \ ./release-cosign.pub -safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(toLower $(uname))-amd64" \ +safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/releases/download/v1.7.2/cosign-$(getPlatform)-amd64" \ ./release-cosign.pub chmod 755 /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 diff --git a/scripts/version.sh b/scripts/version.sh index bc48a55e..7976d929 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.2-rc.11" \ No newline at end of file +echo "v0.1.3-rc.12" \ No newline at end of file From e0ca992e8c631f10089ed9e83ab10e59e48cfff7 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 27 Apr 2022 10:22:05 +0000 Subject: [PATCH 061/140] Added setVar --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 30 ++++++++++++++++++++++++++++++ bash-utils/scripts/test.sh | 19 +++++++++++++++++++ scripts/version.sh | 2 +- 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 14250baa..8db41736 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,2 +1,2 @@ Features: -* safeWget will now store files in /tmp/downloads with names as MD5 of the URL link to ensure that files get re-downloaded if URL changes \ No newline at end of file +* Added setVar function to bash-utils \ No newline at end of file diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 24c67ce8..3d045ea0 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -924,6 +924,36 @@ function setLastLineByPrefixOrAppend() { fi } +# setVar +function setVar() { + local VAR_NAME=$(delWhitespaces "$1") + local VAR_VALUE=$2 + local VAR_FILE=$3 + + ([ -z "$VAR_FILE" ] || [ ! -f $VAR_FILE ]) && echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" + + if [ ! -z "$VAR_NAME" ] && [ -f $VAR_FILE ] ; then + local LINE_NR=$(getLastLineByPrefix "${VAR_NAME}=" "$VAR_FILE" 2> /dev/null || echo "-1") + + # add quotes if string has any whitespaces + echoInfo "INFO: Appending var '$VAR_NAME' with value '$VAR_VALUE' to file '$VAR_FILE'" + if [ -z "$VAR_VALUE" ] || [[ "$VAR_VALUE" = *" "* ]] ; then + echo "${VAR_NAME}=\"${VAR_VALUE}\"" >> $VAR_FILE + else + echo "${VAR_NAME}=${VAR_VALUE}" >> $VAR_FILE + fi + + if [[ $LINE_NR -ge 0 ]] ; then + echoWarn "WARNING: Wiped old var '$VAR_NAME' at line '$LINE_NR' in the file '$VAR_FILE'" + sed -i"" "${LINE_NR}d" $VAR_FILE + fi + return 0 + else + echoErr "ERROR: Failed to set environment variable '$VAR_NAME' in '$VAR_FILE'" + return 1 + fi +} + function setEnv() { local ENV_NAME=$(delWhitespaces "$1") local ENV_VALUE=$2 diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index ff018584..20c91895 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -109,4 +109,23 @@ safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/release chmod 755 /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 cosign_$(getArch) version +################################################################# +echoWarn "TEST: setVar" +TEST_FILE=/tmp/setVar.test +rm -rfv $TEST_FILE && touch $TEST_FILE + +BASH_UTIL_TEST_1="" +BASH_UTIL_TEST_2="" + +setVar BASH_UTIL_TEST_1 ":) Oo" $TEST_FILE +setVar BASH_UTIL_TEST_2 "test" $TEST_FILE +setVar BASH_UTIL_TEST_1 ":) Oo !" $TEST_FILE + +source $TEST_FILE + +[ "$BASH_UTIL_TEST_1" != ":) Oo !" ] && echoErr "ERROR: Expected 'BASH_UTIL_TEST_1' to be ':) Oo !', but got '$BASH_UTIL_TEST_1'" && exit 1 +[ "$BASH_UTIL_TEST_2" != "test" ] && echoErr "ERROR: Expected 'BASH_UTIL_TEST_2' to be ':) Oo !', but got '$BASH_UTIL_TEST_2'" && exit 1 + +################################################################# + echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index 7976d929..3bbbe513 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.3-rc.12" \ No newline at end of file +echo "v0.1.4" \ No newline at end of file From af4cc3ae77c63c46853247dbde9e30b9bf24295c Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 2 May 2022 11:11:41 +0000 Subject: [PATCH 062/140] update all versions and safeWget hash check --- bash-utils/bash-utils.sh | 8 +++----- bash-utils/scripts/test.sh | 7 +++++++ bip39gen/main.go | 2 +- scripts/version.sh | 2 +- tmconnect/main.go | 2 +- tmkms-key-import/tmkms-key-import.py | 2 +- validator-key-gen/main.go | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 3d045ea0..fc4fbee1 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.1.4.6" + local BASH_UTILS_VERSION="v0.1.5" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -280,9 +280,7 @@ function safeWget() { rm -fv "$TMP_PATH_SIG" local FILE_HASH=$(sha256 $TMP_PATH) - - readarray -td, EXPECTED_HASH_ARR <<<"$EXPECTED_HASH"; declare -p EXPECTED_HASH_ARR; - + local EXPECTED_HASH_ARR=($(echo "$EXPECTED_HASH" | tr ',' '\n')) local COSIGN_PUB_KEY="" if (! $(isSHA256 "${EXPECTED_HASH_ARR[0]}")) ; then COSIGN_PUB_KEY="$EXPECTED_HASH" && EXPECTED_HASH="" @@ -313,7 +311,7 @@ function safeWget() { fi fi - local EXPECTED_HASH_ARR=($(echo "$EXPECTED_HASH" | tr ',' '\n')) + EXPECTED_HASH_ARR=($(echo "$EXPECTED_HASH" | tr ',' '\n')) local HASH_MATCH="false" for hash in "${EXPECTED_HASH_ARR[@]}" ; do if [ "$FILE_HASH" == "$hash" ] && ($(isSHA256 "$hash")); then diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 20c91895..183d90e9 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -109,6 +109,13 @@ safeWget /usr/local/bin/cosign_amd64 "https://github.com/sigstore/cosign/release chmod 755 /usr/local/bin/cosign_amd64 /usr/local/bin/cosign_arm64 cosign_$(getArch) version +SYSCTRL_DESTINATION=/usr/bin/systemctl2 +safeWget $SYSCTRL_DESTINATION \ + https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/files/docker/systemctl.py \ + "e02e90c6de6cd68062dadcc6a20078c34b19582be0baf93ffa7d41f5ef0a1fdd" + +systemctl2 version + ################################################################# echoWarn "TEST: setVar" TEST_FILE=/tmp/setVar.test diff --git a/bip39gen/main.go b/bip39gen/main.go index 27706137..36009b0e 100644 --- a/bip39gen/main.go +++ b/bip39gen/main.go @@ -29,7 +29,7 @@ type response struct { const codeSuccess int = 0 const codeFail int = 1 -const Bip39GenVersion = "v0.0.1.1" +const Bip39GenVersion = "v0.1.5" func makeTimestamp() int64 { return time.Now().UnixNano() / int64(time.Millisecond) diff --git a/scripts/version.sh b/scripts/version.sh index 3bbbe513..b1f1a935 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.4" \ No newline at end of file +echo "v0.1.5" \ No newline at end of file diff --git a/tmconnect/main.go b/tmconnect/main.go index 4efafa97..4f39ce64 100644 --- a/tmconnect/main.go +++ b/tmconnect/main.go @@ -37,7 +37,7 @@ const codeSuccess int = 0 const codeFail int = 1 const BlockchainChannel = byte(0x40) const PexChannel = byte(0x00) -const TmConnectVersion = "v0.0.1.0" +const TmConnectVersion = "v0.1.5" func makeTimestamp() int64 { return time.Now().UnixNano() / int64(time.Millisecond) diff --git a/tmkms-key-import/tmkms-key-import.py b/tmkms-key-import/tmkms-key-import.py index 42b2a4e3..50c28234 100644 --- a/tmkms-key-import/tmkms-key-import.py +++ b/tmkms-key-import/tmkms-key-import.py @@ -12,7 +12,7 @@ import base64 import json -TMKMS_KEY_IMPORT_VERSION="v0.0.1.0" +TMKMS_KEY_IMPORT_VERSION="v0.1.5" TRACE=False def trace(x): diff --git a/validator-key-gen/main.go b/validator-key-gen/main.go index 28366d88..981c1c6a 100644 --- a/validator-key-gen/main.go +++ b/validator-key-gen/main.go @@ -12,7 +12,7 @@ import ( "github.com/tendermint/tendermint/privval" ) -const PrivValidatorKeyGenVersion = "v0.0.1.0" +const PrivValidatorKeyGenVersion = "v0.1.5" func main() { mnemonic := flag.String("mnemonic", "", "a string") From 76b31f790ba8378b8a8d275e3d736dab46808c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Thu, 9 Jun 2022 14:14:08 +0200 Subject: [PATCH 063/140] added ipfs-api tool --- ipfs-api/Makefile | 3 + ipfs-api/README.md | 112 ++++++++++ ipfs-api/cmd/ipfs-api/main.go | 10 + ipfs-api/go.mod | 28 +++ ipfs-api/go.sum | 61 +++++ ipfs-api/pkg/cli/cli.go | 82 +++++++ ipfs-api/pkg/cli/download.go | 20 ++ ipfs-api/pkg/cli/getcid.go | 76 +++++++ ipfs-api/pkg/cli/pin.go | 23 ++ ipfs-api/pkg/cli/pinned.go | 19 ++ ipfs-api/pkg/cli/test.go | 21 ++ ipfs-api/pkg/cli/unpin.go | 22 ++ ipfs-api/pkg/cli/version.go | 21 ++ ipfs-api/pkg/ipfslog/ipfslog.go | 32 +++ ipfs-api/pkg/pinatav1/pinatav1.go | 360 ++++++++++++++++++++++++++++++ ipfs-api/types/constants.go | 14 ++ ipfs-api/types/general.go | 7 + ipfs-api/types/msg.go | 18 ++ 18 files changed, 929 insertions(+) create mode 100644 ipfs-api/Makefile create mode 100644 ipfs-api/README.md create mode 100644 ipfs-api/cmd/ipfs-api/main.go create mode 100644 ipfs-api/go.mod create mode 100644 ipfs-api/go.sum create mode 100644 ipfs-api/pkg/cli/cli.go create mode 100644 ipfs-api/pkg/cli/download.go create mode 100644 ipfs-api/pkg/cli/getcid.go create mode 100644 ipfs-api/pkg/cli/pin.go create mode 100644 ipfs-api/pkg/cli/pinned.go create mode 100644 ipfs-api/pkg/cli/test.go create mode 100644 ipfs-api/pkg/cli/unpin.go create mode 100644 ipfs-api/pkg/cli/version.go create mode 100644 ipfs-api/pkg/ipfslog/ipfslog.go create mode 100644 ipfs-api/pkg/pinatav1/pinatav1.go create mode 100644 ipfs-api/types/constants.go create mode 100644 ipfs-api/types/general.go create mode 100644 ipfs-api/types/msg.go diff --git a/ipfs-api/Makefile b/ipfs-api/Makefile new file mode 100644 index 00000000..391cfb25 --- /dev/null +++ b/ipfs-api/Makefile @@ -0,0 +1,3 @@ +build: + @echo "\e[0;31mINFO\e[m: Building an application \e[0;32mIPFS-API\e[m" + @go build -o bin/ipfs-api cmd/ipfs-api/main.go diff --git a/ipfs-api/README.md b/ipfs-api/README.md new file mode 100644 index 00000000..241f5cdd --- /dev/null +++ b/ipfs-api/README.md @@ -0,0 +1,112 @@ +![IPFS]https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/ipfs/ipfs.png) +# IPFS-API + +The app to manipulate data whithin IPFS using pinata.cloud as node service provider. + +## Getting Started + +Get the repo from github. + +` +git clone https://github.com/KiraCore/tools.git +` + +### Prerequisites + +To build the app you need the golang to be preinstalled. + +``` +https://go.dev/doc/install +``` + +Check for updates and install building essentials +` +sudo apt update +sudo apt install build-essential +sudo apt upgrsde -y + +` + +### Installing + +Check the latest branch. It should start from v ... + +` +git branch -r | grep v0 +` + +Switch for the latest branch. + +` +git checkout origin/v0... +` + +after this step just enter the ipfs-api directory and execute: +` +make build +` +the executable will appear in the tools/ipfs-api/bin directory + +Make sure it has an executable permission: +` +chmod +x tools/ipfs-api/bin/ipfs-api +` + + +``` +Give the example +``` + +## Built With + +* [Pinata.Cloud](https://docs.pinata.cloud/pinata-api) - The API v1. is used + + +## Versioning + +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/KiraCore/tools + +## Authors + +* **Yevhen Yakubovskiyi** - *Initial work* - [MrLutik](https://github.com/mrlutik) + + + + + + + + + + + + + + + + + + + + + + + + +/tags). + +## Authors + +* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth) + +See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments + +* Hat tip to anyone whose code was used +* Inspiration +* etc. diff --git a/ipfs-api/cmd/ipfs-api/main.go b/ipfs-api/cmd/ipfs-api/main.go new file mode 100644 index 00000000..0275b028 --- /dev/null +++ b/ipfs-api/cmd/ipfs-api/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "github.com/kiracore/tools/ipfs-api/pkg/cli" +) + +func main() { + cli.Start() + +} diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod new file mode 100644 index 00000000..a624b0ce --- /dev/null +++ b/ipfs-api/go.mod @@ -0,0 +1,28 @@ +module github.com/kiracore/tools/ipfs-api + +go 1.18 + +require ( + github.com/ipfs/go-cid v0.2.0 + github.com/multiformats/go-multihash v0.0.15 + github.com/sirupsen/logrus v1.8.1 + github.com/spf13/cobra v1.4.0 + golang.org/x/net v0.0.0-20211029224645-99673261e6eb +) + +require ( + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/klauspost/cpuid/v2 v2.0.4 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect + github.com/minio/sha256-simd v1.0.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.0.3 // indirect + github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-multibase v0.0.3 // indirect + github.com/multiformats/go-varint v0.0.6 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/testify v1.4.0 // indirect + golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf // indirect + golang.org/x/sys v0.0.0-20210423082822-04245dca01da // indirect + golang.org/x/text v0.3.6 // indirect +) diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum new file mode 100644 index 00000000..b6a467f1 --- /dev/null +++ b/ipfs-api/go.sum @@ -0,0 +1,61 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= +github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= +github.com/klauspost/cpuid/v2 v2.0.4 h1:g0I61F2K2DjRHz1cnxlkNSBIaePVoJIjjnHui8QHbiw= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= +github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= +github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= +github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= +github.com/multiformats/go-multihash v0.0.15 h1:hWOPdrNqDjwHDx82vsYGSDZNyktOJJ2dzZJzFkOV1jM= +github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= +github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM= +golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go new file mode 100644 index 00000000..62a161d2 --- /dev/null +++ b/ipfs-api/pkg/cli/cli.go @@ -0,0 +1,82 @@ +package cli + +import ( + "bufio" + "os" + "strings" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" + "github.com/spf13/cobra" +) + +var ( + keyPath string + gateway string +) + +var rootCmd = &cobra.Command{ + Use: "ipfs-api [sub]", + Short: "IPFS API", +} + +func grabKey(keyPath string) (tp.Keys, error) { + // checking if path to keys is valid + if _, err := os.Stat(keyPath); os.IsNotExist(err) { + log.Error("pin: provided path doesn't exist") + return tp.Keys{}, err + } + + file, err := os.Open(keyPath) + if err != nil { + log.Error("grabkey: unable to get key") + return tp.Keys{}, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + var res []string + + for scanner.Scan() { + newString := strings.Split(scanner.Text(), ":") + if len(newString) != 1 { + res = append(res, strings.TrimSpace(newString[1])) + } else { + log.Error("grabkey: failed to parse keys from file. invalid format\nexpected:\nAPI Key: value\nAPI Secret: value\nJWT: value") + return tp.Keys{}, err + } + + } + + key := tp.Keys{Api_key: res[0], Api_secret: res[1], JWT: res[2]} + if scanner.Err() != nil { + log.Error("err") + return tp.Keys{}, err + } + + return key, nil +} + +func Start() { + //Turn off completion + rootCmd.CompletionOptions.DisableDescriptions = true + rootCmd.CompletionOptions.DisableDefaultCmd = true + + ///Adding flags + pinCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + pinnedCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + unpinCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + downloadCommand.PersistentFlags().StringVarP(&gateway, "gateway", "g", "https://gateway.pinata.cloud", "IPFS gateway") + downloadCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + testCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to yoour key") + + rootCmd.AddCommand(cidZeroCommand) + rootCmd.AddCommand(cidOneCommand) + rootCmd.AddCommand(pinnedCommand) + rootCmd.AddCommand(pinCommand) + rootCmd.AddCommand(versionCommand) + rootCmd.AddCommand(unpinCommand) + rootCmd.AddCommand(downloadCommand) + rootCmd.AddCommand(testCommand) + cobra.CheckErr(rootCmd.Execute()) +} diff --git a/ipfs-api/pkg/cli/download.go b/ipfs-api/pkg/cli/download.go new file mode 100644 index 00000000..cecb9732 --- /dev/null +++ b/ipfs-api/pkg/cli/download.go @@ -0,0 +1,20 @@ +package cli + +import ( + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + "github.com/spf13/cobra" +) + +var downloadCommand = &cobra.Command{ + Use: "download --gateway=", + Short: "File/Folder download", + Long: "File/Folder download", + RunE: cmdDownload, +} + +func cmdDownload(cmd *cobra.Command, args []string) error { + keys, _ := grabKey(keyPath) + pnt.Download(args, keys, gateway) + + return nil +} diff --git a/ipfs-api/pkg/cli/getcid.go b/ipfs-api/pkg/cli/getcid.go new file mode 100644 index 00000000..c384704d --- /dev/null +++ b/ipfs-api/pkg/cli/getcid.go @@ -0,0 +1,76 @@ +package cli + +// TODO: Try to wrap data in node.UnixFS and after that to put this node into merkle DAG + +import ( + "bufio" + "encoding/hex" + "fmt" + "os" + + cid "github.com/ipfs/go-cid" + mh "github.com/multiformats/go-multihash" + "github.com/spf13/cobra" +) + +var cidZeroCommand = &cobra.Command{ + Use: "CID-v0 ", + Short: "CID v0 hash calculator", + Long: "Get CID-v0 of the file", + RunE: cmdGetCIDv0, +} + +var cidOneCommand = &cobra.Command{ + Use: "CID-v1 ", + Short: "CID v1 hash calculator", + Long: "Get CID-v1 of the file", + RunE: cmdGetCIDv1, +} + +func cmdGetCIDv0(cmd *cobra.Command, args []string) error { + prefix := cid.Prefix{ + Version: 0, + Codec: cid.DagProtobuf, + MhType: mh.SHA2_256, + MhLength: -1, + } + + file, _ := os.Open(args[0]) + + defer file.Close() + + bytes := make([]byte, 32) + for { + _, err := file.Read(bytes) + if err != nil { + break + } + } + + cid, _ := prefix.Sum(bytes) + fmt.Println(cid) + return nil + +} +func cmdGetCIDv1(cmd *cobra.Command, args []string) error { + builder := cid.V1Builder{ + Codec: cid.Raw, + MhType: mh.SHA2_256, + MhLength: 32, + } + + file, _ := os.Open(args[0]) + + defer file.Close() + + rd := bufio.NewReader(file) + data, _ := rd.ReadBytes(32) + fmt.Println(len(data)) + fmt.Println(hex.EncodeToString(data)) + + cid, _ := builder.Sum(data) + fmt.Println(cid) + + return nil + +} diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go new file mode 100644 index 00000000..db644503 --- /dev/null +++ b/ipfs-api/pkg/cli/pin.go @@ -0,0 +1,23 @@ +package cli + +import ( + "log" + + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + "github.com/spf13/cobra" +) + +var pinCommand = &cobra.Command{ + Use: "pin --key=", + Short: "File/folder upload and pin", + Long: "File/folder upload and pin", + RunE: pinCmd, +} + +func pinCmd(cmd *cobra.Command, args []string) error { + keys, _ := grabKey(keyPath) + if err := pnt.Pin(args, keys); err != nil { + log.Fatalln("\033[31m", err) + } + return nil +} diff --git a/ipfs-api/pkg/cli/pinned.go b/ipfs-api/pkg/cli/pinned.go new file mode 100644 index 00000000..311adee8 --- /dev/null +++ b/ipfs-api/pkg/cli/pinned.go @@ -0,0 +1,19 @@ +package cli + +import ( + "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + "github.com/spf13/cobra" +) + +var pinnedCommand = &cobra.Command{ + Use: "pinned ", + Short: "File/Folder check allowing to test if the file/folder is already pinned on IPFS or not", + Long: "File/Folder check allowing to test if the file/folder is already pinned on IPFS or not", + RunE: pinned, +} + +func pinned(cmd *cobra.Command, args []string) error { + keys, _ := grabKey(keyPath) + pinatav1.Pinned(args, keys) + return nil +} diff --git a/ipfs-api/pkg/cli/test.go b/ipfs-api/pkg/cli/test.go new file mode 100644 index 00000000..5c3a1ebe --- /dev/null +++ b/ipfs-api/pkg/cli/test.go @@ -0,0 +1,21 @@ +package cli + +import ( + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + "github.com/spf13/cobra" +) + +var testCommand = &cobra.Command{ + Use: "test", + Short: "Testing connection to pinata.cloud", + Long: "Testing connection and given key", + RunE: test, +} + +func test(cmd *cobra.Command, args []string) error { + keys, _ := grabKey(keyPath) + if err := pnt.Test(keys); err != nil { + return err + } + return nil +} diff --git a/ipfs-api/pkg/cli/unpin.go b/ipfs-api/pkg/cli/unpin.go new file mode 100644 index 00000000..fa060f17 --- /dev/null +++ b/ipfs-api/pkg/cli/unpin.go @@ -0,0 +1,22 @@ +package cli + +import ( + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + "github.com/spf13/cobra" +) + +var unpinCommand = &cobra.Command{ + Use: "delete --key=", + Short: "File/folder unpin & delete", + Long: "File/folder unpin & delete", + RunE: unpin, +} + +func unpin(cmd *cobra.Command, args []string) error { + keys, _ := grabKey(keyPath) + if err := pnt.Unpin(args, keys); err != nil { + return err + } + return nil + +} diff --git a/ipfs-api/pkg/cli/version.go b/ipfs-api/pkg/cli/version.go new file mode 100644 index 00000000..b72812e5 --- /dev/null +++ b/ipfs-api/pkg/cli/version.go @@ -0,0 +1,21 @@ +package cli + +import ( + "fmt" + + tp "github.com/kiracore/tools/ipfs-api/types" + "github.com/spf13/cobra" +) + +var versionCommand = &cobra.Command{ + Use: "version", + Short: "Get IPFS API version", + Long: "Get IPFS API version", + RunE: cmdVersion, +} + +func cmdVersion(cmd *cobra.Command, args []string) error { + fmt.Println(tp.IpfsApiVersion) + + return nil +} diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go new file mode 100644 index 00000000..70ad9f5b --- /dev/null +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -0,0 +1,32 @@ +// Package provides minimal needed number of functions and settings +// for logging the app +package ipfslog + +import ( + "github.com/sirupsen/logrus" +) + +var log *logrus.Logger + +func init() { + log = logrus.New() + log.SetLevel(5) +} + +// TODO: add colored output for critical information + +func Info(format string, v ...interface{}) { + log.Infof(format, v...) +} + +func Warn(format string, v ...interface{}) { + log.Warnf(format, v...) +} + +func Debug(format string, v ...interface{}) { + log.Debugf(format, v...) +} + +func Error(format string, v ...interface{}) { + log.Errorf(format, v...) +} diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go new file mode 100644 index 00000000..f58be2d7 --- /dev/null +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -0,0 +1,360 @@ +package pinatav1 + +import ( + "crypto/tls" + "encoding/json" + "fmt" + "io" + "io/fs" + "mime/multipart" + "net/http" + "net/textproto" + "os" + "path/filepath" + "strings" + "time" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" + "golang.org/x/net/http2" +) + +func NewClient() *http.Client { + // Client params to be adjusted ... + + tr := &http.Transport{ + MaxIdleConnsPerHost: 100, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + ExpectContinueTimeout: 5 * time.Second, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + } + http2.ConfigureTransport(tr) + return &http.Client{ + Timeout: 100 * time.Second, + Transport: tr, + } + +} + +func Test(keys tp.Keys) error { + c := NewClient() + + req, err := http.NewRequest("GET", tp.BASE_URL+tp.TESTAUTH, nil) + if err != nil { + log.Error("test: something went wrong with request", err) + return err + } + + req.Header.Add("pinata_api_key", keys.Api_key) + req.Header.Add("pinata_secret_api_key", keys.Api_secret) + + resp, err := c.Do(req) + if err != nil { + log.Error("test: didn't get any response", err) + return err + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("test: can't read the request body", err) + return err + } + + // Parsing response + r := tp.TestResponse{} + e := json.Unmarshal(bytes, &r) + if e != nil { + log.Error("Test: failed to unmarshal json", e) + return e + } + log.Info(r.Message) + + } + return nil +} + +// var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"") + +// func escapeQuotes(s string) string { +// return quoteEscaper.Replace(s) +// } +func addForm(bw *multipart.Writer, filePath string) error { + // wrap in struct + data := strings.Split(filePath, ":") + fileName := data[0] + path := data[1] + + f, err := os.Open(path) + if err != nil { + log.Error("addform: can't open the file") + defer f.Close() + return err + + } + fi, err := f.Stat() + if err != nil { + log.Error("addform: can't read stats from the given path") + return err + } + defer f.Close() + + //MIME Header setup + // if not a standalone directory - add MIME.header + if !fi.IsDir() { + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", + fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileName)) + h.Set("Content-Type", "application/octet-stream") + + content, _ := bw.CreatePart(h) + io.Copy(content, f) + + } + return nil +} + +func createReqBody(filePaths []string) (string, io.Reader, error) { + // creating a pipe + pipeReader, pipeWriter := io.Pipe() + // creating writer for multipart request + bodyWriter := multipart.NewWriter(pipeWriter) + + // calling for a goroutine to add all forms found by walker + go func() { + for _, filePath := range filePaths { + if err := addForm(bodyWriter, filePath); err != nil { + log.Error("createbody: failed to add form to multipart request") + return + } + log.Info("pinned: %v", filePath) + } + + bodyWriter.Close() + pipeWriter.Close() + + }() + return bodyWriter.FormDataContentType(), pipeReader, nil + +} + +func walker(rootDir string) []string { + // add error handling + var res []string + wout := make(chan string) + + // calling for a gouroutine wich will yeild res throug chan + go func() { + defer close(wout) // Chan is empty can be closed + base := filepath.Base(rootDir) + "/" + err := filepath.Walk(rootDir, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + + rel, err := filepath.Rel(rootDir, path) + if err != nil { + log.Error("walker: can't get relative path for %v. err: %v", path, err) + } + fn := filepath.Clean(base + rel) + wout <- fn + ":" + path + return nil + }) + if err != nil { + return + } + }() + + for { + if msg, state := <-wout; state { + res = append(res, msg) + } else { + break + } + + } + return res + +} + +func Pin(args []string, keys tp.Keys) error { + path := args[0] + // checking if the path is valid and file/folder exist + if _, err := os.Stat(path); os.IsNotExist(err) { + log.Error("pin: provided path doesn't exist") + return err + } + // assembling the tree + filePaths := walker(path) + + // creating requestbody + contType, reader, err := createReqBody(filePaths) + if err != nil { + log.Error("pin: failed to create body") + return err + } + log.Info("createReqBody ok\n") + + // forming request + req, err := http.NewRequest("POST", tp.BASE_URL+tp.PINFILE, reader) + if err != nil { + log.Error("pin: failed to assemble request") + return err + } + + //adding headers + req.Header.Add("Content-Type", contType) + req.Header.Add("pinata_api_key", keys.Api_key) + req.Header.Add("pinata_secret_api_key", keys.Api_secret) + + client := NewClient() + + // Printing request with all data for debugging + /* + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(requestDump)) + */ + + // sending request + resp, err := client.Do(req) + if err != nil { + log.Error("pin: request send error:", err) + return err + } + + defer resp.Body.Close() + + // checking response code + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("pin: can't read the request body %v", err) + } + + // Parsing response + r := tp.PinResponse{} + e := json.Unmarshal(bytes, &r) + if e != nil { + log.Error("pin: failed to unmarshal json from response %v", e) + } + log.Info("Finished successfully...\nCID: %v\nsize: %v\ntime: %v\nduplicate: %v", r.IpfsHash, r.PinSize, r.Timestamp, r.Duplicate) + + } else { + // if something unexpected received in the response body + log.Info("status: %v\n", resp.StatusCode) + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("pin: can't read the request body %v", err) + } + log.Error("pin: request body: %v", string(bytes)) + } + + return nil +} + +func Unpin(args []string, keys tp.Keys) error { + c := NewClient() + + req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) + if err != nil { + log.Error("unpin: failed to assemble request ") + return err + } + req.Header.Add("pinata_api_key", keys.Api_key) + req.Header.Add("pinata_secret_api_key", keys.Api_secret) + + resp, err := c.Do(req) + + if err != nil { + log.Error("unpin: didn't get any response", err) + return err + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("unpin: can't read the request body", err) + return err + } + log.Info("deleted. CID: %v. Server response: %v", args[0], string(bytes)) + + } else { + log.Error("unpin: file/Folder could NOT be unpinned or deleted from IPFS") + return err + } + return nil +} + +func Pinned(args []string, keys tp.Keys) { + c := NewClient() + + req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) + if err != nil { + return + } + req.Header.Add("pinata_api_key", keys.Api_key) + req.Header.Add("pinata_secret_api_key", keys.Api_secret) + + param := req.URL.Query() + param.Add("hashContains", args[0]) + req.URL.RawQuery = param.Encode() + + resp, err := c.Do(req) + + if err != nil { + log.Error("didn't get any response", err) + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("can't read the request body", err) + } + log.Info("file exists: %v. %v", args[0], string(bytes)) + + } else { + log.Error("file with CID %v doesn't exist", args[0]) + } + +} + +func Download(args []string, keys tp.Keys, gateway string) { + c := NewClient() + + req, err := http.NewRequest(http.MethodGet, gateway+"/ipfs/"+args[0], nil) + if err != nil { + return + } + req.Header.Add("pinata_api_key", keys.Api_key) + req.Header.Add("pinata_secret_api_key", keys.Api_secret) + + f, err := os.Create(args[0]) + if err != nil { + log.Error("download: failed to create file/folder") + return + } + + resp, err := c.Do(req) + if err != nil { + log.Error("download: failed to get the response") + return + } + + if _, err = io.Copy(f, resp.Body); err != nil { + log.Error("Failed to io.Copy") + + } + defer resp.Body.Close() + r, _ := io.ReadAll(resp.Body) + fmt.Println(string(r)) + +} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go new file mode 100644 index 00000000..eb650be6 --- /dev/null +++ b/ipfs-api/types/constants.go @@ -0,0 +1,14 @@ +package types + +const ( + IpfsApiVersion = "v0.2.0-rc.10" + + // Pinata v1 constants + BASE_URL = "https://api.pinata.cloud" + PINFILE = "/pinning/pinFileToIPFS" // Pin file/directory + PINBYHASH = "/pinning/pinByHash" // Pin by CID hash + UNPIN = "/pinning/unpin" // Delete pinned data + METADATA_URL = "/pinning/hashMetadata" // Can be used to store additional data or to change existing one + PINNEDDATA = "/data/pinList" // Enpoint to retrive data by hash + TESTAUTH = "/data/testAuthentication" // Auth test +) diff --git a/ipfs-api/types/general.go b/ipfs-api/types/general.go new file mode 100644 index 00000000..97214316 --- /dev/null +++ b/ipfs-api/types/general.go @@ -0,0 +1,7 @@ +package types + +type Keys struct { + Api_key string + Api_secret string + JWT string +} diff --git a/ipfs-api/types/msg.go b/ipfs-api/types/msg.go new file mode 100644 index 00000000..d24d847d --- /dev/null +++ b/ipfs-api/types/msg.go @@ -0,0 +1,18 @@ +package types + +// TODO: Parse responses from each call +type TestResponse struct { + Message string `json:"message"` +} + +type PinResponse struct { + IpfsHash string `json:"ipfshash"` + PinSize int64 `json:"pinsize"` + Timestamp string `json:"timestamp"` + Duplicate bool `json:"isDuplicate,omitempty"` +} + +type PinataMetadata struct { + Name string `json:"name"` + KeyValues map[interface{}]interface{} `json:"keyvalues"` +} From cc33053c84538cc18530507913dd78808d32cb76 Mon Sep 17 00:00:00 2001 From: Eugene <70693118+MrLutik@users.noreply.github.com> Date: Thu, 9 Jun 2022 14:29:11 +0200 Subject: [PATCH 064/140] Update version.sh --- scripts/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/version.sh b/scripts/version.sh index b1f1a935..e8d3587a 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.5" \ No newline at end of file +echo "v0.1.6" From 7a61aa5dccd1008a30136b8d749a1bcddd9d0f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Thu, 9 Jun 2022 21:29:55 +0200 Subject: [PATCH 065/140] fix --- ipfs-api/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 241f5cdd..90e2b057 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -1,4 +1,3 @@ -![IPFS]https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/ipfs/ipfs.png) # IPFS-API The app to manipulate data whithin IPFS using pinata.cloud as node service provider. @@ -88,8 +87,6 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available, - - From 3b488c8bea058db3b48c2231705b4dfcae532777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 12:13:54 +0200 Subject: [PATCH 066/140] added scripts, nfpm conf --- .github/workflows/main.yml | 2 +- ipfs-api/Makefile | 11 ++++-- ipfs-api/nfpm.yaml | 17 +++++++++ ipfs-api/scripts/build.sh | 27 ++++++++++++++ ipfs-api/scripts/publish.sh | 72 +++++++++++++++++++++++++++++++++++++ ipfs-api/scripts/test.sh | 0 ipfs-api/types/constants.go | 2 +- scripts/build.sh | 4 +++ 8 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 ipfs-api/nfpm.yaml create mode 100644 ipfs-api/scripts/build.sh create mode 100644 ipfs-api/scripts/publish.sh create mode 100644 ipfs-api/scripts/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d81f277b..37030e0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: tar xvf ./src.tar.gz chmod -Rv 555 ./scripts chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts - chmod -Rv 555 ./bash-utils + chmod -Rv 555 ./bash-utils ./ipfs-api/scripts chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make test diff --git a/ipfs-api/Makefile b/ipfs-api/Makefile index 391cfb25..563b7cda 100644 --- a/ipfs-api/Makefile +++ b/ipfs-api/Makefile @@ -1,3 +1,10 @@ +.PHONY: test build publish + +test: + ./scripts/test.sh + build: - @echo "\e[0;31mINFO\e[m: Building an application \e[0;32mIPFS-API\e[m" - @go build -o bin/ipfs-api cmd/ipfs-api/main.go + ./scripts/build.sh + +publish: + ./scripts/publish.sh \ No newline at end of file diff --git a/ipfs-api/nfpm.yaml b/ipfs-api/nfpm.yaml new file mode 100644 index 00000000..579fd4fb --- /dev/null +++ b/ipfs-api/nfpm.yaml @@ -0,0 +1,17 @@ +name: "ipfs-api" +arch: "${ARCH}" +platform: "${PLATFORM}" +version: "${VERSION}" +section: "default" +priority: "extra" +replaces: +- ipfs-api +provides: +- ipfs-api +maintainer: "KIRA " +description: "IPFS-API is a kira cli tool to manipulate data whithin IPFS using pinata.cloud as node service provider" +homepage: "https://github.com/KiraCore/tools" +license: "AGPL-3.0 license" +contents: +- src: ${SOURCE} + dst: ./bin/ diff --git a/ipfs-api/scripts/build.sh b/ipfs-api/scripts/build.sh new file mode 100644 index 00000000..65bcf566 --- /dev/null +++ b/ipfs-api/scripts/build.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e +set +x +. /etc/profile +set -x + +cd ./ipfs-api || echo "Already in the root dir" + +. ../../bash-utils/bash-utils.sh + +LOCAL_PLATFORM=$(toLower $(uname)) +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") +LOCAL_OUT="${GOBIN}/ipfs-api" + +PLATFORM="$1" && [ -z "$PLATFORM" ] && PLATFORM="$LOCAL_PLATFORM" +ARCH="$2" && [ -z "$ARCH" ] && ARCH="$LOCAL_ARCH" +OUTPUT="$3" && [ -z "$OUTPUT" ] && OUTPUT="$LOCAL_OUT" + +CONSTANS_FILE=./types/constants.go +VERSION=$(grep -Fn -m 1 'IpfsApiVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: IpfsApiVersion was NOT found in contants '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old ipfs-api binary" + +go mod tidy +GO111MODULE=on go mod verify +env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ \ No newline at end of file diff --git a/ipfs-api/scripts/publish.sh b/ipfs-api/scripts/publish.sh new file mode 100644 index 00000000..d578413d --- /dev/null +++ b/ipfs-api/scripts/publish.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +set -e +set +x +. /etc/profile +set -x + +. ../bash-utils/bash-utils.sh + +LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") + +go mod tidy +GO111MODULE=on go mod verify + +PKG_CONFIG_FILE=./nfpm.yaml + +function pcgConfigure() { + local ARCH="$1" + local VERSION="$2" + local PLATFORM="$3" + local SOURCE="$4" + local CONFIG="$5" + SOURCE=${SOURCE//"/"/"\/"} + sed -i"" "s/\${ARCH}/$ARCH/" $CONFIG + sed -i"" "s/\${VERSION}/$VERSION/" $CONFIG + sed -i"" "s/\${PLATFORM}/$PLATFORM/" $CONFIG + sed -i"" "s/\${SOURCE}/$SOURCE/" $CONFIG +} + +BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD || echo "") +( [ -z "$BRANCH" ] || [ "${BRANCH,,}" == "head" ] ) && BRANCH="${SOURCE_BRANCH}" + +CONSTANS_FILE=./types/constants.go +VERSION=$(grep -Fn -m 1 'IpfsApiVersion ' $CONSTANS_FILE | rev | cut -d "=" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') +($(isNullOrEmpty "$VERSION")) && ( echoErr "ERROR: IpfsApiVersion was NOT found in '$CONSTANS_FILE' !" && sleep 5 && exit 1 ) + +function pcgRelease() { + local ARCH="$1" && ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]' ) + local VERSION="$2" && VERSION=$(echo "$VERSION" | tr '[:upper:]' '[:lower:]' ) + local PLATFORM="$3" && PLATFORM=$(echo "$PLATFORM" | tr '[:upper:]' '[:lower:]' ) + + local BIN_PATH=./bin/$ARCH/$PLATFORM + local RELEASE_DIR=./bin/deb/$PLATFORM + + mkdir -p $BIN_PATH $RELEASE_DIR + + echoInfo "INFO: Building $ARCH package for $PLATFORM..." + + TMP_PKG_CONFIG_FILE=./nfpm_${ARCH}_${PLATFORM}.yaml + rm -rfv $TMP_PKG_CONFIG_FILE && cp -v $PKG_CONFIG_FILE $TMP_PKG_CONFIG_FILE + + if [ "$PLATFORM" != "windows" ] ; then + local RELEASE_PATH="${RELEASE_DIR}/ipfs-api_${VERSION}_${ARCH}.deb" + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/ipfs-api" + pcgConfigure "$ARCH" "$VERSION" "$PLATFORM" "$BIN_PATH" $TMP_PKG_CONFIG_FILE + nfpm pkg --packager deb --target "$RELEASE_PATH" -f $TMP_PKG_CONFIG_FILE + cp -fv "$RELEASE_PATH" ./bin/ipfs-api-${PLATFORM}-${ARCH}.deb + else + ./scripts/build.sh "${PLATFORM}" "${ARCH}" "$BIN_PATH/ipfs-api.exe" + # deb is not supported on windows, simply copy the executables + cp -fv $BIN_PATH/ipfs-api.exe ./bin/ipfs-api-${PLATFORM}-${ARCH}.exe + fi +} + +rm -rfv ./bin + +# NOTE: To see available build architectures, run: go tool dist list +pcgRelease "$LOCAL_ARCH" "$VERSION" "linux" +pcgRelease "$LOCAL_ARCH" "$VERSION" "darwin" +pcgRelease "$LOCAL_ARCH" "$VERSION" "windows" + +rm -rfv ./bin/amd64 ./bin/arm64 ./bin/deb +echoInfo "INFO: Sucessfully published ipfs-api deb packages into ./bin" \ No newline at end of file diff --git a/ipfs-api/scripts/test.sh b/ipfs-api/scripts/test.sh new file mode 100644 index 00000000..e69de29b diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index eb650be6..a03bf276 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.2.0-rc.10" + IpfsApiVersion = "v0.0.1" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/build.sh b/scripts/build.sh index fdb91ca3..ddaaadf8 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -23,5 +23,9 @@ cd ./bip39gen make build cd $WORKDIR +cd ./ipfs-api +make build +cd $WORKDIR + echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), validator-key-gen $(validator-key-gen --version), bip39gen $(bip39gen version)" \ No newline at end of file From 6d2aa9e517ac2a98bc761cfed034fe97f20ecec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 12:27:25 +0200 Subject: [PATCH 067/140] fix dir --- ipfs-api/scripts/build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ipfs-api/scripts/build.sh b/ipfs-api/scripts/build.sh index 65bcf566..96c4f278 100644 --- a/ipfs-api/scripts/build.sh +++ b/ipfs-api/scripts/build.sh @@ -4,9 +4,7 @@ set +x . /etc/profile set -x -cd ./ipfs-api || echo "Already in the root dir" - -. ../../bash-utils/bash-utils.sh +. ../bash-utils/bash-utils.sh LOCAL_PLATFORM=$(toLower $(uname)) LOCAL_ARCH=$(([[ "$(uname -m)" == *"arm"* ]] || [[ "$(uname -m)" == *"aarch"* ]]) && echo "arm64" || echo "amd64") From 34fce55bd074fb81bd383454594162ced1cabbc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 12:35:24 +0200 Subject: [PATCH 068/140] fix go version, set 1.17 --- ipfs-api/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index a624b0ce..d2b5d1e5 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -1,6 +1,6 @@ module github.com/kiracore/tools/ipfs-api -go 1.18 +go 1.17 require ( github.com/ipfs/go-cid v0.2.0 From 4e54d93548e7c29d1ba734391b0fefbddfd06cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 12:43:12 +0200 Subject: [PATCH 069/140] fix dir to main --- ipfs-api/scripts/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipfs-api/scripts/build.sh b/ipfs-api/scripts/build.sh index 96c4f278..63582e64 100644 --- a/ipfs-api/scripts/build.sh +++ b/ipfs-api/scripts/build.sh @@ -22,4 +22,4 @@ rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old ipfs-api binary" go mod tidy GO111MODULE=on go mod verify -env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./ \ No newline at end of file +env GOOS=$PLATFORM GOARCH=$ARCH go build cmd/ipfs-api/main.go -o "$OUTPUT" ./ \ No newline at end of file From 19b3de516efe183d5b57139f9b8504ba1783cc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 13:04:24 +0200 Subject: [PATCH 070/140] fix dir to main --- ipfs-api/scripts/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipfs-api/scripts/build.sh b/ipfs-api/scripts/build.sh index 63582e64..90cdd56e 100644 --- a/ipfs-api/scripts/build.sh +++ b/ipfs-api/scripts/build.sh @@ -22,4 +22,4 @@ rm -fv "$OUTPUT" || echo "ERROR: Failed to wipe old ipfs-api binary" go mod tidy GO111MODULE=on go mod verify -env GOOS=$PLATFORM GOARCH=$ARCH go build cmd/ipfs-api/main.go -o "$OUTPUT" ./ \ No newline at end of file +env GOOS=$PLATFORM GOARCH=$ARCH go build -o "$OUTPUT" ./cmd/ipfs-api/. \ No newline at end of file From 605bed80def573413129064f120a283725d8a629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 13:17:14 +0200 Subject: [PATCH 071/140] fix permission --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37030e0f..4c25896a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,8 +72,8 @@ jobs: echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts - chmod -Rv 555 ./bash-utils ./ipfs-api/scripts + chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts ./ipfs-api/scripts + chmod -Rv 555 ./bash-utils chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make test From 3d18affa01675d3ab256e2f427e7a4ab0d905dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 13:46:14 +0200 Subject: [PATCH 072/140] fix another permission --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4c25896a..e6efd950 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -161,7 +161,7 @@ jobs: - name: Testing & Building TOOLS run: | echo "(current dir): $PWD" && ls -l ./ - chmod -Rv 555 ./scripts ./bash-utils ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts + chmod -Rv 555 ./scripts ./bash-utils ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts ./ipfs-api/scripts export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make test make build From 4ad2f5ef894c9433433169495e9da88e6b64ee5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 14:06:54 +0200 Subject: [PATCH 073/140] fix sha256 added to release.md --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6efd950..bd7f4cac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -195,6 +195,12 @@ jobs: echo " bip39gen-linux-arm64.deb: sha256:$(sha256sum ./bin/bip39gen-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-amd64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bip39gen-windows-arm64.exe: sha256:$(sha256sum ./bin/bip39gen-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " ipfs-api-darwin-amd64.deb: sha256:$(sha256sum ./bin/ipfs-api-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " ipfs-api-darwin-arm64.deb: sha256:$(sha256sum ./bin/ipfs-api-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " ipfs-api-linux-amd64.deb: sha256:$(sha256sum ./bin/ipfs-api-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " ipfs-api-linux-arm64.deb: sha256:$(sha256sum ./bin/ipfs-api-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " ipfs-api-windows-amd64.exe: sha256:$(sha256sum ./bin/ipfs-api-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " ipfs-api-windows-arm64.exe: sha256:$(sha256sum ./bin/ipfs-api-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " bash-utils.sh: sha256:$(sha256sum ./bin/bash-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md echo " source-code.tar.gz: sha256:$(sha256sum ./bin/source-code.tar.gz | awk '{ print $1 }')" >> ./bin/RELEASE.md echo -e "\`\`\`" >> ./bin/RELEASE.md From 649801ac6584a26643ae976dce2f7ef993af9792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 14:11:01 +0200 Subject: [PATCH 074/140] fix added files --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd7f4cac..5527b59c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -349,6 +349,12 @@ jobs: ./bip39gen-windows-arm64.exe.sig ./bip39gen-darwin-arm64.deb ./bip39gen-darwin-arm64.deb.sig + ./ipfs-api-linux-arm64.deb + ./ipfs-api-linux-arm64.deb.sig + ./ipfs-api-windows-arm64.exe + ./ipfs-api-windows-arm64.exe.sig + ./ipfs-api-darwin-arm64.deb + ./ipfs-api-darwin-arm64.deb.sig ./bash-utils.sh ./bash-utils.sh.sig ./source-code.tar.gz From 47356fe953d54407859c81613bb9aaedbc228582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 14:33:53 +0200 Subject: [PATCH 075/140] fix publish --- scripts/publish.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/publish.sh b/scripts/publish.sh index d8fb1a7b..a83ecb19 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -34,6 +34,11 @@ cd ./bip39gen make publish cd $WORKDIR +# Publish ipfs-api +cd ./ipfs-api +make publish +cd $WORKDIR + # Copy all binaries to bin directory mkdir -p ./bin From e689b2a03ef6ed0cf140ea81c155f58b5fd8672d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 14:43:01 +0200 Subject: [PATCH 076/140] fix copying in publish --- scripts/publish.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index a83ecb19..4c7f3aca 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -46,9 +46,11 @@ cp -rfv ./tmconnect/bin/* ./bin cp -rfv ./tmkms-key-import/bin/* ./bin cp -rfv ./validator-key-gen/bin/* ./bin cp -rfv ./bip39gen/bin/* ./bin +cp -rfv ./ipfs-api/bin/* ./bin cp -rfv ./bash-utils/bash-utils.sh ./bin/bash-utils.sh rm -rfv ./tmconnect/bin/* rm -rfv ./tmkms-key-import/bin/* rm -rfv ./validator-key-gen/bin/* -rm -rfv ./bip39gen/bin/* \ No newline at end of file +rm -rfv ./bip39gen/bin/* +rm -rfv ./ipfs-api/bin/* \ No newline at end of file From 2d0eb9aa865a325b89177722d3eb53600a20a261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 15:03:16 +0200 Subject: [PATCH 077/140] fix build success field --- scripts/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.sh b/scripts/build.sh index ddaaadf8..57245825 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -28,4 +28,4 @@ make build cd $WORKDIR -echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), validator-key-gen $(validator-key-gen --version), bip39gen $(bip39gen version)" \ No newline at end of file +echoInfo "SUCCESS: Build finished, tmkms $(tmconnect version), validator-key-gen $(validator-key-gen --version), bip39gen $(bip39gen version), ipfs-api $(ipfs-api version)" \ No newline at end of file From 44589c7f8c75326ffaab068ddd09ff04ca66a1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 10 Jun 2022 15:08:03 +0200 Subject: [PATCH 078/140] added release data --- RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 8db41736..e2ccbd37 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,2 +1,2 @@ Features: -* Added setVar function to bash-utils \ No newline at end of file +* Added ipfs-api cli tool for interacting dwith ipfs network through pinata.cloud \ No newline at end of file From 098e8361eec7ebeb1ab598cfc64d8c28d2f5dcbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Mon, 13 Jun 2022 09:26:49 +0200 Subject: [PATCH 079/140] added cmd to copy amd for ipfs-api --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5527b59c..61ffc820 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -355,6 +355,12 @@ jobs: ./ipfs-api-windows-arm64.exe.sig ./ipfs-api-darwin-arm64.deb ./ipfs-api-darwin-arm64.deb.sig + ./ipfs-api-linux-amd64.deb + ./ipfs-api-linux-amd64.deb.sig + ./ipfs-api-windows-amd64.exe + ./ipfs-api-windows-amd64.exe.sig + ./ipfs-api-darwin-amd64.deb + ./ipfs-api-darwin-amd64.deb.sig ./bash-utils.sh ./bash-utils.sh.sig ./source-code.tar.gz From 540302e76a401da7c449533159eaa169a76d4782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Mon, 13 Jun 2022 09:45:24 +0200 Subject: [PATCH 080/140] updated readme from feature --- ipfs-api/README.md | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 90e2b057..2ac8301c 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -67,43 +67,4 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available, ## Authors -* **Yevhen Yakubovskiyi** - *Initial work* - [MrLutik](https://github.com/mrlutik) - - - - - - - - - - - - - - - - - - - - - - -/tags). - -## Authors - -* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth) - -See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - -* Hat tip to anyone whose code was used -* Inspiration -* etc. +* **Yevhen Yakubovskiyi** - *Initial work* - [MrLutik](https://github.com/mrlutik) \ No newline at end of file From 0e1fa8374af80975bfb3e4f6bd43cb0ee1e2225b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Tue, 14 Jun 2022 22:31:27 +0200 Subject: [PATCH 081/140] added description --- ipfs-api/pkg/cli/cli.go | 8 ++++++++ ipfs-api/pkg/pinatav1/pinatav1.go | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index 62a161d2..778b6170 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -1,3 +1,4 @@ +// Package to handle cli commands package cli import ( @@ -20,6 +21,11 @@ var rootCmd = &cobra.Command{ Short: "IPFS API", } +// Parsing given path for pinata keys +// Valid file example: +// API Key: +// API Secret: +// JWT: func grabKey(keyPath string) (tp.Keys, error) { // checking if path to keys is valid if _, err := os.Stat(keyPath); os.IsNotExist(err) { @@ -57,6 +63,7 @@ func grabKey(keyPath string) (tp.Keys, error) { return key, nil } +//Main function to create cli func Start() { //Turn off completion rootCmd.CompletionOptions.DisableDescriptions = true @@ -70,6 +77,7 @@ func Start() { downloadCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") testCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to yoour key") + //Assembling commands rootCmd.AddCommand(cidZeroCommand) rootCmd.AddCommand(cidOneCommand) rootCmd.AddCommand(pinnedCommand) diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index f58be2d7..ad6a15d6 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -19,6 +19,7 @@ import ( "golang.org/x/net/http2" ) +//Creating tweaked client func NewClient() *http.Client { // Client params to be adjusted ... @@ -39,6 +40,7 @@ func NewClient() *http.Client { } +// Testing auth wih pinata server func Test(keys tp.Keys) error { c := NewClient() @@ -78,11 +80,7 @@ func Test(keys tp.Keys) error { return nil } -// var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"") - -// func escapeQuotes(s string) string { -// return quoteEscaper.Replace(s) -// } +// Adding HTML form to multipart body func addForm(bw *multipart.Writer, filePath string) error { // wrap in struct data := strings.Split(filePath, ":") @@ -118,6 +116,7 @@ func addForm(bw *multipart.Writer, filePath string) error { return nil } +//Wrapping HTML forms in the request body func createReqBody(filePaths []string) (string, io.Reader, error) { // creating a pipe pipeReader, pipeWriter := io.Pipe() @@ -142,12 +141,13 @@ func createReqBody(filePaths []string) (string, io.Reader, error) { } +//Parsing directory tree recursively. NB: SLOW func walker(rootDir string) []string { // add error handling var res []string wout := make(chan string) - // calling for a gouroutine wich will yeild res throug chan + // calling for a goroutine which will yield res through chan go func() { defer close(wout) // Chan is empty can be closed base := filepath.Base(rootDir) + "/" @@ -181,6 +181,7 @@ func walker(rootDir string) []string { } +//Pins given file/directory to pinata.cloud service using api v1 func Pin(args []string, keys tp.Keys) error { path := args[0] // checking if the path is valid and file/folder exist @@ -188,7 +189,7 @@ func Pin(args []string, keys tp.Keys) error { log.Error("pin: provided path doesn't exist") return err } - // assembling the tree + // parsing the tree filePaths := walker(path) // creating requestbody @@ -231,7 +232,7 @@ func Pin(args []string, keys tp.Keys) error { defer resp.Body.Close() - // checking response code + // checking a response code if resp.StatusCode == http.StatusOK { bytes, err := io.ReadAll(resp.Body) if err != nil { @@ -259,6 +260,7 @@ func Pin(args []string, keys tp.Keys) error { return nil } +// Deleting data from pinata.cloud by hash (CID) func Unpin(args []string, keys tp.Keys) error { c := NewClient() @@ -293,6 +295,7 @@ func Unpin(args []string, keys tp.Keys) error { return nil } +//Checking data if it is pinned on pinata.cloud func Pinned(args []string, keys tp.Keys) { c := NewClient() @@ -327,6 +330,7 @@ func Pinned(args []string, keys tp.Keys) { } +//Downloading data. TODO: adding download for directories func Download(args []string, keys tp.Keys, gateway string) { c := NewClient() From fb530d790d9441c8594e3f8e0e97f80ea43c5612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 15 Jun 2022 13:39:30 +0200 Subject: [PATCH 082/140] added metadat, options, return of CIDv1 --- ipfs-api/go.mod | 15 ++++++++------- ipfs-api/go.sum | 31 +++++++++++++++---------------- ipfs-api/pkg/pinatav1/pinatav1.go | 17 ++++++++++------- ipfs-api/types/msg.go | 18 ++++++++++++++++-- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index d2b5d1e5..beff7139 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -1,18 +1,18 @@ module github.com/kiracore/tools/ipfs-api -go 1.17 +go 1.18 require ( github.com/ipfs/go-cid v0.2.0 - github.com/multiformats/go-multihash v0.0.15 + github.com/multiformats/go-multihash v0.1.0 github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 - golang.org/x/net v0.0.0-20211029224645-99673261e6eb + golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 ) require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/klauspost/cpuid/v2 v2.0.4 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -20,9 +20,10 @@ require ( github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect github.com/multiformats/go-varint v0.0.6 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.4.0 // indirect golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf // indirect - golang.org/x/sys v0.0.0-20210423082822-04245dca01da // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/text v0.3.7 // indirect + lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum index b6a467f1..b18f073c 100644 --- a/ipfs-api/go.sum +++ b/ipfs-api/go.sum @@ -1,13 +1,13 @@ github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= -github.com/klauspost/cpuid/v2 v2.0.4 h1:g0I61F2K2DjRHz1cnxlkNSBIaePVoJIjjnHui8QHbiw= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= @@ -21,8 +21,8 @@ github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ8 github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multihash v0.0.15 h1:hWOPdrNqDjwHDx82vsYGSDZNyktOJJ2dzZJzFkOV1jM= -github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= +github.com/multiformats/go-multihash v0.1.0 h1:CgAgwqk3//SVEw3T+6DqI4mWMyRuDwZtOWcJT0q9+EA= +github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -30,32 +30,31 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM= -golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 h1:0qjDla5xICC2suMtyRH/QqX3B1btXTfNsIt/i4LFgO0= +golang.org/x/net v0.0.0-20220614195744-fb05da6f9022/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= +lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index ad6a15d6..f09c3a93 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,6 +8,7 @@ import ( "io/fs" "mime/multipart" "net/http" + "net/http/httputil" "net/textproto" "os" "path/filepath" @@ -109,6 +110,9 @@ func addForm(bw *multipart.Writer, filePath string) error { fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileName)) h.Set("Content-Type", "application/octet-stream") + bw.WriteField("pinataOptions", `{"cidVersion": 1}`) + bw.WriteField("pinataMetadata", fmt.Sprintf(`{"name": "%v"}`, fileName)) + content, _ := bw.CreatePart(h) io.Copy(content, f) @@ -215,13 +219,12 @@ func Pin(args []string, keys tp.Keys) error { client := NewClient() // Printing request with all data for debugging - /* - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - fmt.Println(err) - } - fmt.Println(string(requestDump)) - */ + + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(requestDump)) // sending request resp, err := client.Do(req) diff --git a/ipfs-api/types/msg.go b/ipfs-api/types/msg.go index d24d847d..6c8fa0ad 100644 --- a/ipfs-api/types/msg.go +++ b/ipfs-api/types/msg.go @@ -13,6 +13,20 @@ type PinResponse struct { } type PinataMetadata struct { - Name string `json:"name"` - KeyValues map[interface{}]interface{} `json:"keyvalues"` + Name string `json:"name"` // By default name of the file/directory + KeyValues map[interface{}]interface{} `json:"keyvalues"` // Some additional data +} + +type Region struct { + ID string `json:"id"` + DesiredReplicationCount int `json:"desiredReplicationCount"` +} + +type CustomPinPolicy struct { + Regions []Region `json:"regions"` +} +type PinataOptions struct { + CidVersion int `json:"cidVersion"` // 0 or 1 Returns CID version of a choice + WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash + CustomPinPolicy CustomPinPolicy `json:"customPinPolicy"` // Allows to choose region and qty of nodes used to pin the data } From e2eaa402d94060e16ed14adb0fa7d34e28596ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 15 Jun 2022 15:32:16 +0200 Subject: [PATCH 083/140] added metadat, options, return of CIDv1 --- ipfs-api/go.mod | 2 +- ipfs-api/pkg/pinatav1/pinatav1.go | 2 ++ ipfs-api/types/constants.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index beff7139..42b039b6 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -1,6 +1,6 @@ module github.com/kiracore/tools/ipfs-api -go 1.18 +go 1.17 require ( github.com/ipfs/go-cid v0.2.0 diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index f09c3a93..630a79a4 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -110,6 +110,8 @@ func addForm(bw *multipart.Writer, filePath string) error { fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileName)) h.Set("Content-Type", "application/octet-stream") + // Adding data-form with metadata and option fields + // NB! Ready types for this entry are ready in pkg types bw.WriteField("pinataOptions", `{"cidVersion": 1}`) bw.WriteField("pinataMetadata", fmt.Sprintf(`{"name": "%v"}`, fileName)) diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index a03bf276..4b18fb8c 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.1" + IpfsApiVersion = "v0.0.3" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" From 028052467add3f1234fc96cc51c7fc9ba832326f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Fri, 17 Jun 2022 16:39:09 +0200 Subject: [PATCH 084/140] added test --- ipfs-api/README.md | 2 +- ipfs-api/pkg/cli/cli.go | 8 ++- ipfs-api/pkg/cli/getcid.go | 67 ++++++++++++----------- ipfs-api/pkg/cli/pin.go | 5 ++ ipfs-api/pkg/pinatav1/pinatav1.go | 76 +++++++++++++++++++++++--- ipfs-api/pkg/pinatav1/pinatav1_test.go | 35 ++++++++++++ ipfs-api/scripts/test.sh | 7 +++ ipfs-api/types/constants.go | 4 +- ipfs-api/types/msg.go | 19 ++----- scripts/test.sh | 5 ++ scripts/version.sh | 2 +- 11 files changed, 171 insertions(+), 59 deletions(-) create mode 100644 ipfs-api/pkg/pinatav1/pinatav1_test.go diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 2ac8301c..f998b878 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -63,7 +63,7 @@ Give the example ## Versioning -We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/KiraCore/tools +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags](https://github.com/KiraCore/tools/tags) ## Authors diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index 778b6170..5b893434 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -12,8 +12,10 @@ import ( ) var ( - keyPath string - gateway string + keyPath string // Path to pinata keys + gateway string // Pinata gateway to use + wd bool // Wrap with dictionary representation + c int8 // CID version integer representation ) var rootCmd = &cobra.Command{ @@ -71,6 +73,8 @@ func Start() { ///Adding flags pinCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + pinCommand.Flags().BoolVarP(&wd, "wrap", "w", false, "Wrap with the directory") + pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") pinnedCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") unpinCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") downloadCommand.PersistentFlags().StringVarP(&gateway, "gateway", "g", "https://gateway.pinata.cloud", "IPFS gateway") diff --git a/ipfs-api/pkg/cli/getcid.go b/ipfs-api/pkg/cli/getcid.go index c384704d..9664a65a 100644 --- a/ipfs-api/pkg/cli/getcid.go +++ b/ipfs-api/pkg/cli/getcid.go @@ -3,13 +3,10 @@ package cli // TODO: Try to wrap data in node.UnixFS and after that to put this node into merkle DAG import ( - "bufio" - "encoding/hex" - "fmt" "os" - cid "github.com/ipfs/go-cid" - mh "github.com/multiformats/go-multihash" + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" "github.com/spf13/cobra" ) @@ -28,48 +25,52 @@ var cidOneCommand = &cobra.Command{ } func cmdGetCIDv0(cmd *cobra.Command, args []string) error { - prefix := cid.Prefix{ - Version: 0, - Codec: cid.DagProtobuf, - MhType: mh.SHA2_256, - MhLength: -1, + f, _ := os.Open(args[0]) + defer f.Close() + + fi, err := f.Stat() + if err != nil { + return err } - file, _ := os.Open(args[0]) + bytes := make([]byte, fi.Size()) + rb, err := f.Read(bytes) - defer file.Close() + if err != nil { + return err + } - bytes := make([]byte, 32) - for { - _, err := file.Read(bytes) - if err != nil { - break - } + c, err := pnt.GetCidV0(bytes) + if err != nil { + log.Error("cmdGetCIDv1: failed to get the cid: %v", err) } + log.Info("cid v1. hash: %v. bytes: %v", c, rb) - cid, _ := prefix.Sum(bytes) - fmt.Println(cid) return nil } func cmdGetCIDv1(cmd *cobra.Command, args []string) error { - builder := cid.V1Builder{ - Codec: cid.Raw, - MhType: mh.SHA2_256, - MhLength: 32, - } - file, _ := os.Open(args[0]) + f, _ := os.Open(args[0]) + defer f.Close() - defer file.Close() + fi, err := f.Stat() + if err != nil { + return err + } - rd := bufio.NewReader(file) - data, _ := rd.ReadBytes(32) - fmt.Println(len(data)) - fmt.Println(hex.EncodeToString(data)) + bytes := make([]byte, fi.Size()) + rb, err := f.Read(bytes) - cid, _ := builder.Sum(data) - fmt.Println(cid) + if err != nil { + return err + } + + c, err := pnt.GetCidV1(bytes) + if err != nil { + log.Error("cmdGetCIDv1: failed to get the cid: %v", err) + } + log.Info("cid v1. hash: %v. bytes: %v", c, rb) return nil diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index db644503..060b008f 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -4,6 +4,7 @@ import ( "log" pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + tp "github.com/kiracore/tools/ipfs-api/types" "github.com/spf13/cobra" ) @@ -15,7 +16,11 @@ var pinCommand = &cobra.Command{ } func pinCmd(cmd *cobra.Command, args []string) error { + if c != 1 && c != 0 { + log.Fatalln("CID version value should be 0 or 1") + } keys, _ := grabKey(keyPath) + tp.Opts = tp.PinataOptions{CidVersion: c, WrapWithDirectory: wd} if err := pnt.Pin(args, keys); err != nil { log.Fatalln("\033[31m", err) } diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index 630a79a4..9ca55948 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,15 +8,16 @@ import ( "io/fs" "mime/multipart" "net/http" - "net/http/httputil" "net/textproto" "os" "path/filepath" "strings" "time" + cid "github.com/ipfs/go-cid" log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" tp "github.com/kiracore/tools/ipfs-api/types" + mh "github.com/multiformats/go-multihash" "golang.org/x/net/http2" ) @@ -81,6 +82,31 @@ func Test(keys tp.Keys) error { return nil } +// Adding pinataOptions to the request. +func setPinataOptions(bw *multipart.Writer, c int8, w bool) error { + v, err := json.Marshal(tp.Opts) + if err != nil { + return err + } + bw.WriteField(tp.PINATAOPTS, string(v)) + return nil + +} +func setPinataMetadata(bw *multipart.Writer, fi fs.FileInfo) error { + d := make(map[string]interface{}) + d["size"] = fi.Size() + d["modtime"] = fi.ModTime().UTC().Unix() + fi.Sys() + + m := tp.PinataMetadata{Name: fi.Name(), KeyValues: d} + s, err := json.Marshal(m) + if err != nil { + return err + } + bw.WriteField(tp.PINATAMETA, string(s)) + return nil +} + // Adding HTML form to multipart body func addForm(bw *multipart.Writer, filePath string) error { // wrap in struct @@ -112,8 +138,17 @@ func addForm(bw *multipart.Writer, filePath string) error { // Adding data-form with metadata and option fields // NB! Ready types for this entry are ready in pkg types - bw.WriteField("pinataOptions", `{"cidVersion": 1}`) - bw.WriteField("pinataMetadata", fmt.Sprintf(`{"name": "%v"}`, fileName)) + if err := setPinataOptions(bw, 1, false); err != nil { + log.Error("addform: failed to add pinataOptions to the for. %v", err) + return err + } + if err := setPinataMetadata(bw, fi); err != nil { + log.Error("addform: failed to add pinataMetadata to the for. %v", err) + return err + } + //bw.WriteField("pinataOptions", `{"cidVersion": 1}`) + + //bw.WriteField("pinataMetadata", fmt.Sprintf(`{"name": "%v"}`, fileName)) content, _ := bw.CreatePart(h) io.Copy(content, f) @@ -222,11 +257,11 @@ func Pin(args []string, keys tp.Keys) error { // Printing request with all data for debugging - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - fmt.Println(err) - } - fmt.Println(string(requestDump)) + // requestDump, err := httputil.DumpRequest(req, true) + // if err != nil { + // fmt.Println(err) + // } + // fmt.Println(string(requestDump)) // sending request resp, err := client.Do(req) @@ -300,6 +335,31 @@ func Unpin(args []string, keys tp.Keys) error { return nil } +// GetCidV1 accept byte slice and count hash sum +func GetCidV1(b []byte) (cid.Cid, error) { + builder := cid.V1Builder{ + Codec: cid.DagProtobuf, + MhType: mh.SHA2_256, + MhLength: -1, + } + c, err := builder.Sum(b) + if err != nil { + return cid.Cid{}, err + } + return c, nil + +} + +func GetCidV0(b []byte) (cid.Cid, error) { + builder := cid.V0Builder{} + c, err := builder.Sum(b) + if err != nil { + return cid.Cid{}, err + } + return c, nil + +} + //Checking data if it is pinned on pinata.cloud func Pinned(args []string, keys tp.Keys) { c := NewClient() diff --git a/ipfs-api/pkg/pinatav1/pinatav1_test.go b/ipfs-api/pkg/pinatav1/pinatav1_test.go new file mode 100644 index 00000000..3d36c2e5 --- /dev/null +++ b/ipfs-api/pkg/pinatav1/pinatav1_test.go @@ -0,0 +1,35 @@ +package pinatav1_test + +import ( + "fmt" + "strings" + "testing" + + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" +) + +func TestCidV1Func(t *testing.T) { + s := "Hello, World!" + c := "bafybeig77vqcdozl2wyk6z3cscaj5q5fggi53aoh64fewkdiri3cdauyn4" + b := []byte(s) + + cid, err := pnt.GetCidV1(b) + + if err != nil { + t.Errorf("gietcidv1 func failed") + } + r := strings.Compare(c, cid.String()) + + fmt.Println(r) + switch r { + case 0: + t.Logf("cidv1 correct") + + case 1: + t.Errorf("cidv1 incorrect") + + case -1: + t.Errorf("cidv1 incorrect") + } + +} diff --git a/ipfs-api/scripts/test.sh b/ipfs-api/scripts/test.sh index e69de29b..eba8f571 100644 --- a/ipfs-api/scripts/test.sh +++ b/ipfs-api/scripts/test.sh @@ -0,0 +1,7 @@ +set -e +set +x +. /etc/profile +set -x + +go test pkg/pinatav1 -vet=off || echo "IPFS-API test finished successfully" + diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 4b18fb8c..8e68117f 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -9,6 +9,8 @@ const ( PINBYHASH = "/pinning/pinByHash" // Pin by CID hash UNPIN = "/pinning/unpin" // Delete pinned data METADATA_URL = "/pinning/hashMetadata" // Can be used to store additional data or to change existing one - PINNEDDATA = "/data/pinList" // Enpoint to retrive data by hash + PINNEDDATA = "/data/pinList" // Endpoint to retrieve data by hash TESTAUTH = "/data/testAuthentication" // Auth test + PINATAOPTS = "pinataOptions" + PINATAMETA = "pinataMetadata" ) diff --git a/ipfs-api/types/msg.go b/ipfs-api/types/msg.go index 6c8fa0ad..63acb4e6 100644 --- a/ipfs-api/types/msg.go +++ b/ipfs-api/types/msg.go @@ -13,20 +13,13 @@ type PinResponse struct { } type PinataMetadata struct { - Name string `json:"name"` // By default name of the file/directory - KeyValues map[interface{}]interface{} `json:"keyvalues"` // Some additional data + Name string `json:"name"` // By default name of the file/directory + KeyValues map[string]interface{} `json:"keyvalues"` // Some additional data } -type Region struct { - ID string `json:"id"` - DesiredReplicationCount int `json:"desiredReplicationCount"` -} - -type CustomPinPolicy struct { - Regions []Region `json:"regions"` -} type PinataOptions struct { - CidVersion int `json:"cidVersion"` // 0 or 1 Returns CID version of a choice - WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash - CustomPinPolicy CustomPinPolicy `json:"customPinPolicy"` // Allows to choose region and qty of nodes used to pin the data + CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice + WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash } + +var Opts PinataOptions diff --git a/scripts/test.sh b/scripts/test.sh index e19405b8..a69d515f 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -25,4 +25,9 @@ cd ./tmkms-key-import make test cd $WORKDIR +# Test tm key importer +cd ./ipfs-api +make test +cd $WORKDIR + echoInfo "SUCCESS: Testing finished" \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh index e8d3587a..f7768c5b 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.6" +echo "v0.1.6_rc.01" From 4a381baa342a4b77a8e727c8755213eea093be1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Sun, 19 Jun 2022 09:35:35 +0200 Subject: [PATCH 085/140] improved structs, moved options and metadata --- .vscode/launch.json | 16 ++ ipfs-api/cmd/ipfs-api/hello.txt | 1 + ipfs-api/cmd/ipfs-api/key.txt | 3 + .../test_dir1/test_dir_2/test_file2.txt | 1 + .../cmd/ipfs-api/test_dir1/test_file1.txt | 1 + ipfs-api/pkg/ipfslog/test/main.go | 82 ++++++++++ ipfs-api/pkg/pinatav1/pinatav1.go | 144 +++++++++--------- ipfs-api/types/constants.go | 2 +- ipfs-api/types/general.go | 8 + ipfs-api/types/msg.go | 11 +- scripts/version.sh | 2 +- 11 files changed, 195 insertions(+), 76 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 ipfs-api/cmd/ipfs-api/hello.txt create mode 100644 ipfs-api/cmd/ipfs-api/key.txt create mode 100644 ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt create mode 100644 ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt create mode 100644 ipfs-api/pkg/ipfslog/test/main.go diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..f0eb9144 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api", + "args": ["pin", "/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1", "-k", "/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/key.txt"], + } + ] +} \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/hello.txt b/ipfs-api/cmd/ipfs-api/hello.txt new file mode 100644 index 00000000..b45ef6fe --- /dev/null +++ b/ipfs-api/cmd/ipfs-api/hello.txt @@ -0,0 +1 @@ +Hello, World! \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/key.txt b/ipfs-api/cmd/ipfs-api/key.txt new file mode 100644 index 00000000..6a6c08d4 --- /dev/null +++ b/ipfs-api/cmd/ipfs-api/key.txt @@ -0,0 +1,3 @@ +API Key: dbc635c1c1dd69a4a018 + API Secret: 5f0d5c97a474c91a3335886e60500851c767f62ba592904783398ea9f082fb1a + JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImRiYzYzNWMxYzFkZDY5YTRhMDE4Iiwic2NvcGVkS2V5U2VjcmV0IjoiNWYwZDVjOTdhNDc0YzkxYTMzMzU4ODZlNjA1MDA4NTFjNzY3ZjYyYmE1OTI5MDQ3ODMzOThlYTlmMDgyZmIxYSIsImlhdCI6MTY1NTI4OTQ2NX0.Zooi19QTZJDR6mueWpvAnD_qaG3T9LtPpInI_lTBrGo \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt b/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt new file mode 100644 index 00000000..0f9ef446 --- /dev/null +++ b/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt @@ -0,0 +1 @@ +test_file2 \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt b/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt new file mode 100644 index 00000000..b86d8d51 --- /dev/null +++ b/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt @@ -0,0 +1 @@ +test_file1 \ No newline at end of file diff --git a/ipfs-api/pkg/ipfslog/test/main.go b/ipfs-api/pkg/ipfslog/test/main.go new file mode 100644 index 00000000..7f6de307 --- /dev/null +++ b/ipfs-api/pkg/ipfslog/test/main.go @@ -0,0 +1,82 @@ +package main + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "mime/multipart" + "net/http" + "net/http/httputil" + "os" + "path/filepath" +) + +func main() { + + url := "https://api.pinata.cloud/pinning/pinFileToIPFS" + method := "POST" + + payload := &bytes.Buffer{} + writer := multipart.NewWriter(payload) + + file, errFile1 := os.Open("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt") + defer file.Close() + part1, + errFile1 := writer.CreateFormFile("file", "dir/"+filepath.Base("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt")) + _, errFile1 = io.Copy(part1, file) + if errFile1 != nil { + fmt.Println(errFile1) + return + } + _ = writer.WriteField("pinataOptions", "{\"cidVersion\": 1}") + _ = writer.WriteField("pinataMetadata", "{\"name\": \"MyFile\", \"keyvalues\": {\"company\": \"Pinata\"}}") + + file1, errFile2 := os.Open("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt") + defer file.Close() + part2, + errFile2 := writer.CreateFormFile("file", "dir/"+filepath.Base("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt")) + _, errFile2 = io.Copy(part2, file1) + if errFile2 != nil { + fmt.Println(errFile2) + return + } + _ = writer.WriteField("pinataOptions", "{\"cidVersion\": 1}") + _ = writer.WriteField("pinataMetadata", "{\"name\": \"MyFile\", \"keyvalues\": {\"company\": \"Pinata\"}}") + err := writer.Close() + if err != nil { + fmt.Println(err) + return + } + + client := &http.Client{} + req, err := http.NewRequest(method, url, payload) + + if err != nil { + fmt.Println(err) + return + } + req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImRiYzYzNWMxYzFkZDY5YTRhMDE4Iiwic2NvcGVkS2V5U2VjcmV0IjoiNWYwZDVjOTdhNDc0YzkxYTMzMzU4ODZlNjA1MDA4NTFjNzY3ZjYyYmE1OTI5MDQ3ODMzOThlYTlmMDgyZmIxYSIsImlhdCI6MTY1NTI4OTQ2NX0.Zooi19QTZJDR6mueWpvAnD_qaG3T9LtPpInI_lTBrGo") + + req.Header.Set("Content-Type", writer.FormDataContentType()) + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + + } + fmt.Println(string(requestDump)) + + res, err := client.Do(req) + if err != nil { + fmt.Println(err) + return + } + defer res.Body.Close() + + body, err := ioutil.ReadAll(res.Body) + if err != nil { + fmt.Println(err) + return + } + fmt.Println(string(body)) +} diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index 9ca55948..716e84b8 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,10 +8,11 @@ import ( "io/fs" "mime/multipart" "net/http" + "net/http/httputil" "net/textproto" "os" "path/filepath" - "strings" + "sync" "time" cid "github.com/ipfs/go-cid" @@ -88,137 +89,135 @@ func setPinataOptions(bw *multipart.Writer, c int8, w bool) error { if err != nil { return err } + fmt.Println(string(v)) bw.WriteField(tp.PINATAOPTS, string(v)) return nil } -func setPinataMetadata(bw *multipart.Writer, fi fs.FileInfo) error { - d := make(map[string]interface{}) - d["size"] = fi.Size() - d["modtime"] = fi.ModTime().UTC().Unix() - fi.Sys() +func setPinataMetadata(bw *multipart.Writer, fi fs.FileInfo, d map[string]string) error { m := tp.PinataMetadata{Name: fi.Name(), KeyValues: d} s, err := json.Marshal(m) if err != nil { return err } + bw.WriteField(tp.PINATAMETA, string(s)) return nil } // Adding HTML form to multipart body -func addForm(bw *multipart.Writer, filePath string) error { +func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { // wrap in struct - data := strings.Split(filePath, ":") - fileName := data[0] - path := data[1] - f, err := os.Open(path) + f, err := os.Open(filePath.AbsoultePath) if err != nil { log.Error("addform: can't open the file") - defer f.Close() return err } - fi, err := f.Stat() - if err != nil { - log.Error("addform: can't read stats from the given path") - return err - } - defer f.Close() + + // fi, err := f.Stat() + // if err != nil { + // log.Error("addform: can't read stats from the given path") + // return err + // } //MIME Header setup - // if not a standalone directory - add MIME.header - if !fi.IsDir() { - h := make(textproto.MIMEHeader) - h.Set("Content-Disposition", - fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileName)) - h.Set("Content-Type", "application/octet-stream") - - // Adding data-form with metadata and option fields - // NB! Ready types for this entry are ready in pkg types - if err := setPinataOptions(bw, 1, false); err != nil { - log.Error("addform: failed to add pinataOptions to the for. %v", err) - return err - } - if err := setPinataMetadata(bw, fi); err != nil { - log.Error("addform: failed to add pinataMetadata to the for. %v", err) - return err - } - //bw.WriteField("pinataOptions", `{"cidVersion": 1}`) - //bw.WriteField("pinataMetadata", fmt.Sprintf(`{"name": "%v"}`, fileName)) + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", + fmt.Sprintf(`form-data; name="file"; filename="%s"`, filePath.Path)) + h.Set("Content-Type", "application/octet-stream") + content, _ := bw.CreatePart(h) - content, _ := bw.CreatePart(h) - io.Copy(content, f) + io.Copy(content, f) + + defer f.Close() - } return nil } //Wrapping HTML forms in the request body -func createReqBody(filePaths []string) (string, io.Reader, error) { +func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { + // creating a pipe pipeReader, pipeWriter := io.Pipe() // creating writer for multipart request bodyWriter := multipart.NewWriter(pipeWriter) + // Adding data-form with metadata and option fields + // NB! Ready types for this entry are ready in pkg types + if err := setPinataOptions(bodyWriter, 1, false); err != nil { + log.Error("addform: failed to add pinataOptions to the for. %v", err) + } + d := make(map[string]string) + + if err := setPinataMetadata(bodyWriter, filePaths[0].Info, d); err != nil { + log.Error("addform: failed to add pinataMetadata to the for. %v", err) + + } + // calling for a goroutine to add all forms found by walker + for _, t := range filePaths { + fmt.Println(t.Path) + } go func() { for _, filePath := range filePaths { if err := addForm(bodyWriter, filePath); err != nil { log.Error("createbody: failed to add form to multipart request") return + } - log.Info("pinned: %v", filePath) + log.Info("pinned: %v", filePath.Info.Name()) + } bodyWriter.Close() pipeWriter.Close() }() + return bodyWriter.FormDataContentType(), pipeReader, nil } //Parsing directory tree recursively. NB: SLOW -func walker(rootDir string) []string { - // add error handling - var res []string - wout := make(chan string) +func walker(rootDir string) []tp.ExtendedFileInfo { + + var wg sync.WaitGroup + var efi = []tp.ExtendedFileInfo{} // calling for a goroutine which will yield res through chan + wg.Add(1) go func() { - defer close(wout) // Chan is empty can be closed base := filepath.Base(rootDir) + "/" err := filepath.Walk(rootDir, func(path string, info fs.FileInfo, err error) error { if err != nil { return err } + if !info.IsDir() { + rel, err := filepath.Rel(rootDir, path) + if err != nil { + log.Error("walker: can't get relative path for %v. err: %v", path, err) + } + fn := filepath.Clean(base + rel) + efi = append(efi, tp.ExtendedFileInfo{Info: info, Path: fn, AbsoultePath: rootDir}) - rel, err := filepath.Rel(rootDir, path) - if err != nil { - log.Error("walker: can't get relative path for %v. err: %v", path, err) } - fn := filepath.Clean(base + rel) - wout <- fn + ":" + path + + // wout <- fn + ":" + path return nil + }) if err != nil { return } + wg.Done() }() + wg.Wait() - for { - if msg, state := <-wout; state { - res = append(res, msg) - } else { - break - } - - } - return res + return efi } @@ -249,19 +248,22 @@ func Pin(args []string, keys tp.Keys) error { } //adding headers + + // req.Header.Add("pinata_api_key", keys.Api_key) + // req.Header.Add("pinata_secret_api_key", keys.Api_secret) + req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImRiYzYzNWMxYzFkZDY5YTRhMDE4Iiwic2NvcGVkS2V5U2VjcmV0IjoiNWYwZDVjOTdhNDc0YzkxYTMzMzU4ODZlNjA1MDA4NTFjNzY3ZjYyYmE1OTI5MDQ3ODMzOThlYTlmMDgyZmIxYSIsImlhdCI6MTY1NTI4OTQ2NX0.Zooi19QTZJDR6mueWpvAnD_qaG3T9LtPpInI_lTBrGo") req.Header.Add("Content-Type", contType) - req.Header.Add("pinata_api_key", keys.Api_key) - req.Header.Add("pinata_secret_api_key", keys.Api_secret) client := NewClient() // Printing request with all data for debugging - // requestDump, err := httputil.DumpRequest(req, true) - // if err != nil { - // fmt.Println(err) - // } - // fmt.Println(string(requestDump)) + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + + } + fmt.Println(string(requestDump)) // sending request resp, err := client.Do(req) @@ -419,7 +421,7 @@ func Download(args []string, keys tp.Keys, gateway string) { } if _, err = io.Copy(f, resp.Body); err != nil { - log.Error("Failed to io.Copy") + log.Error("download: failed to io.Copy") } defer resp.Body.Close() @@ -427,3 +429,7 @@ func Download(args []string, keys tp.Keys, gateway string) { fmt.Println(string(r)) } + +func PostDownloadCheck(args []string) { + +} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 8e68117f..322ff671 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.3" + IpfsApiVersion = "v0.0.4" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/ipfs-api/types/general.go b/ipfs-api/types/general.go index 97214316..847d9e15 100644 --- a/ipfs-api/types/general.go +++ b/ipfs-api/types/general.go @@ -1,7 +1,15 @@ package types +import "io/fs" + type Keys struct { Api_key string Api_secret string JWT string } + +type ExtendedFileInfo struct { + Info fs.FileInfo + Path string + AbsoultePath string +} diff --git a/ipfs-api/types/msg.go b/ipfs-api/types/msg.go index 63acb4e6..1b1ea96e 100644 --- a/ipfs-api/types/msg.go +++ b/ipfs-api/types/msg.go @@ -6,20 +6,21 @@ type TestResponse struct { } type PinResponse struct { + Duplicate bool `json:"isDuplicate,omitempty"` IpfsHash string `json:"ipfshash"` - PinSize int64 `json:"pinsize"` Timestamp string `json:"timestamp"` - Duplicate bool `json:"isDuplicate,omitempty"` + PinSize int64 `json:"pinsize"` } type PinataMetadata struct { - Name string `json:"name"` // By default name of the file/directory - KeyValues map[string]interface{} `json:"keyvalues"` // Some additional data + Name string `json:"name"` // By default name of the file/directory + KeyValues map[string]string `json:"keyvalues"` // Some additional data } type PinataOptions struct { - CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash + CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice + } var Opts PinataOptions diff --git a/scripts/version.sh b/scripts/version.sh index f7768c5b..3569234c 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.6_rc.01" +echo "v0.1.6-rc.02" From 0e9dc3d671f3523f71908bed9b767184de17e1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Sun, 19 Jun 2022 19:43:36 +0200 Subject: [PATCH 086/140] relative path, keys handling, return 1, CIDv1 for dirs --- .vscode/launch.json | 16 --- RELEASE.md | 5 +- ipfs-api/cmd/ipfs-api/hello.txt | 1 - ipfs-api/cmd/ipfs-api/key.txt | 3 - .../test_dir1/test_dir_2/test_file2.txt | 1 - .../cmd/ipfs-api/test_dir1/test_file1.txt | 1 - ipfs-api/pkg/cli/cli.go | 60 +-------- ipfs-api/pkg/cli/download.go | 2 +- ipfs-api/pkg/cli/keys.go | 93 ++++++++++++++ ipfs-api/pkg/cli/pin.go | 4 +- ipfs-api/pkg/cli/pinned.go | 2 +- ipfs-api/pkg/cli/test.go | 5 +- ipfs-api/pkg/cli/unpin.go | 2 +- ipfs-api/pkg/ipfslog/test/main.go | 82 ------------- ipfs-api/pkg/pinatav1/pinatav1.go | 114 +++++++++++------- ipfs-api/types/constants.go | 2 +- ipfs-api/types/general.go | 10 +- 17 files changed, 192 insertions(+), 211 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 ipfs-api/cmd/ipfs-api/hello.txt delete mode 100644 ipfs-api/cmd/ipfs-api/key.txt delete mode 100644 ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt delete mode 100644 ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt create mode 100644 ipfs-api/pkg/cli/keys.go delete mode 100644 ipfs-api/pkg/ipfslog/test/main.go diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index f0eb9144..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch Package", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api", - "args": ["pin", "/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1", "-k", "/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/key.txt"], - } - ] -} \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md index e2ccbd37..d426e3ba 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,2 +1,5 @@ Features: -* Added ipfs-api cli tool for interacting dwith ipfs network through pinata.cloud \ No newline at end of file +* Ipfs-api: fixed issue with relative path +* Ipfs-api: extended keys handling +* Ipfs-api: return 1 on exit +* Ipfs-api: CIDv1 returned for directories \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/hello.txt b/ipfs-api/cmd/ipfs-api/hello.txt deleted file mode 100644 index b45ef6fe..00000000 --- a/ipfs-api/cmd/ipfs-api/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/key.txt b/ipfs-api/cmd/ipfs-api/key.txt deleted file mode 100644 index 6a6c08d4..00000000 --- a/ipfs-api/cmd/ipfs-api/key.txt +++ /dev/null @@ -1,3 +0,0 @@ -API Key: dbc635c1c1dd69a4a018 - API Secret: 5f0d5c97a474c91a3335886e60500851c767f62ba592904783398ea9f082fb1a - JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImRiYzYzNWMxYzFkZDY5YTRhMDE4Iiwic2NvcGVkS2V5U2VjcmV0IjoiNWYwZDVjOTdhNDc0YzkxYTMzMzU4ODZlNjA1MDA4NTFjNzY3ZjYyYmE1OTI5MDQ3ODMzOThlYTlmMDgyZmIxYSIsImlhdCI6MTY1NTI4OTQ2NX0.Zooi19QTZJDR6mueWpvAnD_qaG3T9LtPpInI_lTBrGo \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt b/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt deleted file mode 100644 index 0f9ef446..00000000 --- a/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt +++ /dev/null @@ -1 +0,0 @@ -test_file2 \ No newline at end of file diff --git a/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt b/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt deleted file mode 100644 index b86d8d51..00000000 --- a/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt +++ /dev/null @@ -1 +0,0 @@ -test_file1 \ No newline at end of file diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index 5b893434..d9e8f72d 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -2,17 +2,11 @@ package cli import ( - "bufio" - "os" - "strings" - - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - tp "github.com/kiracore/tools/ipfs-api/types" "github.com/spf13/cobra" ) var ( - keyPath string // Path to pinata keys + key string // Path to pinata keys gateway string // Pinata gateway to use wd bool // Wrap with dictionary representation c int8 // CID version integer representation @@ -23,48 +17,6 @@ var rootCmd = &cobra.Command{ Short: "IPFS API", } -// Parsing given path for pinata keys -// Valid file example: -// API Key: -// API Secret: -// JWT: -func grabKey(keyPath string) (tp.Keys, error) { - // checking if path to keys is valid - if _, err := os.Stat(keyPath); os.IsNotExist(err) { - log.Error("pin: provided path doesn't exist") - return tp.Keys{}, err - } - - file, err := os.Open(keyPath) - if err != nil { - log.Error("grabkey: unable to get key") - return tp.Keys{}, err - } - defer file.Close() - - scanner := bufio.NewScanner(file) - var res []string - - for scanner.Scan() { - newString := strings.Split(scanner.Text(), ":") - if len(newString) != 1 { - res = append(res, strings.TrimSpace(newString[1])) - } else { - log.Error("grabkey: failed to parse keys from file. invalid format\nexpected:\nAPI Key: value\nAPI Secret: value\nJWT: value") - return tp.Keys{}, err - } - - } - - key := tp.Keys{Api_key: res[0], Api_secret: res[1], JWT: res[2]} - if scanner.Err() != nil { - log.Error("err") - return tp.Keys{}, err - } - - return key, nil -} - //Main function to create cli func Start() { //Turn off completion @@ -72,14 +24,14 @@ func Start() { rootCmd.CompletionOptions.DisableDefaultCmd = true ///Adding flags - pinCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + pinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") pinCommand.Flags().BoolVarP(&wd, "wrap", "w", false, "Wrap with the directory") pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") - pinnedCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") - unpinCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") + pinnedCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") + unpinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") downloadCommand.PersistentFlags().StringVarP(&gateway, "gateway", "g", "https://gateway.pinata.cloud", "IPFS gateway") - downloadCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to your key") - testCommand.PersistentFlags().StringVarP(&keyPath, "key", "k", "", "path to yoour key") + downloadCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") + testCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") //Assembling commands rootCmd.AddCommand(cidZeroCommand) diff --git a/ipfs-api/pkg/cli/download.go b/ipfs-api/pkg/cli/download.go index cecb9732..3df37dfc 100644 --- a/ipfs-api/pkg/cli/download.go +++ b/ipfs-api/pkg/cli/download.go @@ -13,7 +13,7 @@ var downloadCommand = &cobra.Command{ } func cmdDownload(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(keyPath) + keys, _ := grabKey(key) pnt.Download(args, keys, gateway) return nil diff --git a/ipfs-api/pkg/cli/keys.go b/ipfs-api/pkg/cli/keys.go new file mode 100644 index 00000000..ed619f6c --- /dev/null +++ b/ipfs-api/pkg/cli/keys.go @@ -0,0 +1,93 @@ +package cli + +import ( + "bufio" + "encoding/json" + "io/fs" + "os" + "strings" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" +) + +func keyFromFile(path string, fi fs.FileInfo) (tp.Keys, error) { + var keys tp.Keys + + f, err := os.Open(path) + if err != nil { + log.Error("keyFromFile: can't open file") + os.Exit(1) + } + + if strings.Split(fi.Name(), ".")[1] == "json" { + b := make([]byte, fi.Size()) + rb, err := f.Read(b) + if err != nil { + log.Error("keyFromFile: can't read from file") + os.Exit(1) + } + + json.Unmarshal(b, &keys) + + log.Info("keyFromFile: read %v bytes", rb) + return keys, nil + + } else { + scanner := bufio.NewScanner(f) + var res []string + + for scanner.Scan() { + newString := strings.Split(scanner.Text(), ":") + if len(newString) != 1 { + res = append(res, strings.TrimSpace(newString[1])) + } else { + log.Error("keyFromFile: failed to parse keys from file. invalid format\nexpected:\nAPI Key: value\nAPI Secret: value\nJWT: value") + return keys, err + } + } + keys := tp.Keys{Api_key: res[0], Api_secret: res[1], JWT: res[2]} + return keys, nil + + } +} + +func keyFromString(key string) (tp.Keys, error) { + + k1 := strings.Split(key, " ") + k2 := strings.Split(key, ",") + + if len(k1) > 2 || len(k2) > 2 { + log.Error("keyFromString: format incorrect. expect: | key secret | key,secret | key, secret |") + os.Exit(1) + } + + if len(k2) > 1 { + + return tp.Keys{Api_key: strings.TrimSpace(k2[0]), Api_secret: strings.TrimSpace(k2[1])}, nil + + } else if len(k1) > 1 { + + return tp.Keys{Api_key: strings.TrimSpace(k1[0]), Api_secret: strings.TrimSpace(k1[1])}, nil + } else { + + return tp.Keys{JWT: strings.TrimSpace(key)}, nil + } + +} + +func grabKey(key string) (tp.Keys, error) { + if key == "" { + log.Error("grabKey: key can't be empty") + os.Exit(1) + } + if fi, err := os.Stat(key); err == nil { + + return keyFromFile(key, fi) + } else { + + return keyFromString(key) + + } + +} diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index 060b008f..3adfcb1b 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -2,6 +2,7 @@ package cli import ( "log" + "os" pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" tp "github.com/kiracore/tools/ipfs-api/types" @@ -19,10 +20,11 @@ func pinCmd(cmd *cobra.Command, args []string) error { if c != 1 && c != 0 { log.Fatalln("CID version value should be 0 or 1") } - keys, _ := grabKey(keyPath) + keys, _ := grabKey(key) tp.Opts = tp.PinataOptions{CidVersion: c, WrapWithDirectory: wd} if err := pnt.Pin(args, keys); err != nil { log.Fatalln("\033[31m", err) + os.Exit(1) } return nil } diff --git a/ipfs-api/pkg/cli/pinned.go b/ipfs-api/pkg/cli/pinned.go index 311adee8..b232d296 100644 --- a/ipfs-api/pkg/cli/pinned.go +++ b/ipfs-api/pkg/cli/pinned.go @@ -13,7 +13,7 @@ var pinnedCommand = &cobra.Command{ } func pinned(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(keyPath) + keys, _ := grabKey(key) pinatav1.Pinned(args, keys) return nil } diff --git a/ipfs-api/pkg/cli/test.go b/ipfs-api/pkg/cli/test.go index 5c3a1ebe..7ba28512 100644 --- a/ipfs-api/pkg/cli/test.go +++ b/ipfs-api/pkg/cli/test.go @@ -1,6 +1,8 @@ package cli import ( + "os" + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" "github.com/spf13/cobra" ) @@ -13,8 +15,9 @@ var testCommand = &cobra.Command{ } func test(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(keyPath) + keys, _ := grabKey(key) if err := pnt.Test(keys); err != nil { + os.Exit(1) return err } return nil diff --git a/ipfs-api/pkg/cli/unpin.go b/ipfs-api/pkg/cli/unpin.go index fa060f17..f1990063 100644 --- a/ipfs-api/pkg/cli/unpin.go +++ b/ipfs-api/pkg/cli/unpin.go @@ -13,7 +13,7 @@ var unpinCommand = &cobra.Command{ } func unpin(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(keyPath) + keys, _ := grabKey(key) if err := pnt.Unpin(args, keys); err != nil { return err } diff --git a/ipfs-api/pkg/ipfslog/test/main.go b/ipfs-api/pkg/ipfslog/test/main.go deleted file mode 100644 index 7f6de307..00000000 --- a/ipfs-api/pkg/ipfslog/test/main.go +++ /dev/null @@ -1,82 +0,0 @@ -package main - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "mime/multipart" - "net/http" - "net/http/httputil" - "os" - "path/filepath" -) - -func main() { - - url := "https://api.pinata.cloud/pinning/pinFileToIPFS" - method := "POST" - - payload := &bytes.Buffer{} - writer := multipart.NewWriter(payload) - - file, errFile1 := os.Open("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt") - defer file.Close() - part1, - errFile1 := writer.CreateFormFile("file", "dir/"+filepath.Base("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_file1.txt")) - _, errFile1 = io.Copy(part1, file) - if errFile1 != nil { - fmt.Println(errFile1) - return - } - _ = writer.WriteField("pinataOptions", "{\"cidVersion\": 1}") - _ = writer.WriteField("pinataMetadata", "{\"name\": \"MyFile\", \"keyvalues\": {\"company\": \"Pinata\"}}") - - file1, errFile2 := os.Open("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt") - defer file.Close() - part2, - errFile2 := writer.CreateFormFile("file", "dir/"+filepath.Base("/home/eugene/Code/go/src/github.com/kiracore/tools/ipfs-api/cmd/ipfs-api/test_dir1/test_dir_2/test_file2.txt")) - _, errFile2 = io.Copy(part2, file1) - if errFile2 != nil { - fmt.Println(errFile2) - return - } - _ = writer.WriteField("pinataOptions", "{\"cidVersion\": 1}") - _ = writer.WriteField("pinataMetadata", "{\"name\": \"MyFile\", \"keyvalues\": {\"company\": \"Pinata\"}}") - err := writer.Close() - if err != nil { - fmt.Println(err) - return - } - - client := &http.Client{} - req, err := http.NewRequest(method, url, payload) - - if err != nil { - fmt.Println(err) - return - } - req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImRiYzYzNWMxYzFkZDY5YTRhMDE4Iiwic2NvcGVkS2V5U2VjcmV0IjoiNWYwZDVjOTdhNDc0YzkxYTMzMzU4ODZlNjA1MDA4NTFjNzY3ZjYyYmE1OTI5MDQ3ODMzOThlYTlmMDgyZmIxYSIsImlhdCI6MTY1NTI4OTQ2NX0.Zooi19QTZJDR6mueWpvAnD_qaG3T9LtPpInI_lTBrGo") - - req.Header.Set("Content-Type", writer.FormDataContentType()) - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - fmt.Println(err) - - } - fmt.Println(string(requestDump)) - - res, err := client.Do(req) - if err != nil { - fmt.Println(err) - return - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(string(body)) -} diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index 716e84b8..c1b3a299 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -22,6 +22,17 @@ import ( "golang.org/x/net/http2" ) +func addKeysToHeader(req *http.Request, keys tp.Keys) { + if keys.JWT != "" { + + req.Header.Add("Authorization", "Bearer "+keys.JWT) + + } else { + req.Header.Add("pinata_api_key", keys.Api_key) + req.Header.Add("pinata_secret_api_key", keys.Api_secret) + } +} + //Creating tweaked client func NewClient() *http.Client { // Client params to be adjusted ... @@ -50,15 +61,16 @@ func Test(keys tp.Keys) error { req, err := http.NewRequest("GET", tp.BASE_URL+tp.TESTAUTH, nil) if err != nil { log.Error("test: something went wrong with request", err) + os.Exit(1) return err } - req.Header.Add("pinata_api_key", keys.Api_key) - req.Header.Add("pinata_secret_api_key", keys.Api_secret) + addKeysToHeader(req, keys) resp, err := c.Do(req) if err != nil { log.Error("test: didn't get any response", err) + os.Exit(1) return err } defer resp.Body.Close() @@ -67,6 +79,7 @@ func Test(keys tp.Keys) error { bytes, err := io.ReadAll(resp.Body) if err != nil { log.Error("test: can't read the request body", err) + os.Exit(1) return err } @@ -75,6 +88,7 @@ func Test(keys tp.Keys) error { e := json.Unmarshal(bytes, &r) if e != nil { log.Error("Test: failed to unmarshal json", e) + os.Exit(1) return e } log.Info(r.Message) @@ -87,10 +101,11 @@ func Test(keys tp.Keys) error { func setPinataOptions(bw *multipart.Writer, c int8, w bool) error { v, err := json.Marshal(tp.Opts) if err != nil { + os.Exit(1) return err } - fmt.Println(string(v)) bw.WriteField(tp.PINATAOPTS, string(v)) + return nil } @@ -99,6 +114,7 @@ func setPinataMetadata(bw *multipart.Writer, fi fs.FileInfo, d map[string]string m := tp.PinataMetadata{Name: fi.Name(), KeyValues: d} s, err := json.Marshal(m) if err != nil { + os.Exit(1) return err } @@ -113,17 +129,15 @@ func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { f, err := os.Open(filePath.AbsoultePath) if err != nil { log.Error("addform: can't open the file") + os.Exit(1) return err } - // fi, err := f.Stat() - // if err != nil { - // log.Error("addform: can't read stats from the given path") - // return err - // } - //MIME Header setup + // if err := setPinataOptions(bw, 1, false); err != nil { + // log.Error("addform: failed to add pinataOptions to the for. %v", err) + // } h := make(textproto.MIMEHeader) h.Set("Content-Disposition", @@ -146,26 +160,21 @@ func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { // creating writer for multipart request bodyWriter := multipart.NewWriter(pipeWriter) - // Adding data-form with metadata and option fields - // NB! Ready types for this entry are ready in pkg types - if err := setPinataOptions(bodyWriter, 1, false); err != nil { - log.Error("addform: failed to add pinataOptions to the for. %v", err) - } - d := make(map[string]string) - - if err := setPinataMetadata(bodyWriter, filePaths[0].Info, d); err != nil { - log.Error("addform: failed to add pinataMetadata to the for. %v", err) - - } - - // calling for a goroutine to add all forms found by walker for _, t := range filePaths { fmt.Println(t.Path) } go func() { + if err := setPinataOptions(bodyWriter, 1, false); err != nil { + log.Error("addform: failed to add pinataOptions to the for. %v", err) + os.Exit(1) + } + // if err := setPinataMetadata(bodyWriter, fi, d); err != nil { + // log.Error("addform: failed to add pinataMetadata to the for. %v", err) + // } for _, filePath := range filePaths { if err := addForm(bodyWriter, filePath); err != nil { log.Error("createbody: failed to add form to multipart request") + os.Exit(1) return } @@ -184,6 +193,11 @@ func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { //Parsing directory tree recursively. NB: SLOW func walker(rootDir string) []tp.ExtendedFileInfo { + ap, err := filepath.Abs(rootDir) + if err != nil { + log.Error("walker: failed to get absolute path") + os.Exit(1) + } var wg sync.WaitGroup var efi = []tp.ExtendedFileInfo{} @@ -191,26 +205,28 @@ func walker(rootDir string) []tp.ExtendedFileInfo { // calling for a goroutine which will yield res through chan wg.Add(1) go func() { - base := filepath.Base(rootDir) + "/" - err := filepath.Walk(rootDir, func(path string, info fs.FileInfo, err error) error { + base := filepath.Base(ap) + "/" + err := filepath.Walk(ap, func(path string, info fs.FileInfo, err error) error { if err != nil { + os.Exit(1) return err } if !info.IsDir() { - rel, err := filepath.Rel(rootDir, path) + rel, err := filepath.Rel(ap, path) if err != nil { log.Error("walker: can't get relative path for %v. err: %v", path, err) + os.Exit(1) } fn := filepath.Clean(base + rel) - efi = append(efi, tp.ExtendedFileInfo{Info: info, Path: fn, AbsoultePath: rootDir}) + efi = append(efi, tp.ExtendedFileInfo{Info: info, Path: fn, AbsoultePath: ap}) } - // wout <- fn + ":" + path return nil }) if err != nil { + os.Exit(1) return } wg.Done() @@ -227,6 +243,7 @@ func Pin(args []string, keys tp.Keys) error { // checking if the path is valid and file/folder exist if _, err := os.Stat(path); os.IsNotExist(err) { log.Error("pin: provided path doesn't exist") + os.Exit(1) return err } // parsing the tree @@ -236,6 +253,7 @@ func Pin(args []string, keys tp.Keys) error { contType, reader, err := createReqBody(filePaths) if err != nil { log.Error("pin: failed to create body") + os.Exit(1) return err } log.Info("createReqBody ok\n") @@ -244,14 +262,11 @@ func Pin(args []string, keys tp.Keys) error { req, err := http.NewRequest("POST", tp.BASE_URL+tp.PINFILE, reader) if err != nil { log.Error("pin: failed to assemble request") + os.Exit(1) return err } - //adding headers - - // req.Header.Add("pinata_api_key", keys.Api_key) - // req.Header.Add("pinata_secret_api_key", keys.Api_secret) - req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImRiYzYzNWMxYzFkZDY5YTRhMDE4Iiwic2NvcGVkS2V5U2VjcmV0IjoiNWYwZDVjOTdhNDc0YzkxYTMzMzU4ODZlNjA1MDA4NTFjNzY3ZjYyYmE1OTI5MDQ3ODMzOThlYTlmMDgyZmIxYSIsImlhdCI6MTY1NTI4OTQ2NX0.Zooi19QTZJDR6mueWpvAnD_qaG3T9LtPpInI_lTBrGo") + addKeysToHeader(req, keys) req.Header.Add("Content-Type", contType) client := NewClient() @@ -269,6 +284,7 @@ func Pin(args []string, keys tp.Keys) error { resp, err := client.Do(req) if err != nil { log.Error("pin: request send error:", err) + os.Exit(1) return err } @@ -279,6 +295,7 @@ func Pin(args []string, keys tp.Keys) error { bytes, err := io.ReadAll(resp.Body) if err != nil { log.Error("pin: can't read the request body %v", err) + os.Exit(1) } // Parsing response @@ -286,6 +303,7 @@ func Pin(args []string, keys tp.Keys) error { e := json.Unmarshal(bytes, &r) if e != nil { log.Error("pin: failed to unmarshal json from response %v", e) + os.Exit(1) } log.Info("Finished successfully...\nCID: %v\nsize: %v\ntime: %v\nduplicate: %v", r.IpfsHash, r.PinSize, r.Timestamp, r.Duplicate) @@ -295,6 +313,7 @@ func Pin(args []string, keys tp.Keys) error { bytes, err := io.ReadAll(resp.Body) if err != nil { log.Error("pin: can't read the request body %v", err) + os.Exit(1) } log.Error("pin: request body: %v", string(bytes)) } @@ -309,15 +328,18 @@ func Unpin(args []string, keys tp.Keys) error { req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) if err != nil { log.Error("unpin: failed to assemble request ") + os.Exit(1) return err } - req.Header.Add("pinata_api_key", keys.Api_key) - req.Header.Add("pinata_secret_api_key", keys.Api_secret) + // req.Header.Add("pinata_api_key", keys.Api_key) + // req.Header.Add("pinata_secret_api_key", keys.Api_secret) + addKeysToHeader(req, keys) resp, err := c.Do(req) if err != nil { log.Error("unpin: didn't get any response", err) + os.Exit(1) return err } defer resp.Body.Close() @@ -326,12 +348,14 @@ func Unpin(args []string, keys tp.Keys) error { bytes, err := io.ReadAll(resp.Body) if err != nil { log.Error("unpin: can't read the request body", err) + os.Exit(1) return err } log.Info("deleted. CID: %v. Server response: %v", args[0], string(bytes)) } else { log.Error("unpin: file/Folder could NOT be unpinned or deleted from IPFS") + os.Exit(1) return err } return nil @@ -346,6 +370,7 @@ func GetCidV1(b []byte) (cid.Cid, error) { } c, err := builder.Sum(b) if err != nil { + os.Exit(1) return cid.Cid{}, err } return c, nil @@ -356,6 +381,7 @@ func GetCidV0(b []byte) (cid.Cid, error) { builder := cid.V0Builder{} c, err := builder.Sum(b) if err != nil { + os.Exit(1) return cid.Cid{}, err } return c, nil @@ -368,10 +394,12 @@ func Pinned(args []string, keys tp.Keys) { req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) if err != nil { + os.Exit(1) return } - req.Header.Add("pinata_api_key", keys.Api_key) - req.Header.Add("pinata_secret_api_key", keys.Api_secret) + // req.Header.Add("pinata_api_key", keys.Api_key) + // req.Header.Add("pinata_secret_api_key", keys.Api_secret) + addKeysToHeader(req, keys) param := req.URL.Query() param.Add("hashContains", args[0]) @@ -381,6 +409,7 @@ func Pinned(args []string, keys tp.Keys) { if err != nil { log.Error("didn't get any response", err) + os.Exit(1) } defer resp.Body.Close() @@ -388,11 +417,13 @@ func Pinned(args []string, keys tp.Keys) { bytes, err := io.ReadAll(resp.Body) if err != nil { log.Error("can't read the request body", err) + os.Exit(1) } log.Info("file exists: %v. %v", args[0], string(bytes)) } else { log.Error("file with CID %v doesn't exist", args[0]) + os.Exit(1) } } @@ -403,33 +434,32 @@ func Download(args []string, keys tp.Keys, gateway string) { req, err := http.NewRequest(http.MethodGet, gateway+"/ipfs/"+args[0], nil) if err != nil { + os.Exit(1) return } - req.Header.Add("pinata_api_key", keys.Api_key) - req.Header.Add("pinata_secret_api_key", keys.Api_secret) + addKeysToHeader(req, keys) f, err := os.Create(args[0]) if err != nil { log.Error("download: failed to create file/folder") + os.Exit(1) return } resp, err := c.Do(req) if err != nil { log.Error("download: failed to get the response") + os.Exit(1) return } if _, err = io.Copy(f, resp.Body); err != nil { log.Error("download: failed to io.Copy") + os.Exit(1) } defer resp.Body.Close() r, _ := io.ReadAll(resp.Body) fmt.Println(string(r)) } - -func PostDownloadCheck(args []string) { - -} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 322ff671..5d5039f1 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.4" + IpfsApiVersion = "v0.0.5" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/ipfs-api/types/general.go b/ipfs-api/types/general.go index 847d9e15..2dd962cc 100644 --- a/ipfs-api/types/general.go +++ b/ipfs-api/types/general.go @@ -1,11 +1,13 @@ package types -import "io/fs" +import ( + "io/fs" +) type Keys struct { - Api_key string - Api_secret string - JWT string + Api_key string `json:"api_key,omitempty"` + Api_secret string `json:"api_secret,omitempty"` + JWT string `json:"jwt,omitempty"` } type ExtendedFileInfo struct { From a379bbc5736fbb1ba30e00334b06e47c40a2fb50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Mon, 20 Jun 2022 15:44:20 +0200 Subject: [PATCH 087/140] added jsoin output, verbosity, installation script --- RELEASE.md | 7 +- ipfs-api/README.md | 46 ++--------- ipfs-api/cmd/ipfs-api/main.go | 5 ++ ipfs-api/go.sum | 8 ++ ipfs-api/pkg/cli/cli.go | 7 +- ipfs-api/pkg/cli/keys.go | 3 + ipfs-api/pkg/ipfslog/ipfslog.go | 15 ++-- ipfs-api/pkg/pinatav1/pinatav1.go | 100 ++--------------------- ipfs-api/pkg/pinatav1/pinatav1_pinned.go | 79 ++++++++++++++++++ ipfs-api/pkg/pinatav1/pinatav1_unpin.go | 72 ++++++++++++++++ ipfs-api/types/constants.go | 2 +- ipfs-api/types/general.go | 14 ++++ ipfs-api/types/msg.go | 33 +++++++- scripts/version.sh | 2 +- 14 files changed, 246 insertions(+), 147 deletions(-) create mode 100644 ipfs-api/pkg/pinatav1/pinatav1_pinned.go create mode 100644 ipfs-api/pkg/pinatav1/pinatav1_unpin.go diff --git a/RELEASE.md b/RELEASE.md index d426e3ba..4cb145bc 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,4 @@ Features: -* Ipfs-api: fixed issue with relative path -* Ipfs-api: extended keys handling -* Ipfs-api: return 1 on exit -* Ipfs-api: CIDv1 returned for directories \ No newline at end of file +* added installation script to readme +* added json output from all commands +* added verbosity level diff --git a/ipfs-api/README.md b/ipfs-api/README.md index f998b878..0b337776 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -10,51 +10,21 @@ Get the repo from github. git clone https://github.com/KiraCore/tools.git ` -### Prerequisites - -To build the app you need the golang to be preinstalled. - -``` -https://go.dev/doc/install -``` - -Check for updates and install building essentials -` -sudo apt update -sudo apt install build-essential -sudo apt upgrsde -y - -` - ### Installing -Check the latest branch. It should start from v ... - -` -git branch -r | grep v0 -` - -Switch for the latest branch. +Installation script: -` -git checkout origin/v0... -` +``` +TOOLS_VERSION="v0.1.6-rc.3" && rm -rfv /tmp/ipfs-api && \ + safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ + dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ + ipfs-api version + ``` -after this step just enter the ipfs-api directory and execute: -` -make build -` -the executable will appear in the tools/ipfs-api/bin directory +## Use -Make sure it has an executable permission: -` -chmod +x tools/ipfs-api/bin/ipfs-api -` -``` -Give the example -``` ## Built With diff --git a/ipfs-api/cmd/ipfs-api/main.go b/ipfs-api/cmd/ipfs-api/main.go index 0275b028..6c9b3854 100644 --- a/ipfs-api/cmd/ipfs-api/main.go +++ b/ipfs-api/cmd/ipfs-api/main.go @@ -2,9 +2,14 @@ package main import ( "github.com/kiracore/tools/ipfs-api/pkg/cli" + "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" ) func main() { cli.Start() + if tp.V != 0 { + ipfslog.Log.SetLevel(tp.LogLevelMap[tp.V]) + } } diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum index b18f073c..d8099f9a 100644 --- a/ipfs-api/go.sum +++ b/ipfs-api/go.sum @@ -21,6 +21,7 @@ github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ8 github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= +github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= github.com/multiformats/go-multihash v0.1.0 h1:CgAgwqk3//SVEw3T+6DqI4mWMyRuDwZtOWcJT0q9+EA= github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= @@ -43,17 +44,24 @@ golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 h1:0qjDla5xICC2suMtyRH/QqX3B1btXTfNsIt/i4LFgO0= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index d9e8f72d..635ff05e 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -2,6 +2,7 @@ package cli import ( + tp "github.com/kiracore/tools/ipfs-api/types" "github.com/spf13/cobra" ) @@ -10,6 +11,7 @@ var ( gateway string // Pinata gateway to use wd bool // Wrap with dictionary representation c int8 // CID version integer representation + v int32 ) var rootCmd = &cobra.Command{ @@ -24,8 +26,8 @@ func Start() { rootCmd.CompletionOptions.DisableDefaultCmd = true ///Adding flags + rootCmd.PersistentFlags().Int32VarP(&v, "verbose", "v", 0, "Verbosity of the output from 0..5 ") pinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") - pinCommand.Flags().BoolVarP(&wd, "wrap", "w", false, "Wrap with the directory") pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") pinnedCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") unpinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") @@ -43,4 +45,7 @@ func Start() { rootCmd.AddCommand(downloadCommand) rootCmd.AddCommand(testCommand) cobra.CheckErr(rootCmd.Execute()) + + // setting verbosity level + tp.V = v } diff --git a/ipfs-api/pkg/cli/keys.go b/ipfs-api/pkg/cli/keys.go index ed619f6c..d4816b32 100644 --- a/ipfs-api/pkg/cli/keys.go +++ b/ipfs-api/pkg/cli/keys.go @@ -11,6 +11,7 @@ import ( tp "github.com/kiracore/tools/ipfs-api/types" ) +// Gets keys value from plain text or json file func keyFromFile(path string, fi fs.FileInfo) (tp.Keys, error) { var keys tp.Keys @@ -52,6 +53,7 @@ func keyFromFile(path string, fi fs.FileInfo) (tp.Keys, error) { } } +// Gets keys from string provided by user func keyFromString(key string) (tp.Keys, error) { k1 := strings.Split(key, " ") @@ -76,6 +78,7 @@ func keyFromString(key string) (tp.Keys, error) { } +// grabKey chooses source to parse and provide keys func grabKey(key string) (tp.Keys, error) { if key == "" { log.Error("grabKey: key can't be empty") diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go index 70ad9f5b..b22cdf2e 100644 --- a/ipfs-api/pkg/ipfslog/ipfslog.go +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -6,27 +6,28 @@ import ( "github.com/sirupsen/logrus" ) -var log *logrus.Logger +var Log *logrus.Logger func init() { - log = logrus.New() - log.SetLevel(5) + + Log = logrus.New() + } // TODO: add colored output for critical information func Info(format string, v ...interface{}) { - log.Infof(format, v...) + Log.Infof(format, v...) } func Warn(format string, v ...interface{}) { - log.Warnf(format, v...) + Log.Warnf(format, v...) } func Debug(format string, v ...interface{}) { - log.Debugf(format, v...) + Log.Debugf(format, v...) } func Error(format string, v ...interface{}) { - log.Errorf(format, v...) + Log.Errorf(format, v...) } diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index c1b3a299..73710270 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -22,6 +22,7 @@ import ( "golang.org/x/net/http2" ) +// Adding authentication method from given input, json or plain text file func addKeysToHeader(req *http.Request, keys tp.Keys) { if keys.JWT != "" { @@ -98,6 +99,8 @@ func Test(keys tp.Keys) error { } // Adding pinataOptions to the request. +// func using external variable tp.Opts to write +// user input data func setPinataOptions(bw *multipart.Writer, c int8, w bool) error { v, err := json.Marshal(tp.Opts) if err != nil { @@ -124,8 +127,8 @@ func setPinataMetadata(bw *multipart.Writer, fi fs.FileInfo, d map[string]string // Adding HTML form to multipart body func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { - // wrap in struct + // wrap in struct f, err := os.Open(filePath.AbsoultePath) if err != nil { log.Error("addform: can't open the file") @@ -134,11 +137,6 @@ func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { } - //MIME Header setup - // if err := setPinataOptions(bw, 1, false); err != nil { - // log.Error("addform: failed to add pinataOptions to the for. %v", err) - // } - h := make(textproto.MIMEHeader) h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, filePath.Path)) @@ -160,17 +158,12 @@ func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { // creating writer for multipart request bodyWriter := multipart.NewWriter(pipeWriter) - for _, t := range filePaths { - fmt.Println(t.Path) - } go func() { if err := setPinataOptions(bodyWriter, 1, false); err != nil { log.Error("addform: failed to add pinataOptions to the for. %v", err) os.Exit(1) } - // if err := setPinataMetadata(bodyWriter, fi, d); err != nil { - // log.Error("addform: failed to add pinataMetadata to the for. %v", err) - // } + for _, filePath := range filePaths { if err := addForm(bodyWriter, filePath); err != nil { log.Error("createbody: failed to add form to multipart request") @@ -278,7 +271,7 @@ func Pin(args []string, keys tp.Keys) error { fmt.Println(err) } - fmt.Println(string(requestDump)) + log.Debug(string(requestDump)) // sending request resp, err := client.Do(req) @@ -306,6 +299,7 @@ func Pin(args []string, keys tp.Keys) error { os.Exit(1) } log.Info("Finished successfully...\nCID: %v\nsize: %v\ntime: %v\nduplicate: %v", r.IpfsHash, r.PinSize, r.Timestamp, r.Duplicate) + fmt.Println(string(bytes)) } else { // if something unexpected received in the response body @@ -321,46 +315,6 @@ func Pin(args []string, keys tp.Keys) error { return nil } -// Deleting data from pinata.cloud by hash (CID) -func Unpin(args []string, keys tp.Keys) error { - c := NewClient() - - req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) - if err != nil { - log.Error("unpin: failed to assemble request ") - os.Exit(1) - return err - } - // req.Header.Add("pinata_api_key", keys.Api_key) - // req.Header.Add("pinata_secret_api_key", keys.Api_secret) - addKeysToHeader(req, keys) - - resp, err := c.Do(req) - - if err != nil { - log.Error("unpin: didn't get any response", err) - os.Exit(1) - return err - } - defer resp.Body.Close() - - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("unpin: can't read the request body", err) - os.Exit(1) - return err - } - log.Info("deleted. CID: %v. Server response: %v", args[0], string(bytes)) - - } else { - log.Error("unpin: file/Folder could NOT be unpinned or deleted from IPFS") - os.Exit(1) - return err - } - return nil -} - // GetCidV1 accept byte slice and count hash sum func GetCidV1(b []byte) (cid.Cid, error) { builder := cid.V1Builder{ @@ -388,46 +342,6 @@ func GetCidV0(b []byte) (cid.Cid, error) { } -//Checking data if it is pinned on pinata.cloud -func Pinned(args []string, keys tp.Keys) { - c := NewClient() - - req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) - if err != nil { - os.Exit(1) - return - } - // req.Header.Add("pinata_api_key", keys.Api_key) - // req.Header.Add("pinata_secret_api_key", keys.Api_secret) - addKeysToHeader(req, keys) - - param := req.URL.Query() - param.Add("hashContains", args[0]) - req.URL.RawQuery = param.Encode() - - resp, err := c.Do(req) - - if err != nil { - log.Error("didn't get any response", err) - os.Exit(1) - } - defer resp.Body.Close() - - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("can't read the request body", err) - os.Exit(1) - } - log.Info("file exists: %v. %v", args[0], string(bytes)) - - } else { - log.Error("file with CID %v doesn't exist", args[0]) - os.Exit(1) - } - -} - //Downloading data. TODO: adding download for directories func Download(args []string, keys tp.Keys, gateway string) { c := NewClient() diff --git a/ipfs-api/pkg/pinatav1/pinatav1_pinned.go b/ipfs-api/pkg/pinatav1/pinatav1_pinned.go new file mode 100644 index 00000000..8c3deb82 --- /dev/null +++ b/ipfs-api/pkg/pinatav1/pinatav1_pinned.go @@ -0,0 +1,79 @@ +package pinatav1 + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "net/http/httputil" + "os" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" +) + +//Checking data if it is pinned on pinata.cloud +func Pinned(args []string, keys tp.Keys) { + c := NewClient() + + req, err := http.NewRequest("GET", "https://api.pinata.cloud/data/pinList", nil) + if err != nil { + os.Exit(1) + return + } + // req.Header.Add("pinata_api_key", keys.Api_key) + // req.Header.Add("pinata_secret_api_key", keys.Api_secret) + addKeysToHeader(req, keys) + + param := req.URL.Query() + param.Add("hashContains", args[0]) + req.URL.RawQuery = param.Encode() + + resp, err := c.Do(req) + if err != nil { + log.Error("didn't get any response", err) + os.Exit(1) + } + defer resp.Body.Close() + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + + } + + log.Debug(string(requestDump)) + + r := tp.PinnedResponse{} + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("can't read the request body", err) + os.Exit(1) + } + + er := json.Unmarshal(bytes, &r) + if er != nil { + log.Error("pinned: failed to unmarshal json: %v", er) + os.Exit(1) + + } + + log.Info("pinned: address exists: %v", args[0]) + j, err := json.Marshal(r) + if err != nil { + log.Error("pinned: failed to marshal json: %v", err) + } + //fmt.Println(string(bytes)) + //fmt.Println() + fmt.Println(string(j)) + + } else { + + log.Error("file with CID %v doesn't exist", args[0]) + bytes, _ := io.ReadAll(resp.Body) + + fmt.Println(string(bytes)) + os.Exit(1) + } + +} diff --git a/ipfs-api/pkg/pinatav1/pinatav1_unpin.go b/ipfs-api/pkg/pinatav1/pinatav1_unpin.go new file mode 100644 index 00000000..2bc83547 --- /dev/null +++ b/ipfs-api/pkg/pinatav1/pinatav1_unpin.go @@ -0,0 +1,72 @@ +package pinatav1 + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "os" + "time" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" +) + +// Deleting data from pinata.cloud by hash (CID) +func Unpin(args []string, keys tp.Keys) error { + c := NewClient() + + req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) + if err != nil { + log.Error("unpin: failed to assemble request ") + os.Exit(1) + return err + } + + addKeysToHeader(req, keys) + + resp, err := c.Do(req) + + if err != nil { + log.Error("unpin: didn't get any response", err) + os.Exit(1) + return err + } + defer resp.Body.Close() + r := tp.UnpinResponse{} + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("unpin: can't read the request body", err) + os.Exit(1) + return err + } + log.Info("deleted. CID: %v. Server response: %v", args[0], string(bytes)) + r.Success = true + r.Hash = args[0] + r.Time = time.Now() + j, err := json.Marshal(r) + if err != nil { + log.Error("unpin: failed to marshal") + os.Exit(1) + } + + fmt.Println(string(j)) + + } else { + log.Error("unpin: file/folder can't be unpinned. doesn't exist or deleted.") + r.Success = false + r.Hash = args[0] + r.Time = time.Now() + j, err := json.Marshal(r) + if err != nil { + log.Error("unpin: failed to marshal") + os.Exit(1) + } + + fmt.Println(string(j)) + os.Exit(1) + return err + } + return nil +} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 5d5039f1..0a404d96 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.5" + IpfsApiVersion = "v0.0.6" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/ipfs-api/types/general.go b/ipfs-api/types/general.go index 2dd962cc..04e41646 100644 --- a/ipfs-api/types/general.go +++ b/ipfs-api/types/general.go @@ -2,6 +2,8 @@ package types import ( "io/fs" + + "github.com/sirupsen/logrus" ) type Keys struct { @@ -15,3 +17,15 @@ type ExtendedFileInfo struct { Path string AbsoultePath string } + +var LogLevelMap = []logrus.Level{ + 1: logrus.TraceLevel, + 2: logrus.DebugLevel, + 3: logrus.InfoLevel, + 4: logrus.WarnLevel, + 5: logrus.ErrorLevel, + 6: logrus.FatalLevel, + 7: logrus.PanicLevel, +} + +var V int32 diff --git a/ipfs-api/types/msg.go b/ipfs-api/types/msg.go index 1b1ea96e..3f546d93 100644 --- a/ipfs-api/types/msg.go +++ b/ipfs-api/types/msg.go @@ -1,5 +1,7 @@ package types +import "time" + // TODO: Parse responses from each call type TestResponse struct { Message string `json:"message"` @@ -12,15 +14,42 @@ type PinResponse struct { PinSize int64 `json:"pinsize"` } +type UnpinResponse struct { + Success bool `json:"success"` + Hash string `json:"hash"` + Time time.Time `json:"time"` +} + type PinataMetadata struct { Name string `json:"name"` // By default name of the file/directory KeyValues map[string]string `json:"keyvalues"` // Some additional data } type PinataOptions struct { - WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash - CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice + WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash + CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice + Regions Regions `json:"regions,omitempty"` +} +type Regions struct { + RegionId string `json:"regionId,omitempty"` + CurrentRC int16 `json:"currentReplicationCount,omitempty"` + DesiredRC int16 `json:"desiredReplicationCount,omitempty"` +} + +type Rows struct { + Id string `json:"id,omitempty"` + CID string `json:"ipfs_pin_hash,omitempty"` + UserId string `json:"user_id,omitempty"` + Size int16 `json:"size,omitempty"` + Date time.Time `json:"date_pinned,omitempty"` + DateUnpin time.Time `json:"date_unpinned,omitempty"` + Metadata PinataMetadata `json:"metadata,omitempty"` + Regions []Regions `json:"regions,omitempty"` +} +type PinnedResponse struct { + Count int16 `json:"count,omitempty"` + Rows []Rows `json:"rows,omitempty"` } var Opts PinataOptions diff --git a/scripts/version.sh b/scripts/version.sh index 3569234c..3d0e719e 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.6-rc.02" +echo "v0.1.6-rc.3" From a025bc2ef6647a3998107c99b1fd307e4b3aadac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Tue, 21 Jun 2022 19:08:05 +0200 Subject: [PATCH 088/140] fix dir missread path --- ipfs-api/cmd/ipfs-api/main.go | 5 ---- ipfs-api/go.mod | 7 ++++- ipfs-api/go.sum | 24 +++++++++++++-- ipfs-api/pkg/ipfslog/ipfslog.go | 1 + ipfs-api/pkg/pinatav1/pinatav1.go | 38 +++++++++++++----------- ipfs-api/pkg/pinatav1/pinatav1_pinned.go | 5 ++-- ipfs-api/pkg/pinatav2/pinatav2.go | 19 ++++++++++++ ipfs-api/types/constants.go | 2 +- 8 files changed, 73 insertions(+), 28 deletions(-) create mode 100644 ipfs-api/pkg/pinatav2/pinatav2.go diff --git a/ipfs-api/cmd/ipfs-api/main.go b/ipfs-api/cmd/ipfs-api/main.go index 6c9b3854..0275b028 100644 --- a/ipfs-api/cmd/ipfs-api/main.go +++ b/ipfs-api/cmd/ipfs-api/main.go @@ -2,14 +2,9 @@ package main import ( "github.com/kiracore/tools/ipfs-api/pkg/cli" - "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - tp "github.com/kiracore/tools/ipfs-api/types" ) func main() { cli.Start() - if tp.V != 0 { - ipfslog.Log.SetLevel(tp.LogLevelMap[tp.V]) - } } diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index 42b039b6..c1bc4e2f 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -5,6 +5,7 @@ go 1.17 require ( github.com/ipfs/go-cid v0.2.0 github.com/multiformats/go-multihash v0.1.0 + github.com/schollz/progressbar/v3 v3.8.6 github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 @@ -13,17 +14,21 @@ require ( require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/sha256-simd v1.0.0 // indirect + github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect github.com/multiformats/go-varint v0.0.6 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf // indirect + golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum index d8099f9a..038aaeb6 100644 --- a/ipfs-api/go.sum +++ b/ipfs-api/go.sum @@ -1,17 +1,24 @@ github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= +github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -28,7 +35,11 @@ github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2 github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/schollz/progressbar/v3 v3.8.6 h1:QruMUdzZ1TbEP++S1m73OqRJk20ON11m6Wqv4EoGg8c= +github.com/schollz/progressbar/v3 v3.8.6/go.mod h1:W5IEwbJecncFGBvuEh4A7HT1nZZ6WNIL2i3qbnI0WKY= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -37,28 +48,37 @@ github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE= +golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 h1:0qjDla5xICC2suMtyRH/QqX3B1btXTfNsIt/i4LFgO0= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go index b22cdf2e..80fdf990 100644 --- a/ipfs-api/pkg/ipfslog/ipfslog.go +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -11,6 +11,7 @@ var Log *logrus.Logger func init() { Log = logrus.New() + Log.SetLevel(logrus.InfoLevel) } diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index 73710270..c5bf7b37 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,7 +8,6 @@ import ( "io/fs" "mime/multipart" "net/http" - "net/http/httputil" "net/textproto" "os" "path/filepath" @@ -131,7 +130,7 @@ func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { // wrap in struct f, err := os.Open(filePath.AbsoultePath) if err != nil { - log.Error("addform: can't open the file") + log.Error("addform: can't open the file %v", filePath.AbsoultePath) os.Exit(1) return err @@ -141,21 +140,27 @@ func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, filePath.Path)) h.Set("Content-Type", "application/octet-stream") + content, _ := bw.CreatePart(h) + d, err := io.Copy(content, f) - io.Copy(content, f) + if err != nil { + log.Error("addForm: failed to copy data: %v", err) + } else { + log.Info("addForm: uploaded file %v: bytes : %v", filePath.Path, d) + } - defer f.Close() + f.Close() return nil } //Wrapping HTML forms in the request body func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { - // creating a pipe pipeReader, pipeWriter := io.Pipe() // creating writer for multipart request + bodyWriter := multipart.NewWriter(pipeWriter) go func() { @@ -171,7 +176,6 @@ func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { return } - log.Info("pinned: %v", filePath.Info.Name()) } @@ -187,6 +191,7 @@ func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { //Parsing directory tree recursively. NB: SLOW func walker(rootDir string) []tp.ExtendedFileInfo { ap, err := filepath.Abs(rootDir) + base := filepath.Base(ap) if err != nil { log.Error("walker: failed to get absolute path") os.Exit(1) @@ -195,10 +200,9 @@ func walker(rootDir string) []tp.ExtendedFileInfo { var wg sync.WaitGroup var efi = []tp.ExtendedFileInfo{} - // calling for a goroutine which will yield res through chan wg.Add(1) go func() { - base := filepath.Base(ap) + "/" + err := filepath.Walk(ap, func(path string, info fs.FileInfo, err error) error { if err != nil { os.Exit(1) @@ -206,13 +210,13 @@ func walker(rootDir string) []tp.ExtendedFileInfo { } if !info.IsDir() { rel, err := filepath.Rel(ap, path) + if err != nil { log.Error("walker: can't get relative path for %v. err: %v", path, err) os.Exit(1) } - fn := filepath.Clean(base + rel) - efi = append(efi, tp.ExtendedFileInfo{Info: info, Path: fn, AbsoultePath: ap}) - + fn := filepath.Clean(base + "/" + rel) + efi = append(efi, tp.ExtendedFileInfo{Info: info, Path: fn, AbsoultePath: path}) } return nil @@ -249,7 +253,7 @@ func Pin(args []string, keys tp.Keys) error { os.Exit(1) return err } - log.Info("createReqBody ok\n") + log.Info("pin: body formed\n") // forming request req, err := http.NewRequest("POST", tp.BASE_URL+tp.PINFILE, reader) @@ -266,12 +270,12 @@ func Pin(args []string, keys tp.Keys) error { // Printing request with all data for debugging - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - fmt.Println(err) + // requestDump, err := httputil.DumpRequest(req, true) + // if err != nil { + // fmt.Println(err) - } - log.Debug(string(requestDump)) + // } + // log.Debug(string(requestDump)) // sending request resp, err := client.Do(req) diff --git a/ipfs-api/pkg/pinatav1/pinatav1_pinned.go b/ipfs-api/pkg/pinatav1/pinatav1_pinned.go index 8c3deb82..639e87ab 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1_pinned.go +++ b/ipfs-api/pkg/pinatav1/pinatav1_pinned.go @@ -37,8 +37,9 @@ func Pinned(args []string, keys tp.Keys) { defer resp.Body.Close() requestDump, err := httputil.DumpRequest(req, true) if err != nil { - fmt.Println(err) - + log.Error("pin: failed to dump request log") + } else { + log.Debug(string(requestDump)) } log.Debug(string(requestDump)) diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go new file mode 100644 index 00000000..81d8af51 --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -0,0 +1,19 @@ +// Refactoring, not used +package pinatav2 + +type Keys struct { + api_key string + api_secret string + jwt string +} + +type PinataApi struct { + keys Keys +} + +func (p PinataApi) AddKeys() PinataApi { + keys := func() Keys { + return Keys{api_key: "", api_secret: "", jwt: ""} + }() + return PinataApi{keys: keys} +} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 0a404d96..9fd54631 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.6" + IpfsApiVersion = "v0.0.7" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" From 002bae16cf8e61d1820f3a1ffb35408c69d7110b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 22 Jun 2022 08:39:52 +0200 Subject: [PATCH 089/140] fix dir read path, loglevel --- RELEASE.md | 2 ++ ipfs-api/go.mod | 6 +---- ipfs-api/go.sum | 13 ---------- ipfs-api/pkg/cli/pin.go | 14 ++++++++--- ipfs-api/pkg/pinatav1/pinatav1.go | 41 +++++++++++++++++++++++++++++++ scripts/version.sh | 2 +- 6 files changed, 55 insertions(+), 23 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 4cb145bc..bb41faeb 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,3 +2,5 @@ Features: * added installation script to readme * added json output from all commands * added verbosity level +* added pinned endpoint data structure + diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index c1bc4e2f..89065ace 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -5,7 +5,6 @@ go 1.17 require ( github.com/ipfs/go-cid v0.2.0 github.com/multiformats/go-multihash v0.1.0 - github.com/schollz/progressbar/v3 v3.8.6 github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 @@ -14,21 +13,18 @@ require ( require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/klauspost/cpuid/v2 v2.0.9 // indirect - github.com/mattn/go-runewidth v0.0.13 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/sha256-simd v1.0.0 // indirect - github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect github.com/multiformats/go-varint v0.0.6 // indirect - github.com/rivo/uniseg v0.2.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/testify v1.3.0 // indirect golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum index 038aaeb6..ee846e3f 100644 --- a/ipfs-api/go.sum +++ b/ipfs-api/go.sum @@ -6,19 +6,13 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= -github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -35,11 +29,7 @@ github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2 github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/schollz/progressbar/v3 v3.8.6 h1:QruMUdzZ1TbEP++S1m73OqRJk20ON11m6Wqv4EoGg8c= -github.com/schollz/progressbar/v3 v3.8.6/go.mod h1:W5IEwbJecncFGBvuEh4A7HT1nZZ6WNIL2i3qbnI0WKY= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -68,13 +58,10 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index 3adfcb1b..bad600d3 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -10,10 +10,11 @@ import ( ) var pinCommand = &cobra.Command{ - Use: "pin --key=", - Short: "File/folder upload and pin", - Long: "File/folder upload and pin", - RunE: pinCmd, + Use: "pin --key=", + Short: "File/folder upload and pin", + Long: "File/folder upload and pin", + PreRunE: checkName, + RunE: pinCmd, } func pinCmd(cmd *cobra.Command, args []string) error { @@ -28,3 +29,8 @@ func pinCmd(cmd *cobra.Command, args []string) error { } return nil } +func checkName(cmd *cobra.Command, args []string) error { + keys, _ := grabKey(key) + pnt.GetHashByName(args, keys) + return nil +} diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index c5bf7b37..1cc5ccb0 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,6 +8,7 @@ import ( "io/fs" "mime/multipart" "net/http" + "net/http/httputil" "net/textproto" "os" "path/filepath" @@ -234,6 +235,46 @@ func walker(rootDir string) []tp.ExtendedFileInfo { } +func GetHashByName(args []string, keys tp.Keys) { + if args[1] != "" { + c := NewClient() + req, err := http.NewRequest("GET", tp.BASE_URL+tp.PINNEDDATA+"?metadata[name]="+args[1], nil) + if err != nil { + log.Error("GetHashByName: failed to assemble request: %v", err) + os.Exit(1) + } + //q := req.URL.Query() + //q.Add("metadata[name]", args[1]) + + addKeysToHeader(req, keys) + //req.URL.RawQuery = q.Encode() + resp, err := c.Do(req) + if err != nil { + log.Error("GetHashByName: failed to ger response: %v", err) + os.Exit(1) + } + defer resp.Body.Close() + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Error("pin: can't read the request body %v", err) + os.Exit(1) + } + // Printing request with all data for debugging + + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) + + } + fmt.Println(string(requestDump)) + + // sending request + fmt.Println(string(bytes)) + + } + +} + //Pins given file/directory to pinata.cloud service using api v1 func Pin(args []string, keys tp.Keys) error { path := args[0] diff --git a/scripts/version.sh b/scripts/version.sh index 3d0e719e..a956765b 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.6-rc.3" +echo "v0.1.6-rc.4" From 2d31eee9c691366472690f5d657139e75b2d6e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 22 Jun 2022 08:50:53 +0200 Subject: [PATCH 090/140] fix len, version, output --- ipfs-api/README.md | 2 +- ipfs-api/pkg/pinatav1/pinatav1.go | 13 ++++++------- ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 0b337776..55758361 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.1.6-rc.3" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.1.6-rc.5" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index 1cc5ccb0..f828bfa0 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,7 +8,6 @@ import ( "io/fs" "mime/multipart" "net/http" - "net/http/httputil" "net/textproto" "os" "path/filepath" @@ -236,7 +235,7 @@ func walker(rootDir string) []tp.ExtendedFileInfo { } func GetHashByName(args []string, keys tp.Keys) { - if args[1] != "" { + if len(args) > 1 { c := NewClient() req, err := http.NewRequest("GET", tp.BASE_URL+tp.PINNEDDATA+"?metadata[name]="+args[1], nil) if err != nil { @@ -261,12 +260,12 @@ func GetHashByName(args []string, keys tp.Keys) { } // Printing request with all data for debugging - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - fmt.Println(err) + // requestDump, err := httputil.DumpRequest(req, true) + // if err != nil { + // fmt.Println(err) - } - fmt.Println(string(requestDump)) + // } + // fmt.Println(string(requestDump)) // sending request fmt.Println(string(bytes)) diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 9fd54631..bc0d849b 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.7" + IpfsApiVersion = "v0.0.8" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index a956765b..2be23506 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.6-rc.4" +echo "v0.1.6-rc.5" From 846a9a98853f4266857812e1b4325178f2ab0ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 22 Jun 2022 10:20:05 +0200 Subject: [PATCH 091/140] added metadata field --- ipfs-api/README.md | 2 +- ipfs-api/pkg/pinatav1/pinatav1.go | 8 +- ipfs-api/pkg/pinatav2/pinatav2.go | 13 --- ipfs-api/pkg/pinatav2/pinatav2_keys.go | 117 ++++++++++++++++++++ ipfs-api/pkg/pinatav2/pinatav2_keys_test.go | 7 ++ ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 7 files changed, 133 insertions(+), 18 deletions(-) create mode 100644 ipfs-api/pkg/pinatav2/pinatav2_keys.go create mode 100644 ipfs-api/pkg/pinatav2/pinatav2_keys_test.go diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 55758361..eaccf8ce 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.1.6-rc.5" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.1.7-rc.6" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index f828bfa0..bc169b56 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -156,7 +156,7 @@ func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { } //Wrapping HTML forms in the request body -func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { +func createReqBody(args []string, filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { // creating a pipe pipeReader, pipeWriter := io.Pipe() // creating writer for multipart request @@ -168,6 +168,10 @@ func createReqBody(filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { log.Error("addform: failed to add pinataOptions to the for. %v", err) os.Exit(1) } + if len(args) > 1 { + bodyWriter.WriteField(tp.PINATAMETA, fmt.Sprintf(`{name: %v, keyvalues: {}}`, args[1])) + + } for _, filePath := range filePaths { if err := addForm(bodyWriter, filePath); err != nil { @@ -287,7 +291,7 @@ func Pin(args []string, keys tp.Keys) error { filePaths := walker(path) // creating requestbody - contType, reader, err := createReqBody(filePaths) + contType, reader, err := createReqBody(args, filePaths) if err != nil { log.Error("pin: failed to create body") os.Exit(1) diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index 81d8af51..0a01742f 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -1,19 +1,6 @@ // Refactoring, not used package pinatav2 -type Keys struct { - api_key string - api_secret string - jwt string -} - type PinataApi struct { keys Keys } - -func (p PinataApi) AddKeys() PinataApi { - keys := func() Keys { - return Keys{api_key: "", api_secret: "", jwt: ""} - }() - return PinataApi{keys: keys} -} diff --git a/ipfs-api/pkg/pinatav2/pinatav2_keys.go b/ipfs-api/pkg/pinatav2/pinatav2_keys.go new file mode 100644 index 00000000..5a686ef9 --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinatav2_keys.go @@ -0,0 +1,117 @@ +package pinatav2 + +import ( + "bufio" + "encoding/json" + "io/fs" + "os" + "strings" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" +) + +// Secured keys struct. Can't be changed anywhere. +// Should only be passed as a copy. +type Keys struct { + api_key string + api_secret string + jwt string +} + +// Structure for parsing keys provided in json +// Should only be passed as a copy. +type KeysJSON struct { + Api_key string `json:"api_key,omitempty"` + Api_secret string `json:"api_secret,omitempty"` + Jwt string `json:"jwt,omitempty"` +} + +func (k Keys) Add(key string, secret string, jwt string) Keys { + return Keys{api_key: key, api_secret: secret, jwt: jwt} +} + +func keyFromFile(path string, fi fs.FileInfo) (Keys, error) { + var keysJson KeysJSON + var keys Keys + + f, err := os.Open(path) + if err != nil { + log.Error("keyFromFile: can't open file") + os.Exit(1) + } + + if strings.Split(fi.Name(), ".")[1] == "json" { + b := make([]byte, fi.Size()) + rb, err := f.Read(b) + if err != nil { + log.Error("keyFromFile: can't read from file") + os.Exit(1) + } + + json.Unmarshal(b, &keysJson) + + log.Info("keyFromFile: read %v bytes", rb) + + return keys.Add(keysJson.Api_key, keysJson.Api_secret, keysJson.Jwt), nil + + } else { + scanner := bufio.NewScanner(f) + var res []string + + for scanner.Scan() { + newString := strings.Split(scanner.Text(), ":") + if len(newString) != 1 { + res = append(res, strings.TrimSpace(newString[1])) + } else { + log.Error("keyFromFile: failed to parse keys from file. invalid format\nexpected:\nAPI Key: value\nAPI Secret: value\nJWT: value") + return keys, err + } + } + + return keys.Add(res[0], res[1], res[2]), nil + + } +} + +// Gets keys from string provided by user +func keyFromString(key string) (Keys, error) { + var keys Keys + + k1 := strings.Split(key, " ") + k2 := strings.Split(key, ",") + + if len(k1) > 2 || len(k2) > 2 { + log.Error("keyFromString: format incorrect. expect: | key secret | key,secret | key, secret |") + os.Exit(1) + } + + if len(k2) > 1 { + + return keys.Add(strings.TrimSpace(k2[0]), strings.TrimSpace(k2[1]), ""), nil + + } else if len(k1) > 1 { + + return keys.Add(strings.TrimSpace(k1[0]), strings.TrimSpace(k1[1]), ""), nil + } else { + + return keys.Add("", "", strings.TrimSpace(key)), nil + } + +} + +// grabKey chooses source to parse and provide keys +func grabKey(key string) (Keys, error) { + if key == "" { + log.Error("grabKey: key can't be empty") + os.Exit(1) + } + if fi, err := os.Stat(key); err == nil { + + return keyFromFile(key, fi) + } else { + + return keyFromString(key) + + } + +} diff --git a/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go b/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go new file mode 100644 index 00000000..cf12ebce --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go @@ -0,0 +1,7 @@ +package pinatav2 + +import "testing" + +func TestKeysFromJsonKeySecret(t *testing.T) { + +} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index bc0d849b..609775c7 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.8" + IpfsApiVersion = "v0.0.9" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index 2be23506..70c8c78a 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.6-rc.5" +echo "v0.1.7-rc.6" From 8701af89be01d15661ed1d1799ac64ae46e2791e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 22 Jun 2022 10:42:06 +0200 Subject: [PATCH 092/140] fix log, metadata --- RELEASE.md | 6 ++---- ipfs-api/README.md | 2 +- ipfs-api/pkg/ipfslog/ipfslog.go | 5 ++++- ipfs-api/pkg/pinatav1/pinatav1.go | 25 +++++++++++++------------ ipfs-api/pkg/pinatav2/pinatav2_keys.go | 2 ++ ipfs-api/testing/test_keys.txt | 1 + ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 8 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 ipfs-api/testing/test_keys.txt diff --git a/RELEASE.md b/RELEASE.md index bb41faeb..e36c6c6d 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,4 @@ Features: -* added installation script to readme -* added json output from all commands -* added verbosity level -* added pinned endpoint data structure +* fix metadat, log + diff --git a/ipfs-api/README.md b/ipfs-api/README.md index eaccf8ce..54d78362 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.1.7-rc.6" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.1.8-rc.7" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go index 80fdf990..e2705813 100644 --- a/ipfs-api/pkg/ipfslog/ipfslog.go +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -3,6 +3,8 @@ package ipfslog import ( + "io/ioutil" + "github.com/sirupsen/logrus" ) @@ -11,7 +13,8 @@ var Log *logrus.Logger func init() { Log = logrus.New() - Log.SetLevel(logrus.InfoLevel) + Log.SetLevel(logrus.TraceLevel) + Log.Out = ioutil.Discard } diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index bc169b56..d0bf956d 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -8,6 +8,7 @@ import ( "io/fs" "mime/multipart" "net/http" + "net/http/httputil" "net/textproto" "os" "path/filepath" @@ -169,7 +170,7 @@ func createReqBody(args []string, filePaths []tp.ExtendedFileInfo) (string, io.R os.Exit(1) } if len(args) > 1 { - bodyWriter.WriteField(tp.PINATAMETA, fmt.Sprintf(`{name: %v, keyvalues: {}}`, args[1])) + bodyWriter.WriteField(tp.PINATAMETA, fmt.Sprintf(`{"name":"%v","keyvalues": {}}`, args[1])) } @@ -257,11 +258,11 @@ func GetHashByName(args []string, keys tp.Keys) { os.Exit(1) } defer resp.Body.Close() - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("pin: can't read the request body %v", err) - os.Exit(1) - } + // bytes, err := io.ReadAll(resp.Body) + // if err != nil { + // log.Error("pin: can't read the request body %v", err) + // os.Exit(1) + // } // Printing request with all data for debugging // requestDump, err := httputil.DumpRequest(req, true) @@ -272,7 +273,7 @@ func GetHashByName(args []string, keys tp.Keys) { // fmt.Println(string(requestDump)) // sending request - fmt.Println(string(bytes)) + //fmt.Println(string(bytes)) } @@ -314,12 +315,12 @@ func Pin(args []string, keys tp.Keys) error { // Printing request with all data for debugging - // requestDump, err := httputil.DumpRequest(req, true) - // if err != nil { - // fmt.Println(err) + requestDump, err := httputil.DumpRequest(req, true) + if err != nil { + fmt.Println(err) - // } - // log.Debug(string(requestDump)) + } + log.Debug(string(requestDump)) // sending request resp, err := client.Do(req) diff --git a/ipfs-api/pkg/pinatav2/pinatav2_keys.go b/ipfs-api/pkg/pinatav2/pinatav2_keys.go index 5a686ef9..33f0f799 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2_keys.go +++ b/ipfs-api/pkg/pinatav2/pinatav2_keys.go @@ -26,6 +26,8 @@ type KeysJSON struct { Jwt string `json:"jwt,omitempty"` } + + func (k Keys) Add(key string, secret string, jwt string) Keys { return Keys{api_key: key, api_secret: secret, jwt: jwt} } diff --git a/ipfs-api/testing/test_keys.txt b/ipfs-api/testing/test_keys.txt new file mode 100644 index 00000000..3ef394d3 --- /dev/null +++ b/ipfs-api/testing/test_keys.txt @@ -0,0 +1 @@ +eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImI4ZTEwNTZiNWFmY2ZhYmE5OWI1Iiwic2NvcGVkS2V5U2VjcmV0IjoiNzRmMjA0Yzk2MDBlNTc5ZjM3ZmM3YzEzNzdhM2ZkYmY5MGY4ODZhM2JiZjAyODFlYWE0MGQzM2E5ZmMyYTA1OCIsImlhdCI6MTY1NTg4NjUyOX0.KUq6PPMJI6nyRL_SIK8V0AdUjdGNSo_6LwoiJy0Vwbo diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 609775c7..9a1e03b8 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.9" + IpfsApiVersion = "v0.0.10" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index 70c8c78a..f875c41d 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.7-rc.6" +echo "v0.1.8-rc.7" From 3ce8a12700c5edef7d0d6b1c0cfd26896a894e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Wed, 22 Jun 2022 23:58:35 +0200 Subject: [PATCH 093/140] refactored to v2 --- ipfs-api/dump.log | 35 +++ ipfs-api/pkg/cli/cli.go | 16 +- ipfs-api/pkg/cli/pin.go | 82 +++++-- ipfs-api/pkg/cli/test.go | 22 +- ipfs-api/pkg/ipfslog/ipfslog.go | 5 +- ipfs-api/pkg/pinatav1/pinatav1.go | 1 - ipfs-api/pkg/pinatav2/pinata2_dirwalker.go | 55 +++++ ipfs-api/pkg/pinatav2/pinata2_efi.go | 14 ++ ipfs-api/pkg/pinatav2/pinata2_header.go | 12 + ipfs-api/pkg/pinatav2/pinata2_pinata_api.go | 252 ++++++++++++++++++++ ipfs-api/pkg/pinatav2/pinatav2.go | 92 ++++++- ipfs-api/pkg/pinatav2/pinatav2_keys.go | 43 ++-- ipfs-api/pkg/pinatav2/pinatav2_keys_test.go | 66 ++++- ipfs-api/pkg/pinatav2/pinatav2_request.go | 25 ++ ipfs-api/testing/test_keys.txt | 1 - ipfs-api/tests/keys/test_keys_j.txt | 3 + ipfs-api/tests/keys/test_keys_ks.txt | 4 + ipfs-api/tests/keys/test_keys_ksj.txt | 5 + ipfs-api/types/general.go | 14 +- 19 files changed, 673 insertions(+), 74 deletions(-) create mode 100644 ipfs-api/dump.log create mode 100644 ipfs-api/pkg/pinatav2/pinata2_dirwalker.go create mode 100644 ipfs-api/pkg/pinatav2/pinata2_efi.go create mode 100644 ipfs-api/pkg/pinatav2/pinata2_header.go create mode 100644 ipfs-api/pkg/pinatav2/pinata2_pinata_api.go create mode 100644 ipfs-api/pkg/pinatav2/pinatav2_request.go delete mode 100644 ipfs-api/testing/test_keys.txt create mode 100644 ipfs-api/tests/keys/test_keys_j.txt create mode 100644 ipfs-api/tests/keys/test_keys_ks.txt create mode 100644 ipfs-api/tests/keys/test_keys_ksj.txt diff --git a/ipfs-api/dump.log b/ipfs-api/dump.log new file mode 100644 index 00000000..c99f954f --- /dev/null +++ b/ipfs-api/dump.log @@ -0,0 +1,35 @@ +POST /pinning/pinFileToIPFS HTTP/1.1 +Host: api.pinata.cloud +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6IjZkYzA3ZWQ0YjQ3MzBhZDBmYThmIiwic2NvcGVkS2V5U2VjcmV0IjoiYjgzMmQ0ZTk5MDBkNDBmM2MzODJjYTNkZjM0ZjkyZjNiNjBhMDY3YzllZDE2NWNlYzBhNjE4MWIxMzk5YzEyMiIsImlhdCI6MTY1NTcwNjk0Mn0.275ZMx9dEwInnfcKWtwSIAbtkyYNbwEQRm4bPS9vaVE +Content-Type: multipart/form-data; boundary=83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 + +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 +Content-Disposition: form-data; name="pinataOptions" + +{"wrapWithDirectory":false,"cidVersion":1,"regions":{}} +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 +Content-Disposition: form-data; name="pinataMetadata" + +{"name":"tra-la-la","keyvalues":null} +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 +Content-Disposition: form-data; name="file"; filename="test_dir/test_dir2/test_dir2/test_file2.txt" +Content-Type: application/octet-stream + + +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 +Content-Disposition: form-data; name="file"; filename="test_dir/test_dir2/test_file2.txt" +Content-Type: application/octet-stream + + +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 +Content-Disposition: form-data; name="file"; filename="test_dir/test_file.json" +Content-Type: application/octet-stream + +{"wrapWithDirectory":false,"cidVersion":1,"regions":{}} + +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 +Content-Disposition: form-data; name="file"; filename="test_dir/test_file1.txt" +Content-Type: application/octet-stream + + +--83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347-- diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index 635ff05e..d21c9370 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -2,16 +2,16 @@ package cli import ( - tp "github.com/kiracore/tools/ipfs-api/types" "github.com/spf13/cobra" ) var ( - key string // Path to pinata keys - gateway string // Pinata gateway to use - wd bool // Wrap with dictionary representation - c int8 // CID version integer representation - v int32 + key string // Path to pinata keys + gateway string // Pinata gateway to use + meta string + path string + c int8 // CID version integer representation + verbosity int32 ) var rootCmd = &cobra.Command{ @@ -26,7 +26,7 @@ func Start() { rootCmd.CompletionOptions.DisableDefaultCmd = true ///Adding flags - rootCmd.PersistentFlags().Int32VarP(&v, "verbose", "v", 0, "Verbosity of the output from 0..5 ") + rootCmd.PersistentFlags().Int32VarP(&verbosity, "verbose", "v", 0, "Verbosity of the output from 0..5 ") pinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") pinnedCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") @@ -47,5 +47,5 @@ func Start() { cobra.CheckErr(rootCmd.Execute()) // setting verbosity level - tp.V = v + } diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index bad600d3..e4f7defe 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -1,36 +1,76 @@ package cli import ( - "log" - "os" + "fmt" - pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" - tp "github.com/kiracore/tools/ipfs-api/types" + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" "github.com/spf13/cobra" ) +func matchAll(checks ...cobra.PositionalArgs) cobra.PositionalArgs { + return func(cmd *cobra.Command, args []string) error { + for _, check := range checks { + if err := check(cmd, args); err != nil { + return err + } + } + return nil + } +} + var pinCommand = &cobra.Command{ - Use: "pin --key=", - Short: "File/folder upload and pin", - Long: "File/folder upload and pin", - PreRunE: checkName, - RunE: pinCmd, + Use: "pin --key=", + Short: "File/folder upload and pin", + Long: "File/folder upload and pin", + Args: matchAll(cobra.MinimumNArgs(1), cobra.MaximumNArgs(2)), + RunE: pinCmd, } +// func pinCmd(cmd *cobra.Command, args []string) error { +// if c != 1 && c != 0 { +// log.Fatalln("CID version value should be 0 or 1") +// } +// keys, _ := grabKey(key) +// tp.Opts = tp.PinataOptions{CidVersion: c, WrapWithDirectory: wd} +// if err := pnt.Pin(args, keys); err != nil { +// log.Fatalln("\033[31m", err) +// os.Exit(1) +// } +// return nil +// } +// func checkName(cmd *cobra.Command, args []string) error { +// keys, _ := grabKey(key) +// pnt.GetHashByName(args, keys) +// return nil +// } func pinCmd(cmd *cobra.Command, args []string) error { - if c != 1 && c != 0 { - log.Fatalln("CID version value should be 0 or 1") + keys, err := pnt.GrabKey(key) + if err != nil { + log.Error("grabKey: failed to get keys: %v", err) + return err } - keys, _ := grabKey(key) - tp.Opts = tp.PinataOptions{CidVersion: c, WrapWithDirectory: wd} - if err := pnt.Pin(args, keys); err != nil { - log.Fatalln("\033[31m", err) - os.Exit(1) + p := pnt.PinataApi{} + fmt.Println(meta, path) + p.SetKeys(keys) + p.Dump() + switch len(args) { + case 1: + { + err := p.Pin(args[0]) + if err != nil { + log.Error("pin failed %v", err) + } + } + case 2: + { + p.SetMetaName(args[1]) + err := p.Pin(args[0]) + if err != nil { + log.Error("pin failed %v", err) + } + } } - return nil -} -func checkName(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(key) - pnt.GetHashByName(args, keys) + return nil } diff --git a/ipfs-api/pkg/cli/test.go b/ipfs-api/pkg/cli/test.go index 7ba28512..4df52556 100644 --- a/ipfs-api/pkg/cli/test.go +++ b/ipfs-api/pkg/cli/test.go @@ -3,7 +3,8 @@ package cli import ( "os" - pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" "github.com/spf13/cobra" ) @@ -15,10 +16,23 @@ var testCommand = &cobra.Command{ } func test(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(key) - if err := pnt.Test(keys); err != nil { + keys, err := pnt.GrabKey(key) + if err != nil { + log.Error("grabKey: failed to get keys: %v", err) os.Exit(1) - return err } + if !keys.Check() { + log.Error("Keys not provided") + os.Exit(1) + } + + p := pnt.PinataApi{} + p.SetKeys(keys) + er := p.Test() + if er != nil { + os.Exit(1) + } + return nil + } diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go index e2705813..2a3268a2 100644 --- a/ipfs-api/pkg/ipfslog/ipfslog.go +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -3,8 +3,6 @@ package ipfslog import ( - "io/ioutil" - "github.com/sirupsen/logrus" ) @@ -13,8 +11,7 @@ var Log *logrus.Logger func init() { Log = logrus.New() - Log.SetLevel(logrus.TraceLevel) - Log.Out = ioutil.Discard + Log.SetLevel(logrus.DebugLevel) } diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go index d0bf956d..e547d034 100644 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ b/ipfs-api/pkg/pinatav1/pinatav1.go @@ -264,7 +264,6 @@ func GetHashByName(args []string, keys tp.Keys) { // os.Exit(1) // } // Printing request with all data for debugging - // requestDump, err := httputil.DumpRequest(req, true) // if err != nil { // fmt.Println(err) diff --git a/ipfs-api/pkg/pinatav2/pinata2_dirwalker.go b/ipfs-api/pkg/pinatav2/pinata2_dirwalker.go new file mode 100644 index 00000000..e9d93182 --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinata2_dirwalker.go @@ -0,0 +1,55 @@ +package pinatav2 + +import ( + "io/fs" + "os" + "path/filepath" + "sync" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" +) + +func (w *Walker) Walk(rootDir string) error { + ap, err := filepath.Abs(rootDir) + base := filepath.Base(ap) + if err != nil { + return err + } + + var wg sync.WaitGroup + var efi = []ExtendedFileInfo{} + + wg.Add(1) + go func() { + + err := filepath.Walk(ap, func(path string, info fs.FileInfo, err error) error { + if err != nil { + os.Exit(1) + return err + } + if !info.IsDir() { + rel, err := filepath.Rel(ap, path) + + if err != nil { + log.Error("walker: can't get relative path for %v. err: %v", path, err) + os.Exit(1) + } + fn := filepath.Clean(base + "/" + rel) + e := ExtendedFileInfo{} + efi = append(efi, e.Set(info, fn, path)) + } + + return nil + + }) + if err != nil { + os.Exit(1) + return + } + wg.Done() + }() + wg.Wait() + w.bulk = efi + return nil + +} diff --git a/ipfs-api/pkg/pinatav2/pinata2_efi.go b/ipfs-api/pkg/pinatav2/pinata2_efi.go new file mode 100644 index 00000000..9843fe6e --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinata2_efi.go @@ -0,0 +1,14 @@ +package pinatav2 + +import "io/fs" + +func (e ExtendedFileInfo) Set(fs fs.FileInfo, p string, ap string) ExtendedFileInfo { + return ExtendedFileInfo{info: fs, path: p, absoultePath: ap} +} +func (e ExtendedFileInfo) Abs() string { + return e.absoultePath +} + +func (e ExtendedFileInfo) Path() string { + return e.path +} diff --git a/ipfs-api/pkg/pinatav2/pinata2_header.go b/ipfs-api/pkg/pinatav2/pinata2_header.go new file mode 100644 index 00000000..340f9538 --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinata2_header.go @@ -0,0 +1,12 @@ +package pinatav2 + +func (h *Header) Init() { + if h.keys.jwt != "" { + + h.header.Add("Authorization", "Bearer "+h.keys.jwt) + + } else { + h.header.Add("pinata_api_key", h.keys.api_key) + h.header.Add("pinata_secret_api_key", h.keys.api_secret) + } +} diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go new file mode 100644 index 00000000..ba8da71d --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go @@ -0,0 +1,252 @@ +package pinatav2 + +import ( + "crypto/tls" + "encoding/json" + "errors" + "fmt" + "io" + "mime/multipart" + "os" + + "net/http" + "net/http/httputil" + "net/textproto" + "time" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" + tp "github.com/kiracore/tools/ipfs-api/types" + "golang.org/x/net/http2" +) + +// Setting new client for an Api +func (p *PinataApi) newClient() { + + // Client params to be adjusted ... + tr := &http.Transport{ + MaxIdleConnsPerHost: 100, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + ExpectContinueTimeout: 5 * time.Second, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + } + http2.ConfigureTransport(tr) + p.client = http.Client{ + Timeout: 100 * time.Second, + Transport: tr, + } + +} + +// Adding keys to request header +func (p *PinataApi) SetKeys(keys Keys) { + p.request.header.keys = keys + p.newClient() + p.SetOptsDefault() +} + +// Sending GET request to check authorization +func (p *PinataApi) Test() error { + req, err := p.request.Get(tp.BASE_URL + tp.TESTAUTH) + if err != nil { + log.Debug("Ipfs-api: test: invalid request: %v", err) + return err + } + p.request.dump = *req + resp, err := p.client.Do(req) + if err != nil { + log.Debug("Ipfs-api: test: invalid response: %v", err) + return err + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusOK { + bytes, err := io.ReadAll(resp.Body) + if err != nil { + log.Debug("Ipfs-api: test: failed to read response: %v", err) + return err + } + fmt.Println(string(bytes)) + } + + return nil +} + +func (p *PinataApi) Pin(path string) error { + if _, err := os.Stat(path); os.IsNotExist(err) { + log.Error("pin: provided path doesn't exist") + return err + } + err := p.walker.Walk(path) + if err != nil { + return err + } + c, r, err := p.createBody() + if err != nil { + return err + } + req, err := p.request.Post(tp.BASE_URL+tp.PINFILE, &r) + if err != nil { + return err + } + + req.Header.Add("Content-Type", c) + if p.dump { + rd, err := httputil.DumpRequest(req, true) + if err != nil { + return err + } + f, err := os.Create("./dump.log") + if err != nil { + return err + } + f.Write(rd) + f.Close() + } + + resp, err := p.client.Do(req) + if err != nil { + log.Debug("Ipfs-api: pin: invalid response: %v", err) + return err + } + defer resp.Body.Close() + + b, _ := io.ReadAll(resp.Body) + p.SaveResp(b) + p.SetRespCode(resp.StatusCode) + pr := PinResponseJSON{} + if err := json.Unmarshal(b, &pr); err != nil { + return err + } + + if resp.StatusCode == http.StatusOK { + + if err != nil { + log.Debug("Ipfs-api: test: failed to read response: %v", err) + return err + } + j, err := json.Marshal(pr) + if err != nil { + return err + } + fmt.Println(string(j)) + } else { + fmt.Println(string(b)) + } + + return nil +} + +func (p *PinataApi) createBody() (string, io.Reader, error) { + + pr, pw := io.Pipe() + bw := multipart.NewWriter(pw) + + go func() { + + bw.WriteField(tp.PINATAOPTS, p.GetOpts()) + + if p.CheckMeta() { + bw.WriteField(tp.PINATAMETA, p.GetMeta()) + } + + for _, p := range p.walker.bulk { + f, err := os.Open(p.Abs()) + if err != nil { + log.Error("failed to open %v", p.Abs()) + os.Exit(1) // return error + } + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", + fmt.Sprintf(`form-data; name="file"; filename="%s"`, p.Path())) + h.Set("Content-Type", "application/octet-stream") + + c, err := bw.CreatePart(h) + if err != nil { + log.Error("failed to create part") + os.Exit(1) + } + d, err := io.Copy(c, f) + if err != nil { + log.Error("failed to copy content") + os.Exit(1) + } else { + log.Debug("uploaded file %v: bytes : %v", p.Path(), d) + } + f.Close() + + } + + bw.Close() + pw.Close() + + }() + return bw.FormDataContentType(), pr, nil + +} + +func (p *PinataApi) SetOpts(c int8, b bool) error { + if c >= 0 && c < 2 { + p.opts.cidVersion = c + } else { + return errors.New("CID version should be 0 or 1") + } + if b && !b { + p.opts.wrapWithDirectory = b + } else { + return errors.New("accept bool value true or false") + } + return nil +} + +func (p *PinataApi) SetOptsDefault() { + p.SetOpts(1, false) +} + +func (p *PinataApi) GetOpts() string { + o := PinataOptionsJSON{WrapWithDirectory: p.opts.wrapWithDirectory, CidVersion: p.opts.cidVersion} + j, err := json.Marshal(o) + if err != nil { + log.Error("failed to get options") + } + return string(j) +} + +func (p *PinataApi) GetMeta() string { + m := PinataMetadataJSON{Name: p.meta.name, KeyValues: p.meta.keyValues} + j, err := json.Marshal(m) + if err != nil { + log.Error("failed to get options") + } + return string(j) +} + +func (p *PinataApi) SetMetaName(n string) error { + if len(n) != 0 && len(n) <= 250 { + p.meta.name = n + return nil + } else { + return errors.New("provided name should be from 1 to 250 chars long") + } + +} +func (p *PinataApi) CheckMeta() bool { + if len(p.meta.name) > 1 || len(p.meta.keyValues) > 1 { + return true + } else { + return false + } +} + +func (p *PinataApi) Dump() { + p.dump = true +} + +func (p *PinataApi) SetRespCode(code int) { + p.respCode = code +} +func (p *PinataApi) SaveResp(resp []byte) { + p.resp = resp +} diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index 0a01742f..956d4934 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -1,6 +1,96 @@ // Refactoring, not used package pinatav2 +import ( + "io/fs" + "net/http" +) + +type PinResponseJSON struct { + Duplicate bool `json:"isduplicate,omitempty"` + IpfsHash string `json:"hash"` + Timestamp string `json:"timestamp"` + PinSize int64 `json:"pinsize"` +} +type PinResponse struct { + duplicate bool `json:"isDuplicate,omitempty"` + ipfsHash string `json:"ipfshash"` + timestamp string `json:"timestamp"` + pinSize int64 `json:"pinsize"` +} + +type PinataMetadataJSON struct { + Name string `json:"name"` // By default name of the file/directory + KeyValues map[string]string `json:"keyvalues"` // Some additional data +} + +type PinataMetadata struct { + name string `json:"name"` + keyValues map[string]string `json:"keyvalues"` +} + +type RegionsJSON struct { + RegionId string `json:"regionId,omitempty"` + CurrentRC int16 `json:"currentReplicationCount,omitempty"` + DesiredRC int16 `json:"desiredReplicationCount,omitempty"` +} + +type Regions struct { + regionId string `json:"regionId,omitempty"` + currentRC int16 `json:"currentReplicationCount,omitempty"` + desiredRC int16 `json:"desiredReplicationCount,omitempty"` +} + +type PinataOptionsJSON struct { + WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash + CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice + Regions Regions `json:"regions,omitempty"` +} + +type PinataOptions struct { + wrapWithDirectory bool // Adds availability to address dir name instead of hash + cidVersion int8 // 0 or 1 Returns CID version of a choice + regions Regions +} + +type ExtendedFileInfo struct { + info fs.FileInfo + path string + absoultePath string +} +type Walker struct { + bulk []ExtendedFileInfo +} + +type KeysJSON struct { + Api_key string `json:"api_key,omitempty"` + Api_secret string `json:"api_secret,omitempty"` + Jwt string `json:"jwt,omitempty"` +} +type Keys struct { + set bool + api_key string + api_secret string + jwt string +} + +type Header struct { + keys Keys + header http.Header +} + +type Request struct { + header Header + dump http.Request +} + type PinataApi struct { - keys Keys + client http.Client + request Request + walker Walker + opts PinataOptions + meta PinataMetadata + resp []byte + dump bool + respCode int } diff --git a/ipfs-api/pkg/pinatav2/pinatav2_keys.go b/ipfs-api/pkg/pinatav2/pinatav2_keys.go index 33f0f799..245d721c 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2_keys.go +++ b/ipfs-api/pkg/pinatav2/pinatav2_keys.go @@ -3,6 +3,7 @@ package pinatav2 import ( "bufio" "encoding/json" + "errors" "io/fs" "os" "strings" @@ -10,28 +11,14 @@ import ( log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" ) -// Secured keys struct. Can't be changed anywhere. -// Should only be passed as a copy. -type Keys struct { - api_key string - api_secret string - jwt string -} - -// Structure for parsing keys provided in json -// Should only be passed as a copy. -type KeysJSON struct { - Api_key string `json:"api_key,omitempty"` - Api_secret string `json:"api_secret,omitempty"` - Jwt string `json:"jwt,omitempty"` -} - - - func (k Keys) Add(key string, secret string, jwt string) Keys { return Keys{api_key: key, api_secret: secret, jwt: jwt} } +func (k Keys) Check() bool { + return k.set +} + func keyFromFile(path string, fi fs.FileInfo) (Keys, error) { var keysJson KeysJSON var keys Keys @@ -69,8 +56,11 @@ func keyFromFile(path string, fi fs.FileInfo) (Keys, error) { return keys, err } } - - return keys.Add(res[0], res[1], res[2]), nil + if len(res) > 1 { + return keys.Add(res[0], res[1], res[2]), nil + } else { + return keys.Add("", "", res[0]), nil + } } } @@ -84,7 +74,7 @@ func keyFromString(key string) (Keys, error) { if len(k1) > 2 || len(k2) > 2 { log.Error("keyFromString: format incorrect. expect: | key secret | key,secret | key, secret |") - os.Exit(1) + return Keys{set: false}, errors.New("keyFromString: format incorrect. expect: | key secret | key,secret | key, secret |") } if len(k2) > 1 { @@ -102,14 +92,17 @@ func keyFromString(key string) (Keys, error) { } // grabKey chooses source to parse and provide keys -func grabKey(key string) (Keys, error) { +func GrabKey(key string) (Keys, error) { if key == "" { log.Error("grabKey: key can't be empty") - os.Exit(1) + return Keys{set: false}, errors.New("grabKey: key can't be empty") + } if fi, err := os.Stat(key); err == nil { - - return keyFromFile(key, fi) + if !fi.IsDir() { + return keyFromFile(key, fi) + } + return Keys{set: false}, err } else { return keyFromString(key) diff --git a/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go b/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go index cf12ebce..e51a5bcd 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go +++ b/ipfs-api/pkg/pinatav2/pinatav2_keys_test.go @@ -1,7 +1,69 @@ package pinatav2 -import "testing" +import ( + "testing" -func TestKeysFromJsonKeySecret(t *testing.T) { + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" +) +// txt files to test +const ( + t1 = "../testing/keys/test_keys_ksj.txt" + t2 = "../testing/keys/test_keys_ks.txt" + t3 = "../testing/keys/test_keys_j.txt" + + s1 = "LHEqALswTtxLgNrsFQG5, uyceqYWeMqo6NMTxG7JJwk24DBM1vsHQULawh0N7ur716ErKWkFEcJMr1yN0VamJ" + s2 = "LHEqALswTtxLgNrsFQG5 uyceqYWeMqo6NMTxG7JJwk24DBM1vsHQULawh0N7ur716ErKWkFEcJMr1yN0VamJ" + s3 = "fRKFqdX21j0wrckpt489NRfsR6sgxXIWY8eO5Awjp5J8oqlTyV7yeG6xF57GmMtM6izUOaoy73HW7XBwdpvSOKA897RpiStTS0k52CYPqKpolHbBr471QxQVq8r3q9C9u207caD9astZtTgCN2tFcFM5d1cCBZ5lIlvcPboUpandnISVFpIKGsJkh1FkLOmQh0M9QAMTan3z4TcqzSPpdbBYdrS5t4ymfKZUQgvzylciEND5ImUwv8XgyOp0XVJTV6vS0CZzAAHaOSMMBNy4NmbWMbUf8Fuocs4qkX0w79m6RqbUOvPq9AeGIIoNh3NnPl8jtZSqCIen8ptJhD3vDZvMCDvLlYjOXUxGHWZ6yqgOaRIrAm5llxlekT9UFKTT6vmr9OivYcAW4wXwolv96gKYMSYCMN5bZ8GfgDcj3ScfUclvGhyQ4Dzmlo2uqX8gyFT7Iq78j7eMCSIyFW9nAwuY13DJLIELUrVw3lptHBo7aVqapmi7DstcsywsVl3y08aiQ3qU8fHvajEj1JuyJLNJaExSlpOvwN2PPuvbHgdNiNbPtiw9JT9n16ls8KadIOjQN280W0q2UpV9s9p5b3SlExaauk3WCbrHL5Uy2gnb3t8bIzA7" + + se = "" +) + +func TestKeysFromTxtKSJ(t *testing.T) { + k, err := GrabKey(t1) + if err != nil { + log.Error("TestKeysFromTxtKSJ: %v, key: %v", err, k) + } +} + +func TestKeysFromTxtKS(t *testing.T) { + k, err := GrabKey(t2) + if err != nil { + log.Error("TestKeysFromTxtKS: %v, key: %v", err, k) + } +} + +func TestKeysFromTxtJ(t *testing.T) { + k, err := GrabKey(t3) + if err != nil { + log.Error("TestKeysFromTxtJ: %v, key: %v", err, k) + } +} + +func TestKeysFromStrKSW(t *testing.T) { + k, err := GrabKey(s1) + if err != nil { + log.Error("TestKeysFromStrKSW: %v, key: %v", err, k) + } +} + +func TestKeysFromStrKSC(t *testing.T) { + k, err := GrabKey(s2) + if err != nil { + log.Error("TestKeysFromStrKSC: %v, key: %v", err, k) + } +} + +func TestKeysFromStrJ(t *testing.T) { + k, err := GrabKey(s3) + if err != nil { + log.Error("TestKeysFromStrJ: %v, key: %v", err, k) + } +} + +func TestKeysFromEmptyStr(t *testing.T) { + k, err := GrabKey(se) + if err == nil { + log.Error("TestKeysFromEmtyStr: %v, key: %v", err, k) + } } diff --git a/ipfs-api/pkg/pinatav2/pinatav2_request.go b/ipfs-api/pkg/pinatav2/pinatav2_request.go new file mode 100644 index 00000000..04ffc4ac --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinatav2_request.go @@ -0,0 +1,25 @@ +package pinatav2 + +import ( + "io" + "net/http" +) + +func (r *Request) Get(url string) (*http.Request, error) { + req, err := http.NewRequest(http.MethodGet, url, nil) + if err != nil { + return req, err + } + r.header.header = req.Header + r.header.Init() //initialize header(adding keys) + return req, nil +} +func (r *Request) Post(url string, reader *io.Reader) (*http.Request, error) { + req, err := http.NewRequest(http.MethodPost, url, *reader) + if err != nil { + return req, err + } + r.header.header = req.Header + r.header.Init() //initialize header(adding keys) + return req, nil +} diff --git a/ipfs-api/testing/test_keys.txt b/ipfs-api/testing/test_keys.txt deleted file mode 100644 index 3ef394d3..00000000 --- a/ipfs-api/testing/test_keys.txt +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6ImI4ZTEwNTZiNWFmY2ZhYmE5OWI1Iiwic2NvcGVkS2V5U2VjcmV0IjoiNzRmMjA0Yzk2MDBlNTc5ZjM3ZmM3YzEzNzdhM2ZkYmY5MGY4ODZhM2JiZjAyODFlYWE0MGQzM2E5ZmMyYTA1OCIsImlhdCI6MTY1NTg4NjUyOX0.KUq6PPMJI6nyRL_SIK8V0AdUjdGNSo_6LwoiJy0Vwbo diff --git a/ipfs-api/tests/keys/test_keys_j.txt b/ipfs-api/tests/keys/test_keys_j.txt new file mode 100644 index 00000000..536044c3 --- /dev/null +++ b/ipfs-api/tests/keys/test_keys_j.txt @@ -0,0 +1,3 @@ +JWT: fRKFqdX21j0wrckpt489NRfsR6sgxXIWY8eO5Awjp5J8oqlTyV7yeG6xF57GmMtM6izUOaoy73HW7XBwdpvSOKA897RpiStTS0k52CYPqKpolHbBr471QxQVq8r3q9C9u207caD9astZtTgCN2tFcFM5d1cCBZ5lIlvcPboUpandnISVFpIKGsJkh1FkLOmQh0M9QAMTan3z4TcqzSPpdbBYdrS5t4ymfKZUQgvzylciEND5ImUwv8XgyOp0XVJTV6vS0CZzAAHaOSMMBNy4NmbWMbUf8Fuocs4qkX0w79m6RqbUOvPq9AeGIIoNh3NnPl8jtZSqCIen8ptJhD3vDZvMCDvLlYjOXUxGHWZ6yqgOaRIrAm5llxlekT9UFKTT6vmr9OivYcAW4wXwolv96gKYMSYCMN5bZ8GfgDcj3ScfUclvGhyQ4Dzmlo2uqX8gyFT7Iq78j7eMCSIyFW9nAwuY13DJLIELUrVw3lptHBo7aVqapmi7DstcsywsVl3y08aiQ3qU8fHvajEj1JuyJLNJaExSlpOvwN2PPuvbHgdNiNbPtiw9JT9n16ls8KadIOjQN280W0q2UpV9s9p5b3SlExaauk3WCbrHL5Uy2gnb3t8bIzA7 + + diff --git a/ipfs-api/tests/keys/test_keys_ks.txt b/ipfs-api/tests/keys/test_keys_ks.txt new file mode 100644 index 00000000..c2da3c50 --- /dev/null +++ b/ipfs-api/tests/keys/test_keys_ks.txt @@ -0,0 +1,4 @@ +API Key: LHEqALswTtxLgNrsFQG5 +API Secret: uyceqYWeMqo6NMTxG7JJwk24DBM1vsHQULawh0N7ur716ErKWkFEcJMr1yN0VamJ + + diff --git a/ipfs-api/tests/keys/test_keys_ksj.txt b/ipfs-api/tests/keys/test_keys_ksj.txt new file mode 100644 index 00000000..40f9803b --- /dev/null +++ b/ipfs-api/tests/keys/test_keys_ksj.txt @@ -0,0 +1,5 @@ +API Key: LHEqALswTtxLgNrsFQG5 +API Secret: uyceqYWeMqo6NMTxG7JJwk24DBM1vsHQULawh0N7ur716ErKWkFEcJMr1yN0VamJ +JWT: fRKFqdX21j0wrckpt489NRfsR6sgxXIWY8eO5Awjp5J8oqlTyV7yeG6xF57GmMtM6izUOaoy73HW7XBwdpvSOKA897RpiStTS0k52CYPqKpolHbBr471QxQVq8r3q9C9u207caD9astZtTgCN2tFcFM5d1cCBZ5lIlvcPboUpandnISVFpIKGsJkh1FkLOmQh0M9QAMTan3z4TcqzSPpdbBYdrS5t4ymfKZUQgvzylciEND5ImUwv8XgyOp0XVJTV6vS0CZzAAHaOSMMBNy4NmbWMbUf8Fuocs4qkX0w79m6RqbUOvPq9AeGIIoNh3NnPl8jtZSqCIen8ptJhD3vDZvMCDvLlYjOXUxGHWZ6yqgOaRIrAm5llxlekT9UFKTT6vmr9OivYcAW4wXwolv96gKYMSYCMN5bZ8GfgDcj3ScfUclvGhyQ4Dzmlo2uqX8gyFT7Iq78j7eMCSIyFW9nAwuY13DJLIELUrVw3lptHBo7aVqapmi7DstcsywsVl3y08aiQ3qU8fHvajEj1JuyJLNJaExSlpOvwN2PPuvbHgdNiNbPtiw9JT9n16ls8KadIOjQN280W0q2UpV9s9p5b3SlExaauk3WCbrHL5Uy2gnb3t8bIzA7 + + diff --git a/ipfs-api/types/general.go b/ipfs-api/types/general.go index 04e41646..fc0add89 100644 --- a/ipfs-api/types/general.go +++ b/ipfs-api/types/general.go @@ -19,13 +19,13 @@ type ExtendedFileInfo struct { } var LogLevelMap = []logrus.Level{ - 1: logrus.TraceLevel, - 2: logrus.DebugLevel, - 3: logrus.InfoLevel, - 4: logrus.WarnLevel, - 5: logrus.ErrorLevel, - 6: logrus.FatalLevel, - 7: logrus.PanicLevel, + logrus.TraceLevel, + logrus.DebugLevel, + logrus.InfoLevel, + logrus.WarnLevel, + logrus.ErrorLevel, + logrus.FatalLevel, + logrus.PanicLevel, } var V int32 From 34e65024860797d3b80f969a544cc56cd04aab7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Thu, 23 Jun 2022 10:07:28 +0200 Subject: [PATCH 094/140] linked new logic to cli, old logic left intact --- ipfs-api/README.md | 2 +- ipfs-api/dump.log | 35 ------ ipfs-api/pkg/cli/cli.go | 13 +- ipfs-api/pkg/cli/pin.go | 9 +- ipfs-api/pkg/cli/pinned.go | 20 ++- ipfs-api/pkg/cli/test.go | 20 ++- ipfs-api/pkg/ipfslog/ipfslog.go | 40 +++++- ipfs-api/pkg/pinatav2/pinata2_pinata_api.go | 131 +++++++++++++++----- ipfs-api/pkg/pinatav2/pinatav2.go | 62 ++++++--- ipfs-api/pkg/pinatav2/pinatav2_request.go | 10 ++ ipfs-api/types/constants.go | 2 +- ipfs-api/types/general.go | 31 ----- ipfs-api/types/msg.go | 2 +- scripts/version.sh | 2 +- 14 files changed, 244 insertions(+), 135 deletions(-) delete mode 100644 ipfs-api/dump.log delete mode 100644 ipfs-api/types/general.go diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 54d78362..81a9d0d2 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.1.8-rc.7" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.0" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/dump.log b/ipfs-api/dump.log deleted file mode 100644 index c99f954f..00000000 --- a/ipfs-api/dump.log +++ /dev/null @@ -1,35 +0,0 @@ -POST /pinning/pinFileToIPFS HTTP/1.1 -Host: api.pinata.cloud -Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiIzNWRjZDc0OC1mMDE3LTQ0NjEtYTdiOC0wOGVkZDc3MDU2NzciLCJlbWFpbCI6InlhaWV2Z2VuaXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6IjZkYzA3ZWQ0YjQ3MzBhZDBmYThmIiwic2NvcGVkS2V5U2VjcmV0IjoiYjgzMmQ0ZTk5MDBkNDBmM2MzODJjYTNkZjM0ZjkyZjNiNjBhMDY3YzllZDE2NWNlYzBhNjE4MWIxMzk5YzEyMiIsImlhdCI6MTY1NTcwNjk0Mn0.275ZMx9dEwInnfcKWtwSIAbtkyYNbwEQRm4bPS9vaVE -Content-Type: multipart/form-data; boundary=83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 - ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 -Content-Disposition: form-data; name="pinataOptions" - -{"wrapWithDirectory":false,"cidVersion":1,"regions":{}} ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 -Content-Disposition: form-data; name="pinataMetadata" - -{"name":"tra-la-la","keyvalues":null} ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 -Content-Disposition: form-data; name="file"; filename="test_dir/test_dir2/test_dir2/test_file2.txt" -Content-Type: application/octet-stream - - ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 -Content-Disposition: form-data; name="file"; filename="test_dir/test_dir2/test_file2.txt" -Content-Type: application/octet-stream - - ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 -Content-Disposition: form-data; name="file"; filename="test_dir/test_file.json" -Content-Type: application/octet-stream - -{"wrapWithDirectory":false,"cidVersion":1,"regions":{}} - ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347 -Content-Disposition: form-data; name="file"; filename="test_dir/test_file1.txt" -Content-Type: application/octet-stream - - ---83f6d30161a1d39fa9ac08789f63125115508a157b271a88f514de0d8347-- diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index d21c9370..f215c319 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -2,6 +2,9 @@ package cli import ( + "os" + + "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" "github.com/spf13/cobra" ) @@ -11,7 +14,7 @@ var ( meta string path string c int8 // CID version integer representation - verbosity int32 + verbosity int8 ) var rootCmd = &cobra.Command{ @@ -26,7 +29,13 @@ func Start() { rootCmd.CompletionOptions.DisableDefaultCmd = true ///Adding flags - rootCmd.PersistentFlags().Int32VarP(&verbosity, "verbose", "v", 0, "Verbosity of the output from 0..5 ") + rootCmd.PersistentFlags().Int8VarP(&verbosity, "verbose", "v", 0, "Verbosity of the output from 0..5 ") + rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { + if err := ipfslog.SetDebugLvl(verbosity); err != nil { + os.Exit(1) + } + return nil + } pinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") pinnedCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index e4f7defe..04dac5b3 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -1,7 +1,7 @@ package cli import ( - "fmt" + "os" log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" @@ -51,9 +51,8 @@ func pinCmd(cmd *cobra.Command, args []string) error { return err } p := pnt.PinataApi{} - fmt.Println(meta, path) p.SetKeys(keys) - p.Dump() + switch len(args) { case 1: { @@ -71,6 +70,10 @@ func pinCmd(cmd *cobra.Command, args []string) error { } } } + if err := p.OutputPinJson(); err != nil { + log.Error("failed to print results: %v", err) + os.Exit(1) + } return nil } diff --git a/ipfs-api/pkg/cli/pinned.go b/ipfs-api/pkg/cli/pinned.go index b232d296..e255ce18 100644 --- a/ipfs-api/pkg/cli/pinned.go +++ b/ipfs-api/pkg/cli/pinned.go @@ -1,7 +1,7 @@ package cli import ( - "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" "github.com/spf13/cobra" ) @@ -9,11 +9,25 @@ var pinnedCommand = &cobra.Command{ Use: "pinned ", Short: "File/Folder check allowing to test if the file/folder is already pinned on IPFS or not", Long: "File/Folder check allowing to test if the file/folder is already pinned on IPFS or not", + Args: cobra.MaximumNArgs(1), RunE: pinned, } func pinned(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(key) - pinatav1.Pinned(args, keys) + keys, err := pnt.GrabKey(key) + if err != nil { + return err + } + + p := pnt.PinataApi{} + p.SetKeys(keys) + if err := p.Pinned(args[0]); err != nil { + return err + } + err = p.OutputPinnedJson() + if err != nil { + return err + } + return nil } diff --git a/ipfs-api/pkg/cli/test.go b/ipfs-api/pkg/cli/test.go index 4df52556..3380b198 100644 --- a/ipfs-api/pkg/cli/test.go +++ b/ipfs-api/pkg/cli/test.go @@ -1,9 +1,6 @@ package cli import ( - "os" - - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" "github.com/spf13/cobra" ) @@ -12,25 +9,24 @@ var testCommand = &cobra.Command{ Use: "test", Short: "Testing connection to pinata.cloud", Long: "Testing connection and given key", + Args: cobra.MaximumNArgs(0), RunE: test, } func test(cmd *cobra.Command, args []string) error { keys, err := pnt.GrabKey(key) if err != nil { - log.Error("grabKey: failed to get keys: %v", err) - os.Exit(1) - } - if !keys.Check() { - log.Error("Keys not provided") - os.Exit(1) + return err } p := pnt.PinataApi{} p.SetKeys(keys) - er := p.Test() - if er != nil { - os.Exit(1) + if err := p.Test(); err != nil { + return err + } + err = p.OutputTestJson() + if err != nil { + return err } return nil diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go index 2a3268a2..4c4c0daf 100644 --- a/ipfs-api/pkg/ipfslog/ipfslog.go +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -3,15 +3,53 @@ package ipfslog import ( + "errors" + "io/ioutil" + "github.com/sirupsen/logrus" ) var Log *logrus.Logger +// log.Trace("Something very low level.") +// log.Debug("Useful debugging information.") +// log.Info("Something noteworthy happened!") +// log.Warn("You should probably take a look at this.") +// log.Error("Something failed but I'm not quitting.") +// // Calls os.Exit(1) after logging +// log.Fatal("Bye.") +// // Calls panic() after logging +// log.Panic("I'm bailing.") + +func SetDebugLvl(l int8) error { + if l >= 0 && l < 8 { + switch l { + case 0: + Log.SetOutput(ioutil.Discard) + case 7: + Log.SetLevel(logrus.TraceLevel) + case 6: + Log.SetLevel(logrus.DebugLevel) + case 5: + Log.SetLevel(logrus.InfoLevel) + case 4: + Log.SetLevel(logrus.WarnLevel) + case 3: + Log.SetLevel(logrus.ErrorLevel) + case 2: + Log.SetLevel(logrus.FatalLevel) + case 1: + Log.SetLevel(logrus.PanicLevel) + } + } else { + return errors.New("verbocity should be in range 0 to 7") + } + return nil +} func init() { Log = logrus.New() - Log.SetLevel(logrus.DebugLevel) + //Log.SetLevel(logrus.InfoLevel) } diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go index ba8da71d..db0d60a5 100644 --- a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go @@ -54,7 +54,7 @@ func (p *PinataApi) Test() error { log.Debug("Ipfs-api: test: invalid request: %v", err) return err } - p.request.dump = *req + resp, err := p.client.Do(req) if err != nil { log.Debug("Ipfs-api: test: invalid response: %v", err) @@ -62,18 +62,58 @@ func (p *PinataApi) Test() error { } defer resp.Body.Close() - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Debug("Ipfs-api: test: failed to read response: %v", err) - return err - } - fmt.Println(string(bytes)) + b, err := io.ReadAll(resp.Body) + if err != nil { + return err } + p.SaveResp(b) + p.SetRespCode(resp.StatusCode) return nil } +func (p *PinataApi) Unpin(hash string) error { + req, err := p.request.Del(tp.BASE_URL + tp.UNPIN) + if err != nil { + return err + } + resp, err := p.client.Do(req) + if err != nil { + log.Debug("Ipfs-api: test: invalid response: %v", err) + return err + } + defer resp.Body.Close() + + b, err := io.ReadAll(resp.Body) + if err != nil { + return err + } + p.SaveResp(b) + p.SetRespCode(resp.StatusCode) + return nil +} + +func (p *PinataApi) Pinned(hash string) error { + req, err := p.request.Get(tp.BASE_URL + tp.PINNEDDATA) + if err != nil { + return err + } + resp, err := p.client.Do(req) + if err != nil { + log.Debug("Ipfs-api: test: invalid response: %v", err) + return err + } + defer resp.Body.Close() + + b, err := io.ReadAll(resp.Body) + if err != nil { + return err + } + p.SaveResp(b) + p.SetRespCode(resp.StatusCode) + return nil +} + func (p *PinataApi) Pin(path string) error { if _, err := os.Stat(path); os.IsNotExist(err) { log.Error("pin: provided path doesn't exist") @@ -113,29 +153,12 @@ func (p *PinataApi) Pin(path string) error { } defer resp.Body.Close() - b, _ := io.ReadAll(resp.Body) - p.SaveResp(b) - p.SetRespCode(resp.StatusCode) - pr := PinResponseJSON{} - if err := json.Unmarshal(b, &pr); err != nil { + b, err := io.ReadAll(resp.Body) + if err != nil { return err } - - if resp.StatusCode == http.StatusOK { - - if err != nil { - log.Debug("Ipfs-api: test: failed to read response: %v", err) - return err - } - j, err := json.Marshal(pr) - if err != nil { - return err - } - fmt.Println(string(j)) - } else { - fmt.Println(string(b)) - } - + p.SaveResp(b) + p.SetRespCode(resp.StatusCode) return nil } @@ -250,3 +273,53 @@ func (p *PinataApi) SetRespCode(code int) { func (p *PinataApi) SaveResp(resp []byte) { p.resp = resp } + +func (p *PinataApi) OutputPinJson() error { + s := PinResponseJSON{} + if err := json.Unmarshal(p.resp, &s); err != nil { + return err + } + j, err := json.Marshal(s) + if err != nil { + return err + } + fmt.Println(string(j)) + return nil +} +func (p *PinataApi) OutputPinnedJson() error { + s := PinnedResponse{} + if err := json.Unmarshal(p.resp, &s); err != nil { + return err + } + j, err := json.Marshal(s) + if err != nil { + return err + } + fmt.Println(string(j)) + return nil +} + +func (p *PinataApi) OutputTestJson() error { + s := TestResponse{} + if err := json.Unmarshal(p.resp, &s); err != nil { + return err + } + j, err := json.Marshal(s) + if err != nil { + return err + } + fmt.Println(string(j)) + return nil +} +func (p *PinataApi) OutputUnpinJson() error { + s := UnpinResponse{} + if err := json.Unmarshal(p.resp, &s); err != nil { + return err + } + j, err := json.Marshal(s) + if err != nil { + return err + } + fmt.Println(string(j)) + return nil +} diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index 956d4934..ab864b63 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -4,19 +4,51 @@ package pinatav2 import ( "io/fs" "net/http" + "time" ) +type UnpinResponse struct { + Success bool `json:"success"` + Hash string `json:"hash"` + Time time.Time `json:"time"` +} + +type TestResponse struct { + Message string `json:"message"` +} +type Regions struct { + RegionId string `json:"regionId,omitempty"` + CurrentRC int16 `json:"currentReplicationCount,omitempty"` + DesiredRC int16 `json:"desiredReplicationCount,omitempty"` +} + +type Rows struct { + Id string `json:"id,omitempty"` + CID string `json:"ipfs_pin_hash,omitempty"` + UserId string `json:"user_id,omitempty"` + Size int64 `json:"size,omitempty"` + Date time.Time `json:"date_pinned,omitempty"` + DateUnpin time.Time `json:"date_unpinned,omitempty"` + Metadata PinataMetadataJSON `json:"metadata,omitempty"` + Regions []Regions `json:"regions,omitempty"` +} + +type PinnedResponse struct { + Count int32 `json:"count,omitempty"` + Rows []Rows `json:"rows,omitempty"` +} + type PinResponseJSON struct { Duplicate bool `json:"isduplicate,omitempty"` - IpfsHash string `json:"hash"` + IpfsHash string `json:"ipfshash"` Timestamp string `json:"timestamp"` PinSize int64 `json:"pinsize"` } type PinResponse struct { - duplicate bool `json:"isDuplicate,omitempty"` - ipfsHash string `json:"ipfshash"` - timestamp string `json:"timestamp"` - pinSize int64 `json:"pinsize"` + duplicate bool + ipfsHash string + timestamp string + pinSize int64 } type PinataMetadataJSON struct { @@ -25,21 +57,21 @@ type PinataMetadataJSON struct { } type PinataMetadata struct { - name string `json:"name"` - keyValues map[string]string `json:"keyvalues"` + name string + keyValues map[string]string } type RegionsJSON struct { - RegionId string `json:"regionId,omitempty"` - CurrentRC int16 `json:"currentReplicationCount,omitempty"` - DesiredRC int16 `json:"desiredReplicationCount,omitempty"` + RegionId string `json:"regionid,omitempty"` + CurrentRC int16 `json:"currentreplicationcount,omitempty"` + DesiredRC int16 `json:"desiredreplicationcount,omitempty"` } -type Regions struct { - regionId string `json:"regionId,omitempty"` - currentRC int16 `json:"currentReplicationCount,omitempty"` - desiredRC int16 `json:"desiredReplicationCount,omitempty"` -} +// type Regions struct { +// regionId string +// currentRC int16 +// desiredRC int16 +// } type PinataOptionsJSON struct { WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash diff --git a/ipfs-api/pkg/pinatav2/pinatav2_request.go b/ipfs-api/pkg/pinatav2/pinatav2_request.go index 04ffc4ac..7308d8cc 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2_request.go +++ b/ipfs-api/pkg/pinatav2/pinatav2_request.go @@ -14,6 +14,16 @@ func (r *Request) Get(url string) (*http.Request, error) { r.header.Init() //initialize header(adding keys) return req, nil } + +func (r *Request) Del(url string) (*http.Request, error) { + req, err := http.NewRequest(http.MethodDelete, url, nil) + if err != nil { + return req, err + } + r.header.header = req.Header + r.header.Init() //initialize header(adding keys) + return req, nil +} func (r *Request) Post(url string, reader *io.Reader) (*http.Request, error) { req, err := http.NewRequest(http.MethodPost, url, *reader) if err != nil { diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 9a1e03b8..89d5a05e 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.0.10" + IpfsApiVersion = "v0.1.1" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/ipfs-api/types/general.go b/ipfs-api/types/general.go deleted file mode 100644 index fc0add89..00000000 --- a/ipfs-api/types/general.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "io/fs" - - "github.com/sirupsen/logrus" -) - -type Keys struct { - Api_key string `json:"api_key,omitempty"` - Api_secret string `json:"api_secret,omitempty"` - JWT string `json:"jwt,omitempty"` -} - -type ExtendedFileInfo struct { - Info fs.FileInfo - Path string - AbsoultePath string -} - -var LogLevelMap = []logrus.Level{ - logrus.TraceLevel, - logrus.DebugLevel, - logrus.InfoLevel, - logrus.WarnLevel, - logrus.ErrorLevel, - logrus.FatalLevel, - logrus.PanicLevel, -} - -var V int32 diff --git a/ipfs-api/types/msg.go b/ipfs-api/types/msg.go index 3f546d93..430111a8 100644 --- a/ipfs-api/types/msg.go +++ b/ipfs-api/types/msg.go @@ -40,7 +40,7 @@ type Rows struct { Id string `json:"id,omitempty"` CID string `json:"ipfs_pin_hash,omitempty"` UserId string `json:"user_id,omitempty"` - Size int16 `json:"size,omitempty"` + Size int64 `json:"size,omitempty"` Date time.Time `json:"date_pinned,omitempty"` DateUnpin time.Time `json:"date_unpinned,omitempty"` Metadata PinataMetadata `json:"metadata,omitempty"` diff --git a/scripts/version.sh b/scripts/version.sh index f875c41d..1d214b41 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.1.8-rc.7" +echo "v0.2.0" From 8fc5aea0c1d968f13404a1e5dbd12288e9114b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Thu, 23 Jun 2022 10:23:13 +0200 Subject: [PATCH 095/140] old version deleted --- RELEASE.md | 2 +- ipfs-api/README.md | 2 +- ipfs-api/go.mod | 13 - ipfs-api/go.sum | 44 --- ipfs-api/pkg/cli/cli.go | 8 +- ipfs-api/pkg/cli/download.go | 20 -- ipfs-api/pkg/cli/getcid.go | 77 ---- ipfs-api/pkg/cli/keys.go | 96 ----- ipfs-api/pkg/cli/unpin.go | 11 +- ipfs-api/pkg/pinatav1/pinatav1.go | 427 ----------------------- ipfs-api/pkg/pinatav1/pinatav1_pinned.go | 80 ----- ipfs-api/pkg/pinatav1/pinatav1_test.go | 35 -- ipfs-api/pkg/pinatav1/pinatav1_unpin.go | 72 ---- ipfs-api/scripts/build.sh | 0 ipfs-api/scripts/publish.sh | 0 ipfs-api/scripts/test.sh | 2 +- ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 18 files changed, 16 insertions(+), 877 deletions(-) delete mode 100644 ipfs-api/pkg/cli/download.go delete mode 100644 ipfs-api/pkg/cli/getcid.go delete mode 100644 ipfs-api/pkg/cli/keys.go delete mode 100644 ipfs-api/pkg/pinatav1/pinatav1.go delete mode 100644 ipfs-api/pkg/pinatav1/pinatav1_pinned.go delete mode 100644 ipfs-api/pkg/pinatav1/pinatav1_test.go delete mode 100644 ipfs-api/pkg/pinatav1/pinatav1_unpin.go mode change 100644 => 100755 ipfs-api/scripts/build.sh mode change 100644 => 100755 ipfs-api/scripts/publish.sh mode change 100644 => 100755 ipfs-api/scripts/test.sh diff --git a/RELEASE.md b/RELEASE.md index e36c6c6d..f1c1eee6 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ Features: -* fix metadat, log +* fix ipfs-api refactored diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 81a9d0d2..f534135f 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.2.0" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.1" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index 89065ace..8544b2e7 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -3,8 +3,6 @@ module github.com/kiracore/tools/ipfs-api go 1.17 require ( - github.com/ipfs/go-cid v0.2.0 - github.com/multiformats/go-multihash v0.1.0 github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 @@ -12,19 +10,8 @@ require ( require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect - github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect - github.com/minio/sha256-simd v1.0.0 // indirect - github.com/mr-tron/base58 v1.2.0 // indirect - github.com/multiformats/go-base32 v0.0.3 // indirect - github.com/multiformats/go-base36 v0.1.0 // indirect - github.com/multiformats/go-multibase v0.0.3 // indirect - github.com/multiformats/go-varint v0.0.6 // indirect - github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.3.0 // indirect - golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/text v0.3.7 // indirect - lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum index ee846e3f..e7793627 100644 --- a/ipfs-api/go.sum +++ b/ipfs-api/go.sum @@ -4,36 +4,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= -github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= -github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= -github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= -github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= -github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= -github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= -github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= -github.com/multiformats/go-multihash v0.1.0 h1:CgAgwqk3//SVEw3T+6DqI4mWMyRuDwZtOWcJT0q9+EA= -github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= -github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= -github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -42,34 +17,15 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 h1:0qjDla5xICC2suMtyRH/QqX3B1btXTfNsIt/i4LFgO0= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= -lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index f215c319..6b52557d 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -40,18 +40,16 @@ func Start() { pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") pinnedCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") unpinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") - downloadCommand.PersistentFlags().StringVarP(&gateway, "gateway", "g", "https://gateway.pinata.cloud", "IPFS gateway") - downloadCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") + testCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") //Assembling commands - rootCmd.AddCommand(cidZeroCommand) - rootCmd.AddCommand(cidOneCommand) + rootCmd.AddCommand(pinnedCommand) rootCmd.AddCommand(pinCommand) rootCmd.AddCommand(versionCommand) rootCmd.AddCommand(unpinCommand) - rootCmd.AddCommand(downloadCommand) + rootCmd.AddCommand(testCommand) cobra.CheckErr(rootCmd.Execute()) diff --git a/ipfs-api/pkg/cli/download.go b/ipfs-api/pkg/cli/download.go deleted file mode 100644 index 3df37dfc..00000000 --- a/ipfs-api/pkg/cli/download.go +++ /dev/null @@ -1,20 +0,0 @@ -package cli - -import ( - pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" - "github.com/spf13/cobra" -) - -var downloadCommand = &cobra.Command{ - Use: "download --gateway=", - Short: "File/Folder download", - Long: "File/Folder download", - RunE: cmdDownload, -} - -func cmdDownload(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(key) - pnt.Download(args, keys, gateway) - - return nil -} diff --git a/ipfs-api/pkg/cli/getcid.go b/ipfs-api/pkg/cli/getcid.go deleted file mode 100644 index 9664a65a..00000000 --- a/ipfs-api/pkg/cli/getcid.go +++ /dev/null @@ -1,77 +0,0 @@ -package cli - -// TODO: Try to wrap data in node.UnixFS and after that to put this node into merkle DAG - -import ( - "os" - - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" - "github.com/spf13/cobra" -) - -var cidZeroCommand = &cobra.Command{ - Use: "CID-v0 ", - Short: "CID v0 hash calculator", - Long: "Get CID-v0 of the file", - RunE: cmdGetCIDv0, -} - -var cidOneCommand = &cobra.Command{ - Use: "CID-v1 ", - Short: "CID v1 hash calculator", - Long: "Get CID-v1 of the file", - RunE: cmdGetCIDv1, -} - -func cmdGetCIDv0(cmd *cobra.Command, args []string) error { - f, _ := os.Open(args[0]) - defer f.Close() - - fi, err := f.Stat() - if err != nil { - return err - } - - bytes := make([]byte, fi.Size()) - rb, err := f.Read(bytes) - - if err != nil { - return err - } - - c, err := pnt.GetCidV0(bytes) - if err != nil { - log.Error("cmdGetCIDv1: failed to get the cid: %v", err) - } - log.Info("cid v1. hash: %v. bytes: %v", c, rb) - - return nil - -} -func cmdGetCIDv1(cmd *cobra.Command, args []string) error { - - f, _ := os.Open(args[0]) - defer f.Close() - - fi, err := f.Stat() - if err != nil { - return err - } - - bytes := make([]byte, fi.Size()) - rb, err := f.Read(bytes) - - if err != nil { - return err - } - - c, err := pnt.GetCidV1(bytes) - if err != nil { - log.Error("cmdGetCIDv1: failed to get the cid: %v", err) - } - log.Info("cid v1. hash: %v. bytes: %v", c, rb) - - return nil - -} diff --git a/ipfs-api/pkg/cli/keys.go b/ipfs-api/pkg/cli/keys.go deleted file mode 100644 index d4816b32..00000000 --- a/ipfs-api/pkg/cli/keys.go +++ /dev/null @@ -1,96 +0,0 @@ -package cli - -import ( - "bufio" - "encoding/json" - "io/fs" - "os" - "strings" - - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - tp "github.com/kiracore/tools/ipfs-api/types" -) - -// Gets keys value from plain text or json file -func keyFromFile(path string, fi fs.FileInfo) (tp.Keys, error) { - var keys tp.Keys - - f, err := os.Open(path) - if err != nil { - log.Error("keyFromFile: can't open file") - os.Exit(1) - } - - if strings.Split(fi.Name(), ".")[1] == "json" { - b := make([]byte, fi.Size()) - rb, err := f.Read(b) - if err != nil { - log.Error("keyFromFile: can't read from file") - os.Exit(1) - } - - json.Unmarshal(b, &keys) - - log.Info("keyFromFile: read %v bytes", rb) - return keys, nil - - } else { - scanner := bufio.NewScanner(f) - var res []string - - for scanner.Scan() { - newString := strings.Split(scanner.Text(), ":") - if len(newString) != 1 { - res = append(res, strings.TrimSpace(newString[1])) - } else { - log.Error("keyFromFile: failed to parse keys from file. invalid format\nexpected:\nAPI Key: value\nAPI Secret: value\nJWT: value") - return keys, err - } - } - keys := tp.Keys{Api_key: res[0], Api_secret: res[1], JWT: res[2]} - return keys, nil - - } -} - -// Gets keys from string provided by user -func keyFromString(key string) (tp.Keys, error) { - - k1 := strings.Split(key, " ") - k2 := strings.Split(key, ",") - - if len(k1) > 2 || len(k2) > 2 { - log.Error("keyFromString: format incorrect. expect: | key secret | key,secret | key, secret |") - os.Exit(1) - } - - if len(k2) > 1 { - - return tp.Keys{Api_key: strings.TrimSpace(k2[0]), Api_secret: strings.TrimSpace(k2[1])}, nil - - } else if len(k1) > 1 { - - return tp.Keys{Api_key: strings.TrimSpace(k1[0]), Api_secret: strings.TrimSpace(k1[1])}, nil - } else { - - return tp.Keys{JWT: strings.TrimSpace(key)}, nil - } - -} - -// grabKey chooses source to parse and provide keys -func grabKey(key string) (tp.Keys, error) { - if key == "" { - log.Error("grabKey: key can't be empty") - os.Exit(1) - } - if fi, err := os.Stat(key); err == nil { - - return keyFromFile(key, fi) - } else { - - return keyFromString(key) - - } - -} diff --git a/ipfs-api/pkg/cli/unpin.go b/ipfs-api/pkg/cli/unpin.go index f1990063..933d631d 100644 --- a/ipfs-api/pkg/cli/unpin.go +++ b/ipfs-api/pkg/cli/unpin.go @@ -1,7 +1,7 @@ package cli import ( - pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" + pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" "github.com/spf13/cobra" ) @@ -9,14 +9,19 @@ var unpinCommand = &cobra.Command{ Use: "delete --key=", Short: "File/folder unpin & delete", Long: "File/folder unpin & delete", + Args: cobra.MaximumNArgs(1), RunE: unpin, } func unpin(cmd *cobra.Command, args []string) error { - keys, _ := grabKey(key) - if err := pnt.Unpin(args, keys); err != nil { + keys, _ := pnt.GrabKey(key) + p := pnt.PinataApi{} + p.SetKeys(keys) + err := p.Unpin(args[0]) + if err != nil { return err } + p.OutputUnpinJson() return nil } diff --git a/ipfs-api/pkg/pinatav1/pinatav1.go b/ipfs-api/pkg/pinatav1/pinatav1.go deleted file mode 100644 index e547d034..00000000 --- a/ipfs-api/pkg/pinatav1/pinatav1.go +++ /dev/null @@ -1,427 +0,0 @@ -package pinatav1 - -import ( - "crypto/tls" - "encoding/json" - "fmt" - "io" - "io/fs" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/textproto" - "os" - "path/filepath" - "sync" - "time" - - cid "github.com/ipfs/go-cid" - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - tp "github.com/kiracore/tools/ipfs-api/types" - mh "github.com/multiformats/go-multihash" - "golang.org/x/net/http2" -) - -// Adding authentication method from given input, json or plain text file -func addKeysToHeader(req *http.Request, keys tp.Keys) { - if keys.JWT != "" { - - req.Header.Add("Authorization", "Bearer "+keys.JWT) - - } else { - req.Header.Add("pinata_api_key", keys.Api_key) - req.Header.Add("pinata_secret_api_key", keys.Api_secret) - } -} - -//Creating tweaked client -func NewClient() *http.Client { - // Client params to be adjusted ... - - tr := &http.Transport{ - MaxIdleConnsPerHost: 100, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - ExpectContinueTimeout: 5 * time.Second, - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - } - http2.ConfigureTransport(tr) - return &http.Client{ - Timeout: 100 * time.Second, - Transport: tr, - } - -} - -// Testing auth wih pinata server -func Test(keys tp.Keys) error { - c := NewClient() - - req, err := http.NewRequest("GET", tp.BASE_URL+tp.TESTAUTH, nil) - if err != nil { - log.Error("test: something went wrong with request", err) - os.Exit(1) - return err - } - - addKeysToHeader(req, keys) - - resp, err := c.Do(req) - if err != nil { - log.Error("test: didn't get any response", err) - os.Exit(1) - return err - } - defer resp.Body.Close() - - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("test: can't read the request body", err) - os.Exit(1) - return err - } - - // Parsing response - r := tp.TestResponse{} - e := json.Unmarshal(bytes, &r) - if e != nil { - log.Error("Test: failed to unmarshal json", e) - os.Exit(1) - return e - } - log.Info(r.Message) - - } - return nil -} - -// Adding pinataOptions to the request. -// func using external variable tp.Opts to write -// user input data -func setPinataOptions(bw *multipart.Writer, c int8, w bool) error { - v, err := json.Marshal(tp.Opts) - if err != nil { - os.Exit(1) - return err - } - bw.WriteField(tp.PINATAOPTS, string(v)) - - return nil - -} -func setPinataMetadata(bw *multipart.Writer, fi fs.FileInfo, d map[string]string) error { - - m := tp.PinataMetadata{Name: fi.Name(), KeyValues: d} - s, err := json.Marshal(m) - if err != nil { - os.Exit(1) - return err - } - - bw.WriteField(tp.PINATAMETA, string(s)) - return nil -} - -// Adding HTML form to multipart body -func addForm(bw *multipart.Writer, filePath tp.ExtendedFileInfo) error { - - // wrap in struct - f, err := os.Open(filePath.AbsoultePath) - if err != nil { - log.Error("addform: can't open the file %v", filePath.AbsoultePath) - os.Exit(1) - return err - - } - - h := make(textproto.MIMEHeader) - h.Set("Content-Disposition", - fmt.Sprintf(`form-data; name="file"; filename="%s"`, filePath.Path)) - h.Set("Content-Type", "application/octet-stream") - - content, _ := bw.CreatePart(h) - d, err := io.Copy(content, f) - - if err != nil { - log.Error("addForm: failed to copy data: %v", err) - } else { - log.Info("addForm: uploaded file %v: bytes : %v", filePath.Path, d) - } - - f.Close() - - return nil -} - -//Wrapping HTML forms in the request body -func createReqBody(args []string, filePaths []tp.ExtendedFileInfo) (string, io.Reader, error) { - // creating a pipe - pipeReader, pipeWriter := io.Pipe() - // creating writer for multipart request - - bodyWriter := multipart.NewWriter(pipeWriter) - - go func() { - if err := setPinataOptions(bodyWriter, 1, false); err != nil { - log.Error("addform: failed to add pinataOptions to the for. %v", err) - os.Exit(1) - } - if len(args) > 1 { - bodyWriter.WriteField(tp.PINATAMETA, fmt.Sprintf(`{"name":"%v","keyvalues": {}}`, args[1])) - - } - - for _, filePath := range filePaths { - if err := addForm(bodyWriter, filePath); err != nil { - log.Error("createbody: failed to add form to multipart request") - os.Exit(1) - return - - } - - } - - bodyWriter.Close() - pipeWriter.Close() - - }() - - return bodyWriter.FormDataContentType(), pipeReader, nil - -} - -//Parsing directory tree recursively. NB: SLOW -func walker(rootDir string) []tp.ExtendedFileInfo { - ap, err := filepath.Abs(rootDir) - base := filepath.Base(ap) - if err != nil { - log.Error("walker: failed to get absolute path") - os.Exit(1) - } - - var wg sync.WaitGroup - var efi = []tp.ExtendedFileInfo{} - - wg.Add(1) - go func() { - - err := filepath.Walk(ap, func(path string, info fs.FileInfo, err error) error { - if err != nil { - os.Exit(1) - return err - } - if !info.IsDir() { - rel, err := filepath.Rel(ap, path) - - if err != nil { - log.Error("walker: can't get relative path for %v. err: %v", path, err) - os.Exit(1) - } - fn := filepath.Clean(base + "/" + rel) - efi = append(efi, tp.ExtendedFileInfo{Info: info, Path: fn, AbsoultePath: path}) - } - - return nil - - }) - if err != nil { - os.Exit(1) - return - } - wg.Done() - }() - wg.Wait() - - return efi - -} - -func GetHashByName(args []string, keys tp.Keys) { - if len(args) > 1 { - c := NewClient() - req, err := http.NewRequest("GET", tp.BASE_URL+tp.PINNEDDATA+"?metadata[name]="+args[1], nil) - if err != nil { - log.Error("GetHashByName: failed to assemble request: %v", err) - os.Exit(1) - } - //q := req.URL.Query() - //q.Add("metadata[name]", args[1]) - - addKeysToHeader(req, keys) - //req.URL.RawQuery = q.Encode() - resp, err := c.Do(req) - if err != nil { - log.Error("GetHashByName: failed to ger response: %v", err) - os.Exit(1) - } - defer resp.Body.Close() - // bytes, err := io.ReadAll(resp.Body) - // if err != nil { - // log.Error("pin: can't read the request body %v", err) - // os.Exit(1) - // } - // Printing request with all data for debugging - // requestDump, err := httputil.DumpRequest(req, true) - // if err != nil { - // fmt.Println(err) - - // } - // fmt.Println(string(requestDump)) - - // sending request - //fmt.Println(string(bytes)) - - } - -} - -//Pins given file/directory to pinata.cloud service using api v1 -func Pin(args []string, keys tp.Keys) error { - path := args[0] - // checking if the path is valid and file/folder exist - if _, err := os.Stat(path); os.IsNotExist(err) { - log.Error("pin: provided path doesn't exist") - os.Exit(1) - return err - } - // parsing the tree - filePaths := walker(path) - - // creating requestbody - contType, reader, err := createReqBody(args, filePaths) - if err != nil { - log.Error("pin: failed to create body") - os.Exit(1) - return err - } - log.Info("pin: body formed\n") - - // forming request - req, err := http.NewRequest("POST", tp.BASE_URL+tp.PINFILE, reader) - if err != nil { - log.Error("pin: failed to assemble request") - os.Exit(1) - return err - } - - addKeysToHeader(req, keys) - req.Header.Add("Content-Type", contType) - - client := NewClient() - - // Printing request with all data for debugging - - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - fmt.Println(err) - - } - log.Debug(string(requestDump)) - - // sending request - resp, err := client.Do(req) - if err != nil { - log.Error("pin: request send error:", err) - os.Exit(1) - return err - } - - defer resp.Body.Close() - - // checking a response code - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("pin: can't read the request body %v", err) - os.Exit(1) - } - - // Parsing response - r := tp.PinResponse{} - e := json.Unmarshal(bytes, &r) - if e != nil { - log.Error("pin: failed to unmarshal json from response %v", e) - os.Exit(1) - } - log.Info("Finished successfully...\nCID: %v\nsize: %v\ntime: %v\nduplicate: %v", r.IpfsHash, r.PinSize, r.Timestamp, r.Duplicate) - fmt.Println(string(bytes)) - - } else { - // if something unexpected received in the response body - log.Info("status: %v\n", resp.StatusCode) - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("pin: can't read the request body %v", err) - os.Exit(1) - } - log.Error("pin: request body: %v", string(bytes)) - } - - return nil -} - -// GetCidV1 accept byte slice and count hash sum -func GetCidV1(b []byte) (cid.Cid, error) { - builder := cid.V1Builder{ - Codec: cid.DagProtobuf, - MhType: mh.SHA2_256, - MhLength: -1, - } - c, err := builder.Sum(b) - if err != nil { - os.Exit(1) - return cid.Cid{}, err - } - return c, nil - -} - -func GetCidV0(b []byte) (cid.Cid, error) { - builder := cid.V0Builder{} - c, err := builder.Sum(b) - if err != nil { - os.Exit(1) - return cid.Cid{}, err - } - return c, nil - -} - -//Downloading data. TODO: adding download for directories -func Download(args []string, keys tp.Keys, gateway string) { - c := NewClient() - - req, err := http.NewRequest(http.MethodGet, gateway+"/ipfs/"+args[0], nil) - if err != nil { - os.Exit(1) - return - } - addKeysToHeader(req, keys) - - f, err := os.Create(args[0]) - if err != nil { - log.Error("download: failed to create file/folder") - os.Exit(1) - return - } - - resp, err := c.Do(req) - if err != nil { - log.Error("download: failed to get the response") - os.Exit(1) - return - } - - if _, err = io.Copy(f, resp.Body); err != nil { - log.Error("download: failed to io.Copy") - - os.Exit(1) - } - defer resp.Body.Close() - r, _ := io.ReadAll(resp.Body) - fmt.Println(string(r)) - -} diff --git a/ipfs-api/pkg/pinatav1/pinatav1_pinned.go b/ipfs-api/pkg/pinatav1/pinatav1_pinned.go deleted file mode 100644 index 639e87ab..00000000 --- a/ipfs-api/pkg/pinatav1/pinatav1_pinned.go +++ /dev/null @@ -1,80 +0,0 @@ -package pinatav1 - -import ( - "encoding/json" - "fmt" - "io" - "net/http" - "net/http/httputil" - "os" - - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - tp "github.com/kiracore/tools/ipfs-api/types" -) - -//Checking data if it is pinned on pinata.cloud -func Pinned(args []string, keys tp.Keys) { - c := NewClient() - - req, err := http.NewRequest("GET", "https://api.pinata.cloud/data/pinList", nil) - if err != nil { - os.Exit(1) - return - } - // req.Header.Add("pinata_api_key", keys.Api_key) - // req.Header.Add("pinata_secret_api_key", keys.Api_secret) - addKeysToHeader(req, keys) - - param := req.URL.Query() - param.Add("hashContains", args[0]) - req.URL.RawQuery = param.Encode() - - resp, err := c.Do(req) - if err != nil { - log.Error("didn't get any response", err) - os.Exit(1) - } - defer resp.Body.Close() - requestDump, err := httputil.DumpRequest(req, true) - if err != nil { - log.Error("pin: failed to dump request log") - } else { - log.Debug(string(requestDump)) - } - - log.Debug(string(requestDump)) - - r := tp.PinnedResponse{} - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("can't read the request body", err) - os.Exit(1) - } - - er := json.Unmarshal(bytes, &r) - if er != nil { - log.Error("pinned: failed to unmarshal json: %v", er) - os.Exit(1) - - } - - log.Info("pinned: address exists: %v", args[0]) - j, err := json.Marshal(r) - if err != nil { - log.Error("pinned: failed to marshal json: %v", err) - } - //fmt.Println(string(bytes)) - //fmt.Println() - fmt.Println(string(j)) - - } else { - - log.Error("file with CID %v doesn't exist", args[0]) - bytes, _ := io.ReadAll(resp.Body) - - fmt.Println(string(bytes)) - os.Exit(1) - } - -} diff --git a/ipfs-api/pkg/pinatav1/pinatav1_test.go b/ipfs-api/pkg/pinatav1/pinatav1_test.go deleted file mode 100644 index 3d36c2e5..00000000 --- a/ipfs-api/pkg/pinatav1/pinatav1_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package pinatav1_test - -import ( - "fmt" - "strings" - "testing" - - pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav1" -) - -func TestCidV1Func(t *testing.T) { - s := "Hello, World!" - c := "bafybeig77vqcdozl2wyk6z3cscaj5q5fggi53aoh64fewkdiri3cdauyn4" - b := []byte(s) - - cid, err := pnt.GetCidV1(b) - - if err != nil { - t.Errorf("gietcidv1 func failed") - } - r := strings.Compare(c, cid.String()) - - fmt.Println(r) - switch r { - case 0: - t.Logf("cidv1 correct") - - case 1: - t.Errorf("cidv1 incorrect") - - case -1: - t.Errorf("cidv1 incorrect") - } - -} diff --git a/ipfs-api/pkg/pinatav1/pinatav1_unpin.go b/ipfs-api/pkg/pinatav1/pinatav1_unpin.go deleted file mode 100644 index 2bc83547..00000000 --- a/ipfs-api/pkg/pinatav1/pinatav1_unpin.go +++ /dev/null @@ -1,72 +0,0 @@ -package pinatav1 - -import ( - "encoding/json" - "fmt" - "io" - "net/http" - "os" - "time" - - log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" - tp "github.com/kiracore/tools/ipfs-api/types" -) - -// Deleting data from pinata.cloud by hash (CID) -func Unpin(args []string, keys tp.Keys) error { - c := NewClient() - - req, err := http.NewRequest(http.MethodDelete, tp.BASE_URL+tp.UNPIN+"/"+args[0], nil) - if err != nil { - log.Error("unpin: failed to assemble request ") - os.Exit(1) - return err - } - - addKeysToHeader(req, keys) - - resp, err := c.Do(req) - - if err != nil { - log.Error("unpin: didn't get any response", err) - os.Exit(1) - return err - } - defer resp.Body.Close() - r := tp.UnpinResponse{} - if resp.StatusCode == http.StatusOK { - bytes, err := io.ReadAll(resp.Body) - if err != nil { - log.Error("unpin: can't read the request body", err) - os.Exit(1) - return err - } - log.Info("deleted. CID: %v. Server response: %v", args[0], string(bytes)) - r.Success = true - r.Hash = args[0] - r.Time = time.Now() - j, err := json.Marshal(r) - if err != nil { - log.Error("unpin: failed to marshal") - os.Exit(1) - } - - fmt.Println(string(j)) - - } else { - log.Error("unpin: file/folder can't be unpinned. doesn't exist or deleted.") - r.Success = false - r.Hash = args[0] - r.Time = time.Now() - j, err := json.Marshal(r) - if err != nil { - log.Error("unpin: failed to marshal") - os.Exit(1) - } - - fmt.Println(string(j)) - os.Exit(1) - return err - } - return nil -} diff --git a/ipfs-api/scripts/build.sh b/ipfs-api/scripts/build.sh old mode 100644 new mode 100755 diff --git a/ipfs-api/scripts/publish.sh b/ipfs-api/scripts/publish.sh old mode 100644 new mode 100755 diff --git a/ipfs-api/scripts/test.sh b/ipfs-api/scripts/test.sh old mode 100644 new mode 100755 index eba8f571..ed3f0f2d --- a/ipfs-api/scripts/test.sh +++ b/ipfs-api/scripts/test.sh @@ -3,5 +3,5 @@ set +x . /etc/profile set -x -go test pkg/pinatav1 -vet=off || echo "IPFS-API test finished successfully" +go test -vet=off -v ./... || echo "IPFS-API test finished successfully" diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 89d5a05e..bf78af51 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.1.1" + IpfsApiVersion = "v0.1.2" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index 1d214b41..25703ec0 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.0" +echo "v0.2.1" From 4baf3bb400f1359ee29536d9ffadb47b11dabd4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Thu, 23 Jun 2022 11:46:39 +0200 Subject: [PATCH 096/140] fix --- RELEASE.md | 4 ++- ipfs-api/README.md | 2 +- ipfs-api/pkg/cli/cli.go | 4 +-- ipfs-api/pkg/ipfslog/ipfslog.go | 32 ++++++--------------- ipfs-api/pkg/pinatav2/pinata2_pinata_api.go | 12 +++++++- ipfs-api/pkg/pinatav2/pinatav2.go | 6 ++++ ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 8 files changed, 34 insertions(+), 30 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index f1c1eee6..f779f88a 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,6 @@ Features: -* fix ipfs-api refactored +* fix json output +* return 1 if keys failed +* verbosity set to false/true (default false) diff --git a/ipfs-api/README.md b/ipfs-api/README.md index f534135f..3e5d1914 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.2.1" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.2" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index 6b52557d..5ec2f551 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -14,7 +14,7 @@ var ( meta string path string c int8 // CID version integer representation - verbosity int8 + verbosity bool ) var rootCmd = &cobra.Command{ @@ -29,7 +29,7 @@ func Start() { rootCmd.CompletionOptions.DisableDefaultCmd = true ///Adding flags - rootCmd.PersistentFlags().Int8VarP(&verbosity, "verbose", "v", 0, "Verbosity of the output from 0..5 ") + rootCmd.PersistentFlags().BoolVarP(&verbosity, "verbose", "v", false, "Verbosity of the output from 0..5 ") rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { if err := ipfslog.SetDebugLvl(verbosity); err != nil { os.Exit(1) diff --git a/ipfs-api/pkg/ipfslog/ipfslog.go b/ipfs-api/pkg/ipfslog/ipfslog.go index 4c4c0daf..b15e518b 100644 --- a/ipfs-api/pkg/ipfslog/ipfslog.go +++ b/ipfs-api/pkg/ipfslog/ipfslog.go @@ -3,7 +3,6 @@ package ipfslog import ( - "errors" "io/ioutil" "github.com/sirupsen/logrus" @@ -21,29 +20,16 @@ var Log *logrus.Logger // // Calls panic() after logging // log.Panic("I'm bailing.") -func SetDebugLvl(l int8) error { - if l >= 0 && l < 8 { - switch l { - case 0: - Log.SetOutput(ioutil.Discard) - case 7: - Log.SetLevel(logrus.TraceLevel) - case 6: - Log.SetLevel(logrus.DebugLevel) - case 5: - Log.SetLevel(logrus.InfoLevel) - case 4: - Log.SetLevel(logrus.WarnLevel) - case 3: - Log.SetLevel(logrus.ErrorLevel) - case 2: - Log.SetLevel(logrus.FatalLevel) - case 1: - Log.SetLevel(logrus.PanicLevel) - } - } else { - return errors.New("verbocity should be in range 0 to 7") +func SetDebugLvl(l bool) error { + + switch l { + case false: + Log.SetOutput(ioutil.Discard) + case true: + Log.SetLevel(logrus.TraceLevel) + } + return nil } func init() { diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go index db0d60a5..c71b0b18 100644 --- a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go @@ -279,7 +279,8 @@ func (p *PinataApi) OutputPinJson() error { if err := json.Unmarshal(p.resp, &s); err != nil { return err } - j, err := json.Marshal(s) + s2 := PinResponseJSONProd(s) + j, err := json.Marshal(s2) if err != nil { return err } @@ -287,6 +288,9 @@ func (p *PinataApi) OutputPinJson() error { return nil } func (p *PinataApi) OutputPinnedJson() error { + if p.respCode != http.StatusOK { + return errors.New("something failed") + } s := PinnedResponse{} if err := json.Unmarshal(p.resp, &s); err != nil { return err @@ -300,6 +304,9 @@ func (p *PinataApi) OutputPinnedJson() error { } func (p *PinataApi) OutputTestJson() error { + if p.respCode != http.StatusOK { + return errors.New("something failed") + } s := TestResponse{} if err := json.Unmarshal(p.resp, &s); err != nil { return err @@ -312,6 +319,9 @@ func (p *PinataApi) OutputTestJson() error { return nil } func (p *PinataApi) OutputUnpinJson() error { + if p.respCode != http.StatusOK { + return errors.New("something failed") + } s := UnpinResponse{} if err := json.Unmarshal(p.resp, &s); err != nil { return err diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index ab864b63..52e8f351 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -38,6 +38,12 @@ type PinnedResponse struct { Rows []Rows `json:"rows,omitempty"` } +type PinResponseJSONProd struct { + Duplicate bool `json:"duplicate,omitempty"` + IpfsHash string `json:"hash"` + Timestamp string `json:"timestamp"` + PinSize int64 `json:"size"` +} type PinResponseJSON struct { Duplicate bool `json:"isduplicate,omitempty"` IpfsHash string `json:"ipfshash"` diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index bf78af51..2b87aa05 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.1.2" + IpfsApiVersion = "v0.1.3" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index 25703ec0..1ac0c3b6 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.1" +echo "v0.2.2" From 585fe37bab75edf9f20b8a2982fee7db71c081c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Sat, 25 Jun 2022 11:57:10 +0200 Subject: [PATCH 097/140] Added cid validation, tests, pinned by name, metadata pre-check --- RELEASE.md | 8 +- ipfs-api/README.md | 2 +- ipfs-api/go.mod | 11 ++ ipfs-api/go.sum | 34 ++++++ ipfs-api/pkg/cli/pin.go | 7 +- ipfs-api/pkg/cli/pinned.go | 9 ++ ipfs-api/pkg/cli/unpin.go | 17 ++- ipfs-api/pkg/pinatav2/pinata2_pinata_api.go | 52 +++++++-- .../pkg/pinatav2/pinata2_pinata_api_test.go | 103 ++++++++++++++++++ ipfs-api/pkg/pinatav2/pinatav2.go | 12 +- ipfs-api/scripts/test.sh | 2 +- ipfs-api/types/constants.go | 2 +- scripts/test.sh | 4 +- scripts/version.sh | 2 +- 14 files changed, 240 insertions(+), 25 deletions(-) create mode 100644 ipfs-api/pkg/pinatav2/pinata2_pinata_api_test.go diff --git a/RELEASE.md b/RELEASE.md index f779f88a..10e5f845 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,6 @@ Features: -* fix json output -* return 1 if keys failed -* verbosity set to false/true (default false) +* Added func to validate cid +* Added tests to test the cid validation func +* Added check if pinned by name and hash +* Added precheck if metadata name exist on gateway - diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 3e5d1914..5867bdd0 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.2.2" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.3" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/go.mod b/ipfs-api/go.mod index 8544b2e7..03fdea21 100644 --- a/ipfs-api/go.mod +++ b/ipfs-api/go.mod @@ -3,6 +3,7 @@ module github.com/kiracore/tools/ipfs-api go 1.17 require ( + github.com/ipfs/go-cid v0.2.0 github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 @@ -10,8 +11,18 @@ require ( require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/klauspost/cpuid/v2 v2.0.4 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect + github.com/minio/sha256-simd v1.0.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.0.3 // indirect + github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-multibase v0.0.3 // indirect + github.com/multiformats/go-multihash v0.0.15 // indirect + github.com/multiformats/go-varint v0.0.6 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.3.0 // indirect + golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/text v0.3.7 // indirect ) diff --git a/ipfs-api/go.sum b/ipfs-api/go.sum index e7793627..2850d1fb 100644 --- a/ipfs-api/go.sum +++ b/ipfs-api/go.sum @@ -4,6 +4,27 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= +github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= +github.com/klauspost/cpuid/v2 v2.0.4 h1:g0I61F2K2DjRHz1cnxlkNSBIaePVoJIjjnHui8QHbiw= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= +github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= +github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= +github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= +github.com/multiformats/go-multihash v0.0.15 h1:hWOPdrNqDjwHDx82vsYGSDZNyktOJJ2dzZJzFkOV1jM= +github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= +github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -17,13 +38,26 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022 h1:0qjDla5xICC2suMtyRH/QqX3B1btXTfNsIt/i4LFgO0= golang.org/x/net v0.0.0-20220614195744-fb05da6f9022/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index 04dac5b3..e5514b80 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -59,14 +59,19 @@ func pinCmd(cmd *cobra.Command, args []string) error { err := p.Pin(args[0]) if err != nil { log.Error("pin failed %v", err) + return err } } case 2: { - p.SetMetaName(args[1]) + if err := p.SetMetaName(args[1]); err != nil { + log.Error("failed to add metadata %v", err) + return err + } err := p.Pin(args[0]) if err != nil { log.Error("pin failed %v", err) + return err } } } diff --git a/ipfs-api/pkg/cli/pinned.go b/ipfs-api/pkg/cli/pinned.go index e255ce18..b1c3129b 100644 --- a/ipfs-api/pkg/cli/pinned.go +++ b/ipfs-api/pkg/cli/pinned.go @@ -1,7 +1,11 @@ package cli import ( + "errors" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" + "github.com/spf13/cobra" ) @@ -14,6 +18,10 @@ var pinnedCommand = &cobra.Command{ } func pinned(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + log.Error("pinned: empty arg") + return errors.New("args can't be empty") + } keys, err := pnt.GrabKey(key) if err != nil { return err @@ -22,6 +30,7 @@ func pinned(cmd *cobra.Command, args []string) error { p := pnt.PinataApi{} p.SetKeys(keys) if err := p.Pinned(args[0]); err != nil { + log.Error("Cant't pin this") return err } err = p.OutputPinnedJson() diff --git a/ipfs-api/pkg/cli/unpin.go b/ipfs-api/pkg/cli/unpin.go index 933d631d..dc3113e8 100644 --- a/ipfs-api/pkg/cli/unpin.go +++ b/ipfs-api/pkg/cli/unpin.go @@ -17,11 +17,18 @@ func unpin(cmd *cobra.Command, args []string) error { keys, _ := pnt.GrabKey(key) p := pnt.PinataApi{} p.SetKeys(keys) - err := p.Unpin(args[0]) - if err != nil { - return err + + if pnt.ValidateCid(args[0]) { + err := p.Unpin(args[0]) + if err != nil { + return err + } + p.OutputUnpinJson() + } else { + err := p.Pinned(args[0]) + if err != nil { + return err + } } - p.OutputUnpinJson() return nil - } diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go index c71b0b18..3d6536f7 100644 --- a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go @@ -14,12 +14,21 @@ import ( "net/textproto" "time" + cid "github.com/ipfs/go-cid" log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" tp "github.com/kiracore/tools/ipfs-api/types" "golang.org/x/net/http2" ) // Setting new client for an Api +func ValidateCid(hash string) bool { + _, err := cid.Decode(hash) + if err != nil { + return false + } + return true +} + func (p *PinataApi) newClient() { // Client params to be adjusted ... @@ -94,10 +103,17 @@ func (p *PinataApi) Unpin(hash string) error { } func (p *PinataApi) Pinned(hash string) error { - req, err := p.request.Get(tp.BASE_URL + tp.PINNEDDATA) + url := Url{} + if ValidateCid(hash) { + url.Set(tp.BASE_URL + tp.PINNEDDATA + "/?status=pinned&hashContains=" + hash) + } else { + url.Set(tp.BASE_URL + tp.PINNEDDATA + "/?status=pinned&metadata[name]=" + hash) + } + req, err := p.request.Get(url.Get()) if err != nil { return err } + resp, err := p.client.Do(req) if err != nil { log.Debug("Ipfs-api: test: invalid response: %v", err) @@ -111,10 +127,13 @@ func (p *PinataApi) Pinned(hash string) error { } p.SaveResp(b) p.SetRespCode(resp.StatusCode) + return nil } func (p *PinataApi) Pin(path string) error { + // Return response as a struct. Clone output logic to + // response struct if _, err := os.Stat(path); os.IsNotExist(err) { log.Error("pin: provided path doesn't exist") return err @@ -216,11 +235,9 @@ func (p *PinataApi) SetOpts(c int8, b bool) error { } else { return errors.New("CID version should be 0 or 1") } - if b && !b { - p.opts.wrapWithDirectory = b - } else { - return errors.New("accept bool value true or false") - } + + p.opts.wrapWithDirectory = b + return nil } @@ -247,7 +264,20 @@ func (p *PinataApi) GetMeta() string { } func (p *PinataApi) SetMetaName(n string) error { - if len(n) != 0 && len(n) <= 250 { + if len(n) != 0 && len(n) <= 245 { + err := p.Pinned(n) + if err != nil { + return err + } + s := PinnedResponse{} + if err := json.Unmarshal(p.resp, &s); err != nil { + return err + } + if s.Count != 0 { + log.Error("SetMetaName: name exist") + return errors.New("name already exist") + } + p.meta.name = n return nil } else { @@ -333,3 +363,11 @@ func (p *PinataApi) OutputUnpinJson() error { fmt.Println(string(j)) return nil } + +func (u *Url) Set(url string) { + u.url = url +} + +func (u *Url) Get() string { + return u.url +} diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api_test.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api_test.go new file mode 100644 index 00000000..cb493154 --- /dev/null +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api_test.go @@ -0,0 +1,103 @@ +package pinatav2 + +import ( + "testing" +) + +func TestPinataApiSetOptsMax(t *testing.T) { + p := PinataApi{} + err := p.SetOpts(127, false) + if err == nil { + t.Errorf("want error") + } + +} +func TestPinataApiSetOptsMin(t *testing.T) { + p := PinataApi{} + err := p.SetOpts(-127, false) + if err == nil { + t.Errorf("want error") + } + +} +func TestPinataApiSetOptsOne(t *testing.T) { + p := PinataApi{} + err := p.SetOpts(1, false) + if err != nil { + t.Errorf("want error %v", err) + } + +} +func TestPinataApiSetOptZero(t *testing.T) { + p := PinataApi{} + err := p.SetOpts(0, false) + if err != nil { + t.Errorf("want error") + } + +} + +func TestPinataApiSetMetaNameMax(t *testing.T) { + p := PinataApi{} + err := p.SetMetaName("gcwcorzcwupzndmvvawifxtmpvjuaiwbmnuiaqoesqajfucqwpcnrdgkyflcgdrmlquzwcszigxdqpzrttppxwyoxqrtdabllqsfwoionofffkmdtljeyiilrfrvnidmqbwitjklbcfjuutawvcabzdfsqkjmanzaxyvmribarjibidqudyawqpeharlpoaoaxrknvrvhtihsbsymabunbnbseqwnbyklygixxbuwdjzytsjubrkgrgwda") + if err == nil { + t.Errorf("want not nil got nil") + } +} + +func TestPinataApiSetMetaNameMin(t *testing.T) { + p := PinataApi{} + err := p.SetMetaName("") + if err == nil { + t.Errorf("want error: %v", err) + } +} + +func TestPinataApiCheckMetaEmpty(t *testing.T) { + p := PinataApi{} + b := p.CheckMeta() + if b { + t.Errorf("Should be false") + } +} + +func TestPinataApiCheckMetaFull(t *testing.T) { + p := PinataApi{} + p.SetMetaName("Full") + b := p.CheckMeta() + if !b { + t.Errorf("Should be true") + } +} + +func TestPinataApiValidateCidNotValid(t *testing.T) { + str := "./root/test/somefile.txt" + b := ValidateCid(str) + if b { + t.Errorf("String is not valid, want false") + } +} + +func TestPinataApiValidateCidEmpty(t *testing.T) { + str := "" + b := ValidateCid(str) + if b { + t.Errorf("String is not valid, want false") + } +} + +func TestPinataApiValidateCidValidv1(t *testing.T) { + str := "bafybeibkjmxftowv4lki46nad4arescoqc7kdzfnjkqux257i4jonk44w4" + b := ValidateCid(str) + if !b { + t.Errorf("String is not valid, want false") + } +} + +func TestPinataApiValidateCidValidv0(t *testing.T) { + str := "QmRBkKi1PnthqaBaiZnXML6fH6PNqCFdpcBxGYXoUQfp6z" + b := ValidateCid(str) + if !b { + t.Errorf("String is not valid, want false") + } +} diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index 52e8f351..3935e77f 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -34,8 +34,8 @@ type Rows struct { } type PinnedResponse struct { - Count int32 `json:"count,omitempty"` - Rows []Rows `json:"rows,omitempty"` + Count int32 `json:"count"` + Rows []Rows `json:"rows"` } type PinResponseJSONProd struct { @@ -79,6 +79,14 @@ type RegionsJSON struct { // desiredRC int16 // } +type Url struct { + url string +} +type Query struct { + Hash string `url:"metadata[name],omitempty"` + Meta string `url:"metadata[name],omitempty"` +} + type PinataOptionsJSON struct { WrapWithDirectory bool `json:"wrapWithDirectory"` // Adds availability to address dir name instead of hash CidVersion int8 `json:"cidVersion"` // 0 or 1 Returns CID version of a choice diff --git a/ipfs-api/scripts/test.sh b/ipfs-api/scripts/test.sh index ed3f0f2d..e29e6efc 100755 --- a/ipfs-api/scripts/test.sh +++ b/ipfs-api/scripts/test.sh @@ -3,5 +3,5 @@ set +x . /etc/profile set -x -go test -vet=off -v ./... || echo "IPFS-API test finished successfully" +go test ./... -vet=off -v || echo "IPFS-API test finished successfully" diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 2b87aa05..5357b00a 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.1.3" + IpfsApiVersion = "v0.1.4" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/test.sh b/scripts/test.sh index a69d515f..2d3fb2d1 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -25,9 +25,9 @@ cd ./tmkms-key-import make test cd $WORKDIR -# Test tm key importer +# Test ipfs-api cd ./ipfs-api -make test +make test cd $WORKDIR echoInfo "SUCCESS: Testing finished" \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh index 1ac0c3b6..63de3207 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.2" +echo "v0.2.3" From e9a3ac248d5fbd49b1e7291e86a1c6fa6ddc8d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Sat, 25 Jun 2022 14:07:38 +0200 Subject: [PATCH 098/140] added unpin logic, fix cli verbosity --- RELEASE.md | 8 +-- ipfs-api/README.md | 2 +- ipfs-api/pkg/cli/cli.go | 2 +- ipfs-api/pkg/cli/unpin.go | 36 +++++++----- ipfs-api/pkg/cli/version.go | 1 - ipfs-api/pkg/pinatav2/pinata2_pinata_api.go | 62 +++++++++++++++++---- ipfs-api/pkg/pinatav2/pinatav2.go | 1 + scripts/version.sh | 2 +- 8 files changed, 81 insertions(+), 33 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 10e5f845..11b640f9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,6 @@ Features: -* Added func to validate cid -* Added tests to test the cid validation func -* Added check if pinned by name and hash -* Added precheck if metadata name exist on gateway +* Added unpin logic to accept name and cid, as well as pre-check + +Fix: +* ipfs-api cli verbosity description fix diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 5867bdd0..92b93ddd 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.2.3" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.4" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index 5ec2f551..aa0066de 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -29,7 +29,7 @@ func Start() { rootCmd.CompletionOptions.DisableDefaultCmd = true ///Adding flags - rootCmd.PersistentFlags().BoolVarP(&verbosity, "verbose", "v", false, "Verbosity of the output from 0..5 ") + rootCmd.PersistentFlags().BoolVarP(&verbosity, "verbose", "v", false, "Verbosity level: if true log output or false - jsons and errors. ") rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { if err := ipfslog.SetDebugLvl(verbosity); err != nil { os.Exit(1) diff --git a/ipfs-api/pkg/cli/unpin.go b/ipfs-api/pkg/cli/unpin.go index dc3113e8..4ca087f2 100644 --- a/ipfs-api/pkg/cli/unpin.go +++ b/ipfs-api/pkg/cli/unpin.go @@ -1,6 +1,9 @@ package cli import ( + "errors" + + log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" pnt "github.com/kiracore/tools/ipfs-api/pkg/pinatav2" "github.com/spf13/cobra" ) @@ -14,21 +17,28 @@ var unpinCommand = &cobra.Command{ } func unpin(cmd *cobra.Command, args []string) error { - keys, _ := pnt.GrabKey(key) + if len(args) == 0 { + log.Error("pinned: empty arg") + return errors.New("args can't be empty") + } + keys, err := pnt.GrabKey(key) + if err != nil { + log.Error("failed to process keys") + return err + } + p := pnt.PinataApi{} p.SetKeys(keys) - - if pnt.ValidateCid(args[0]) { - err := p.Unpin(args[0]) - if err != nil { - return err - } - p.OutputUnpinJson() - } else { - err := p.Pinned(args[0]) - if err != nil { - return err - } + p.SetData(args[0]) + if err := p.Unpin(args[0]); err != nil { + log.Error("unable to unpin: %v", err) + return err + } + err = p.OutputUnpinJson() + if err != nil { + log.Error("failed to print results") + return err } + return nil } diff --git a/ipfs-api/pkg/cli/version.go b/ipfs-api/pkg/cli/version.go index b72812e5..85d117c5 100644 --- a/ipfs-api/pkg/cli/version.go +++ b/ipfs-api/pkg/cli/version.go @@ -16,6 +16,5 @@ var versionCommand = &cobra.Command{ func cmdVersion(cmd *cobra.Command, args []string) error { fmt.Println(tp.IpfsApiVersion) - return nil } diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go index 3d6536f7..368e5845 100644 --- a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go @@ -82,15 +82,45 @@ func (p *PinataApi) Test() error { } func (p *PinataApi) Unpin(hash string) error { - req, err := p.request.Del(tp.BASE_URL + tp.UNPIN) + url := Url{} + if ValidateCid(hash) { + url.Set(tp.BASE_URL + tp.UNPIN + "/" + hash) + log.Debug("unpin: url: %v", url.Get()) + } else { + err := p.Pinned(hash) + if err != nil { + return err + } + s := PinnedResponse{} + if err := json.Unmarshal(p.resp, &s); err != nil { + log.Error("unpin: failed to unmarshal") + return err + } + + switch s.Count { + case 0: + return fmt.Errorf(`not found. data with name %s doesn't exist`, hash) + case 1: + url.Set(tp.BASE_URL + tp.UNPIN + "/" + s.Rows[0].CID) //TODO: refactor + p.SetData(s.Rows[0].CID) + + default: + return errors.New("more than one result returned") + } + + } + + req, err := p.request.Del(url.Get()) + if err != nil { return err } resp, err := p.client.Do(req) if err != nil { - log.Debug("Ipfs-api: test: invalid response: %v", err) + return err } + defer resp.Body.Close() b, err := io.ReadAll(resp.Body) @@ -98,7 +128,9 @@ func (p *PinataApi) Unpin(hash string) error { return err } p.SaveResp(b) + p.SetRespCode(resp.StatusCode) + return nil } @@ -307,11 +339,13 @@ func (p *PinataApi) SaveResp(resp []byte) { func (p *PinataApi) OutputPinJson() error { s := PinResponseJSON{} if err := json.Unmarshal(p.resp, &s); err != nil { + log.Error("failed to unmarshal in json") return err } s2 := PinResponseJSONProd(s) j, err := json.Marshal(s2) if err != nil { + log.Error("failed to marshal") return err } fmt.Println(string(j)) @@ -350,17 +384,17 @@ func (p *PinataApi) OutputTestJson() error { } func (p *PinataApi) OutputUnpinJson() error { if p.respCode != http.StatusOK { - return errors.New("something failed") - } - s := UnpinResponse{} - if err := json.Unmarshal(p.resp, &s); err != nil { - return err - } - j, err := json.Marshal(s) - if err != nil { - return err + return fmt.Errorf("server returned: %v", p.respCode) + } else { + s := UnpinResponse{Success: true, Hash: p.data, Time: time.Now()} + j, err := json.Marshal(s) + if err != nil { + log.Error("failed to marshal") + return err + } + fmt.Println(string(j)) } - fmt.Println(string(j)) + return nil } @@ -371,3 +405,7 @@ func (u *Url) Set(url string) { func (u *Url) Get() string { return u.url } + +func (p *PinataApi) SetData(data string) { + p.data = data +} diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index 3935e77f..f9f853a6 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -136,6 +136,7 @@ type PinataApi struct { walker Walker opts PinataOptions meta PinataMetadata + data string resp []byte dump bool respCode int diff --git a/scripts/version.sh b/scripts/version.sh index 63de3207..9717157e 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.3" +echo "v0.2.4" From af0c95b3309b68ee8396c7ef5855aa9b07d1eb2d Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 28 Jun 2022 09:08:41 +0000 Subject: [PATCH 099/140] allow pipe to version and date converters --- bash-utils/bash-utils.sh | 10 +++++--- bash-utils/scripts/test.sh | 52 ++++++++++++++++++++++++++++++++++++++ scripts/version.sh | 2 +- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index fc4fbee1..569e6618 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.1.5" + local BASH_UTILS_VERSION="v0.2.5" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -194,7 +194,9 @@ function isVersion { } function date2unix() { - local DATE_TMP="$*" && DATE_TMP=$(echo "$DATE_TMP" | xargs 2> /dev/null || echo -n "") + local DATE_TMP="" + [ -z "$*" ] && DATE_TMP="$(timeout 1 cat 2> /dev/null || echo "")" || DATE_TMP="$*" + DATE_TMP=$(echo "$DATE_TMP" | xargs 2> /dev/null || echo -n "") if (! $(isNullOrWhitespaces "$DATE_TMP")) && (! $(isNaturalNumber $DATE_TMP)) ; then DATE_TMP=$(date -d "$DATE_TMP" +"%s" 2> /dev/null || echo "0") fi @@ -229,7 +231,9 @@ function isFileEmpty() { # Example use case: [[ $(versionToNumber "v0.0.0.3") -lt $(versionToNumber "v1.0.0.2") ]] && echo true || echo false function versionToNumber() { - local version=$(echo "$1" | grep -o '[^-]*$' 2> /dev/null || echo "v0.0.0.0") + local version="" + [ -z "$1" ] && version="$(timeout 1 cat 2> /dev/null || echo "")" || version="$1" + version=$(echo "$version" | tr -d [a-z,A-Z] | sed "s/-././g" | sed "s/+/./g" | sed "s/-//g" | tr -d ' ') local major=$(echo $version | cut -d. -f1 | sed 's/[^0-9]*//g' 2> /dev/null || echo "0") && (! $(isNaturalNumber "$major")) && major=0 local minor=$(echo $version | cut -d. -f2 | sed 's/[^0-9]*//g' 2> /dev/null || echo "0") && (! $(isNaturalNumber "$minor")) && minor=0 local micro=$(echo $version | cut -d. -f3 | sed 's/[^0-9]*//g' 2> /dev/null || echo "0") && (! $(isNaturalNumber "$micro")) && micro=0 diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 183d90e9..5c273ae8 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -133,6 +133,58 @@ source $TEST_FILE [ "$BASH_UTIL_TEST_1" != ":) Oo !" ] && echoErr "ERROR: Expected 'BASH_UTIL_TEST_1' to be ':) Oo !', but got '$BASH_UTIL_TEST_1'" && exit 1 [ "$BASH_UTIL_TEST_2" != "test" ] && echoErr "ERROR: Expected 'BASH_UTIL_TEST_2' to be ':) Oo !', but got '$BASH_UTIL_TEST_2'" && exit 1 +################################################################# +echoWarn "TEST: date2unix" + +TMP_DATE_1=$(date) +TMP_DATE_1_RESULT_1=$(date2unix "$TMP_DATE_1") +TMP_DATE_1_RESULT_2=$(echo "$TMP_DATE_1" | date2unix) + +( (! $(isNaturalNumber "$TMP_DATE_1_RESULT_1")) || [ $TMP_DATE_1_RESULT_1 -lt 1 ] || [ "$TMP_DATE_1_RESULT_1" != "$TMP_DATE_1_RESULT_2" ] ) && \ + echoErr "ERROR: Expected 'TMP_DATE_1_RESULT_1' to be greter than 0 and equal to 'TMP_DATE_1_RESULT_2', but got '$TMP_DATE_1_RESULT_1' && '$TMP_DATE_1_RESULT_2' from '$TMP_DATE_1'" && exit 1 || echoInfo "INFO: Test 1 passed" + +TMP_DATE_3="1970-01-01T00:00:00" +TMP_DATE_3_EXPECTED="0" +TMP_DATE_3_RESULT_1=$(date2unix "$TMP_DATE_3") +TMP_DATE_3_RESULT_2=$(echo "$TMP_DATE_3" | date2unix) +TMP_DATE_3_RESULT_3=$(date2unix "") +TMP_DATE_3_RESULT_4=$(echo "" | date2unix) + +( (! $(isNaturalNumber "$TMP_DATE_3_RESULT_1")) || [ "${TMP_DATE_3_RESULT_1},${TMP_DATE_3_RESULT_2},${TMP_DATE_3_RESULT_3},${TMP_DATE_3_RESULT_4}" != "0,0,0,0" ] ) && \ + echoErr "ERROR: Expected 'TMP_DATE_3_RESULT_1' to be equal to 'TMP_DATE_3_RESULT_2', 'TMP_DATE_3_RESULT_3', 'TMP_DATE_3_RESULT_4' and '$TMP_DATE_3_EXPECTED', but got '$TMP_DATE_3_RESULT_1', '$TMP_DATE_3_RESULT_2', '$TMP_DATE_3_RESULT_3' && '$TMP_DATE_3_RESULT_4' from '$TMP_DATE_3' && ''" && exit 1 || echoInfo "INFO: Test 2 passed" + +TMP_DATE_2="2022-06-24T11:35:30.636Z" +TMP_DATE_2_EXPECTED="1656070530" +TMP_DATE_2_RESULT_1=$(date2unix "$TMP_DATE_2") +TMP_DATE_2_RESULT_2=$(echo "$TMP_DATE_2" | date2unix) + +( (! $(isNaturalNumber "$TMP_DATE_2_RESULT_1")) || [ $TMP_DATE_2_RESULT_1 -ne $TMP_DATE_2_EXPECTED ] || [ "$TMP_DATE_2_RESULT_1" != "$TMP_DATE_2_RESULT_2" ] ) && \ + echoErr "ERROR: Expected 'TMP_DATE_2_RESULT_1' to be equal to 'TMP_DATE_2_RESULT_2' and '$TMP_DATE_2_EXPECTED', but got '$TMP_DATE_2_RESULT_1' && '$TMP_DATE_2_RESULT_2' from '$TMP_DATE_2'" && exit 1 || echoInfo "INFO: Test 3 passed" + +################################################################# +echoWarn "TEST: versionToNumber" + +[[ $(versionToNumber "v1.2.3.4") -lt $(versionToNumber "v0.999.999.999") ]] && \ + echoErr "ERROR: Version 'v1.2.3.4' must be greater than v0.999.999.999" && exit 1 || echoInfo "INFO: Test 1 passed" + +[[ $(versionToNumber "v0.2.3.4") -gt $(versionToNumber "v0.999.999.999") ]] && \ + echoErr "ERROR: Version 'v0.2.3.4' must be less than v0.999.999.999" && exit 1 || echoInfo "INFO: Test 2 passed" + +[ "$(versionToNumber v1.2.3.4)" != "1000200030004" ] && \ + echoErr "ERROR: Version 'v1.2.3.4' must be equal to 1000200030004, but got '$(versionToNumber v1.2.3.4)'" && exit 1 || echoInfo "INFO: Test 3 passed" + +[ "$(versionToNumber v1.2.3-rc.4)" != "1000200030004" ] && \ + echoErr "ERROR: Version 'v1.2.3-rc.4' must be equal to 1000200030004, but got '$(versionToNumber v1.2.3-rc.4)'" && exit 1 || echoInfo "INFO: Test 4 passed" + +[ "$(versionToNumber v1.2.3-alpha.4)" != "1000200030004" ] && \ + echoErr "ERROR: Version 'v1.2.3-alpha.4' must be equal to 1000200030004, but got '$(versionToNumber v1.2.3-alpha.4)'" && exit 1 || echoInfo "INFO: Test 5 passed" + +( [ "$(versionToNumber v1.2.3)" != "1000200030000" ] || "$(echo "1.2.3" | versionToNumber)" != "1000200030000" ] ) && \ + echoErr "ERROR: Version 'v1.2.3' must be equal to 1000200030004, but got '$(versionToNumber v1.2.3)'" && exit 1 || echoInfo "INFO: Test 6 passed" + +( [ "$(echo "" | versionToNumber)" != "0" ] || [ "$(versionToNumber "")" != "0" ] ) && \ + echoErr "ERROR: Version '' must be equal to 0" && exit 1 || echoInfo "INFO: Test 7 passed" + ################################################################# echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index 9717157e..5c50e38e 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.4" +echo "v0.2.5-rc.8" From c60831520eceae33fe855fd8c9601f7b720db7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Sun, 3 Jul 2022 22:13:47 +0200 Subject: [PATCH 100/140] Added overwrite, force, metadata flags --- RELEASE.md | 7 +- ipfs-api/README.md | 2 +- ipfs-api/pkg/cli/cli.go | 6 + ipfs-api/pkg/cli/pin.go | 119 +++++++++++++++----- ipfs-api/pkg/pinatav2/pinata2_pinata_api.go | 56 ++++++++- ipfs-api/pkg/pinatav2/pinatav2.go | 22 ++++ ipfs-api/pkg/pinatav2/pinatav2_request.go | 10 ++ ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 9 files changed, 190 insertions(+), 36 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 11b640f9..d3884e8e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,7 @@ Features: -* Added unpin logic to accept name and cid, as well as pre-check +* Added ```--overwrite``` flag +* Added ```--force``` flag +* Added ```--metadata``` flag + -Fix: -* ipfs-api cli verbosity description fix diff --git a/ipfs-api/README.md b/ipfs-api/README.md index 92b93ddd..f929216b 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.2.4" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.6" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/pkg/cli/cli.go b/ipfs-api/pkg/cli/cli.go index aa0066de..5f2b58c3 100644 --- a/ipfs-api/pkg/cli/cli.go +++ b/ipfs-api/pkg/cli/cli.go @@ -15,6 +15,8 @@ var ( path string c int8 // CID version integer representation verbosity bool + force bool + overwrite bool ) var rootCmd = &cobra.Command{ @@ -38,6 +40,10 @@ func Start() { } pinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") pinCommand.Flags().Int8VarP(&c, "cid", "c", 1, "CID version. 0 - CIDv0, 1 - CIDv1") + pinCommand.PersistentFlags().BoolVarP(&force, "force", "f", false, "force to change name if file/folder already exist (default false)") + pinCommand.PersistentFlags().BoolVarP(&overwrite, "overwrite", "o", false, "will delete and pin again given file/folder (default false)") + pinCommand.PersistentFlags().StringVarP(&meta, "metadata", "m", "", "additional metadata, coma-separated. Example: -m=key,value,key,value") + pinnedCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") unpinCommand.PersistentFlags().StringVarP(&key, "key", "k", "", "path to your key") diff --git a/ipfs-api/pkg/cli/pin.go b/ipfs-api/pkg/cli/pin.go index e5514b80..7e73613d 100644 --- a/ipfs-api/pkg/cli/pin.go +++ b/ipfs-api/pkg/cli/pin.go @@ -1,6 +1,7 @@ package cli import ( + "errors" "os" log "github.com/kiracore/tools/ipfs-api/pkg/ipfslog" @@ -27,24 +28,12 @@ var pinCommand = &cobra.Command{ RunE: pinCmd, } -// func pinCmd(cmd *cobra.Command, args []string) error { -// if c != 1 && c != 0 { -// log.Fatalln("CID version value should be 0 or 1") -// } -// keys, _ := grabKey(key) -// tp.Opts = tp.PinataOptions{CidVersion: c, WrapWithDirectory: wd} -// if err := pnt.Pin(args, keys); err != nil { -// log.Fatalln("\033[31m", err) -// os.Exit(1) -// } -// return nil -// } -// func checkName(cmd *cobra.Command, args []string) error { -// keys, _ := grabKey(key) -// pnt.GetHashByName(args, keys) -// return nil -// } func pinCmd(cmd *cobra.Command, args []string) error { + if overwrite && force { + log.Error("pinCmd: conflict: only one flag can be set") + return errors.New("conflict: only one flag can be set") + } + keys, err := pnt.GrabKey(key) if err != nil { log.Error("grabKey: failed to get keys: %v", err) @@ -55,30 +44,102 @@ func pinCmd(cmd *cobra.Command, args []string) error { switch len(args) { case 1: - { - err := p.Pin(args[0]) + if force { + log.Error("pinCmd: can't force if metadata is not provided") + return errors.New("can't force if metadata is not provided") + } + if len(meta) > 0 { + m, err := pnt.StrToMeta(meta) if err != nil { - log.Error("pin failed %v", err) return err } + p.SetMetaData(m) } + + err := p.Pin(args[0]) + if err != nil { + log.Error("pin failed %v", err) + return err + } + if err := p.OutputPinJson(); err != nil { + log.Error("failed to print results: %v", err) + os.Exit(1) + } + case 2: - { - if err := p.SetMetaName(args[1]); err != nil { - log.Error("failed to add metadata %v", err) - return err + switch force { + case false: + switch overwrite { + case false: + if err := p.SetMetaName(args[1]); err != nil { + log.Error("failed to add metadata %v", err) + return err + } + if len(meta) > 0 { + m, err := pnt.StrToMeta(meta) + if err != nil { + return err + } + p.SetMetaData(m) + } + err := p.Pin(args[0]) + if err != nil { + log.Error("pin failed %v", err) + return err + } + if err := p.OutputPinJson(); err != nil { + log.Error("failed to print results: %v", err) + os.Exit(1) + } + case true: + if err := p.SetMetaName(args[1]); err != nil { + p.Unpin(args[1]) + } + if err := p.SetMetaName(args[1]); err != nil { + log.Error("failed to add metadata %v", err) + return err + } + if len(meta) > 0 { + m, err := pnt.StrToMeta(meta) + if err != nil { + return err + } + p.SetMetaData(m) + } + + err := p.Pin(args[0]) + if err != nil { + log.Error("pin failed %v", err) + return err + } + + } + case true: + if len(meta) > 0 { + m, err := pnt.StrToMeta(meta) + if err != nil { + return err + } + p.SetMetaData(m) } err := p.Pin(args[0]) if err != nil { log.Error("pin failed %v", err) return err } + o, err := p.OutputPinJsonObj() + if err != nil { + return err + } + if o.Duplicate { + err := p.SetMeta(o.IpfsHash, args[1]) + if err != nil { + return err + } + } + } - } - if err := p.OutputPinJson(); err != nil { - log.Error("failed to print results: %v", err) - os.Exit(1) - } + } return nil } diff --git a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go index 368e5845..af7f6773 100644 --- a/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go +++ b/ipfs-api/pkg/pinatav2/pinata2_pinata_api.go @@ -1,6 +1,7 @@ package pinatav2 import ( + "bytes" "crypto/tls" "encoding/json" "errors" @@ -223,6 +224,7 @@ func (p *PinataApi) createBody() (string, io.Reader, error) { bw.WriteField(tp.PINATAOPTS, p.GetOpts()) if p.CheckMeta() { + log.Debug("meta available: will set %v", p.GetMeta()) bw.WriteField(tp.PINATAMETA, p.GetMeta()) } @@ -294,7 +296,50 @@ func (p *PinataApi) GetMeta() string { } return string(j) } +func (p *PinataApi) SetMeta(h string, n string) error { + r := PinataPutMetadataJSON{ + IpfsHash: h, + Name: n, + KeyValues: p.meta.keyValues, + } + var buf bytes.Buffer + + err := json.NewEncoder(&buf).Encode(r) + if err != nil { + log.Error("SetMeta: %s", err) + return err + } + + req, err := p.request.Put(tp.BASE_URL+tp.METADATA_URL, &buf) + if err != nil { + return err + } + req.Header.Add("Content-Type", "application/json") + + rd, err := httputil.DumpRequest(req, true) + if err != nil { + return err + } + f, err := os.Create("./dump.log") + if err != nil { + return err + } + f.Write(rd) + f.Close() + if resp, err := p.client.Do(req); err != nil { + return err + } else { + r, _ := io.ReadAll(resp.Body) + fmt.Println(string(r)) + } + + return nil + +} +func (p *PinataApi) SetMetaData(m map[string]string) { + p.meta.keyValues = m +} func (p *PinataApi) SetMetaName(n string) error { if len(n) != 0 && len(n) <= 245 { err := p.Pinned(n) @@ -309,7 +354,7 @@ func (p *PinataApi) SetMetaName(n string) error { log.Error("SetMetaName: name exist") return errors.New("name already exist") } - + log.Debug("setting meta name to %s", n) p.meta.name = n return nil } else { @@ -335,6 +380,15 @@ func (p *PinataApi) SetRespCode(code int) { func (p *PinataApi) SaveResp(resp []byte) { p.resp = resp } +func (p *PinataApi) OutputPinJsonObj() (PinResponseJSON, error) { + s := PinResponseJSON{} + if err := json.Unmarshal(p.resp, &s); err != nil { + log.Error("failed to unmarshal in json") + return PinResponseJSON{}, err + } + return s, nil + +} func (p *PinataApi) OutputPinJson() error { s := PinResponseJSON{} diff --git a/ipfs-api/pkg/pinatav2/pinatav2.go b/ipfs-api/pkg/pinatav2/pinatav2.go index f9f853a6..d5790b09 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2.go +++ b/ipfs-api/pkg/pinatav2/pinatav2.go @@ -2,8 +2,10 @@ package pinatav2 import ( + "errors" "io/fs" "net/http" + "strings" "time" ) @@ -56,7 +58,12 @@ type PinResponse struct { timestamp string pinSize int64 } +type PinataPutMetadataJSON struct { + IpfsHash string `json:"ipfsPinHash"` + Name string `json:"name"` // By default name of the file/directory + KeyValues map[string]string `json:"keyvalues"` // Some additional data +} type PinataMetadataJSON struct { Name string `json:"name"` // By default name of the file/directory KeyValues map[string]string `json:"keyvalues"` // Some additional data @@ -141,3 +148,18 @@ type PinataApi struct { dump bool respCode int } + +func StrToMeta(meta string) (map[string]string, error) { + var n = make(map[string]string) + s := strings.Split(meta, ",") + l := len(s) + if l != 0 && l%2 == 0 { + for i := 0; i < l; i = i + 2 { + n[strings.TrimSpace(s[i])] = strings.TrimSpace(s[i+1]) + } + + } else { + return make(map[string]string), errors.New("number of key/value pairs should be equal") + } + return n, nil +} diff --git a/ipfs-api/pkg/pinatav2/pinatav2_request.go b/ipfs-api/pkg/pinatav2/pinatav2_request.go index 7308d8cc..f354edf7 100644 --- a/ipfs-api/pkg/pinatav2/pinatav2_request.go +++ b/ipfs-api/pkg/pinatav2/pinatav2_request.go @@ -33,3 +33,13 @@ func (r *Request) Post(url string, reader *io.Reader) (*http.Request, error) { r.header.Init() //initialize header(adding keys) return req, nil } + +func (r *Request) Put(url string, reader io.Reader) (*http.Request, error) { + req, err := http.NewRequest(http.MethodPut, url, reader) + if err != nil { + return req, err + } + r.header.header = req.Header + r.header.Init() //initialize header(adding keys) + return req, nil +} diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 5357b00a..2f074db4 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.1.4" + IpfsApiVersion = "v0.2.6" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index 5c50e38e..693d1adb 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.5-rc.8" +echo "v0.2.6" From 6396c7d01f864143435c91fd9f6f3f4f27d26e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMrLutik=E2=80=9D?= Date: Mon, 4 Jul 2022 07:21:35 +0200 Subject: [PATCH 101/140] fix tag ver --- README.md | 2 +- ipfs-api/README.md | 2 +- ipfs-api/types/constants.go | 2 +- scripts/version.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f11b344e..ae7baf28 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ KIRA bash-utils is a general purpose tool for simplifying scripts & commands ```bash # one line install -TOOLS_VERSION="v0.0.12.4" && mkdir -p /usr/keys && FILE_NAME="bash-utils.sh" && \ +TOOLS_VERSION="v0.2.7" && mkdir -p /usr/keys && FILE_NAME="bash-utils.sh" && \ if [ -z "$KIRA_COSIGN_PUB" ] ; then KIRA_COSIGN_PUB=/usr/keys/kira-cosign.pub ; fi && \ echo -e "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/IrzBQYeMwvKa44/DF/HB7XDpnE+\nf+mU9F/Qbfq25bBWV2+NlYMJv3KvKHNtu3Jknt6yizZjUV4b8WGfKBzFYw==\n-----END PUBLIC KEY-----" > $KIRA_COSIGN_PUB && \ wget "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/${FILE_NAME}" -O ./$FILE_NAME && \ diff --git a/ipfs-api/README.md b/ipfs-api/README.md index f929216b..74407465 100644 --- a/ipfs-api/README.md +++ b/ipfs-api/README.md @@ -15,7 +15,7 @@ git clone https://github.com/KiraCore/tools.git Installation script: ``` -TOOLS_VERSION="v0.2.6" && rm -rfv /tmp/ipfs-api && \ +TOOLS_VERSION="v0.2.7" && rm -rfv /tmp/ipfs-api && \ safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "$KIRA_COSIGN_PUB" && \ dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \ ipfs-api version diff --git a/ipfs-api/types/constants.go b/ipfs-api/types/constants.go index 2f074db4..defbea52 100644 --- a/ipfs-api/types/constants.go +++ b/ipfs-api/types/constants.go @@ -1,7 +1,7 @@ package types const ( - IpfsApiVersion = "v0.2.6" + IpfsApiVersion = "v0.2.7" // Pinata v1 constants BASE_URL = "https://api.pinata.cloud" diff --git a/scripts/version.sh b/scripts/version.sh index 693d1adb..40c2a97f 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.6" +echo "v0.2.7" From 9dcd94eba32cc73687b7aae7b4ff234fbd7a622a Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 06:16:01 +0000 Subject: [PATCH 102/140] new release --- .github/workflows/main.yml | 8 +++++--- scripts/version.sh | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61ffc820..9d06ffba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -225,6 +225,9 @@ jobs: uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605 with: cosign-release: 'v1.7.2' + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Download AMD64 artifacts # ref.: https://github.com/actions/download-artifact, v3.0.0 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 @@ -272,6 +275,7 @@ jobs: echo " Release ver.: ${{ env.RELEASE_VER }}" echo "Release exists: ${{ env.RELEASE_EXISTS }}" echo " Pre-release: ${{ env.PRE_RELEASE }}" + echo " Commit hash: ${{ github.sha }}" - name: Reject on error # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 @@ -302,6 +306,7 @@ jobs: ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 with: + target_commitish: ${{ github.sha }} body_path: RELEASE.md tag_name: ${{ env.SOURCE_BRANCH }} name: ${{ env.SOURCE_BRANCH }} @@ -386,9 +391,6 @@ jobs: run: | git config --global --add safe.directory /github/workspace git config --global --add safe.directory $PWD - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Create PR from a version branch to latest # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 diff --git a/scripts/version.sh b/scripts/version.sh index 5c50e38e..317425b8 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.5-rc.8" +echo "v0.2.8" From 6aa9752603c21c21ce269fe6deaed2bf10d99c16 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 06:43:54 +0000 Subject: [PATCH 103/140] allow to rw all files --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d06ffba..70bd3fd7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -374,6 +374,8 @@ jobs: if: always() shell: bash run: | + set -x + chmod -R 666 ./ shred -vzn 3 ../cosign.key || echo "WARNING: Failed to shred key file" rm -fv ../cosign.key rm -rfv ./* From 1b3345dcf60e68f46f41b01e1b28bc02c6379945 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 06:58:43 +0000 Subject: [PATCH 104/140] only cleanup secrets --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 70bd3fd7..c98c5c06 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -374,11 +374,8 @@ jobs: if: always() shell: bash run: | - set -x - chmod -R 666 ./ shred -vzn 3 ../cosign.key || echo "WARNING: Failed to shred key file" rm -fv ../cosign.key - rm -rfv ./* echo "(current dir): $PWD" && ls -l ./ # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success From 6fc3e8ce814e0848dec9959f7287d484b64787e7 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 07:35:55 +0000 Subject: [PATCH 105/140] artifacts fix --- .github/workflows/main.yml | 120 +++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c98c5c06..dffdff80 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -233,14 +233,17 @@ jobs: uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 with: name: tools-bin-amd64 + path: ./artifacts - name: Download ARM64 artifacts # ref.: https://github.com/actions/download-artifact, v3.0.0 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 with: name: tools-bin-arm64 + path: ./artifacts - name: Inspecting & organizing artifacts run: | echo "(current dir): $PWD" && ls -l ./ + cd ./artifacts tar xvf ./tools-bin-arm64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ tar xvf ./tools-bin-amd64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') @@ -295,8 +298,9 @@ jobs: COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} run: | echo "$KEY" > ../cosign.key - for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done - rm -fv ../cosign.key + cd ./artifacts + for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done + shred -vzn 3 ../../cosign.key # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish release @@ -314,62 +318,62 @@ jobs: draft: false fail_on_unmatched_files: true files: | - ./tmconnect-linux-amd64.deb - ./tmconnect-linux-amd64.deb.sig - ./tmconnect-darwin-amd64.deb - ./tmconnect-darwin-amd64.deb.sig - ./tmconnect-windows-amd64.exe - ./tmconnect-windows-amd64.exe.sig - ./tmkms-key-import-linux-amd64 - ./tmkms-key-import-linux-amd64.sig - ./validator-key-gen-linux-amd64.deb - ./validator-key-gen-linux-amd64.deb.sig - ./validator-key-gen-windows-amd64.exe - ./validator-key-gen-windows-amd64.exe.sig - ./validator-key-gen-darwin-amd64.deb - ./validator-key-gen-darwin-amd64.deb.sig - ./bip39gen-linux-amd64.deb - ./bip39gen-linux-amd64.deb.sig - ./bip39gen-windows-amd64.exe - ./bip39gen-windows-amd64.exe.sig - ./bip39gen-darwin-amd64.deb - ./bip39gen-darwin-amd64.deb.sig - ./tmconnect-linux-arm64.deb - ./tmconnect-linux-arm64.deb.sig - ./tmconnect-darwin-arm64.deb - ./tmconnect-darwin-arm64.deb.sig - ./tmconnect-windows-arm64.exe - ./tmconnect-windows-arm64.exe.sig - ./tmkms-key-import-linux-arm64 - ./tmkms-key-import-linux-arm64.sig - ./validator-key-gen-linux-arm64.deb - ./validator-key-gen-linux-arm64.deb.sig - ./validator-key-gen-windows-arm64.exe - ./validator-key-gen-windows-arm64.exe.sig - ./validator-key-gen-darwin-arm64.deb - ./validator-key-gen-darwin-arm64.deb.sig - ./bip39gen-linux-arm64.deb - ./bip39gen-linux-arm64.deb.sig - ./bip39gen-windows-arm64.exe - ./bip39gen-windows-arm64.exe.sig - ./bip39gen-darwin-arm64.deb - ./bip39gen-darwin-arm64.deb.sig - ./ipfs-api-linux-arm64.deb - ./ipfs-api-linux-arm64.deb.sig - ./ipfs-api-windows-arm64.exe - ./ipfs-api-windows-arm64.exe.sig - ./ipfs-api-darwin-arm64.deb - ./ipfs-api-darwin-arm64.deb.sig - ./ipfs-api-linux-amd64.deb - ./ipfs-api-linux-amd64.deb.sig - ./ipfs-api-windows-amd64.exe - ./ipfs-api-windows-amd64.exe.sig - ./ipfs-api-darwin-amd64.deb - ./ipfs-api-darwin-amd64.deb.sig - ./bash-utils.sh - ./bash-utils.sh.sig - ./source-code.tar.gz - ./source-code.tar.gz.sig + ./artifacts/tmconnect-linux-amd64.deb + ./artifacts/tmconnect-linux-amd64.deb.sig + ./artifacts/tmconnect-darwin-amd64.deb + ./artifacts/tmconnect-darwin-amd64.deb.sig + ./artifacts/tmconnect-windows-amd64.exe + ./artifacts/tmconnect-windows-amd64.exe.sig + ./artifacts/tmkms-key-import-linux-amd64 + ./artifacts/tmkms-key-import-linux-amd64.sig + ./artifacts/validator-key-gen-linux-amd64.deb + ./artifacts/validator-key-gen-linux-amd64.deb.sig + ./artifacts/validator-key-gen-windows-amd64.exe + ./artifacts/validator-key-gen-windows-amd64.exe.sig + ./artifacts/validator-key-gen-darwin-amd64.deb + ./artifacts/validator-key-gen-darwin-amd64.deb.sig + ./artifacts/bip39gen-linux-amd64.deb + ./artifacts/bip39gen-linux-amd64.deb.sig + ./artifacts/bip39gen-windows-amd64.exe + ./artifacts/bip39gen-windows-amd64.exe.sig + ./artifacts/bip39gen-darwin-amd64.deb + ./artifacts/bip39gen-darwin-amd64.deb.sig + ./artifacts/tmconnect-linux-arm64.deb + ./artifacts/tmconnect-linux-arm64.deb.sig + ./artifacts/tmconnect-darwin-arm64.deb + ./artifacts/tmconnect-darwin-arm64.deb.sig + ./artifacts/tmconnect-windows-arm64.exe + ./artifacts/tmconnect-windows-arm64.exe.sig + ./artifacts/tmkms-key-import-linux-arm64 + ./artifacts/tmkms-key-import-linux-arm64.sig + ./artifacts/validator-key-gen-linux-arm64.deb + ./artifacts/validator-key-gen-linux-arm64.deb.sig + ./artifacts/validator-key-gen-windows-arm64.exe + ./artifacts/validator-key-gen-windows-arm64.exe.sig + ./artifacts/validator-key-gen-darwin-arm64.deb + ./artifacts/validator-key-gen-darwin-arm64.deb.sig + ./artifacts/bip39gen-linux-arm64.deb + ./artifacts/bip39gen-linux-arm64.deb.sig + ./artifacts/bip39gen-windows-arm64.exe + ./artifacts/bip39gen-windows-arm64.exe.sig + ./artifacts/bip39gen-darwin-arm64.deb + ./artifacts/bip39gen-darwin-arm64.deb.sig + ./artifacts/ipfs-api-linux-arm64.deb + ./artifacts/ipfs-api-linux-arm64.deb.sig + ./artifacts/ipfs-api-windows-arm64.exe + ./artifacts/ipfs-api-windows-arm64.exe.sig + ./artifacts/ipfs-api-darwin-arm64.deb + ./artifacts/ipfs-api-darwin-arm64.deb.sig + ./artifacts/ipfs-api-linux-amd64.deb + ./artifacts/ipfs-api-linux-amd64.deb.sig + ./artifacts/ipfs-api-windows-amd64.exe + ./artifacts/ipfs-api-windows-amd64.exe.sig + ./artifacts/ipfs-api-darwin-amd64.deb + ./artifacts/ipfs-api-darwin-amd64.deb.sig + ./artifacts/bash-utils.sh + ./artifacts/bash-utils.sh.sig + ./artifacts/source-code.tar.gz + ./artifacts/source-code.tar.gz.sig - name: Cleanup all resources if: always() shell: bash From 2c00e49611c2b896609b80fd5f96d1c280021106 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 08:03:24 +0000 Subject: [PATCH 106/140] testing new tags scheme --- .github/workflows/branch.yml | 4 +- .github/workflows/main.yml | 140 +++++++++++++++++------------------ .github/workflows/master.yml | 6 +- .github/workflows/spam.yml | 8 +- scripts/version.sh | 2 +- 5 files changed, 78 insertions(+), 82 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 750e7089..9676efae 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -35,7 +35,7 @@ jobs: echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - ( git show-branch "origin/$RELEASE_VER" || git show-branch "remotes/origin/$RELEASE_VER" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV + ( git show-branch "origin/release/$RELEASE_VER" || git show-branch "remotes/origin/release/$RELEASE_VER" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | echo "Repository name: ${{ env.REPOSITORY_NAME }}" @@ -68,7 +68,7 @@ jobs: with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} - destination_branch: ${{ env.RELEASE_VER}} + destination_branch: "release/${{ env.RELEASE_VER}}" pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ env.RELEASE_VER }}" pr_label: "kira-automation" pr_allow_empty: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dffdff80..661bab81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,9 @@ name: Build, Test & Publish on: push: - branches: [ v*.*.*, feature/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] + branches: [ v*.*.*, release/v*.*.*, feature/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] pull_request: - branches: [ v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] + branches: [ v*.*.*, release/v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] jobs: build-amd64: name: AMD64 - Repo Test & Build @@ -225,25 +225,19 @@ jobs: uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605 with: cosign-release: 'v1.7.2' - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Download AMD64 artifacts # ref.: https://github.com/actions/download-artifact, v3.0.0 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 with: name: tools-bin-amd64 - path: ./artifacts - name: Download ARM64 artifacts # ref.: https://github.com/actions/download-artifact, v3.0.0 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 with: name: tools-bin-arm64 - path: ./artifacts - name: Inspecting & organizing artifacts run: | echo "(current dir): $PWD" && ls -l ./ - cd ./artifacts tar xvf ./tools-bin-arm64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ tar xvf ./tools-bin-amd64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') @@ -278,7 +272,6 @@ jobs: echo " Release ver.: ${{ env.RELEASE_VER }}" echo "Release exists: ${{ env.RELEASE_EXISTS }}" echo " Pre-release: ${{ env.PRE_RELEASE }}" - echo " Commit hash: ${{ github.sha }}" - name: Reject on error # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 @@ -291,23 +284,22 @@ jobs: if: | github.event_name == 'push' && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) shell: bash env: KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} run: | echo "$KEY" > ../cosign.key - cd ./artifacts - for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done - shred -vzn 3 ../../cosign.key + for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done + rm -fv ../cosign.key # ref: https://github.com/softprops/action-gh-release, v0.1.14 # Release on merge only (push action) - this should run only once - name: Publish release if: | github.event_name == 'push' && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 with: target_commitish: ${{ github.sha }} @@ -318,68 +310,69 @@ jobs: draft: false fail_on_unmatched_files: true files: | - ./artifacts/tmconnect-linux-amd64.deb - ./artifacts/tmconnect-linux-amd64.deb.sig - ./artifacts/tmconnect-darwin-amd64.deb - ./artifacts/tmconnect-darwin-amd64.deb.sig - ./artifacts/tmconnect-windows-amd64.exe - ./artifacts/tmconnect-windows-amd64.exe.sig - ./artifacts/tmkms-key-import-linux-amd64 - ./artifacts/tmkms-key-import-linux-amd64.sig - ./artifacts/validator-key-gen-linux-amd64.deb - ./artifacts/validator-key-gen-linux-amd64.deb.sig - ./artifacts/validator-key-gen-windows-amd64.exe - ./artifacts/validator-key-gen-windows-amd64.exe.sig - ./artifacts/validator-key-gen-darwin-amd64.deb - ./artifacts/validator-key-gen-darwin-amd64.deb.sig - ./artifacts/bip39gen-linux-amd64.deb - ./artifacts/bip39gen-linux-amd64.deb.sig - ./artifacts/bip39gen-windows-amd64.exe - ./artifacts/bip39gen-windows-amd64.exe.sig - ./artifacts/bip39gen-darwin-amd64.deb - ./artifacts/bip39gen-darwin-amd64.deb.sig - ./artifacts/tmconnect-linux-arm64.deb - ./artifacts/tmconnect-linux-arm64.deb.sig - ./artifacts/tmconnect-darwin-arm64.deb - ./artifacts/tmconnect-darwin-arm64.deb.sig - ./artifacts/tmconnect-windows-arm64.exe - ./artifacts/tmconnect-windows-arm64.exe.sig - ./artifacts/tmkms-key-import-linux-arm64 - ./artifacts/tmkms-key-import-linux-arm64.sig - ./artifacts/validator-key-gen-linux-arm64.deb - ./artifacts/validator-key-gen-linux-arm64.deb.sig - ./artifacts/validator-key-gen-windows-arm64.exe - ./artifacts/validator-key-gen-windows-arm64.exe.sig - ./artifacts/validator-key-gen-darwin-arm64.deb - ./artifacts/validator-key-gen-darwin-arm64.deb.sig - ./artifacts/bip39gen-linux-arm64.deb - ./artifacts/bip39gen-linux-arm64.deb.sig - ./artifacts/bip39gen-windows-arm64.exe - ./artifacts/bip39gen-windows-arm64.exe.sig - ./artifacts/bip39gen-darwin-arm64.deb - ./artifacts/bip39gen-darwin-arm64.deb.sig - ./artifacts/ipfs-api-linux-arm64.deb - ./artifacts/ipfs-api-linux-arm64.deb.sig - ./artifacts/ipfs-api-windows-arm64.exe - ./artifacts/ipfs-api-windows-arm64.exe.sig - ./artifacts/ipfs-api-darwin-arm64.deb - ./artifacts/ipfs-api-darwin-arm64.deb.sig - ./artifacts/ipfs-api-linux-amd64.deb - ./artifacts/ipfs-api-linux-amd64.deb.sig - ./artifacts/ipfs-api-windows-amd64.exe - ./artifacts/ipfs-api-windows-amd64.exe.sig - ./artifacts/ipfs-api-darwin-amd64.deb - ./artifacts/ipfs-api-darwin-amd64.deb.sig - ./artifacts/bash-utils.sh - ./artifacts/bash-utils.sh.sig - ./artifacts/source-code.tar.gz - ./artifacts/source-code.tar.gz.sig + ./tmconnect-linux-amd64.deb + ./tmconnect-linux-amd64.deb.sig + ./tmconnect-darwin-amd64.deb + ./tmconnect-darwin-amd64.deb.sig + ./tmconnect-windows-amd64.exe + ./tmconnect-windows-amd64.exe.sig + ./tmkms-key-import-linux-amd64 + ./tmkms-key-import-linux-amd64.sig + ./validator-key-gen-linux-amd64.deb + ./validator-key-gen-linux-amd64.deb.sig + ./validator-key-gen-windows-amd64.exe + ./validator-key-gen-windows-amd64.exe.sig + ./validator-key-gen-darwin-amd64.deb + ./validator-key-gen-darwin-amd64.deb.sig + ./bip39gen-linux-amd64.deb + ./bip39gen-linux-amd64.deb.sig + ./bip39gen-windows-amd64.exe + ./bip39gen-windows-amd64.exe.sig + ./bip39gen-darwin-amd64.deb + ./bip39gen-darwin-amd64.deb.sig + ./tmconnect-linux-arm64.deb + ./tmconnect-linux-arm64.deb.sig + ./tmconnect-darwin-arm64.deb + ./tmconnect-darwin-arm64.deb.sig + ./tmconnect-windows-arm64.exe + ./tmconnect-windows-arm64.exe.sig + ./tmkms-key-import-linux-arm64 + ./tmkms-key-import-linux-arm64.sig + ./validator-key-gen-linux-arm64.deb + ./validator-key-gen-linux-arm64.deb.sig + ./validator-key-gen-windows-arm64.exe + ./validator-key-gen-windows-arm64.exe.sig + ./validator-key-gen-darwin-arm64.deb + ./validator-key-gen-darwin-arm64.deb.sig + ./bip39gen-linux-arm64.deb + ./bip39gen-linux-arm64.deb.sig + ./bip39gen-windows-arm64.exe + ./bip39gen-windows-arm64.exe.sig + ./bip39gen-darwin-arm64.deb + ./bip39gen-darwin-arm64.deb.sig + ./ipfs-api-linux-arm64.deb + ./ipfs-api-linux-arm64.deb.sig + ./ipfs-api-windows-arm64.exe + ./ipfs-api-windows-arm64.exe.sig + ./ipfs-api-darwin-arm64.deb + ./ipfs-api-darwin-arm64.deb.sig + ./ipfs-api-linux-amd64.deb + ./ipfs-api-linux-amd64.deb.sig + ./ipfs-api-windows-amd64.exe + ./ipfs-api-windows-amd64.exe.sig + ./ipfs-api-darwin-amd64.deb + ./ipfs-api-darwin-amd64.deb.sig + ./bash-utils.sh + ./bash-utils.sh.sig + ./source-code.tar.gz + ./source-code.tar.gz.sig - name: Cleanup all resources if: always() shell: bash run: | shred -vzn 3 ../cosign.key || echo "WARNING: Failed to shred key file" rm -fv ../cosign.key + rm -rfv ./* echo "(current dir): $PWD" && ls -l ./ # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - name: Approve pull request on success @@ -394,12 +387,15 @@ jobs: run: | git config --global --add safe.directory /github/workspace git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Create PR from a version branch to latest # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 if: | github.event_name == 'push' && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} @@ -410,7 +406,7 @@ jobs: - name: Auto-merge version branch to latest branch uses: pascalgn/automerge-action@04dfc9eae2586d19b7362d4f6413c48135d9c25a if: github.event_name == 'pull_request' && env.DESTINATION_BRANCH == 'latest' && - ( startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') ) + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) env: MERGE_LABELS: "automerge" GITHUB_TOKEN: "${{ secrets.REPO_ACCESS }}" diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index fd659a8a..0794d485 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -1,8 +1,8 @@ -name: v*.*.* -PR-> master +name: release/v*.*.* -PR-> master on: push: - branches: [ v*.*.* ] + branches: [ v*.*.*, release/v*.*.* ] # git ls-remote | head -1 | sed "s/HEAD//" jobs: @@ -40,7 +40,7 @@ jobs: - name: Create PR from a version branch to master after version branch push # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 - if: startsWith(env.SOURCE_BRANCH, 'v') && contains(env.SOURCE_BRANCH, '.') + if: startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index 8dd102d3..db87394e 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -2,7 +2,7 @@ name: Clean spam PRs on: pull_request: - branches: [ master, dev, latest, v*.*.*, feature/*, bugfix/* ] + branches: [ master, dev, latest, v*.*.*, release/v*.*.*, feature/*, bugfix/* ] jobs: # isolate signing & repo cloning from docker image @@ -49,7 +49,7 @@ jobs: uses: dessant/repo-lockdown@0b093279a77b44bbc38e85089b5463dd06b4aea4 if: | ( env.DESTINATION_BRANCH == 'master' || env.DESTINATION_BRANCH == 'dev' || env.DESTINATION_BRANCH == 'latest' ) && - ( !startsWith(env.SOURCE_BRANCH, 'v') && !contains(env.SOURCE_BRANCH, '.') ) + ( !startsWith(env.SOURCE_BRANCH, 'release/v') && !contains(env.SOURCE_BRANCH, '.') ) with: pr-labels: 'invalid' pr-comment: > @@ -63,7 +63,7 @@ jobs: # ref.: https://github.com/dessant/repo-lockdown uses: dessant/repo-lockdown@0b093279a77b44bbc38e85089b5463dd06b4aea4 if: | - ( startsWith(env.DESTINATION_BRANCH, 'v') && contains(env.DESTINATION_BRANCH, '.') ) && + ( startsWith(env.DESTINATION_BRANCH, 'release/v') && contains(env.DESTINATION_BRANCH, '.') ) && ( !startsWith(env.SOURCE_BRANCH, 'feature') && !startsWith(env.SOURCE_BRANCH, 'bugfix') ) with: pr-labels: 'invalid' @@ -78,7 +78,7 @@ jobs: # ref.: https://github.com/dessant/repo-lockdown uses: dessant/repo-lockdown@0b093279a77b44bbc38e85089b5463dd06b4aea4 if: | - ( startsWith(env.DESTINATION_BRANCH, 'v') && contains(env.DESTINATION_BRANCH, '.') ) && + ( startsWith(env.DESTINATION_BRANCH, 'release/v') && contains(env.DESTINATION_BRANCH, '.') ) && ( env.DESTINATION_BRANCH != env.RELEASE_VER ) with: pr-labels: 'invalid' diff --git a/scripts/version.sh b/scripts/version.sh index 317425b8..68110f4c 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.8" +echo "v0.2.9" From 7ace4023752f016a330df9c27f7e93aa432b2c31 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 08:21:31 +0000 Subject: [PATCH 107/140] ensure to create version branch --- .github/workflows/branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 9676efae..1c1c3a38 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -56,7 +56,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - branch: ${{ env.RELEASE_VER }} + branch: "release/${{ env.RELEASE_VER }}" sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead From e4b5cf652ee56930bfa683fc2c95aacabab5e7a7 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 08:37:21 +0000 Subject: [PATCH 108/140] spam workflows fix for new releases --- .github/workflows/spam.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index db87394e..8d2add8f 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -35,6 +35,7 @@ jobs: VERSION_REGEX="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" REPOSITORY_NAME=${{ github.event.repository.name }} RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV SOURCE_BRANCH="$(echo ${{ env.REF_BRANCH }})" && echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV DESTINATION_BRANCH="$(echo ${{ env.BASE_REF_BRANCH }})" && echo "DESTINATION_BRANCH=$DESTINATION_BRANCH" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV @@ -79,7 +80,7 @@ jobs: uses: dessant/repo-lockdown@0b093279a77b44bbc38e85089b5463dd06b4aea4 if: | ( startsWith(env.DESTINATION_BRANCH, 'release/v') && contains(env.DESTINATION_BRANCH, '.') ) && - ( env.DESTINATION_BRANCH != env.RELEASE_VER ) + ( env.DESTINATION_BRANCH != env.RELEASE_BRANCH ) with: pr-labels: 'invalid' pr-comment: > From 3219a4a5735debd01eb55f1994d6fcc455fa3430 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 08:42:28 +0000 Subject: [PATCH 109/140] syntax --- .github/workflows/branch.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 1c1c3a38..dc9b2b74 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -30,12 +30,13 @@ jobs: echo "(current dir): $PWD" && ls -l ./ chmod -Rv 555 ./scripts RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - ( git show-branch "origin/release/$RELEASE_VER" || git show-branch "remotes/origin/release/$RELEASE_VER" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV + ( git show-branch "origin/$RELEASE_BRANCH" || git show-branch "remotes/origin/$RELEASE_BRANCH" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing run: | echo "Repository name: ${{ env.REPOSITORY_NAME }}" @@ -43,6 +44,7 @@ jobs: echo " Default branch: ${{ env.DEFAULT_BRANCH }}" echo " Master refer.: ${{ env.MASTER_REF }}" echo "Release version: ${{ env.RELEASE_VER }}" + echo " Release branch: ${{ env.RELEASE_BRANCH }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" echo " Event name: ${{ github.event_name }}" echo " Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" @@ -52,11 +54,11 @@ jobs: if: | ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + ( startsWith(env.RELEASE_BRANCH, 'release/v') && contains(env.RELEASE_BRANCH, '.') ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - branch: "release/${{ env.RELEASE_VER }}" + branch: ${{ env.RELEASE_BRANCH }} sha: ${{ env.MASTER_REF }} - name: Create PR from feature to version branch # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead @@ -64,11 +66,11 @@ jobs: if: | ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.RELEASE_VER, 'v') && contains(env.RELEASE_VER, '.') ) + ( startsWith(env.RELEASE_BRANCH, 'release/v') && contains(env.RELEASE_BRANCH, '.') ) with: github_token: ${{ secrets.REPO_ACCESS }} source_branch: ${{ env.SOURCE_BRANCH }} - destination_branch: "release/${{ env.RELEASE_VER}}" - pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ env.RELEASE_VER }}" + destination_branch: ${{ env.RELEASE_BRANCH}} + pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ env.RELEASE_BRANCH }}" pr_label: "kira-automation" pr_allow_empty: true From 50704cac9c810c5e48fadad3fc9566efb4520695 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 09:11:02 +0000 Subject: [PATCH 110/140] rerun tests --- scripts/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/version.sh b/scripts/version.sh index 68110f4c..30e18416 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.9" +echo "v0.2.10" From ccc2b956c771b60d615573022010a88d3deded2f Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 09:25:37 +0000 Subject: [PATCH 111/140] add missing auto-approve --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 661bab81..e49d2bd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -242,6 +242,7 @@ jobs: tar xvf ./tools-bin-amd64.tar.gz && echo "(current dir): $PWD" && ls -l ./ && chmod -Rv 555 ./ RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV @@ -270,6 +271,7 @@ jobs: echo " Repo Name: ${{ env.REPOSITORY_NAME }}" echo " Event name: ${{ github.event_name }}" echo " Release ver.: ${{ env.RELEASE_VER }}" + echo "Release branch: ${{ env.RELEASE_BRANCH }}" echo "Release exists: ${{ env.RELEASE_EXISTS }}" echo " Pre-release: ${{ env.PRE_RELEASE }}" - name: Reject on error @@ -379,7 +381,7 @@ jobs: uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 if: | ( github.event_name == 'pull_request' ) && - ( env.SOURCE_BRANCH == env.RELEASE_VER || env.DESTINATION_BRANCH == env.RELEASE_VER ) + ( env.SOURCE_BRANCH == env.RELEASE_BRANCH || env.DESTINATION_BRANCH == env.RELEASE_BRANCH ) with: github-token: "${{ secrets.GITHUB_TOKEN }}" # Work around https://github.com/actions/checkout/issues/760 From c6322a1bddfbf52471eb093f1750ab253feb9642 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 09:55:52 +0000 Subject: [PATCH 112/140] tag and branch should have diffrent names --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e49d2bd5..5b39306b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -306,7 +306,7 @@ jobs: with: target_commitish: ${{ github.sha }} body_path: RELEASE.md - tag_name: ${{ env.SOURCE_BRANCH }} + tag_name: ${{ env.RELEASE_VER }} name: ${{ env.SOURCE_BRANCH }} prerelease: ${{ env.PRE_RELEASE }} draft: false From 0e249ee729e23ae310820bce96bdcf5d76e3cca5 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 10:22:40 +0000 Subject: [PATCH 113/140] change release name --- .github/workflows/main.yml | 2 +- scripts/version.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b39306b..cb7cf5a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -307,7 +307,7 @@ jobs: target_commitish: ${{ github.sha }} body_path: RELEASE.md tag_name: ${{ env.RELEASE_VER }} - name: ${{ env.SOURCE_BRANCH }} + name: ${{ env.RELEASE_VER }} prerelease: ${{ env.PRE_RELEASE }} draft: false fail_on_unmatched_files: true diff --git a/scripts/version.sh b/scripts/version.sh index 30e18416..83164caf 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.10" +echo "v0.2.11`" From e45ebdc466e896c397eec36364e51db8579b4b3d Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 4 Jul 2022 10:33:26 +0000 Subject: [PATCH 114/140] version name fix --- scripts/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/version.sh b/scripts/version.sh index 83164caf..f27a6c33 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.11`" +echo "v0.2.11" From 3f01b91f87bd8c1747bd839b0615e5426dd2d387 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 10:16:40 +0000 Subject: [PATCH 115/140] toml file manipulation for bash utils --- RELEASE.md | 4 +- bash-utils/bash-utils.sh | 153 +++++++++++++++++++++++++++++++------ bash-utils/scripts/test.sh | 52 +++++++++++++ scripts/version.sh | 2 +- 4 files changed, 185 insertions(+), 26 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index d3884e8e..82cc2e89 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,7 +1,5 @@ Features: -* Added ```--overwrite``` flag -* Added ```--force``` flag -* Added ```--metadata``` flag +* Added `strLength, strStartsWith, strEndsWith, setTomlVar` to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 569e6618..4d2f6416 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# QUICK EDIT: FILE="/usr/local/bin/bash-utils.sh" && rm $FILE && nano $FILE && chmod 555 $FILE +# QUICK EDIT: FILE="/tmp/bash-utils.sh" && rm -fv $FILE && nano $FILE && chmod 555 $FILE && /tmp/bash-utils.sh bashUtilsSetup # NOTE: For this script to work properly the KIRA_GLOBS_DIR env variable should be set to "/var/kiraglob" or equivalent & the directory should exist REGEX_DNS="^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)+[a-zA-Z]{2,}$" REGEX_IP="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$" @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.2.5" + local BASH_UTILS_VERSION="v0.2.12" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -98,7 +98,7 @@ function toUpper() { } function isNullOrEmpty() { - local val=$(toLower "$1") + local val=$(bash-utils toLower "$1") if [ -z "$val" ] || [ "$val" == "null" ] || [ "$val" == "nil" ] ; then echo "true" ; else echo "false" ; fi } @@ -107,7 +107,7 @@ function delWhitespaces() { } function isNullOrWhitespaces() { - isNullOrEmpty $(delWhitespaces "$1") + isNullOrEmpty $(bash-utils delWhitespaces "$1") } function isKiraAddress() { @@ -151,8 +151,8 @@ function isInteger() { } function isBoolean() { - if ($(isNullOrEmpty "$1")) ; then echo "false" ; else - local val=$(toLower "$1") + if ($(bash-utils isNullOrEmpty "$1")) ; then echo "false" ; else + local val=$(bash-utils toLower "$1") if [ "$val" == "false" ] || [ "$val" == "true" ] ; then echo "true" else echo "false" ; fi fi @@ -163,7 +163,7 @@ function isNodeId() { } function isNumber() { - if ($(isNullOrEmpty "$1")) ; then echo "false" ; else [[ "$1" =~ $REGEX_NUMBER ]] && echo "true" || echo "false" ; fi + if ($(bash-utils isNullOrEmpty "$1")) ; then echo "false" ; else [[ "$1" =~ $REGEX_NUMBER ]] && echo "true" || echo "false" ; fi } function isNaturalNumber() { @@ -262,6 +262,38 @@ function md5() { fi } +function strLength() { + [ -z "$1" ] && local string="$(timeout 1 cat 2> /dev/null || echo -n '')" || local string="$1" + [ -z "$string" ] && echo "0" || echo $(echo "$string" | awk '{print length}') || echo -n "-1" +} + +function strStartsWith() { + local string="$1" + local prefix="$2" + local string_len=$(bash-utils strLength "$string") + local prefix_len=$(bash-utils strLength "$prefix") + if [[ $prefix_len -gt $string_len ]] ; then + echo "false" + else + local substr="${string:0:$prefix_len}" + [ "$substr" == "$prefix" ] && echo "true" || echo "false" + fi +} + +function strEndsWith() { + local string="$1" + local suffix="$2" + local string_len=$(bash-utils strLength "$string") + local suffix_len=$(bash-utils strLength "$suffix") + if [[ $suffix_len -gt $string_len ]] ; then + echo "false" + else + local n="-${suffix_len}" + local substr="${string:$n}" + [ "$substr" == "$suffix" ] && echo "true" || echo "false" + fi +} + # Allows to safely download file from external resources by hash verification or cosign file signature # In the case where cosign verification is used the ".sig" URL must exist # safeWget @@ -382,29 +414,39 @@ function getRamTotal() { ($(isNaturalNumber "$MEMORY")) && echo $MEMORY || echo "0" } +# allowed modes: 'default', 'short', 'long' function getArch() { + local mode="$1" && mode="$(bash-utils toLower $mode)" local ARCH=$(uname -m) if [[ "$ARCH" == *"arm"* ]] || [[ "$ARCH" == *"aarch"* ]] ; then echo "arm64" elif [[ "$ARCH" == *"x64"* ]] || [[ "$ARCH" == *"x86_64"* ]] || [[ "$ARCH" == *"amd64"* ]] || [[ "$ARCH" == *"amd"* ]] ; then - echo "amd64" + if [ "$mode" == "short" ] ; then + echo "x64" + else + echo "amd64" + fi else echo "$ARCH" fi } +function getArchX() { + echo $(bash-utils getArch 'short') +} + function getPlatform() { - echo "$(delWhitespaces $(toLower $(uname)))" + echo "$(delWhitespaces $(bash-utils toLower $(uname)))" } function tryMkDir { for kg_var in "$@" ; do kg_var=$(echo "$kg_var" | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") [ -z "$kg_var" ] && continue - [ "$(toLower "$kg_var")" == "-v" ] && continue + [ "$(bash-utils toLower "$kg_var")" == "-v" ] && continue if [ -f "$kg_var" ] ; then - if [ "$(toLower "$1")" == "-v" ] ; then + if [ "$(bash-utils toLower "$1")" == "-v" ] ; then rm -f "$kg_var" 2> /dev/null || : [ ! -f "$kg_var" ] && echo "removed file '$kg_var'" || echo "failed to remove file '$kg_var'" else @@ -412,7 +454,7 @@ function tryMkDir { fi fi - if [ "$(toLower "$1")" == "-v" ] ; then + if [ "$(bash-utils toLower "$1")" == "-v" ] ; then [ ! -d "$kg_var" ] && mkdir -p "$var" 2> /dev/null || : [ -d "$kg_var" ] && echo "created directory '$kg_var'" || echo "failed to create direcotry '$kg_var'" elif [ ! -d "$kg_var" ] ; then @@ -512,9 +554,9 @@ function jsonEdit() { local VALUE="$2" [ ! -z "$3" ] && FIN=$(realpath $3 2> /dev/null || echo -n "") [ ! -z "$4" ] && FOUT=$(realpath $4 2> /dev/null || echo -n "") - [ "$(toLower "$VALUE")" == "null" ] && VALUE="None" - [ "$(toLower "$VALUE")" == "true" ] && VALUE="True" - [ "$(toLower "$VALUE")" == "false" ] && VALUE="False" + [ "$(bash-utils toLower "$VALUE")" == "null" ] && VALUE="None" + [ "$(bash-utils toLower "$VALUE")" == "true" ] && VALUE="True" + [ "$(bash-utils toLower "$VALUE")" == "false" ] && VALUE="False" if [ ! -z "$INPUT" ] ; then for k in ${INPUT//./ } ; do k=$(echo $k | xargs 2> /dev/null || echo -n "") && [ -z "$k" ] && continue @@ -543,9 +585,9 @@ function jsonObjEdit() { [ ! -z "$2" ] && FVAL=$(realpath $2 2> /dev/null || echo -n "") [ ! -z "$3" ] && FIN=$(realpath $3 2> /dev/null || echo -n "") [ ! -z "$4" ] && FOUT=$(realpath $4 2> /dev/null || echo -n "") - [ "$(toLower "$VALUE")" == "null" ] && VALUE="None" - [ "$(toLower "$VALUE")" == "true" ] && VALUE="True" - [ "$(toLower "$VALUE")" == "false" ] && VALUE="False" + [ "$(bash-utils toLower "$VALUE")" == "null" ] && VALUE="None" + [ "$(bash-utils toLower "$VALUE")" == "true" ] && VALUE="True" + [ "$(bash-utils toLower "$VALUE")" == "false" ] && VALUE="False" if [ ! -z "$INPUT" ] ; then for k in ${INPUT//./ } ; do k=$(echo $k | xargs 2> /dev/null || echo -n "") && [ -z "$k" ] && continue @@ -583,7 +625,7 @@ function urlContentLength() { } function globName() { - echo $(echo "$(toLower "$1")" | tr -d '\011\012\013\014\015\040' | md5sum | awk '{ print $1 }') + echo $(echo "$(bash-utils toLower "$1")" | tr -d '\011\012\013\014\015\040' | md5sum | awk '{ print $1 }') return 0 } @@ -761,7 +803,7 @@ function isCommand { function isServiceActive { local ISACT=$(systemctl is-active "$1" 2> /dev/null || echo "inactive") - [ "$(toLower "$ISACT")" == "active" ] && echo "true" || echo "false" + [ "$(bash-utils toLower "$ISACT")" == "active" ] && echo "true" || echo "false" } # returns 0 if failure, otherwise natural number in microseconds @@ -785,10 +827,10 @@ function pressToContinue { local kg_OPTION="" local FOUND=false read -n 1 -s kg_OPTION - kg_OPTION=$(toLower "$kg_OPTION") + kg_OPTION=$(bash-utils toLower "$kg_OPTION") for kg_var in "$@" ; do kg_var=$(echo "$kg_var" | tr -d '\011\012\013\014\015\040' 2>/dev/null || echo -n "") - [ "$(toLower "$kg_var")" == "$kg_OPTION" ] && globSet OPTION "$kg_OPTION" && FOUND=true && break + [ "$(bash-utils toLower "$kg_var")" == "$kg_OPTION" ] && globSet OPTION "$kg_OPTION" && FOUND=true && break done [ "$FOUND" == "true" ] && break done @@ -926,6 +968,73 @@ function setLastLineByPrefixOrAppend() { fi } +function getFirstLineByPrefixAfterPrefix() { + local tag="$1" + local prefix="$2" + local file="$3" + + local result=0 + local index=0 + local min_line=0 + (! $(bash-utils isNullOrWhitespaces "$tag")) && \ + min_line=$(bash-utils getFirstLineByPrefix "$tag" "$file") + + if [[ $min_line -le -1 ]] ; then + result="-1" + else + while [[ result -le min_line ]] ; do + index="$((index+1))" + result=$(bash-utils getNLineByPrefix $index "$prefix" "$file") + [[ $result -le -1 ]] && break + done + fi + + echo "$result" +} + +# setTomlVar +function setTomlVar() { + local VAR_TAG=$(bash-utils delWhitespaces "$1") + local VAR_NAME=$(bash-utils delWhitespaces "$2") + local VAR_VALUE="$3" + local VAR_FILE=$4 + + ([ -z "$VAR_FILE" ] || [ ! -f $VAR_FILE ]) && \ + bash-utils echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" + + local MIN_LINE_NR=$(bash-utils getFirstLineByPrefixAfterPrefix "" "$VAR_TAG" "$VAR_FILE") + local LINE_NR=$(bash-utils getFirstLineByPrefixAfterPrefix "$VAR_TAG" "$VAR_NAME =" "$VAR_FILE") + local MAX_LINE_NR=$(bash-utils getFirstLineByPrefixAfterPrefix "$VAR_TAG" "[" "$VAR_FILE") + ( [[ $LINE_NR -le 0 ]] || ( [[ $MAX_LINE_NR -gt 0 ]] && [[ $LINE_NR -ge $MAX_LINE_NR ]] ) ) && \ + bash-utils echoErr "ERROR: File '$VAR_FILE' does NOT contain a variable name '$VAR_NAME' occuring afer the tag '$VAR_TAG' (line $MIN_LINE_NR), but before the next tag (line $MAX_LINE_NR)" && \ + LINE_NR=-1 + + if [ ! -z "$VAR_NAME" ] && [ -f $VAR_FILE ] && [ $LINE_NR -ge 1 ] ; then + + if ($(bash-utils isNullOrWhitespaces "$VAR_VALUE")) ; then + bash-utils echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' is empty or a sequece od whitespaces" + VAR_VALUE="\"$VAR_VALUE\"" + elif ( ($(bash-utils strStartsWith "$VAR_VALUE" "\"")) && ($(bash-utils strEndsWith "$VAR_VALUE" "\"")) ) ; then + : # nothing to do, quotes already present + elif ( (! $(bash-utils strStartsWith "$VAR_VALUE" "[")) || (! $(bash-utils strEndsWith "$VAR_VALUE" "]")) ) ; then + if ($(isSubStr "$VAR_VALUE" " ")) ; then + bash-utils echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' contains whitespaces" + VAR_VALUE="\"$VAR_VALUE\"" + elif ( (! $(bash-utils isBoolean "$VAR_VALUE")) && (! $(bash-utils isNumber "$VAR_VALUE")) ) ; then + bash-utils echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' in nither a number or boolean" + VAR_VALUE="\"$VAR_VALUE\"" + fi + fi + + bash-utils echoInfo "INFO: Appending var '$VAR_NAME' with value '$VAR_VALUE' to file '$VAR_FILE' (line $LINE_NR), after the tag '$VAR_TAG' (line $MIN_LINE_NR)" + bash-utils setLineByNumber "$LINE_NR" "$VAR_NAME = $VAR_VALUE" "$VAR_FILE" + return 0 + else + bash-utils echoErr "ERROR: Failed to set variable '$VAR_NAME' in '$VAR_FILE'" + return 1 + fi +} + # setVar function setVar() { local VAR_NAME=$(delWhitespaces "$1") diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 5c273ae8..1bec997e 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -185,6 +185,58 @@ echoWarn "TEST: versionToNumber" ( [ "$(echo "" | versionToNumber)" != "0" ] || [ "$(versionToNumber "")" != "0" ] ) && \ echoErr "ERROR: Version '' must be equal to 0" && exit 1 || echoInfo "INFO: Test 7 passed" +################################################################# +echoWarn "TEST: setTomlVar" + +cat > ./test.toml << EOL +aaa = "aaa" +b = 2 +cc_cc = true +ddd = [ "aaa", "b", "cc_cc", ] + +[tag] +aaa = "aaa" +b = 2 +cc_cc = true +ddd = "empty test" + +[tag_2] +aaa = "aaa" +b = 2 +cc_cc = true +ddd = "whitespace test" +EOL + +cat > ./expected.toml << EOL +aaa = "Hello World" +b = 2 +cc_cc = true +ddd = [ "aaa", "b2", "cc_cc", ] + +[tag] +aaa = "aaa" +b = 3 +cc_cc = true +ddd = "" + +[tag_2] +aaa = "aaa" +b = -4 +cc_cc = false +ddd = " " +EOL + +setTomlVar "" aaa "Hello World" ./test.toml +setTomlVar "" ddd '[ "aaa", "b2", "cc_cc", ]' ./test.toml +setTomlVar "[tag]" b 3 ./test.toml +setTomlVar "[tag]" ddd "" ./test.toml +setTomlVar "[tag_2]" b -4 ./test.toml +setTomlVar "[tag_2]" cc_cc false ./test.toml +setTomlVar "[tag_2]" ddd " " ./test.toml + +[ "$(sha256 ./test.toml)" != "$(sha256 ./expected.toml)" ] && \ + echoNErr "\nERROR: Expected ' ./test.toml' to have a hash '$(sha256 ./test.toml)', but got '$(sha256 ./expected.toml)':\n$(cat ./test.toml)\n" && exit 1 || echoInfo "INFO: Test 1 passed" + ################################################################# echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index f27a6c33..50106a07 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.11" +echo "v0.2.12" From 213e79152b793ac3d8bc99be8bce45425fd1b6fa Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 10:35:51 +0000 Subject: [PATCH 116/140] explicit commad run --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb7cf5a3..97e3db8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,6 +69,7 @@ jobs: echo " Release exists: ${{ env.RELEASE_EXISTS }}" - name: Testing & Building TOOLS run: | + set -x echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz chmod -Rv 555 ./scripts From 08cbd3b3a4ccf5f4e7b10d8d9bbae792ca3a8a4c Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 10:50:59 +0000 Subject: [PATCH 117/140] update docker images --- .github/workflows/main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97e3db8e..f44e0cb3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.9.3-rc.3@sha256:ae4cbe04ad2befb265bc9696d001447a8453eb8cd5786bd439d66fa854b3e572 + image: ghcr.io/kiracore/docker/base-image:v0.10.9 steps: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory @@ -72,9 +72,7 @@ jobs: set -x echo "(current dir): $PWD" && ls -l ./ tar xvf ./src.tar.gz - chmod -Rv 555 ./scripts - chmod -Rv 555 ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts ./ipfs-api/scripts - chmod -Rv 555 ./bash-utils + chmod -Rv 555 ./scripts ./bash-utils ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bash-utils/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts ./ipfs-api/scripts chmod -Rv 666 ./RELEASE.md export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} make test @@ -103,7 +101,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.9.3-rc.3@sha256:077c3d5e07c2766027af5e92338a25ffcf8688a2be79e3aa9eae9598650e716a + image: ghcr.io/kiracore/docker/base-image:v0.10.9 steps: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory @@ -161,6 +159,7 @@ jobs: name: tools-bin-amd64 - name: Testing & Building TOOLS run: | + set -x echo "(current dir): $PWD" && ls -l ./ chmod -Rv 555 ./scripts ./bash-utils ./tmconnect/scripts ./tmkms-key-import/scripts ./validator-key-gen/scripts ./bip39gen/scripts ./bip39gen/bip39/scripts ./ipfs-api/scripts export SOURCE_BRANCH=${{ env.SOURCE_BRANCH }} From c6518341c9a4813a348f3f2c31a1b517ee1aa68a Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 10:59:28 +0000 Subject: [PATCH 118/140] pre-intall bash utils --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f44e0cb3..fc39699b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,11 +42,13 @@ jobs: echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV - name: Archive src, install latest bash-utils and setup envs run: | + set -x WORK_DIR=$PWD echo "(current dir): $WORK_DIR" && ls -l ./ cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR chmod -Rv 555 ./scripts ./bash-utils + ./bash-utils/bash-utils.sh bashUtilsSetup set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV @@ -126,12 +128,14 @@ jobs: run: | echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV - - name: Setup ENV variables + - name: Setup ENV variables & install bash-utils run: | + set -x WORK_DIR=$PWD echo "(current dir): $WORK_DIR" && ls -l ./ cd $WORK_DIR chmod -Rv 555 ./scripts ./bash-utils + ./bash-utils/bash-utils.sh bashUtilsSetup set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV From b2e2646bdd61d750e49b0ebf695f4a113320e143 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 11:05:38 +0000 Subject: [PATCH 119/140] latest release --- .github/workflows/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fc39699b..70199715 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.10.9 + image: ghcr.io/kiracore/docker/base-image:v0.11.1 steps: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory @@ -103,7 +103,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.10.9 + image: ghcr.io/kiracore/docker/base-image:v0.11.1 steps: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory @@ -131,12 +131,12 @@ jobs: - name: Setup ENV variables & install bash-utils run: | set -x + set -e WORK_DIR=$PWD echo "(current dir): $WORK_DIR" && ls -l ./ cd $WORK_DIR chmod -Rv 555 ./scripts ./bash-utils ./bash-utils/bash-utils.sh bashUtilsSetup - set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV @@ -149,13 +149,14 @@ jobs: - name: Print debug data before build run: | . /etc/profile - go version + echo " Source branch: $(bash-utils bashUtilsVersion)" echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" echo " Repository name: ${{ env.REPOSITORY_NAME }}" echo " Release version: ${{ env.RELEASE_VER }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" + go version - name: Download AMD64 artifacts # ref.: https://github.com/actions/download-artifact, v3.0.0 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 From 81e49407b5922504f327f4b1a808c92571f6e64b Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 11:22:06 +0000 Subject: [PATCH 120/140] explicit log --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 70199715..1bc64c32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,13 +43,13 @@ jobs: - name: Archive src, install latest bash-utils and setup envs run: | set -x + set -e WORK_DIR=$PWD echo "(current dir): $WORK_DIR" && ls -l ./ cd ../ && tar -czvf src.tar.gz -C ./tools . && cp ./src.tar.gz ./tools/src.tar.gz cd $WORK_DIR chmod -Rv 555 ./scripts ./bash-utils ./bash-utils/bash-utils.sh bashUtilsSetup - set +x RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV @@ -61,14 +61,15 @@ jobs: fi - name: Print debug data before build run: | - . /etc/profile - go version + set -x + echo "Bash Utils version: $(bash-utils bashUtilsVersion)" echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" echo " Repository name: ${{ env.REPOSITORY_NAME }}" echo " Release version: ${{ env.RELEASE_VER }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" + go version - name: Testing & Building TOOLS run: | set -x @@ -148,8 +149,7 @@ jobs: fi - name: Print debug data before build run: | - . /etc/profile - echo " Source branch: $(bash-utils bashUtilsVersion)" + echo "Bash Utils version: $(bash-utils bashUtilsVersion)" echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" echo " Event name: ${{ github.event_name }}" From a4eab6724e9af38481f170cebe639d1a0ff2334f Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 11:28:45 +0000 Subject: [PATCH 121/140] do not check go version --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bc64c32..a32597ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,6 @@ jobs: echo " Repository name: ${{ env.REPOSITORY_NAME }}" echo " Release version: ${{ env.RELEASE_VER }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" - go version - name: Testing & Building TOOLS run: | set -x @@ -84,6 +83,7 @@ jobs: - name: Publishing TOOLS binaries shell: bash run: | + set -x make publish touch ./RELEASE.md cp -fv ./RELEASE.md ./bin/RELEASE.md @@ -156,7 +156,6 @@ jobs: echo " Repository name: ${{ env.REPOSITORY_NAME }}" echo " Release version: ${{ env.RELEASE_VER }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" - go version - name: Download AMD64 artifacts # ref.: https://github.com/actions/download-artifact, v3.0.0 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 From fe1b62ba7f6b0609fd8663b9b1e2dd9c539e1806 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 11:35:02 +0000 Subject: [PATCH 122/140] syntax --- bash-utils/scripts/test.sh | 1 + scripts/build.sh | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 1bec997e..6fc29217 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -114,6 +114,7 @@ safeWget $SYSCTRL_DESTINATION \ https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/files/docker/systemctl.py \ "e02e90c6de6cd68062dadcc6a20078c34b19582be0baf93ffa7d41f5ef0a1fdd" +chmod -v 555 $SYSCTRL_DESTINATION systemctl2 version ################################################################# diff --git a/scripts/build.sh b/scripts/build.sh index 57245825..165bf695 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,7 @@ #!/usr/bin/env bash set -e -set +x -. /etc/profile set -x - +. /etc/profile . ./bash-utils/bash-utils.sh WORKDIR=$PWD From 5fd9e193d9470d9db60b43ed4856970bd7428a7c Mon Sep 17 00:00:00 2001 From: Asmodat Date: Thu, 7 Jul 2022 14:05:43 +0000 Subject: [PATCH 123/140] update image --- .github/workflows/main.yml | 5 +++-- bip39gen/bip39/scripts/test.sh | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a32597ac..f8a32812 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.11.1 + image: ghcr.io/kiracore/docker/base-image:v0.11.2 steps: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory @@ -69,6 +69,7 @@ jobs: echo " Repository name: ${{ env.REPOSITORY_NAME }}" echo " Release version: ${{ env.RELEASE_VER }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" + go version - name: Testing & Building TOOLS run: | set -x @@ -104,7 +105,7 @@ jobs: id-token: write pull-requests: write container: - image: ghcr.io/kiracore/docker/base-image:v0.11.1 + image: ghcr.io/kiracore/docker/base-image:v0.11.2 steps: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory diff --git a/bip39gen/bip39/scripts/test.sh b/bip39gen/bip39/scripts/test.sh index f59aa9bb..2bd73d5b 100644 --- a/bip39gen/bip39/scripts/test.sh +++ b/bip39gen/bip39/scripts/test.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash set -e -set +x -. /etc/profile set -x +. /etc/profile cd ./bip39 || echo "Already in the root dir" From 35e4564fece67a88fe99ecbca554426a89b26243 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 9 Jul 2022 09:35:38 +0000 Subject: [PATCH 124/140] new tools release --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 72 ++++++++++++++++++++++++++++++-------- bash-utils/scripts/test.sh | 21 ++++++++++- scripts/version.sh | 2 +- 4 files changed, 79 insertions(+), 18 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 82cc2e89..58b8e696 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Features: -* Added `strLength, strStartsWith, strEndsWith, setTomlVar` to bash-utils +* Added `getTomlVarName` to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 4d2f6416..c95c3993 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.2.12" + local BASH_UTILS_VERSION="v0.2.13" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -263,35 +263,42 @@ function md5() { } function strLength() { - [ -z "$1" ] && local string="$(timeout 1 cat 2> /dev/null || echo -n '')" || local string="$1" - [ -z "$string" ] && echo "0" || echo $(echo "$string" | awk '{print length}') || echo -n "-1" + local result="" + [ -z "$1" ] && result="0" || result=$(echo "$1" | awk '{print length}') || result=-1 + if ($(isNumber "$result")) ; then + echo $result + else + echo -1 + fi } function strStartsWith() { local string="$1" local prefix="$2" - local string_len=$(bash-utils strLength "$string") - local prefix_len=$(bash-utils strLength "$prefix") - if [[ $prefix_len -gt $string_len ]] ; then - echo "false" - else + local string_len=$(strLength "$string") + local prefix_len=$(strLength "$prefix") + if [[ $prefix_len -eq $string_len ]] && [[ $string_len -ge 1 ]] ; then + [ "$string" == "$prefix" ] && echo "true" && return 0 || echo "false" && return 0 + elif [[ $prefix_len -le $string_len ]] && [[ $prefix_len -ge 1 ]] && [[ $string_len -ge 1 ]] ; then local substr="${string:0:$prefix_len}" - [ "$substr" == "$prefix" ] && echo "true" || echo "false" + [ "$substr" == "$prefix" ] && echo "true" && return 0 || echo "false" && return 0 fi + echo "false" } function strEndsWith() { local string="$1" local suffix="$2" - local string_len=$(bash-utils strLength "$string") - local suffix_len=$(bash-utils strLength "$suffix") - if [[ $suffix_len -gt $string_len ]] ; then - echo "false" - else + local string_len=$(strLength "$string") + local suffix_len=$(strLength "$suffix") + if [[ $suffix_len -eq $string_len ]] && [[ $string_len -ge 1 ]] ; then + [ "$string" == "$suffix" ] && echo "true" && return 0 || echo "false" && return 0 + elif [[ $suffix_len -le $string_len ]] && [[ $suffix_len -ge 1 ]] && [[ $string_len -ge 1 ]] ; then local n="-${suffix_len}" local substr="${string:$n}" - [ "$substr" == "$suffix" ] && echo "true" || echo "false" + [ "$substr" == "$suffix" ] && echo "true" && return 0 || echo "false" && return 0 fi + echo "false" } # Allows to safely download file from external resources by hash verification or cosign file signature @@ -992,12 +999,47 @@ function getFirstLineByPrefixAfterPrefix() { echo "$result" } +# Gets var names by index, e.g. getTomlVarName 36 ./example.toml -> [] +function getTomlVarName() { + local index=$1 + local file=$2 + local tag="[base]" + local name="" + local result="" + local cnt=0 + while read -r row; do + local line=$(delWhitespaces "$row") + if ($(strStartsWith "$line" "#")) || ($(isNullOrWhitespaces "$line")) ; then + continue + elif ($(strStartsWith "$line" '[')) && ($(strEndsWith "$line" ']')) ; then + tag="$line" + continue + elif ($(isSubStr "$line" '=')) ; then + name=$(echo "$line" | cut -d= -f1 | xargs) + if ($(isNullOrWhitespaces "$line")) ; then + continue + else + cnt="$((cnt+1))" + if [[ $cnt -eq $index ]] ; then + result="$tag $name" + break + fi + fi + else + continue + fi + done < $file + echo "$result" +} + # setTomlVar function setTomlVar() { local VAR_TAG=$(bash-utils delWhitespaces "$1") local VAR_NAME=$(bash-utils delWhitespaces "$2") local VAR_VALUE="$3" local VAR_FILE=$4 + + ( [ "$VAR_TAG" == "[base]" ] || [ "$VAR_TAG" == "" ] ) && echoWarn "WARNING: Base tag detected!" && VAR_TAG="" ([ -z "$VAR_FILE" ] || [ ! -f $VAR_FILE ]) && \ bash-utils echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 6fc29217..12b88815 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -228,7 +228,7 @@ ddd = " " EOL setTomlVar "" aaa "Hello World" ./test.toml -setTomlVar "" ddd '[ "aaa", "b2", "cc_cc", ]' ./test.toml +setTomlVar "[base]" ddd '[ "aaa", "b2", "cc_cc", ]' ./test.toml setTomlVar "[tag]" b 3 ./test.toml setTomlVar "[tag]" ddd "" ./test.toml setTomlVar "[tag_2]" b -4 ./test.toml @@ -238,6 +238,25 @@ setTomlVar "[tag_2]" ddd " " ./test.toml [ "$(sha256 ./test.toml)" != "$(sha256 ./expected.toml)" ] && \ echoNErr "\nERROR: Expected ' ./test.toml' to have a hash '$(sha256 ./test.toml)', but got '$(sha256 ./expected.toml)':\n$(cat ./test.toml)\n" && exit 1 || echoInfo "INFO: Test 1 passed" +################################################################# +echoWarn "TEST: getTomlVarName" + +VAR_NAME=$(getTomlVarName 1 ./test.toml) && VAR_NAME_EXP="[base] aaa" +[ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ + echoNErr "\nERROR: Expected variable name 1 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 1 passed" + +VAR_NAME=$(getTomlVarName 3 ./test.toml) && VAR_NAME_EXP="[base] cc_cc" +[ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ + echoNErr "\nERROR: Expected variable name 3 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 2 passed" + +VAR_NAME=$(getTomlVarName 8 ./test.toml) && VAR_NAME_EXP="[tag] ddd" +[ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ + echoNErr "\nERROR: Expected variable name 8 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 3 passed" + +VAR_NAME=$(getTomlVarName 10 ./test.toml) && VAR_NAME_EXP="[tag2] b" +[ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ + echoNErr "\nERROR: Expected variable name 10 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 4 passed" + ################################################################# echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index 50106a07..88cb77e7 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.12" +echo "v0.2.13" From 0493eadeb25e71a6047e43ebed251ae5c6f3c24a Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 9 Jul 2022 09:38:17 +0000 Subject: [PATCH 125/140] speedup execution --- bash-utils/bash-utils.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index c95c3993..3ebd28be 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -1034,45 +1034,45 @@ function getTomlVarName() { # setTomlVar function setTomlVar() { - local VAR_TAG=$(bash-utils delWhitespaces "$1") - local VAR_NAME=$(bash-utils delWhitespaces "$2") + local VAR_TAG=$(delWhitespaces "$1") + local VAR_NAME=$(delWhitespaces "$2") local VAR_VALUE="$3" local VAR_FILE=$4 ( [ "$VAR_TAG" == "[base]" ] || [ "$VAR_TAG" == "" ] ) && echoWarn "WARNING: Base tag detected!" && VAR_TAG="" ([ -z "$VAR_FILE" ] || [ ! -f $VAR_FILE ]) && \ - bash-utils echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" + echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" - local MIN_LINE_NR=$(bash-utils getFirstLineByPrefixAfterPrefix "" "$VAR_TAG" "$VAR_FILE") - local LINE_NR=$(bash-utils getFirstLineByPrefixAfterPrefix "$VAR_TAG" "$VAR_NAME =" "$VAR_FILE") - local MAX_LINE_NR=$(bash-utils getFirstLineByPrefixAfterPrefix "$VAR_TAG" "[" "$VAR_FILE") + local MIN_LINE_NR=$(getFirstLineByPrefixAfterPrefix "" "$VAR_TAG" "$VAR_FILE") + local LINE_NR=$(getFirstLineByPrefixAfterPrefix "$VAR_TAG" "$VAR_NAME =" "$VAR_FILE") + local MAX_LINE_NR=$(getFirstLineByPrefixAfterPrefix "$VAR_TAG" "[" "$VAR_FILE") ( [[ $LINE_NR -le 0 ]] || ( [[ $MAX_LINE_NR -gt 0 ]] && [[ $LINE_NR -ge $MAX_LINE_NR ]] ) ) && \ - bash-utils echoErr "ERROR: File '$VAR_FILE' does NOT contain a variable name '$VAR_NAME' occuring afer the tag '$VAR_TAG' (line $MIN_LINE_NR), but before the next tag (line $MAX_LINE_NR)" && \ + echoErr "ERROR: File '$VAR_FILE' does NOT contain a variable name '$VAR_NAME' occuring afer the tag '$VAR_TAG' (line $MIN_LINE_NR), but before the next tag (line $MAX_LINE_NR)" && \ LINE_NR=-1 if [ ! -z "$VAR_NAME" ] && [ -f $VAR_FILE ] && [ $LINE_NR -ge 1 ] ; then - if ($(bash-utils isNullOrWhitespaces "$VAR_VALUE")) ; then - bash-utils echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' is empty or a sequece od whitespaces" + if ($(isNullOrWhitespaces "$VAR_VALUE")) ; then + echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' is empty or a sequece od whitespaces" VAR_VALUE="\"$VAR_VALUE\"" - elif ( ($(bash-utils strStartsWith "$VAR_VALUE" "\"")) && ($(bash-utils strEndsWith "$VAR_VALUE" "\"")) ) ; then + elif ( ($(strStartsWith "$VAR_VALUE" "\"")) && ($(strEndsWith "$VAR_VALUE" "\"")) ) ; then : # nothing to do, quotes already present - elif ( (! $(bash-utils strStartsWith "$VAR_VALUE" "[")) || (! $(bash-utils strEndsWith "$VAR_VALUE" "]")) ) ; then + elif ( (! $(strStartsWith "$VAR_VALUE" "[")) || (! $(strEndsWith "$VAR_VALUE" "]")) ) ; then if ($(isSubStr "$VAR_VALUE" " ")) ; then - bash-utils echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' contains whitespaces" + echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' contains whitespaces" VAR_VALUE="\"$VAR_VALUE\"" - elif ( (! $(bash-utils isBoolean "$VAR_VALUE")) && (! $(bash-utils isNumber "$VAR_VALUE")) ) ; then - bash-utils echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' in nither a number or boolean" + elif ( (! $(isBoolean "$VAR_VALUE")) && (! $(isNumber "$VAR_VALUE")) ) ; then + echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' in nither a number or boolean" VAR_VALUE="\"$VAR_VALUE\"" fi fi - bash-utils echoInfo "INFO: Appending var '$VAR_NAME' with value '$VAR_VALUE' to file '$VAR_FILE' (line $LINE_NR), after the tag '$VAR_TAG' (line $MIN_LINE_NR)" - bash-utils setLineByNumber "$LINE_NR" "$VAR_NAME = $VAR_VALUE" "$VAR_FILE" + echoInfo "INFO: Appending var '$VAR_NAME' with value '$VAR_VALUE' to file '$VAR_FILE' (line $LINE_NR), after the tag '$VAR_TAG' (line $MIN_LINE_NR)" + setLineByNumber "$LINE_NR" "$VAR_NAME = $VAR_VALUE" "$VAR_FILE" return 0 else - bash-utils echoErr "ERROR: Failed to set variable '$VAR_NAME' in '$VAR_FILE'" + echoErr "ERROR: Failed to set variable '$VAR_NAME' in '$VAR_FILE'" return 1 fi } From f022de5da364edbd1646928238a87d61343a31f1 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sat, 9 Jul 2022 09:46:47 +0000 Subject: [PATCH 126/140] tag fix --- bash-utils/scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 12b88815..549a01c5 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -253,7 +253,7 @@ VAR_NAME=$(getTomlVarName 8 ./test.toml) && VAR_NAME_EXP="[tag] ddd" [ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ echoNErr "\nERROR: Expected variable name 8 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 3 passed" -VAR_NAME=$(getTomlVarName 10 ./test.toml) && VAR_NAME_EXP="[tag2] b" +VAR_NAME=$(getTomlVarName 10 ./test.toml) && VAR_NAME_EXP="[tag_2] b" [ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ echoNErr "\nERROR: Expected variable name 10 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 4 passed" From 9eda3898d92ddb697b301aea95f963bd9404d142 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Jul 2022 01:31:35 +0000 Subject: [PATCH 127/140] Updating toml editor --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 59 +++++++++++++++++++++++++------------- bash-utils/scripts/test.sh | 4 +-- scripts/version.sh | 2 +- 4 files changed, 43 insertions(+), 24 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 58b8e696..abfa63ab 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Features: -* Added `getTomlVarName` to bash-utils +* Added `getTomlVarNames` to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 3ebd28be..b7debbb5 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.2.13" + local BASH_UTILS_VERSION="v0.2.14" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -1005,41 +1005,60 @@ function getTomlVarName() { local file=$2 local tag="[base]" local name="" - local result="" local cnt=0 - while read -r row; do - local line=$(delWhitespaces "$row") - if ($(strStartsWith "$line" "#")) || ($(isNullOrWhitespaces "$line")) ; then - continue - elif ($(strStartsWith "$line" '[')) && ($(strEndsWith "$line" ']')) ; then + local line="" + local line_nr=0 + mapfile rows < $file + for row in "${rows[@]}"; do + line=$(echo "$row" | tr -d '\011\012\013\014\015\040') + line_nr="$((line_nr+1))" + if [[ $line = \[*\] ]] ; then tag="$line" continue - elif ($(isSubStr "$line" '=')) ; then + elif [ -z "$line" ] || [[ $line = \#* ]] || [[ $line_nr -lt $index ]]; then + continue + elif [[ $line = *=* ]] ; then name=$(echo "$line" | cut -d= -f1 | xargs) - if ($(isNullOrWhitespaces "$line")) ; then - continue - else + if [ ! -z "$name" ] ; then cnt="$((cnt+1))" - if [[ $cnt -eq $index ]] ; then - result="$tag $name" - break - fi + [[ $cnt -eq $index ]] && echo "$tag $name" && break fi - else + fi + done +} + +# getTomlVarNames ./example.toml +function getTomlVarNames() { + local file=$1 + local tag="[base]" + local name="" + local result="" + local cnt=0 + local line="" + mapfile rows < $file + for row in "${rows[@]}"; do + line=$(echo "$row" | tr -d '\011\012\013\014\015\040') + if [[ $line = \[*\] ]] ; then + tag="$line" continue + elif [ -z "$line" ] || [[ $line = \#* ]] ; then + continue + elif [[ $line = *=* ]] ; then + name=$(echo "$line" | cut -d= -f1 | xargs) + [ ! -z "$name" ] && echo "$tag $name" fi - done < $file - echo "$result" + done } # setTomlVar function setTomlVar() { - local VAR_TAG=$(delWhitespaces "$1") + local VAR_TAG=$(echo "$1" | tr -d '\011\012\013\014\015\040\133\135' | xargs) local VAR_NAME=$(delWhitespaces "$2") local VAR_VALUE="$3" local VAR_FILE=$4 - ( [ "$VAR_TAG" == "[base]" ] || [ "$VAR_TAG" == "" ] ) && echoWarn "WARNING: Base tag detected!" && VAR_TAG="" + ( [ "$VAR_TAG" == "base" ] || [ "$VAR_TAG" == "" ] ) && echoWarn "WARNING: Base tag detected!" && VAR_TAG="" + [ ! -z "$VAR_TAG" ] && VAR_TAG="[$VAR_TAG]" ([ -z "$VAR_FILE" ] || [ ! -f $VAR_FILE ]) && \ echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 549a01c5..deac444e 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -230,9 +230,9 @@ EOL setTomlVar "" aaa "Hello World" ./test.toml setTomlVar "[base]" ddd '[ "aaa", "b2", "cc_cc", ]' ./test.toml setTomlVar "[tag]" b 3 ./test.toml -setTomlVar "[tag]" ddd "" ./test.toml +setTomlVar "tag" ddd "" ./test.toml setTomlVar "[tag_2]" b -4 ./test.toml -setTomlVar "[tag_2]" cc_cc false ./test.toml +setTomlVar "tag_2" cc_cc false ./test.toml setTomlVar "[tag_2]" ddd " " ./test.toml [ "$(sha256 ./test.toml)" != "$(sha256 ./expected.toml)" ] && \ diff --git a/scripts/version.sh b/scripts/version.sh index 88cb77e7..62d2a787 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.13" +echo "v0.2.14" From 64d8f94b54d3f714e2a9971ef0062b7346355b0a Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 13 Jul 2022 02:19:12 +0000 Subject: [PATCH 128/140] synatx fix & extra tests --- bash-utils/bash-utils.sh | 16 +++++++--------- bash-utils/scripts/test.sh | 31 +++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index b7debbb5..dc71c318 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -1007,15 +1007,13 @@ function getTomlVarName() { local name="" local cnt=0 local line="" - local line_nr=0 mapfile rows < $file for row in "${rows[@]}"; do line=$(echo "$row" | tr -d '\011\012\013\014\015\040') - line_nr="$((line_nr+1))" if [[ $line = \[*\] ]] ; then tag="$line" continue - elif [ -z "$line" ] || [[ $line = \#* ]] || [[ $line_nr -lt $index ]]; then + elif [ -z "$line" ] || [[ $line = \#* ]] ; then continue elif [[ $line = *=* ]] ; then name=$(echo "$line" | cut -d= -f1 | xargs) @@ -1057,23 +1055,23 @@ function setTomlVar() { local VAR_VALUE="$3" local VAR_FILE=$4 - ( [ "$VAR_TAG" == "base" ] || [ "$VAR_TAG" == "" ] ) && echoWarn "WARNING: Base tag detected!" && VAR_TAG="" - [ ! -z "$VAR_TAG" ] && VAR_TAG="[$VAR_TAG]" + [ ! -z "$VAR_TAG" ] && VAR_TAG="[${VAR_TAG}]" + [ "$VAR_TAG" == "[base]" ] && echoWarn "WARNING: Base tag detected!" && VAR_TAG="" ([ -z "$VAR_FILE" ] || [ ! -f $VAR_FILE ]) && \ - echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't usert '$VAR_NAME' variable" + echoErr "ERROR: File '$VAR_FILE' does NOT exist, can't upsert '$VAR_NAME' variable" && return 1 local MIN_LINE_NR=$(getFirstLineByPrefixAfterPrefix "" "$VAR_TAG" "$VAR_FILE") local LINE_NR=$(getFirstLineByPrefixAfterPrefix "$VAR_TAG" "$VAR_NAME =" "$VAR_FILE") local MAX_LINE_NR=$(getFirstLineByPrefixAfterPrefix "$VAR_TAG" "[" "$VAR_FILE") ( [[ $LINE_NR -le 0 ]] || ( [[ $MAX_LINE_NR -gt 0 ]] && [[ $LINE_NR -ge $MAX_LINE_NR ]] ) ) && \ echoErr "ERROR: File '$VAR_FILE' does NOT contain a variable name '$VAR_NAME' occuring afer the tag '$VAR_TAG' (line $MIN_LINE_NR), but before the next tag (line $MAX_LINE_NR)" && \ - LINE_NR=-1 + LINE_NR=-1 && return 1 if [ ! -z "$VAR_NAME" ] && [ -f $VAR_FILE ] && [ $LINE_NR -ge 1 ] ; then if ($(isNullOrWhitespaces "$VAR_VALUE")) ; then - echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' is empty or a sequece od whitespaces" + echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' is empty or a seq. of whitespaces" VAR_VALUE="\"$VAR_VALUE\"" elif ( ($(strStartsWith "$VAR_VALUE" "\"")) && ($(strEndsWith "$VAR_VALUE" "\"")) ) ; then : # nothing to do, quotes already present @@ -1087,7 +1085,7 @@ function setTomlVar() { fi fi - echoInfo "INFO: Appending var '$VAR_NAME' with value '$VAR_VALUE' to file '$VAR_FILE' (line $LINE_NR), after the tag '$VAR_TAG' (line $MIN_LINE_NR)" + echoInfo "INFO: Updating '$VAR_TAG' '$VAR_NAME' with value '$VAR_VALUE' in the file '$VAR_FILE' at line '$LINE_NR'" setLineByNumber "$LINE_NR" "$VAR_NAME = $VAR_VALUE" "$VAR_FILE" return 0 else diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index deac444e..c1ec9094 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -243,19 +243,42 @@ echoWarn "TEST: getTomlVarName" VAR_NAME=$(getTomlVarName 1 ./test.toml) && VAR_NAME_EXP="[base] aaa" [ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ - echoNErr "\nERROR: Expected variable name 1 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 1 passed" + echoErr "ERROR: Expected variable name 1 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 1 passed" VAR_NAME=$(getTomlVarName 3 ./test.toml) && VAR_NAME_EXP="[base] cc_cc" [ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ - echoNErr "\nERROR: Expected variable name 3 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 2 passed" + echoErr "ERROR: Expected variable name 3 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 2 passed" VAR_NAME=$(getTomlVarName 8 ./test.toml) && VAR_NAME_EXP="[tag] ddd" [ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ - echoNErr "\nERROR: Expected variable name 8 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 3 passed" + echoErr "ERROR: Expected variable name 8 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 3 passed" VAR_NAME=$(getTomlVarName 10 ./test.toml) && VAR_NAME_EXP="[tag_2] b" [ "$VAR_NAME" != "$VAR_NAME_EXP" ] && \ - echoNErr "\nERROR: Expected variable name 10 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 4 passed" + echoErr "ERROR: Expected variable name 10 to be '$VAR_NAME', but got $VAR_NAME_EXP" && exit 1 || echoInfo "INFO: Test 4 passed" + +################################################################# +echoWarn "TEST: getTomlVarNames" + +getTomlVarNames ./test.toml > ./names_test.toml + +cat > ./expected.toml << EOL +[base] aaa +[base] b +[base] cc_cc +[base] ddd +[tag] aaa +[tag] b +[tag] cc_cc +[tag] ddd +[tag_2] aaa +[tag_2] b +[tag_2] cc_cc +[tag_2] ddd +EOL + +[ "$(sha256 ./names_test.toml)" != "$(sha256 ./expected.toml)" ] && \ + echoNErr "\nERROR: Expected ' ./names_test.toml' to have a hash '$(sha256 ./names_test.toml)', but got '$(sha256 ./expected.toml)':\n$(cat ./names_test.toml)\n" && exit 1 || echoInfo "INFO: Test 1 passed" ################################################################# From 19b5465457b44cadf7ff2a5ed7884d00e651ba6a Mon Sep 17 00:00:00 2001 From: Asmodat Date: Mon, 18 Jul 2022 10:51:37 +0000 Subject: [PATCH 129/140] Add set by substr --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 63 ++++++++++++++++++++++++++++++++++++++ bash-utils/scripts/test.sh | 36 ++++++++++++++++++++++ scripts/version.sh | 2 +- 4 files changed, 101 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index abfa63ab..f05e941f 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Features: -* Added `getTomlVarNames` to bash-utils +* Added a range of `set by SubStr` functions to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index dc71c318..fc189209 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -902,6 +902,25 @@ function echol() { grep -n "$1" $0 | sed "s/echo_line_no//" } +function getNLineBySubStr() { + local INDEX=$1 + local SUBSTR=$2 + local FILE=$3 + INDEX="$((INDEX-1))" + if ($(isNullOrWhitespaces "$SUBSTR")) || ($(isNullOrWhitespaces "$FILE")) || [ ! -f $FILE ] ; then echo "-1" ; else + SUBSTR=${SUBSTR//"="/"\="} + SUBSTR=${SUBSTR//"/"/"\/"} + SUBSTR=${SUBSTR//"["/"\["} + SUBSTR=${SUBSTR//"*"/"\*"} + local lines=$(sed -n "/${SUBSTR}/=" $FILE) + if ($(isNullOrWhitespaces "$lines")) ; then echo "-1" ; else + local lineArr=($(echo $lines)) + local lineNr=${lineArr[$INDEX]} + ($(isNaturalNumber "$lineNr")) && echo "$lineNr" || echo "-1" + fi + fi +} + # for now this funciton is only intended for env variables discovery function getNLineByPrefix() { local INDEX=$1 @@ -922,10 +941,18 @@ function getNLineByPrefix() { fi } +function getLastLineByPSubStr() { + getNLineBySubStr "0" "$1" "$2" +} + function getLastLineByPrefix() { getNLineByPrefix "0" "$1" "$2" } +function getFirstLineBySubStr() { + getNLineBySubStr "1" "$1" "$2" +} + function getFirstLineByPrefix() { getNLineByPrefix "1" "$1" "$2" } @@ -939,6 +966,20 @@ function setLineByNumber() { $TEXT" $FILE } +function setNLineBySubStr() { + local INDEX=$1 + local SUBSTR=$2 + local TEXT=$3 + local FILE=$4 + local LINE=$(getNLineBySubStr "$INDEX" "$SUBSTR" "$FILE") + if [[ $LINE -ge 0 ]] ; then + setLineByNumber "$LINE" "$TEXT" "$FILE" + echo "true" + else + echo "false" + fi +} + function setNLineByPrefix() { local INDEX=$1 local PREFIX=$2 @@ -953,14 +994,36 @@ function setNLineByPrefix() { fi } +function setLastLineBySubStr() { + setNLineBySubStr "0" "$1" "$2" "$3" +} + function setLastLineByPrefix() { setNLineByPrefix "0" "$1" "$2" "$3" } +function setFirstLineBySubStr() { + setNLineBySubStr "1" "$1" "$2" "$3" +} + function setFirstLineByPrefix() { setNLineByPrefix "1" "$1" "$2" "$3" } +function setLastLineBySubStrOrAppend() { + local SUBSTR=$1 + local TEXT=$2 + local FILE=$3 + [ ! -f "$FILE" ] && echoErr "ERROR: File '$FILE' does NOT exist, nothing can be set!" + local ADDED=$(setLastLineBySubStr "$SUBSTR" "$TEXT" "$FILE") + if [ "$ADDED" == "false" ] ; then + echo "$TEXT" >> $FILE + elif [ "$ADDED" != "true" ] ; then + echoErr "ERROR: Failed to set line or apped to '$FILE'" + return 1 + fi +} + function setLastLineByPrefixOrAppend() { local PREFIX=$1 local TEXT=$2 diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index c1ec9094..7b2600d1 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -280,6 +280,42 @@ EOL [ "$(sha256 ./names_test.toml)" != "$(sha256 ./expected.toml)" ] && \ echoNErr "\nERROR: Expected ' ./names_test.toml' to have a hash '$(sha256 ./names_test.toml)', but got '$(sha256 ./expected.toml)':\n$(cat ./names_test.toml)\n" && exit 1 || echoInfo "INFO: Test 1 passed" +################################################################# +echoWarn "TEST: setLastLineBySubStrOrAppend" + +cat > ./test.txt << EOL +10.1.0.2 registry.local +10.2.0.2 validator.local +10.3.0.2 interx.local +127.0.0.1 localhost +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts +EOL + +setLastLineBySubStrOrAppend "interx.local" "172.16.0.2 interx.local" ./test.txt +setLastLineBySubStrOrAppend "ip6-allhos" "ff02::4 ip6-allhosts2" ./test.txt +sort -u ./test.txt -o ./test.txt + +cat > ./expected.txt << EOL +10.1.0.2 registry.local +10.2.0.2 validator.local +127.0.0.1 localhost +172.16.0.2 interx.local +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::4 ip6-allhosts2 +EOL + +[ "$(sha256 ./test.txt)" != "$(sha256 ./expected.txt)" ] && \ + echoNErr "\nERROR: Expected ' ./test.txt' to have a hash '$(sha256 ./test.txt)', but got '$(sha256 ./expected.txt)':\n$(cat ./test.txt)\n" && exit 1 || echoInfo "INFO: Test 1 passed" + ################################################################# echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index 62d2a787..87d0b78c 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.14" +echo "v0.2.15" From ca6e5e46a710bb9d38a62bb90900099ca37ad435 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Tue, 19 Jul 2022 10:27:24 +0000 Subject: [PATCH 130/140] Add funciton to grab json attributes & version control --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 41 +++++++++++++++++++++++++++++++++++--- bash-utils/scripts/test.sh | 10 +++++++++- scripts/version.sh | 2 +- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index f05e941f..c63c6964 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Features: -* Added a range of `set by SubStr` functions to bash-utils +* Added `jsonAttributes` function to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index fc189209..1befa706 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.2.14" + local BASH_UTILS_VERSION="v0.2.16" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -532,6 +532,35 @@ function jsonParse() { fi } +function jsonAttributes() { + local FIN="$1" + if [ ! -z "$FIN" ] ; then + if (! $(isFileEmpty "$FIN")) ; then + python3 -c " +import json,sys; +def ptrintAttributes(root, obj): + for key in obj: + val=obj[key] + if str(type(val)) == \"\": + ptrintAttributes(root + '.' + key, val) + else: + print((root + '.' + key)[1:]) +f=open('$FIN','r');obj=json.load(f);ptrintAttributes('', obj);f.close()" + fi + else + cat | python3 -c " +import json,sys; +def ptrintAttributes(root, obj): + for key in obj: + val=obj[key] + if str(type(val)) == \"\": + ptrintAttributes(root + '.' + key, val) + else: + print((root + '.' + key)[1:]) +obj=json.load(sys.stdin); ptrintAttributes('', obj)" + fi +} + function isFileJson() { if (! $(isFileEmpty "$1")) ; then jsonParse "" "$1" &> /dev/null && echo "true" || echo "false" @@ -962,8 +991,14 @@ function setLineByNumber() { local TEXT=$2 local FILE=$3 [ ! -f "$FILE" ] && echoErr "ERROR: File '$FILE' does NOT exist, nothing can be set!" - sed -i"" "$INDEX c\ + if [ -z "$TEXT" ] ; then + # delete line if text is empty + sed -i"" "${INDEX}d" $FILE + else + # set line if text is NOT eopty + sed -i"" "$INDEX c\ $TEXT" $FILE + fi } function setNLineBySubStr() { @@ -1143,7 +1178,7 @@ function setTomlVar() { echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' contains whitespaces" VAR_VALUE="\"$VAR_VALUE\"" elif ( (! $(isBoolean "$VAR_VALUE")) && (! $(isNumber "$VAR_VALUE")) ) ; then - echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' in nither a number or boolean" + echoWarn "WARNING: Brackets will be added, value '$VAR_VALUE' in neither a number or boolean" VAR_VALUE="\"$VAR_VALUE\"" fi fi diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 7b2600d1..357b175d 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -46,6 +46,14 @@ if [[ $(timerSpan) -lt 3 ]] ; then exit 1 fi +################################################################# +echoWarn "TEST: bashUtilsVersion" +ver=$(bashUtilsVersion) +ver_expected=$(../scripts/version.sh) + +[ "$ver" != "$ver_expected" ] && \ + echoErr "ERROR: Verison check failed, expected 'bashUtilsVersion' to return '$ver_expected', but got '$ver'" && exit 1 || echoInfo "INFO: Test 1 passed" + ################################################################# echoWarn "TEST: SHA & MD5" TEST_FILE=/tmp/testfile.tmp @@ -298,6 +306,7 @@ EOL setLastLineBySubStrOrAppend "interx.local" "172.16.0.2 interx.local" ./test.txt setLastLineBySubStrOrAppend "ip6-allhos" "ff02::4 ip6-allhosts2" ./test.txt +setLastLineBySubStrOrAppend "ip6-mcastprefix" "" ./test.txt sort -u ./test.txt -o ./test.txt cat > ./expected.txt << EOL @@ -307,7 +316,6 @@ cat > ./expected.txt << EOL 172.16.0.2 interx.local ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet -ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::4 ip6-allhosts2 diff --git a/scripts/version.sh b/scripts/version.sh index 87d0b78c..d60e7f53 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.15" +echo "v0.2.16" From aaee541ad19835c730a2660fad19b2da8b12c853 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sun, 24 Jul 2022 10:56:18 +0000 Subject: [PATCH 131/140] add args parser --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 28 ++++++++++++++++++++++------ bash-utils/scripts/test.sh | 10 ++++++++++ bip39gen/Makefile | 1 + bip39gen/scripts/test.sh | 18 ++++++++++++++++++ scripts/version.sh | 2 +- 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 bip39gen/scripts/test.sh diff --git a/RELEASE.md b/RELEASE.md index c63c6964..37e1613a 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Features: -* Added `jsonAttributes` function to bash-utils +* Added `getArgs` function to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 1befa706..bc2f97e5 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -21,7 +21,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.2.16" + local BASH_UTILS_VERSION="v0.2.17" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -263,13 +263,10 @@ function md5() { } function strLength() { + [ "$1" == "-e" ] && echo "2" && return 0 local result="" [ -z "$1" ] && result="0" || result=$(echo "$1" | awk '{print length}') || result=-1 - if ($(isNumber "$result")) ; then - echo $result - else - echo -1 - fi + ($(isNumber "$result")) && echo $result || echo -1 } function strStartsWith() { @@ -301,6 +298,25 @@ function strEndsWith() { echo "false" } +# getArgs --test="lol1" --tes-t="lol-l" --test2="lol 2" -e=ok -t=ok2 +function getArgs() { + for arg in "$@" ; do + ($(strStartsWith "$arg" "-")) && (! $(strStartsWith "$arg" "--")) && arg="-${arg}" + if ($(strStartsWith "$arg" "--")) && [[ "$arg" == *"="* ]] ; then + local arg_len=$(strLength "$arg") + local prefix=$(echo $arg | cut -d'=' -f1) + local prefix_len=$(strLength "$prefix") + local n="-$((arg_len - prefix_len - 1))" + local val="${arg:$n}" + local key=$(echo "$prefix" | tr -d '-') + eval $key="'$val'" + else + echoErr "ERROR: Invalid argument '$arg', missing '--' and/or '=' operators" + return 1 + fi + done +} + # Allows to safely download file from external resources by hash verification or cosign file signature # In the case where cosign verification is used the ".sig" URL must exist # safeWget diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index 357b175d..ef9d04a4 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -323,6 +323,16 @@ EOL [ "$(sha256 ./test.txt)" != "$(sha256 ./expected.txt)" ] && \ echoNErr "\nERROR: Expected ' ./test.txt' to have a hash '$(sha256 ./test.txt)', but got '$(sha256 ./expected.txt)':\n$(cat ./test.txt)\n" && exit 1 || echoInfo "INFO: Test 1 passed" +################################################################# +echoWarn "TEST: getArgs" + +getArgs -test1="test 1" --test_2="te\st 2" -t3='t3' -e="t 4" --p="test5" -z=" \" :)" + +RES="${test1}${test_2}${t3}${e}${p}${z}" +RES_EXP="test 1te\st 2t3t 4test5 \" :)" + +[ "$RES" != "$RES_EXP" ] && \ + echoErr "ERROR: Expected args parsing result to be '$RES_EXP', but got '$RES'" && exit 1 || echoInfo "INFO: Test 1 passed" ################################################################# diff --git a/bip39gen/Makefile b/bip39gen/Makefile index 7952aef9..bd239286 100644 --- a/bip39gen/Makefile +++ b/bip39gen/Makefile @@ -2,6 +2,7 @@ test: ./bip39/scripts/test.sh + ./scripts/test.sh build: ./bip39/scripts/build.sh diff --git a/bip39gen/scripts/test.sh b/bip39gen/scripts/test.sh new file mode 100644 index 00000000..cd18368a --- /dev/null +++ b/bip39gen/scripts/test.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -e +set +x +. /etc/profile +set -x + +. ./bash-utils/bash-utils.sh +. ./bip39/scripts/build.sh +. ./scripts/build.sh + + +ENTROPY=$(sha256 "daring collect artist first six arena brown design park syrup jump pluck") +MNEMONIC_TEST_1=$(bip39gen mnemonic -l 12 -e "$ENTROPY") +MNEMONIC_TEST_2=$(bip39gen mnemonic -l 12 -e "$ENTROPY") + +[ "$MNEMONIC_TEST_1" != "$MNEMONIC_TEST_2" ] && \ + echoErr "ERROR: When user entropy is provided expected mnemonic to change every time, in the process of being mixed with computer provided entropy" && exit 1 || echoInfo "INFO: Test 1 passed" + diff --git a/scripts/version.sh b/scripts/version.sh index d60e7f53..f546b5ad 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.16" +echo "v0.2.17" From 8b01ccf2f5fbd900c24a576044aaf4f85bb37523 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sun, 24 Jul 2022 10:59:27 +0000 Subject: [PATCH 132/140] syntax --- bip39gen/scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip39gen/scripts/test.sh b/bip39gen/scripts/test.sh index cd18368a..fc5e164b 100644 --- a/bip39gen/scripts/test.sh +++ b/bip39gen/scripts/test.sh @@ -4,7 +4,7 @@ set +x . /etc/profile set -x -. ./bash-utils/bash-utils.sh +. ../bash-utils/bash-utils.sh . ./bip39/scripts/build.sh . ./scripts/build.sh From d2f43ab73f5ac2fc0165e1479b6197c28004355c Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sun, 24 Jul 2022 11:03:03 +0000 Subject: [PATCH 133/140] run in go dir --- bip39gen/scripts/test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bip39gen/scripts/test.sh b/bip39gen/scripts/test.sh index fc5e164b..cd2a4874 100644 --- a/bip39gen/scripts/test.sh +++ b/bip39gen/scripts/test.sh @@ -8,6 +8,7 @@ set -x . ./bip39/scripts/build.sh . ./scripts/build.sh +cd $GOBIN ENTROPY=$(sha256 "daring collect artist first six arena brown design park syrup jump pluck") MNEMONIC_TEST_1=$(bip39gen mnemonic -l 12 -e "$ENTROPY") From 5e8520ba7ea41fc0c2f8d9d2fb92964759900350 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sun, 24 Jul 2022 11:05:37 +0000 Subject: [PATCH 134/140] syntax --- bip39gen/scripts/test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bip39gen/scripts/test.sh b/bip39gen/scripts/test.sh index cd2a4874..04d323e3 100644 --- a/bip39gen/scripts/test.sh +++ b/bip39gen/scripts/test.sh @@ -8,11 +8,11 @@ set -x . ./bip39/scripts/build.sh . ./scripts/build.sh -cd $GOBIN +BIN_bip39gen="${GOBIN}/bip39gen" ENTROPY=$(sha256 "daring collect artist first six arena brown design park syrup jump pluck") -MNEMONIC_TEST_1=$(bip39gen mnemonic -l 12 -e "$ENTROPY") -MNEMONIC_TEST_2=$(bip39gen mnemonic -l 12 -e "$ENTROPY") +MNEMONIC_TEST_1=$($BIN_bip39gen mnemonic -l 12 -e "$ENTROPY") +MNEMONIC_TEST_2=$($BIN_bip39gen mnemonic -l 12 -e "$ENTROPY") [ "$MNEMONIC_TEST_1" != "$MNEMONIC_TEST_2" ] && \ echoErr "ERROR: When user entropy is provided expected mnemonic to change every time, in the process of being mixed with computer provided entropy" && exit 1 || echoInfo "INFO: Test 1 passed" From 5a676a533a201d76b19defce4c4417492d4f194b Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sun, 24 Jul 2022 11:11:51 +0000 Subject: [PATCH 135/140] syntax --- bip39gen/Makefile | 2 ++ bip39gen/scripts/test.sh | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bip39gen/Makefile b/bip39gen/Makefile index bd239286..373e6c3e 100644 --- a/bip39gen/Makefile +++ b/bip39gen/Makefile @@ -2,6 +2,8 @@ test: ./bip39/scripts/test.sh + ./bip39/scripts/build.sh + ./scripts/build.sh ./scripts/test.sh build: diff --git a/bip39gen/scripts/test.sh b/bip39gen/scripts/test.sh index 04d323e3..04414f48 100644 --- a/bip39gen/scripts/test.sh +++ b/bip39gen/scripts/test.sh @@ -5,8 +5,6 @@ set +x set -x . ../bash-utils/bash-utils.sh -. ./bip39/scripts/build.sh -. ./scripts/build.sh BIN_bip39gen="${GOBIN}/bip39gen" From 596c53e6eca18660b2a16d59e58861c5f40b15ce Mon Sep 17 00:00:00 2001 From: Asmodat Date: Sun, 24 Jul 2022 11:13:48 +0000 Subject: [PATCH 136/140] syntax --- bip39gen/scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip39gen/scripts/test.sh b/bip39gen/scripts/test.sh index 04414f48..99ca3c8d 100644 --- a/bip39gen/scripts/test.sh +++ b/bip39gen/scripts/test.sh @@ -12,6 +12,6 @@ ENTROPY=$(sha256 "daring collect artist first six arena brown design park syrup MNEMONIC_TEST_1=$($BIN_bip39gen mnemonic -l 12 -e "$ENTROPY") MNEMONIC_TEST_2=$($BIN_bip39gen mnemonic -l 12 -e "$ENTROPY") -[ "$MNEMONIC_TEST_1" != "$MNEMONIC_TEST_2" ] && \ +[ "$MNEMONIC_TEST_1" == "$MNEMONIC_TEST_2" ] && \ echoErr "ERROR: When user entropy is provided expected mnemonic to change every time, in the process of being mixed with computer provided entropy" && exit 1 || echoInfo "INFO: Test 1 passed" From a7242df7a2999547376f4e76e684585c8feed04d Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 10 Aug 2022 09:29:12 +0000 Subject: [PATCH 137/140] Add URL check to tools --- RELEASE.md | 2 +- bash-utils/bash-utils.sh | 26 +++++++++++++++++++++++--- bash-utils/scripts/test.sh | 20 +++++++++++++++++--- scripts/version.sh | 2 +- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 37e1613a..5480d3de 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ Features: -* Added `getArgs` function to bash-utils +* Added `isURL, isCID, isSameFile` function to bash-utils diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index bc2f97e5..cf67d37b 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -12,7 +12,9 @@ REGEX_NUMBER="^[+-]?([0-9]*[.])?([0-9]+)?$" REGEX_PUBLIC_IP='^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(? /dev/null || bash-utils bashUtilsSetup "version" @@ -21,7 +23,7 @@ function bashUtilsVersion() { # this is default installation script for utils # ./bash-utils.sh bashUtilsSetup "/var/kiraglob" function bashUtilsSetup() { - local BASH_UTILS_VERSION="v0.2.17" + local BASH_UTILS_VERSION="v0.2.18" if [ "$1" == "version" ] ; then echo "$BASH_UTILS_VERSION" return 0 @@ -193,6 +195,14 @@ function isVersion { [[ "$1" =~ $REGEX_VERSION ]] && echo "true" || echo "false" } +function isCID() { + if ($(isNullOrEmpty "$1")) ; then echo "false" ; else [[ "$1" =~ $REGEX_CID ]] && echo "true" || echo "false" ; fi +} + +function isURL() { + if ($(isNullOrEmpty "$1")) ; then echo "false" ; else [[ "$1" =~ $REGEX_URL ]] && echo "true" || echo "false" ; fi +} + function date2unix() { local DATE_TMP="" [ -z "$*" ] && DATE_TMP="$(timeout 1 cat 2> /dev/null || echo "")" || DATE_TMP="$*" @@ -229,6 +239,16 @@ function isFileEmpty() { fi } +function isSameFile() { + local FILE1="$1" + local FILE2="$2" + if [ ! -z $FILE1 ] && [ -f $FILE1 ] && [ ! -z $FILE2 ] && [ -f $FILE2 ] ; then + echo $(cmp --silent $FILE1 $FILE2 && echo "true" || echo "false") + else + echo "false" + fi +} + # Example use case: [[ $(versionToNumber "v0.0.0.3") -lt $(versionToNumber "v1.0.0.2") ]] && echo true || echo false function versionToNumber() { local version="" @@ -308,7 +328,7 @@ function getArgs() { local prefix_len=$(strLength "$prefix") local n="-$((arg_len - prefix_len - 1))" local val="${arg:$n}" - local key=$(echo "$prefix" | tr -d '-') + local key=$(echo "$prefix" | tr '-' '_') eval $key="'$val'" else echoErr "ERROR: Invalid argument '$arg', missing '--' and/or '=' operators" diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index ef9d04a4..b7823ec2 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -326,14 +326,28 @@ EOL ################################################################# echoWarn "TEST: getArgs" -getArgs -test1="test 1" --test_2="te\st 2" -t3='t3' -e="t 4" --p="test5" -z=" \" :)" +getArgs -test1="test 1" --test_2="te\st 2" -t3='t3' -e="t 4" --p="test5" -z=" \" :)" --l-ol=lol -RES="${test1}${test_2}${t3}${e}${p}${z}" -RES_EXP="test 1te\st 2t3t 4test5 \" :)" +RES="${test1}${test_2}${t3}${e}${p}${z}${l_ol}" +RES_EXP="test 1te\st 2t3t 4test5 \" :)lol" [ "$RES" != "$RES_EXP" ] && \ echoErr "ERROR: Expected args parsing result to be '$RES_EXP', but got '$RES'" && exit 1 || echoInfo "INFO: Test 1 passed" +################################################################# +echoWarn "TEST: isCID" + +CID_0="QmcRD4wkPPi6dig81r5sLj9Zm1gDCL4zgpEj9CfuRrGbzF" +CID_1="bafybeigrf2dwtpjkiovnigysyto3d55opf6qkdikx6d65onrqnfzwgdkfa" +CID_e0="pmcRD4wkPPi6dig81r5sLj9Zm1gDCL4zgpEj9CfuRrGbzF" +CID_e1="bafybeigrf2dwtpjkiovnigysyto3d55of6qkdikx6d65onrqnfzwgdkfa" + +(! $(isCID $CID_0)) && echoErr "ERROR: Expected '$CID_0' to be a valid CID, but got false response" && exit 1 || echoInfo "INFO: Test 1 passed" +(! $(isCID $CID_1)) && echoErr "ERROR: Expected '$CID_1' to be a valid CID, but got false response" && exit 1 || echoInfo "INFO: Test 2 passed" +(! $(isCID $CID_e0)) && echoErr "ERROR: Expected '$CID_e0' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 3 passed" +(! $(isCID $CID_e1)) && echoErr "ERROR: Expected '$CID_e1' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 4 passed" +(! $(isCID "")) && echoErr "ERROR: Expected '' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 5 passed" + ################################################################# echoInfo "INFO: Successsfully executed all bash-utils test cases, elapsed $(prettyTime $(timerSpan))" diff --git a/scripts/version.sh b/scripts/version.sh index f546b5ad..957db479 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "v0.2.17" +echo "v0.2.18" From 805716706740a296baeb7cad731a53f6947628f3 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 10 Aug 2022 09:46:32 +0000 Subject: [PATCH 138/140] syntax & new brancher --- .github/workflows/branch.yml | 24 ++++++++++++++++++++---- .github/workflows/main.yml | 4 ++-- .github/workflows/master.yml | 2 +- .github/workflows/spam.yml | 2 +- bash-utils/bash-utils.sh | 6 ++++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index dc9b2b74..4f8cd819 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -17,11 +17,15 @@ jobs: # Work around https://github.com/actions/checkout/issues/760 - name: Add safe.directory run: | + git config --global --add safe.directory /usr/lib/flutter git config --global --add safe.directory /github/workspace git config --global --add safe.directory $PWD # ref.: https://github.com/actions/checkout, v3.0.0 + # NOTE: Fetch length must be 0 to recover all history for all branches and tags. - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b + with: + fetch-depth: 0 - name: Extract branch name on pull request shell: bash run: | @@ -32,9 +36,17 @@ jobs: RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + SOURCE_BRANCH="$(echo ${GITHUB_REF#refs/heads/})" + echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV + echo "LATEST_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME latest | awk '{ print $1}')" >> $GITHUB_ENV + echo "SOURCE_REF=$(echo $GITHUB_SHA)" >> $GITHUB_ENV + PARENT_BRANCH=$(git --no-pager log --decorate --simplify-by-decoration --oneline | grep -v "(HEAD" | head -n1 | sed 's/.* (\(.*\)) .*/\1/' | sed 's/\(.*\), .*/\1/' | sed 's/origin\///' | cut -d ',' -f 1 || echo "") + [ -z "$PARENT_BRANCH" ] && PARENT_BRANCH="master" + echo "PARENT_BRANCH=$PARENT_BRANCH" >> "$GITHUB_ENV" + echo "PARENT_BRANCH_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME $PARENT_BRANCH | awk '{ print $1}' | head -n1)" >> $GITHUB_ENV + [ -z "$PARENT_BRANCH_REF" ] && PARENT_BRANCH_REF="$MASTER_REF" && PARENT_BRANCH="master" git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV ( git show-branch "origin/$RELEASE_BRANCH" || git show-branch "remotes/origin/$RELEASE_BRANCH" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV - name: Print debug data before publishing @@ -42,14 +54,18 @@ jobs: echo "Repository name: ${{ env.REPOSITORY_NAME }}" echo " Source branch: ${{ env.SOURCE_BRANCH }}" echo " Default branch: ${{ env.DEFAULT_BRANCH }}" + echo " Parent branch: ${{ env.PARENT_BRANCH }}" echo " Master refer.: ${{ env.MASTER_REF }}" + echo " Latest refer.: ${{ env.LATEST_REF }}" + echo " Source refer.: $GITHUB_SHA" + echo " Parent refer.: ${{ env.PARENT_BRANCH_REF }}" echo "Release version: ${{ env.RELEASE_VER }}" echo " Release branch: ${{ env.RELEASE_BRANCH }}" echo " Release exists: ${{ env.RELEASE_EXISTS }}" echo " Event name: ${{ github.event_name }}" echo " Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" # ref.: https://github.com/peterjgrainger/action-create-branch, v2.2.0 - - name: Create version branch from master + - name: Create version branch from source uses: peterjgrainger/action-create-branch@c2800a3a9edbba2218da6861fa46496cf8f3195a if: | ( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && @@ -59,7 +75,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: ${{ env.RELEASE_BRANCH }} - sha: ${{ env.MASTER_REF }} + sha: ${{ env.PARENT_BRANCH_REF }} - name: Create PR from feature to version branch # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8a32812..000e005d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,9 @@ name: Build, Test & Publish on: push: - branches: [ v*.*.*, release/v*.*.*, feature/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] + branches: [ release/v*.*.*, feature/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] pull_request: - branches: [ v*.*.*, release/v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] + branches: [ release/v*.*.*, bugfix/*, master, dev, latest, testnet-*, mainnet-*, kira-* ] jobs: build-amd64: name: AMD64 - Repo Test & Build diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 0794d485..fc451ae7 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -2,7 +2,7 @@ name: release/v*.*.* -PR-> master on: push: - branches: [ v*.*.*, release/v*.*.* ] + branches: [ release/v*.*.* ] # git ls-remote | head -1 | sed "s/HEAD//" jobs: diff --git a/.github/workflows/spam.yml b/.github/workflows/spam.yml index 8d2add8f..008d38e9 100644 --- a/.github/workflows/spam.yml +++ b/.github/workflows/spam.yml @@ -2,7 +2,7 @@ name: Clean spam PRs on: pull_request: - branches: [ master, dev, latest, v*.*.*, release/v*.*.*, feature/*, bugfix/* ] + branches: [ master, dev, latest, release/v*.*.*, feature/*, bugfix/* ] jobs: # isolate signing & repo cloning from docker image diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index cf67d37b..57cee2ac 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -322,16 +322,18 @@ function strEndsWith() { function getArgs() { for arg in "$@" ; do ($(strStartsWith "$arg" "-")) && (! $(strStartsWith "$arg" "--")) && arg="-${arg}" - if ($(strStartsWith "$arg" "--")) && [[ "$arg" == *"="* ]] ; then + if ($(strStartsWith "$arg" "--")) && [[ "$arg" == *"="* ]] && [[ "$arg" != "--="* ]] && [[ "$arg" != "-="* ]] ; then local arg_len=$(strLength "$arg") local prefix=$(echo $arg | cut -d'=' -f1) local prefix_len=$(strLength "$prefix") local n="-$((arg_len - prefix_len - 1))" local val="${arg:$n}" + prefix="$(echo $prefix | sed -z 's/^-*//')" local key=$(echo "$prefix" | tr '-' '_') + echoInfo "$key='$val'" eval $key="'$val'" else - echoErr "ERROR: Invalid argument '$arg', missing '--' and/or '=' operators" + echoErr "ERROR: Invalid argument '$arg', missing name, '--' and/or '=' operators" return 1 fi done From d2a7641dbf6d415f0bb73a2005bb60942d5100bc Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 10 Aug 2022 10:36:47 +0000 Subject: [PATCH 139/140] syntax & extra tests --- bash-utils/bash-utils.sh | 21 ++++++++++++--------- bash-utils/scripts/test.sh | 20 +++++++++++++++++--- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 57cee2ac..5438839a 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -14,7 +14,8 @@ REGEX_KIRA="^(kira)[a-zA-Z0-9]{39}$" REGEX_VERSION="^(v?)([0-9]+)\.([0-9]+)\.([0-9]+)(-?)([a-zA-Z]+)?(\.?([0-9]+)?)$" REGEX_CID="^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})$" # NOTE: Important! in the REGEX_URL the ' quote character must be used instead of ", do NOT modify this string -REGEX_URL='^(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]\.[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]$' +REGEX_URL1='[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]\.[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]$' +REGEX_URL2="^(https?|ftp|file)://$REGEX_URL1" function bashUtilsVersion() { bashUtilsSetup "version" 2> /dev/null || bash-utils bashUtilsSetup "version" @@ -199,10 +200,6 @@ function isCID() { if ($(isNullOrEmpty "$1")) ; then echo "false" ; else [[ "$1" =~ $REGEX_CID ]] && echo "true" || echo "false" ; fi } -function isURL() { - if ($(isNullOrEmpty "$1")) ; then echo "false" ; else [[ "$1" =~ $REGEX_URL ]] && echo "true" || echo "false" ; fi -} - function date2unix() { local DATE_TMP="" [ -z "$*" ] && DATE_TMP="$(timeout 1 cat 2> /dev/null || echo "")" || DATE_TMP="$*" @@ -681,17 +678,23 @@ function jsonObjEdit() { fi } -# e.g. urlExists "18.168.78.192:11000/download/peers.txt" +function isURL() { + if ($(isNullOrEmpty "$1")) ; then echo "false" ; else ( [[ "$1" =~ $REGEX_URL1 ]] || [[ "$1" =~ $REGEX_URL2 ]] ) && echo "true" || echo "false" ; fi +} + +# e.g. urlExists "18.168.78.192:11000/download/peers.txt" 10 function urlExists() { + local timeout="$2" && (! $(isNaturalNumber $timeout)) && timeout=10 if ($(isNullOrEmpty "$1")) ; then echo "false" - elif curl -r0-0 --fail --silent "$1" >/dev/null; then echo "true" + elif curl -r0-0 --fail --silent -m $timeout "$1" >/dev/null; then echo "true" else echo "false" ; fi } # TODO: Investigate 0 output -# urlContentLength 18.168.78.192:11000/api/snapshot +# urlContentLength 18.168.78.192:11000/api/snapshot 10 function urlContentLength() { - local VAL=$(curl --fail $1 --dump-header /dev/fd/1 --silent 2> /dev/null | grep -i Content-Length -m 1 2> /dev/null | awk '{print $2}' 2> /dev/null || echo -n "") + local timeout="$2" && (! $(isNaturalNumber $timeout)) && timeout=10 + local VAL=$(curl --fail $1 --dump-header /dev/fd/1 --silent -m $timeout 2> /dev/null | grep -i Content-Length -m 1 2> /dev/null | awk '{print $2}' 2> /dev/null || echo -n "") # remove invisible whitespace characters VAL=$(echo ${VAL%$'\r'}) (! $(isNaturalNumber $VAL)) && VAL=0 diff --git a/bash-utils/scripts/test.sh b/bash-utils/scripts/test.sh index b7823ec2..a5824d08 100644 --- a/bash-utils/scripts/test.sh +++ b/bash-utils/scripts/test.sh @@ -344,9 +344,23 @@ CID_e1="bafybeigrf2dwtpjkiovnigysyto3d55of6qkdikx6d65onrqnfzwgdkfa" (! $(isCID $CID_0)) && echoErr "ERROR: Expected '$CID_0' to be a valid CID, but got false response" && exit 1 || echoInfo "INFO: Test 1 passed" (! $(isCID $CID_1)) && echoErr "ERROR: Expected '$CID_1' to be a valid CID, but got false response" && exit 1 || echoInfo "INFO: Test 2 passed" -(! $(isCID $CID_e0)) && echoErr "ERROR: Expected '$CID_e0' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 3 passed" -(! $(isCID $CID_e1)) && echoErr "ERROR: Expected '$CID_e1' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 4 passed" -(! $(isCID "")) && echoErr "ERROR: Expected '' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 5 passed" +($(isCID $CID_e0)) && echoErr "ERROR: Expected '$CID_e0' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 3 passed" +($(isCID $CID_e1)) && echoErr "ERROR: Expected '$CID_e1' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 4 passed" +($(isCID "")) && echoErr "ERROR: Expected '' to be an invalid CID, but got true response" && exit 1 || echoInfo "INFO: Test 5 passed" + +################################################################# +echoWarn "TEST: isURL" + +URL_0="https://github.com/KiraCore/tools/runs/7763984248?check_suite_focus=true" +URL_1="ghcr.io/kiracore/docker/base-image:v0.11.4" +URL_e0="v0.11.4" +URL_e1="http://ghcrio" + +(! $(isURL $URL_0)) && echoErr "ERROR: Expected '$URL_0' to be a valid URL, but got false response" && exit 1 || echoInfo "INFO: Test 1 passed" +(! $(isURL $URL_1)) && echoErr "ERROR: Expected '$URL_1' to be a valid URL, but got false response" && exit 1 || echoInfo "INFO: Test 2 passed" +($(isURL $URL_e0)) && echoErr "ERROR: Expected '$URL_e0' to be an invalid URL, but got true response" && exit 1 || echoInfo "INFO: Test 3 passed" +($(isURL $URL_e1)) && echoErr "ERROR: Expected '$URL_e1' to be an invalid URL, but got true response" && exit 1 || echoInfo "INFO: Test 4 passed" +($(isURL "")) && echoErr "ERROR: Expected '' to be an invalid URL, but got true response" && exit 1 || echoInfo "INFO: Test 5 passed" ################################################################# From 04e7eb4b82072cfc2de68d833395f8d7ce86ec38 Mon Sep 17 00:00:00 2001 From: Asmodat Date: Wed, 10 Aug 2022 10:41:40 +0000 Subject: [PATCH 140/140] version can't be URL --- bash-utils/bash-utils.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash-utils/bash-utils.sh b/bash-utils/bash-utils.sh index 5438839a..35edb438 100644 --- a/bash-utils/bash-utils.sh +++ b/bash-utils/bash-utils.sh @@ -679,7 +679,8 @@ function jsonObjEdit() { } function isURL() { - if ($(isNullOrEmpty "$1")) ; then echo "false" ; else ( [[ "$1" =~ $REGEX_URL1 ]] || [[ "$1" =~ $REGEX_URL2 ]] ) && echo "true" || echo "false" ; fi + if ($(isNullOrEmpty "$1")) || ($(isVersion "$1")) ; then echo "false" ; + else ( [[ "$1" =~ $REGEX_URL1 ]] || [[ "$1" =~ $REGEX_URL2 ]] ) && echo "true" || echo "false" ; fi } # e.g. urlExists "18.168.78.192:11000/download/peers.txt" 10