pax_global_header00006660000000000000000000000064146725610160014522gustar00rootroot0000000000000052 comment=fbec7bce6000a1d5300e73bee5d0b8a7e0bd8814 pluggable-discovery-protocol-handler-2.2.1/000077500000000000000000000000001467256101600207455ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.codespellrc000066400000000000000000000007701467256101600232510ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc # See: https://github.com/codespell-project/codespell#using-a-config-file [codespell] # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: ignore-words-list = , builtin = clear,informal,en-GB_to_en-US check-filenames = check-hidden = skip = ./.git,./.licenses,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock pluggable-discovery-protocol-handler-2.2.1/.ecrc000066400000000000000000000001211467256101600216540ustar00rootroot00000000000000{ "Exclude": [ "LICENSE.txt", "poetry.lock", "^\\.licenses/" ] } pluggable-discovery-protocol-handler-2.2.1/.editorconfig000066400000000000000000000023251467256101600234240ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/.editorconfig # See: https://editorconfig.org/ # The formatting style defined in this file is the official standardized style to be used in all Arduino Tooling # projects and should not be modified. # Note: indent style for each file type is defined even when it matches the universal config in order to make it clear # that this type has an official style. [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true [*.{adoc,asc,asciidoc}] indent_size = 2 indent_style = space [*.{bash,sh}] indent_size = 2 indent_style = space [*.{c,cc,cp,cpp,cxx,h,hh,hpp,hxx,ii,inl,ino,ixx,pde,tpl,tpp,txx}] indent_size = 2 indent_style = space [*.{go,mod}] indent_style = tab [*.java] indent_size = 2 indent_style = space [*.{js,jsx,json,jsonc,json5,ts,tsx}] indent_size = 2 indent_style = space [*.{md,mdx,mkdn,mdown,markdown}] indent_size = unset indent_style = space [*.proto] indent_size = 2 indent_style = space [*.py] indent_size = 4 indent_style = space [*.svg] indent_size = 2 indent_style = space [*.{yaml,yml}] indent_size = 2 indent_style = space pluggable-discovery-protocol-handler-2.2.1/.github/000077500000000000000000000000001467256101600223055ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.github/ISSUE_TEMPLATE/000077500000000000000000000000001467256101600244705ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.github/ISSUE_TEMPLATE/bug-report.yml000066400000000000000000000037661467256101600273150ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/forms/general/bug-report.yml # See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms name: Bug report description: Report a problem with the code or documentation in this repository. labels: - "type: imperfection" body: - type: textarea id: description attributes: label: Describe the problem validations: required: true - type: textarea id: reproduce attributes: label: To reproduce description: Provide the specific set of steps we can follow to reproduce the problem. validations: required: true - type: textarea id: expected attributes: label: Expected behavior description: What would you expect to happen after following those instructions? validations: required: true - type: input id: project-version attributes: label: "'github.com/arduino/pluggable-discovery-protocol-handler' version" description: | Which version of `github.com/arduino/pluggable-discovery-protocol-handler` are you using? _This should be the most recent version available._ validations: required: true - type: textarea id: additional attributes: label: Additional context description: Add any additional information here. validations: required: false - type: checkboxes id: checklist attributes: label: Issue checklist description: Please double-check that you have done each of the following things before submitting the issue. options: - label: I searched for previous reports in [the issue tracker](https://github.com/arduino/pluggable-discovery-protocol-handler/issues?q=) required: true - label: I verified the problem still occurs when using the latest version required: true - label: My report contains all necessary details required: true pluggable-discovery-protocol-handler-2.2.1/.github/ISSUE_TEMPLATE/config.yml000066400000000000000000000014371467256101600264650ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/template-choosers/general/config.yml # See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser blank_issues_enabled: true contact_links: - name: Learn about using this project url: https://github.com/arduino/pluggable-discovery-protocol-handler#readme about: Detailed usage documentation is available here. - name: Support request url: https://forum.arduino.cc/ about: We can help you out on the Arduino Forum! - name: Discuss development work on the project url: https://groups.google.com/a/arduino.cc/g/developers about: Arduino Developers Mailing List pluggable-discovery-protocol-handler-2.2.1/.github/ISSUE_TEMPLATE/feature-request.yml000066400000000000000000000036071467256101600303420ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/forms/general/bug-report.yml # See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms name: Feature request description: Suggest an enhancement to this project. labels: - "type: enhancement" body: - type: textarea id: description attributes: label: Describe the request validations: required: true - type: textarea id: current attributes: label: Describe the current behavior description: | What is the current behavior of `github.com/arduino/pluggable-discovery-protocol-handler` in relation to your request? How can we reproduce that behavior? validations: required: true - type: input id: project-version attributes: label: "'github.com/arduino/pluggable-discovery-protocol-handler' version" description: | Which version of `github.com/arduino/pluggable-discovery-protocol-handler` are you using? _This should be the most recent version available._ validations: required: true - type: textarea id: additional attributes: label: Additional context description: Add any additional information here. validations: required: false - type: checkboxes id: checklist attributes: label: Issue checklist description: Please double-check that you have done each of the following things before submitting the issue. options: - label: I searched for previous requests in [the issue tracker](https://github.com/arduino/pluggable-discovery-protocol-handler/issues?q=) required: true - label: I verified the feature was still missing when using the latest version required: true - label: My request contains all necessary details required: true pluggable-discovery-protocol-handler-2.2.1/.github/dependabot.yml000066400000000000000000000012721467256101600251370ustar00rootroot00000000000000# See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file version: 2 updates: # Configure check for outdated GitHub Actions actions in workflows. # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md # See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot - package-ecosystem: github-actions directory: / # Check the repository's workflows under /.github/workflows/ schedule: interval: daily labels: - "topic: infrastructure" pluggable-discovery-protocol-handler-2.2.1/.github/workflows/000077500000000000000000000000001467256101600243425ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.github/workflows/build-dummy-discovery.yaml000066400000000000000000000010151467256101600314600ustar00rootroot00000000000000name: Build dummy discovery on: push: pull_request: jobs: test: runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Taskfile uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Install Go uses: actions/setup-go@v5 with: go-version: "1.21" - name: Build run: task build-dummy-discovery pluggable-discovery-protocol-handler-2.2.1/.github/workflows/check-general-formatting-task.yml000066400000000000000000000036241467256101600326720ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-general-formatting-task.md name: Check General Formatting # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: push: pull_request: schedule: # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to tools. - cron: "0 8 * * TUE" workflow_dispatch: repository_dispatch: jobs: check: runs-on: ubuntu-latest steps: - name: Set environment variables run: | # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >> "$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v4 - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Download latest editorconfig-checker release binary package id: download uses: MrOctopus/download-asset-action@1.0 with: repository: editorconfig-checker/editorconfig-checker excludes: prerelease, draft asset: linux-amd64.tar.gz target: ${{ env.EC_INSTALL_PATH }} - name: Install editorconfig-checker run: | cd "${{ env.EC_INSTALL_PATH }}" tar --extract --file="${{ steps.download.outputs.name }}" # Give the binary a standard name mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec" # Add installation to PATH: # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH" - name: Check formatting run: task --silent general:check-formatting pluggable-discovery-protocol-handler-2.2.1/.github/workflows/check-go-dependencies-task.yml000066400000000000000000000101201467256101600321230ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md name: Check Go Dependencies env: # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax GO_VERSION: "1.21" # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows on: create: push: paths: - ".github/workflows/check-go-dependencies-task.ya?ml" - ".licenses/**" - ".licensed.json" - ".licensed.ya?ml" - "Taskfile.ya?ml" - "**/.gitmodules" - "**/go.mod" - "**/go.sum" pull_request: paths: - ".github/workflows/check-go-dependencies-task.ya?ml" - ".licenses/**" - ".licensed.json" - ".licensed.ya?ml" - "Taskfile.ya?ml" - "**/.gitmodules" - "**/go.mod" - "**/go.sum" schedule: # Run periodically to catch breakage caused by external changes. - cron: "0 8 * * WED" workflow_dispatch: repository_dispatch: jobs: run-determination: runs-on: ubuntu-latest outputs: result: ${{ steps.determination.outputs.result }} steps: - name: Determine if the rest of the workflow should run id: determination run: | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. if [[ "${{ github.event_name }}" != "create" || "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX ]]; then # Run the other jobs. RESULT="true" else # There is no need to run the other jobs. RESULT="false" fi echo "::set-output name=result::$RESULT" check-cache: needs: run-determination if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - name: Install licensed uses: jonabc/setup-licensed@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Update dependencies license metadata cache run: task --silent general:cache-dep-licenses - name: Check for outdated cache id: diff run: | git add . if ! git diff --cached --color --exit-code; then echo echo "::error::Dependency license metadata out of sync. See: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md#metadata-cache" exit 1 fi # Some might find it convenient to have CI generate the cache rather than setting up for it locally - name: Upload cache to workflow artifact if: failure() && steps.diff.outcome == 'failure' uses: actions/upload-artifact@v3 with: if-no-files-found: error include-hidden-files: true name: dep-licenses-cache path: .licenses/ check-deps: needs: run-determination if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - name: Install licensed uses: jonabc/setup-licensed@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Check for dependencies with unapproved licenses run: task --silent general:check-dep-licenses pluggable-discovery-protocol-handler-2.2.1/.github/workflows/check-go-task.yml000066400000000000000000000063641467256101600275160ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md name: Check Go env: # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax GO_VERSION: "1.21" # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: push: paths: - ".github/workflows/check-go-task.ya?ml" - "Taskfile.ya?ml" - "go.mod" - "go.sum" - "**.go" pull_request: paths: - ".github/workflows/check-go-task.ya?ml" - "Taskfile.ya?ml" - "go.mod" - "go.sum" - "**.go" workflow_dispatch: repository_dispatch: jobs: check-errors: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Check for errors run: task go:vet check-outdated: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Modernize usages of outdated APIs run: task go:fix - name: Check if any fixes were needed run: git diff --color --exit-code check-style: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Install golint run: go install golang.org/x/lint/golint@latest - name: Check style run: task --silent go:lint check-formatting: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Format code run: task go:format - name: Check formatting run: git diff --color --exit-code check-config: name: check-config (${{ matrix.module.path }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: module: - path: ./ steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Run go mod tidy working-directory: ${{ matrix.module.path }} run: go mod tidy - name: Check whether any tidying was needed run: git diff --color --exit-code pluggable-discovery-protocol-handler-2.2.1/.github/workflows/check-taskfiles.yml000066400000000000000000000056211467256101600301310ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md name: Check Taskfiles env: # See: https://github.com/actions/setup-node/#readme NODE_VERSION: 16.x # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows on: create: push: paths: - ".github/workflows/check-taskfiles.ya?ml" - "package.json" - "package-lock.json" - "**/Taskfile.ya?ml" pull_request: paths: - ".github/workflows/check-taskfiles.ya?ml" - "package.json" - "package-lock.json" - "**/Taskfile.ya?ml" schedule: # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. - cron: "0 8 * * TUE" workflow_dispatch: repository_dispatch: jobs: run-determination: runs-on: ubuntu-latest outputs: result: ${{ steps.determination.outputs.result }} steps: - name: Determine if the rest of the workflow should run id: determination run: | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. if [[ "${{ github.event_name }}" != "create" || "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX ]]; then # Run the other jobs. RESULT="true" else # There is no need to run the other jobs. RESULT="false" fi echo "result=$RESULT" >> $GITHUB_OUTPUT validate: name: Validate ${{ matrix.file }} needs: run-determination if: needs.run-determination.outputs.result == 'true' runs-on: ubuntu-latest strategy: fail-fast: false matrix: file: # TODO: add paths to any additional Taskfiles here - ./**/Taskfile.yml steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Download JSON schema for Taskfiles id: download-schema uses: carlosperate/download-file-action@v2 with: # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json file-url: https://taskfile.dev/schema.json location: ${{ runner.temp }}/taskfile-schema - name: Install JSON schema validator run: npm install - name: Validate ${{ matrix.file }} run: | # See: https://github.com/ajv-validator/ajv-cli#readme npx \ --package=ajv-cli \ --package=ajv-formats \ ajv validate \ --all-errors \ --strict=false \ -c ajv-formats \ -s "${{ steps.download-schema.outputs.file-path }}" \ -d "${{ matrix.file }}" pluggable-discovery-protocol-handler-2.2.1/.github/workflows/check-workflows-task.yml000066400000000000000000000016311467256101600311360ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/master/workflow-templates/check-workflows-task.md name: Check Workflows # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: push: paths: - ".github/workflows/*.ya?ml" - "Taskfile.ya?ml" pull_request: paths: - ".github/workflows/*.ya?ml" - "Taskfile.ya?ml" schedule: # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. - cron: "0 8 * * TUE" workflow_dispatch: repository_dispatch: jobs: validate: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Validate workflows run: task --silent ci:validate pluggable-discovery-protocol-handler-2.2.1/.github/workflows/release-tag.yml000066400000000000000000000042171467256101600272620ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/release-tag.md name: Release on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+*" jobs: release: runs-on: ubuntu-latest env: # See: https://github.com/fsaintjacques/semver-tool/releases SEMVER_TOOL_VERSION: 3.2.0 steps: - name: Set environment variables run: | # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable echo "CHANGELOG_PATH=${{ runner.temp }}/CHANGELOG.md" >> "$GITHUB_ENV" echo "SEMVER_TOOL_PATH=${{ runner.temp }}/semver" >> "$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Create changelog uses: arduino/create-changelog@v1 with: tag-regex: '^v[0-9]+\.[0-9]+\.[0-9]+.*$' filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*' case-insensitive-regex: true changelog-file-path: ${{ env.CHANGELOG_PATH }} - name: Download semver tool id: download-semver-tool uses: carlosperate/download-file-action@v2 with: file-url: https://github.com/fsaintjacques/semver-tool/archive/${{ env.SEMVER_TOOL_VERSION }}.zip location: ${{ runner.temp }}/semver-tool - name: Install semver tool run: | unzip \ -p \ "${{ steps.download-semver-tool.outputs.file-path }}" \ semver-tool-${{ env.SEMVER_TOOL_VERSION }}/src/semver > \ "${{ env.SEMVER_TOOL_PATH }}" chmod +x "${{ env.SEMVER_TOOL_PATH }}" - name: Identify Prerelease id: prerelease run: | if [[ "$("${{ env.SEMVER_TOOL_PATH }}" get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "::set-output name=IS_PRE::true"; fi - name: Create Github release uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} bodyFile: ${{ env.CHANGELOG_PATH }} draft: false prerelease: ${{ steps.prerelease.outputs.IS_PRE }} pluggable-discovery-protocol-handler-2.2.1/.github/workflows/spell-check-task.yml000066400000000000000000000017131467256101600302210ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md name: Spell Check # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: push: pull_request: schedule: # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. - cron: "0 8 * * TUE" workflow_dispatch: repository_dispatch: jobs: spellcheck: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Python uses: actions/setup-python@v5 with: python-version: "3.9" - name: Install Poetry run: pip install poetry - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Spell check run: task general:check-spelling pluggable-discovery-protocol-handler-2.2.1/.github/workflows/sync-labels.yml000066400000000000000000000111341467256101600273010ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md name: Sync Labels # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: push: paths: - ".github/workflows/sync-labels.ya?ml" - ".github/label-configuration-files/*.ya?ml" pull_request: paths: - ".github/workflows/sync-labels.ya?ml" - ".github/label-configuration-files/*.ya?ml" schedule: # Run daily at 8 AM UTC to sync with changes to shared label configurations. - cron: "0 8 * * *" workflow_dispatch: repository_dispatch: env: CONFIGURATIONS_FOLDER: .github/label-configuration-files CONFIGURATIONS_ARTIFACT: label-configuration-files jobs: check: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Download JSON schema for labels configuration file id: download-schema uses: carlosperate/download-file-action@v2 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json location: ${{ runner.temp }}/label-configuration-schema - name: Install JSON schema validator run: | sudo npm install \ --global \ ajv-cli \ ajv-formats - name: Validate local labels configuration run: | # See: https://github.com/ajv-validator/ajv-cli#readme ajv validate \ --all-errors \ -c ajv-formats \ -s "${{ steps.download-schema.outputs.file-path }}" \ -d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}" download: needs: check runs-on: ubuntu-latest strategy: matrix: filename: # Filenames of the shared configurations to apply to the repository in addition to the local configuration. # https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels - universal.yml - tooling.yml steps: - name: Download uses: carlosperate/download-file-action@v2 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} - name: Pass configuration files to next job via workflow artifact uses: actions/upload-artifact@v3 with: path: | *.yaml *.yml if-no-files-found: error name: ${{ env.CONFIGURATIONS_ARTIFACT }} sync: needs: download runs-on: ubuntu-latest steps: - name: Set environment variables run: | # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV" - name: Determine whether to dry run id: dry-run if: > github.event_name == 'pull_request' || ( ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) ) run: | # Use of this flag in the github-label-sync command will cause it to only check the validity of the # configuration. echo "::set-output name=flag::--dry-run" - name: Checkout repository uses: actions/checkout@v4 - name: Download configuration files artifact uses: actions/download-artifact@v3 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} path: ${{ env.CONFIGURATIONS_FOLDER }} - name: Remove unneeded artifact uses: geekyeggo/delete-artifact@v2 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} - name: Merge label configuration files run: | # Merge all configuration files shopt -s extglob cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}" - name: Install github-label-sync run: sudo npm install --global github-label-sync - name: Sync labels env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # See: https://github.com/Financial-Times/github-label-sync github-label-sync \ --labels "${{ env.MERGED_CONFIGURATION_PATH }}" \ ${{ steps.dry-run.outputs.flag }} \ ${{ github.repository }} pluggable-discovery-protocol-handler-2.2.1/.github/workflows/test-go-task.yml000066400000000000000000000070021467256101600274060ustar00rootroot00000000000000# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/test-go-task.md name: Test Go env: # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax GO_VERSION: "1.21" # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: create: push: paths: - ".github/workflows/test-go-task.ya?ml" - "codecov.ya?ml" - "**/go.mod" - "**/go.sum" - "Taskfile.ya?ml" - "**.go" - "**/testdata/**" pull_request: paths: - ".github/workflows/test-go-task.ya?ml" - "codecov.ya?ml" - "**/go.mod" - "**/go.sum" - "Taskfile.ya?ml" - "**.go" - "**/testdata/**" workflow_dispatch: repository_dispatch: jobs: run-determination: runs-on: ubuntu-latest outputs: result: ${{ steps.determination.outputs.result }} steps: - name: Determine if the rest of the workflow should run id: determination run: | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. if [[ \ "${{ github.event_name }}" != "create" || \ "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ ]]; then # Run the other jobs. RESULT="true" else # There is no need to run the other jobs. RESULT="false" fi echo "::set-output name=result::$RESULT" test: name: test (${{ matrix.module.path }} - ${{ matrix.operating-system }}) needs: run-determination if: needs.run-determination.outputs.result == 'true' strategy: fail-fast: false matrix: operating-system: - ubuntu-latest - windows-latest - macos-latest module: - path: ./ codecov-flags: unit runs-on: ${{ matrix.operating-system }} steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Install Task uses: arduino/setup-task@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - name: Run tests env: GO_MODULE_PATH: ${{ matrix.module.path }} run: task go:test - name: Send unit tests coverage to Codecov if: runner.os == 'Linux' && github.repository == 'arduino/pluggable-discovery-protocol-handler' uses: codecov/codecov-action@v4 with: # A token is used to avoid intermittent spurious job failures caused by rate limiting. token: d2497f03-291d-4e0c-9d31-d94614ed7c16 file: ${{ matrix.module.path }}coverage_unit.txt flags: ${{ matrix.module.codecov-flags }} fail_ci_if_error: true - name: Send unit tests coverage to Codecov (run from a fork) if: runner.os == 'Linux' && github.repository != 'arduino/pluggable-discovery-protocol-handler' uses: codecov/codecov-action@v4 with: # use repository variable CODECOV_TOKEN if running from a fork. # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input. token: ${{ vars.CODECOV_TOKEN }} file: ${{ matrix.module.path }}coverage_unit.txt flags: ${{ matrix.module.codecov-flags }} fail_ci_if_error: false pluggable-discovery-protocol-handler-2.2.1/.gitignore000066400000000000000000000000261467256101600227330ustar00rootroot00000000000000dist/ coverage_*.txt pluggable-discovery-protocol-handler-2.2.1/.licensed.yml000066400000000000000000000044701467256101600233410ustar00rootroot00000000000000# See: https://github.com/github/licensed/blob/master/docs/configuration.md sources: go: true apps: - source_path: ./ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies/GPL-3.0/.licensed.yml allowed: # The following are based on: https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses - gpl-1.0-or-later - gpl-1.0+ # Deprecated ID for `gpl-1.0-or-later` - gpl-2.0-or-later - gpl-2.0+ # Deprecated ID for `gpl-2.0-or-later` - gpl-3.0-only - gpl-3.0 # Deprecated ID for `gpl-3.0-only` - gpl-3.0-or-later - gpl-3.0+ # Deprecated ID for `gpl-3.0-or-later` - lgpl-2.0-or-later - lgpl-2.0+ # Deprecated ID for `lgpl-2.0-or-later` - lgpl-2.1-only - lgpl-2.1 # Deprecated ID for `lgpl-2.1-only` - lgpl-2.1-or-later - lgpl-2.1+ # Deprecated ID for `lgpl-2.1-or-later` - lgpl-3.0-only - lgpl-3.0 # Deprecated ID for `lgpl-3.0-only` - lgpl-3.0-or-later - lgpl-3.0+ # Deprecated ID for `lgpl-3.0-or-later` - fsfap - apache-2.0 - artistic-2.0 - clartistic - sleepycat - bsl-1.0 - bsd-3-clause - cecill-2.0 - bsd-3-clause-clear # "Cryptix General License" - no SPDX ID (https://github.com/spdx/license-list-XML/issues/456) - ecos-2.0 - ecl-2.0 - efl-2.0 - eudatagrid - mit - bsd-2-clause # Subsumed by `bsd-2-clause-views` - bsd-2-clause-netbsd # Deprecated ID for `bsd-2-clause` - bsd-2-clause-views # This is the version linked from https://www.gnu.org/licenses/license-list.html#FreeBSD - bsd-2-clause-freebsd # Deprecated ID for `bsd-2-clause-views` - ftl - hpnd - imatix - imlib2 - ijg # "Informal license" - this is a general class of license - intel - isc - mpl-2.0 - ncsa # "License of Netscape JavaScript" - no SPDX ID - oldap-2.7 # "License of Perl 5 and below" - possibly `Artistic-1.0-Perl` ? - cc0-1.0 - cc-pddc - psf-2.0 - ruby - sgi-b-2.0 - smlnj - standardml-nj # Deprecated ID for `smlnj` - unicode-dfs-2015 - upl-1.0 - unlicense - vim - w3c - wtfpl - lgpl-2.0-or-later with wxwindows-exception-3.1 - wxwindows # Deprecated ID for `lgpl-2.0-or-later with wxwindows-exception-3.1` - x11 - xfree86-1.1 - zlib - zpl-2.0 - zpl-2.1 # The following are based on individual license text - eupl-1.2 - liliq-r-1.1 - liliq-rplus-1.1 pluggable-discovery-protocol-handler-2.2.1/.licenses/000077500000000000000000000000001467256101600226305ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/000077500000000000000000000000001467256101600320515ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/go/000077500000000000000000000000001467256101600324565ustar00rootroot00000000000000github.com/000077500000000000000000000000001467256101600344365ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/goarduino/000077500000000000000000000000001467256101600360775ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/go/github.comgo-paths-helper.dep.yml000066400000000000000000000457571467256101600424120ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/go/github.com/arduino--- name: github.com/arduino/go-paths-helper version: v1.10.0 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/go-paths-helper license: gpl-2.0-or-later licenses: - sources: LICENSE text: |2 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. notices: [] go-properties-orderedmap.dep.yml000066400000000000000000000461151467256101600443170ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/go/github.com/arduino--- name: github.com/arduino/go-properties-orderedmap version: v1.8.0 type: go summary: Package properties is a library for handling maps of hierarchical properties. homepage: https://pkg.go.dev/github.com/arduino/go-properties-orderedmap license: gpl-2.0-or-later licenses: - sources: LICENSE text: |2 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. notices: [] pkg/000077500000000000000000000000001467256101600352175ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/go/github.comerrors.dep.yml000066400000000000000000000032161467256101600400270ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/.licenses/pluggable-discovery-protocol-handler/go/github.com/pkg--- name: github.com/pkg/errors version: v0.9.1 type: go summary: Package errors provides simple error handling primitives. homepage: https://pkg.go.dev/github.com/pkg/errors license: bsd-2-clause licenses: - sources: LICENSE text: | Copyright (c) 2015, Dave Cheney All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - sources: README.md text: BSD-2-Clause notices: [] pluggable-discovery-protocol-handler-2.2.1/LICENSE.txt000066400000000000000000001060051467256101600225720ustar00rootroot00000000000000This file includes licensing information for serial-discovery Copyright (c) 2018 ARDUINO SA (www.arduino.cc) The software is released under the GNU General Public License, which covers the main body of the serial-discovery code. The terms of this license can be found at: https://www.gnu.org/licenses/gpl-3.0.en.html You can be released from the requirements of the above licenses by purchasing a commercial license. Buying such a license is mandatory if you want to modify or otherwise use the software for commercial activities involving the Arduino software without disclosing the source code of your own applications. To purchase a commercial license, send an email to license@arduino.cc GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . pluggable-discovery-protocol-handler-2.2.1/README.md000066400000000000000000000034131467256101600222250ustar00rootroot00000000000000# Pluggable Discovery Protocol Handler [![Go Reference](https://pkg.go.dev/badge/github.com/arduino/pluggable-discovery-protocol-handler.svg)](https://pkg.go.dev/github.com/arduino/pluggable-discovery-protocol-handler/v2) [![Test Go status](https://github.com/arduino/pluggable-discovery-protocol-handler/actions/workflows/test-go-task.yml/badge.svg)](https://github.com/arduino/pluggable-discovery-protocol-handler/actions/workflows/test-go-task.yml) [![Codecov](https://codecov.io/gh/arduino/pluggable-discovery-protocol-handler/branch/main/graph/badge.svg)](https://codecov.io/gh/arduino/pluggable-discovery-protocol-handler) This project is a library to ease implementation of pluggable discoveries for the [Arduino CLI](https://github.com/arduino/arduino-cli) following the [official specification](https://arduino.github.io/arduino-cli/latest/platform-specification/#pluggable-discovery). ## Reference implementation The [`dummy-discovery` folder](dummy-discovery) contains a reference pluggable discovery implementation. ## Security If you think you found a vulnerability or other security-related bug in this project, please read our [security policy](https://github.com/arduino/pluggable-discovery-protocol-handler/security/policy) and report the bug to our Security Team 🛡️ Thank you! e-mail contact: security@arduino.cc ## License Copyright (c) 2021 ARDUINO SA (www.arduino.cc) The software is released under the GNU General Public License, which covers the main body of the serial-discovery code. The terms of this license can be found at: https://www.gnu.org/licenses/gpl-3.0.en.html See [LICENSE.txt](https://github.com/arduino/pluggable-discovery-protocol-handler/blob/master/LICENSE.txt) for details. pluggable-discovery-protocol-handler-2.2.1/Taskfile.yml000077500000000000000000000150051467256101600232360ustar00rootroot00000000000000version: "3" vars: DIST_DIR: "dist" DUMMY_DISCOVERY_VERSION: sh: echo "$(git describe --tags --dirty --broken)" DUMMY_DISCOVERY_TIMESTAMP: sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" DUMMY_DISCOVERY_LDFLAGS: > -X github.com/arduino/pluggable-discovery-protocol-handler/dummy-discovery/args.Tag={{.DUMMY_DISCOVERY_VERSION}} -X github.com/arduino/pluggable-discovery-protocol-handler/dummy-discovery/args.Timestamp={{.DUMMY_DISCOVERY_TIMESTAMP}} # Path of the project's primary Go module: DEFAULT_GO_MODULE_PATH: ./ DEFAULT_GO_PACKAGES: sh: | echo $(cd {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}} && go list ./... | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"') # `-ldflags` flag to use for `go test` command TEST_LDFLAGS: tasks: build-dummy-discovery: desc: Build the dummy-discovery client example vars: EXECUTABLE: dummy-discovery{{if eq OS "windows"}}.exe{{end}} cmds: - go build -o dist/{{.EXECUTABLE}} -v -ldflags '{{.DUMMY_DISCOVERY_LDFLAGS}}' ./dummy-discovery # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml go:test: desc: Run unit tests dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}" cmds: - | go test \ -v \ -short \ -run '{{default ".*" .GO_TEST_REGEX}}' \ {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \ -coverprofile=coverage_unit.txt \ {{.TEST_LDFLAGS}} \ {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml ci:validate: desc: Validate GitHub Actions workflows against their JSON schema vars: # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json WORKFLOW_SCHEMA_URL: https://json.schemastore.org/github-workflow WORKFLOW_SCHEMA_PATH: sh: mktemp -t workflow-schema-XXXXXXXXXX.json WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}" cmds: - | wget \ --quiet \ --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \ {{.WORKFLOW_SCHEMA_URL}} - | npx \ --package=ajv-cli \ --package=ajv-formats \ ajv validate \ --all-errors \ --strict=false \ -c ajv-formats \ -s "{{.WORKFLOW_SCHEMA_PATH}}" \ -d "{{.WORKFLOWS_DATA_PATH}}" # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml general:cache-dep-licenses: desc: Cache dependency license metadata cmds: - | if ! which licensed &>/dev/null; then if [[ "{{OS}}" == "windows" ]]; then echo "Licensed does not have Windows support." echo "Please use Linux/macOS or download the dependencies cache from the GitHub Actions workflow artifact." else echo "licensed not found or not in PATH. Please install: https://github.com/github/licensed#as-an-executable" fi exit 1 fi - licensed cache # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml general:check-dep-licenses: desc: Check for unapproved dependency licenses deps: - task: general:cache-dep-licenses cmds: - licensed status # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml general:check-formatting: desc: Check basic formatting style of all files cmds: - | if ! which ec &>/dev/null; then echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation" exit 1 fi - ec # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml general:check-spelling: desc: Check for commonly misspelled words deps: - task: poetry:install-deps cmds: - poetry run codespell # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml general:correct-spelling: desc: Correct commonly misspelled words where possible deps: - task: poetry:install-deps cmds: - poetry run codespell --write-changes # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml poetry:install-deps: desc: Install dependencies managed by Poetry cmds: - poetry install --no-root # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml poetry:update-deps: desc: Update all dependencies managed by Poetry to their newest versions cmds: - poetry update # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml go:check: desc: Check for problems with Go code deps: - task: go:vet - task: go:lint # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml go:vet: desc: Check for errors in Go code cmds: - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml go:fix: desc: Modernize usages of outdated APIs cmds: - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml go:lint: desc: Lint Go code cmds: - | if ! which golint &>/dev/null; then echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation" exit 1 fi - | golint \ {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \ {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml go:format: desc: Format Go code cmds: - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} pluggable-discovery-protocol-handler-2.2.1/client.go000066400000000000000000000276641467256101600225710ustar00rootroot00000000000000// // This file is part of pluggable-discovery-protocol-handler. // // Copyright 2024 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package discovery import ( "encoding/json" "errors" "fmt" "io" "strings" "sync" "time" "github.com/arduino/go-paths-helper" ) // Client is a tool that detects communication ports to interact // with the boards. type Client struct { id string processArgs []string process *paths.Process outgoingCommandsPipe io.Writer incomingMessagesChan <-chan *discoveryMessage userAgent string logger ClientLogger // All the following fields are guarded by statusMutex statusMutex sync.Mutex incomingMessagesError error eventChan chan<- *Event } // ClientLogger is the interface that must be implemented by a logger // to be used in the discovery client. type ClientLogger interface { Debugf(format string, args ...interface{}) Errorf(format string, args ...interface{}) } type nullClientLogger struct{} func (l *nullClientLogger) Debugf(format string, args ...interface{}) {} func (l *nullClientLogger) Errorf(format string, args ...interface{}) {} type discoveryMessage struct { EventType string `json:"eventType"` Message string `json:"message"` Error bool `json:"error"` ProtocolVersion int `json:"protocolVersion"` // Used in HELLO command Ports []*Port `json:"ports"` // Used in LIST command Port *Port `json:"port"` // Used in add and remove events } func (msg discoveryMessage) String() string { s := fmt.Sprintf("type: %s", msg.EventType) if msg.Message != "" { s += fmt.Sprintf(", message: %s", msg.Message) } if msg.ProtocolVersion != 0 { s += fmt.Sprintf(", protocol version: %d", msg.ProtocolVersion) } if len(msg.Ports) > 0 { s += fmt.Sprintf(", ports: %s", msg.Ports) } if msg.Port != nil { s += fmt.Sprintf(", port: %s", msg.Port) } return s } // Event is a pluggable discovery event type Event struct { Type string Port *Port DiscoveryID string } // NewClient create a new pluggable discovery client func NewClient(id string, args ...string) *Client { return &Client{ id: id, processArgs: args, userAgent: "pluggable-discovery-protocol-handler", logger: &nullClientLogger{}, } } // SetUserAgent sets the user agent to be used in the discovery func (disc *Client) SetUserAgent(userAgent string) { disc.userAgent = userAgent } // SetLogger sets the logger to be used in the discovery func (disc *Client) SetLogger(logger ClientLogger) { disc.logger = logger } // GetID returns the identifier for this discovery func (disc *Client) GetID() string { return disc.id } func (disc *Client) String() string { return disc.id } func (disc *Client) jsonDecodeLoop(in io.Reader, outChan chan<- *discoveryMessage) { decoder := json.NewDecoder(in) closeAndReportError := func(err error) { disc.statusMutex.Lock() disc.incomingMessagesError = err disc.stopSync() disc.killProcess() disc.statusMutex.Unlock() close(outChan) if err != nil { disc.logger.Errorf("Stopped decode loop: %v", err) } else { disc.logger.Debugf("Stopped decode loop") } } for { var msg discoveryMessage if err := decoder.Decode(&msg); err != nil { closeAndReportError(err) return } disc.logger.Debugf("Received message %s", msg) if msg.EventType == "add" { if msg.Port == nil { closeAndReportError(errors.New("invalid 'add' message: missing port")) return } disc.statusMutex.Lock() if disc.eventChan != nil { disc.eventChan <- &Event{"add", msg.Port, disc.GetID()} } disc.statusMutex.Unlock() } else if msg.EventType == "remove" { if msg.Port == nil { closeAndReportError(errors.New("invalid 'remove' message: missing port")) return } disc.statusMutex.Lock() if disc.eventChan != nil { disc.eventChan <- &Event{"remove", msg.Port, disc.GetID()} } disc.statusMutex.Unlock() } else { outChan <- &msg } } } // Alive returns true if the discovery is running and false otherwise. func (disc *Client) Alive() bool { disc.statusMutex.Lock() defer disc.statusMutex.Unlock() return disc.process != nil } func (disc *Client) waitMessage(timeout time.Duration) (*discoveryMessage, error) { select { case msg := <-disc.incomingMessagesChan: if msg == nil { disc.statusMutex.Lock() err := disc.incomingMessagesError disc.statusMutex.Unlock() return nil, err } return msg, nil case <-time.After(timeout): return nil, fmt.Errorf("timeout waiting for message from %s", disc) } } func (disc *Client) sendCommand(command string) error { disc.logger.Debugf("Sending command %s", strings.TrimSpace(command)) data := []byte(command) for { n, err := disc.outgoingCommandsPipe.Write(data) if err != nil { return err } if n == len(data) { return nil } data = data[n:] } } func (disc *Client) runProcess() error { disc.logger.Debugf("Starting discovery process") proc, err := paths.NewProcess(nil, disc.processArgs...) if err != nil { return err } stdout, err := proc.StdoutPipe() if err != nil { return err } stdin, err := proc.StdinPipe() if err != nil { return err } disc.outgoingCommandsPipe = stdin messageChan := make(chan *discoveryMessage) disc.incomingMessagesChan = messageChan go disc.jsonDecodeLoop(stdout, messageChan) if err := proc.Start(); err != nil { return err } disc.statusMutex.Lock() defer disc.statusMutex.Unlock() disc.process = proc disc.logger.Debugf("Discovery process started") return nil } func (disc *Client) killProcess() { disc.logger.Debugf("Killing discovery process") if process := disc.process; process != nil { disc.process = nil if err := process.Kill(); err != nil { disc.logger.Errorf("Killing discovery process: %v", err) } if err := process.Wait(); err != nil { disc.logger.Errorf("Waiting discovery process termination: %v", err) } } disc.logger.Debugf("Discovery process killed") } // Run starts the discovery executable process and sends the HELLO command to the discovery to agree on the // pluggable discovery protocol. This must be the first command to run in the communication with the discovery. // If the process is started but the HELLO command fails the process is killed. func (disc *Client) Run() (err error) { if err = disc.runProcess(); err != nil { return err } defer func() { // If the discovery process is started successfully but the HELLO handshake // fails the discovery is an unusable state, we kill the process to avoid // further issues down the line. if err == nil { return } disc.statusMutex.Lock() disc.killProcess() disc.statusMutex.Unlock() }() if err = disc.sendCommand("HELLO 1 \"arduino-cli " + disc.userAgent + "\"\n"); err != nil { return err } if msg, err := disc.waitMessage(time.Second * 10); err != nil { return fmt.Errorf("calling HELLO: %w", err) } else if msg.EventType != "hello" { return fmt.Errorf("event out of sync, expected 'hello', received '%s'", msg.EventType) } else if msg.Error { return fmt.Errorf("command failed: %s", msg.Message) } else if strings.ToUpper(msg.Message) != "OK" { return fmt.Errorf("communication out of sync, expected 'OK', received '%s'", msg.Message) } else if msg.ProtocolVersion > 1 { return fmt.Errorf("protocol version not supported: requested 1, got %d", msg.ProtocolVersion) } return nil } // Start initializes and start the discovery internal subroutines. This command must be // called before List. func (disc *Client) Start() error { if err := disc.sendCommand("START\n"); err != nil { return err } if msg, err := disc.waitMessage(time.Second * 10); err != nil { return fmt.Errorf("calling START: %w", err) } else if msg.EventType != "start" { return fmt.Errorf("event out of sync, expected 'start', received '%s'", msg.EventType) } else if msg.Error { return fmt.Errorf("command failed: %s", msg.Message) } else if strings.ToUpper(msg.Message) != "OK" { return fmt.Errorf("communication out of sync, expected 'OK', received '%s'", msg.Message) } return nil } // Stop stops the discovery internal subroutines and possibly free the internally // used resources. This command should be called if the client wants to pause the // discovery for a while. func (disc *Client) Stop() error { if err := disc.sendCommand("STOP\n"); err != nil { return err } if msg, err := disc.waitMessage(time.Second * 10); err != nil { return fmt.Errorf("calling STOP: %w", err) } else if msg.EventType != "stop" { return fmt.Errorf("event out of sync, expected 'stop', received '%s'", msg.EventType) } else if msg.Error { return fmt.Errorf("command failed: %s", msg.Message) } else if strings.ToUpper(msg.Message) != "OK" { return fmt.Errorf("communication out of sync, expected 'OK', received '%s'", msg.Message) } disc.statusMutex.Lock() defer disc.statusMutex.Unlock() disc.stopSync() return nil } func (disc *Client) stopSync() { if disc.eventChan != nil { disc.eventChan <- &Event{"stop", nil, disc.GetID()} close(disc.eventChan) disc.eventChan = nil } } // Quit terminates the discovery. No more commands can be accepted by the discovery. func (disc *Client) Quit() { _ = disc.sendCommand("QUIT\n") if _, err := disc.waitMessage(time.Second * 5); err != nil { disc.logger.Errorf("Quitting discovery: %s", err) } disc.statusMutex.Lock() disc.stopSync() disc.killProcess() disc.statusMutex.Unlock() } // List executes an enumeration of the ports and returns a list of the available // ports at the moment of the call. func (disc *Client) List() ([]*Port, error) { if err := disc.sendCommand("LIST\n"); err != nil { return nil, err } if msg, err := disc.waitMessage(time.Second * 10); err != nil { return nil, fmt.Errorf("calling LIST: %w", err) } else if msg.EventType != "list" { return nil, fmt.Errorf("event out of sync, expected 'list', received '%s'", msg.EventType) } else if msg.Error { return nil, fmt.Errorf("command failed: %s", msg.Message) } else { return msg.Ports, nil } } // StartSync puts the discovery in "events" mode: the discovery will send "add" // and "remove" events each time a new port is detected or removed respectively. // After calling StartSync an initial burst of "add" events may be generated to // report all the ports available at the moment of the start. // It also creates a channel used to receive events from the pluggable discovery. // The event channel must be consumed as quickly as possible since it may block the // discovery if it becomes full. The channel size is configurable. func (disc *Client) StartSync(size int) (<-chan *Event, error) { if err := disc.sendCommand("START_SYNC\n"); err != nil { return nil, err } if msg, err := disc.waitMessage(time.Second * 10); err != nil { return nil, fmt.Errorf("calling START_SYNC: %w", err) } else if msg.EventType != "start_sync" { return nil, fmt.Errorf("evemt out of sync, expected 'start_sync', received '%s'", msg.EventType) } else if msg.Error { return nil, fmt.Errorf("command failed: %s", msg.Message) } else if strings.ToUpper(msg.Message) != "OK" { return nil, fmt.Errorf("communication out of sync, expected 'OK', received '%s'", msg.Message) } // In case there is already an existing event channel in use we close it before creating a new one. disc.statusMutex.Lock() defer disc.statusMutex.Unlock() disc.stopSync() c := make(chan *Event, size) disc.eventChan = c return c, nil } pluggable-discovery-protocol-handler-2.2.1/client_test.go000066400000000000000000000100141467256101600236050ustar00rootroot00000000000000// // This file is part of pluggable-discovery-protocol-handler. // // Copyright 2024 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package discovery import ( "fmt" "io" "net" "testing" "time" "github.com/arduino/go-paths-helper" "github.com/stretchr/testify/require" ) type testLogger struct{} func (l *testLogger) Debugf(msg string, args ...any) { fmt.Printf(msg, args...) fmt.Println() } func (l *testLogger) Errorf(msg string, args ...any) { fmt.Printf(msg, args...) fmt.Println() } func TestDiscoveryStdioHandling(t *testing.T) { // Build `netcat` helper inside testdata/cat builder, err := paths.NewProcess(nil, "go", "build") require.NoError(t, err) builder.SetDir("testdata/netcat") require.NoError(t, builder.Run()) // Run netcat and test if streaming json works as expected listener, err := net.ListenTCP("tcp", nil) require.NoError(t, err) disc := NewClient("test", "testdata/netcat/netcat", listener.Addr().String()) disc.SetLogger(&testLogger{}) err = disc.runProcess() require.NoError(t, err) listener.SetDeadline(time.Now().Add(time.Second)) conn, err := listener.Accept() require.NoError(t, err) _, err = conn.Write([]byte(`{ "eventType":`)) // send partial JSON require.NoError(t, err) msg, err := disc.waitMessage(time.Millisecond * 100) require.Error(t, err) require.Nil(t, msg) _, err = conn.Write([]byte(`"ev1" }{ `)) // complete previous json and start another one require.NoError(t, err) msg, err = disc.waitMessage(time.Millisecond * 100) require.NoError(t, err) require.NotNil(t, msg) require.Equal(t, "ev1", msg.EventType) msg, err = disc.waitMessage(time.Millisecond * 100) require.Error(t, err) require.Nil(t, msg) _, err = conn.Write([]byte(`"eventType":"ev2" }`)) // complete previous json require.NoError(t, err) msg, err = disc.waitMessage(time.Millisecond * 100) require.NoError(t, err) require.NotNil(t, msg) require.Equal(t, "ev2", msg.EventType) require.True(t, disc.Alive()) err = conn.Close() require.NoError(t, err) time.Sleep(time.Millisecond * 500) require.False(t, disc.Alive()) } func TestClient(t *testing.T) { // Build dummy-discovery builder, err := paths.NewProcess(nil, "go", "build") require.NoError(t, err) builder.SetDir("dummy-discovery") require.NoError(t, builder.Run()) t.Run("WithDiscoveryCrashingOnStartup", func(t *testing.T) { // Run client with discovery crashing on startup cl := NewClient("1", "dummy-discovery/dummy-discovery", "--invalid") require.ErrorIs(t, cl.Run(), io.EOF) }) t.Run("WithDiscoveryCrashingWhileSendingCommands", func(t *testing.T) { // Run client with crashing discovery after 1 second cl := NewClient("1", "dummy-discovery/dummy-discovery", "-k") require.NoError(t, cl.Run()) time.Sleep(time.Second) ch, err := cl.StartSync(20) require.Error(t, err) require.Nil(t, ch) }) t.Run("WithDiscoveryCrashingWhileStreamingEvents", func(t *testing.T) { // Run client with crashing discovery after 1 second cl := NewClient("1", "dummy-discovery/dummy-discovery", "-k") require.NoError(t, cl.Run()) ch, err := cl.StartSync(20) require.NoError(t, err) time.Sleep(time.Second) loop: for { select { case msg, ok := <-ch: if !ok { // Channel closed: Test passed fmt.Println("Event channel closed") break loop } fmt.Println("Recv: ", msg) case <-time.After(time.Second): t.Error("Crashing client did not close event channel") break loop } } cl.Quit() }) } pluggable-discovery-protocol-handler-2.2.1/discovery.go000066400000000000000000000202531467256101600233050ustar00rootroot00000000000000// // This file is part of pluggable-discovery-protocol-handler. // // Copyright 2021 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // // Package discovery is a library for handling the Arduino Pluggable-Discovery protocol // (https://github.com/arduino/tooling-rfcs/blob/main/RFCs/0002-pluggable-discovery.md#pluggable-discovery-api-via-stdinstdout) // // The library implements the state machine and the parsing logic to implement a pluggable-discovery client and server. // // While implementing a server, all the commands issued by the client are conveniently translated into function calls, in particular // the methods of the Discovery interface are the only functions that must be implemented to get a fully working pluggable discovery // using this library. // // A usage example is provided in the dummy-discovery package. package discovery import ( "bufio" "encoding/json" "fmt" "io" "regexp" "strconv" "strings" "sync" ) // Discovery is an interface that represents the business logic that // a pluggable discovery must implement. The communication protocol // is completely hidden and it's handled by a DiscoveryServer. type Discovery interface { // Hello is called once at startup to provide the userAgent string // and the protocolVersion negotiated with the client. Hello(userAgent string, protocolVersion int) error // StartSync is called to put the discovery in event mode. When the // function returns the discovery must send port events ("add" or "remove") // using the eventCB function. StartSync(eventCB EventCallback, errorCB ErrorCallback) error // Stop stops the discovery internal subroutines. If the discovery is // in event mode it must stop sending events through the eventCB previously // set. Stop() error // Quit is called just before the server terminates. This function can be // used by the discovery as a last chance gracefully close resources. Quit() } // EventCallback is a callback function to call to transmit port // metadata when the discovery is in "sync" mode and a new event // is detected. type EventCallback func(event string, port *Port) // ErrorCallback is a callback function to signal unrecoverable errors to the // client while the discovery is in event mode. Once the discovery signal an // error it means that no more port-events will be delivered until the client // performs a STOP+START_SYNC cycle. type ErrorCallback func(err string) // A Server is a pluggable discovery protocol handler, // it must be created using the NewServer function. type Server struct { impl Discovery userAgent string reqProtocolVersion int initialized bool started bool syncStarted bool cachedPorts map[string]*Port cachedErr string output io.Writer outputMutex sync.Mutex } // NewServer creates a new discovery server backed by the // provided pluggable discovery implementation. To start the server // use the Run method. func NewServer(impl Discovery) *Server { return &Server{ impl: impl, } } // Run starts the protocol handling loop on the given input and // output stream, usually `os.Stdin` and `os.Stdout` are used. // The function blocks until the `QUIT` command is received or // the input stream is closed. In case of IO error the error is // returned. func (d *Server) Run(in io.Reader, out io.Writer) error { d.output = out reader := bufio.NewReader(in) for { fullCmd, err := reader.ReadString('\n') if err != nil { d.send(messageError("command_error", err.Error())) return err } fullCmd = strings.TrimSpace(fullCmd) split := strings.Split(fullCmd, " ") cmd := strings.ToUpper(split[0]) if !d.initialized && cmd != "HELLO" && cmd != "QUIT" { d.send(messageError("command_error", fmt.Sprintf("First command must be HELLO, but got '%s'", cmd))) continue } switch cmd { case "HELLO": if len(fullCmd) < 7 { d.hello("") } else { d.hello(fullCmd[6:]) } case "START": d.start() case "LIST": d.list() case "START_SYNC": d.startSync() case "STOP": d.stop() case "QUIT": d.impl.Quit() d.send(messageOk("quit")) return nil default: d.send(messageError("command_error", fmt.Sprintf("Command %s not supported", cmd))) } } } func (d *Server) hello(cmd string) { if d.initialized { d.send(messageError("hello", "HELLO already called")) return } re := regexp.MustCompile(`^(\d+) "([^"]+)"$`) matches := re.FindStringSubmatch(cmd) if len(matches) != 3 { d.send(messageError("hello", "Invalid HELLO command")) return } d.userAgent = matches[2] v, err := strconv.ParseInt(matches[1], 10, 64) if err != nil { d.send(messageError("hello", "Invalid protocol version: "+matches[2])) return } d.reqProtocolVersion = int(v) if err := d.impl.Hello(d.userAgent, 1); err != nil { d.send(messageError("hello", err.Error())) return } d.send(&message{ EventType: "hello", ProtocolVersion: 1, // Protocol version 1 is the only supported for now... Message: "OK", }) d.initialized = true } func (d *Server) start() { if d.started { d.send(messageError("start", "Discovery already STARTed")) return } if d.syncStarted { d.send(messageError("start", "Discovery already START_SYNCed, cannot START")) return } d.cachedPorts = map[string]*Port{} d.cachedErr = "" if err := d.impl.StartSync(d.eventCallback, d.errorCallback); err != nil { d.send(messageError("start", "Cannot START: "+err.Error())) return } d.started = true d.send(messageOk("start")) } func (d *Server) eventCallback(event string, port *Port) { id := port.Address + "|" + port.Protocol if event == "add" { d.cachedPorts[id] = port } if event == "remove" { delete(d.cachedPorts, id) } } func (d *Server) errorCallback(msg string) { d.cachedErr = msg } func (d *Server) list() { if !d.started { d.send(messageError("list", "Discovery not STARTed")) return } if d.syncStarted { d.send(messageError("list", "discovery already START_SYNCed, LIST not allowed")) return } if d.cachedErr != "" { d.send(messageError("list", d.cachedErr)) return } ports := []*Port{} for _, port := range d.cachedPorts { ports = append(ports, port) } d.send(&message{ EventType: "list", Ports: &ports, }) } func (d *Server) startSync() { if d.syncStarted { d.send(messageError("start_sync", "Discovery already START_SYNCed")) return } if d.started { d.send(messageError("start_sync", "Discovery already STARTed, cannot START_SYNC")) return } if err := d.impl.StartSync(d.syncEvent, d.errorEvent); err != nil { d.send(messageError("start_sync", "Cannot START_SYNC: "+err.Error())) return } d.syncStarted = true d.send(messageOk("start_sync")) } func (d *Server) stop() { if !d.syncStarted && !d.started { d.send(messageError("stop", "Discovery already STOPped")) return } if err := d.impl.Stop(); err != nil { d.send(messageError("stop", "Cannot STOP: "+err.Error())) return } d.started = false if d.syncStarted { d.syncStarted = false } d.send(messageOk("stop")) } func (d *Server) syncEvent(event string, port *Port) { d.send(&message{ EventType: event, Port: port, }) } func (d *Server) errorEvent(msg string) { d.send(messageError("start_sync", msg)) } func (d *Server) send(msg *message) { data, err := json.MarshalIndent(msg, "", " ") if err != nil { // We are certain that this will be marshalled correctly // so we don't handle the error data, _ = json.MarshalIndent(messageError("command_error", err.Error()), "", " ") } data = append(data, '\n') d.outputMutex.Lock() defer d.outputMutex.Unlock() n, err := d.output.Write(data) if n != len(data) || err != nil { panic("ERROR") } } pluggable-discovery-protocol-handler-2.2.1/discovery_test.go000066400000000000000000000042241467256101600243440ustar00rootroot00000000000000// // This file is part of pluggable-discovery-protocol-handler. // // Copyright 2022 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package discovery import ( "testing" "github.com/arduino/go-paths-helper" "github.com/stretchr/testify/require" ) func TestDisc(t *testing.T) { builder, err := paths.NewProcess(nil, "go", "build") require.NoError(t, err) builder.SetDir("dummy-discovery") require.NoError(t, builder.Run()) discovery, err := paths.NewProcess(nil, "./dummy-discovery") require.NoError(t, err) discovery.SetDir("dummy-discovery") stdout, err := discovery.StdoutPipe() require.NoError(t, err) stdin, err := discovery.StdinPipe() require.NoError(t, err) require.NoError(t, discovery.Start()) { // Check that discovery is able to handle an "hello" without parameters gracefully // https://github.com/arduino/pluggable-discovery-protocol-handler/issues/32 inN, err := stdin.Write([]byte("hello\n")) require.NoError(t, err) require.Greater(t, inN, 0) output := [1024]byte{} outN, err := stdout.Read(output[:]) require.Greater(t, outN, 0) require.NoError(t, err) require.Equal(t, "{\n \"eventType\": \"hello\",\n \"message\": \"Invalid HELLO command\",\n \"error\": true\n}\n", string(output[:outN])) } { inN, err := stdin.Write([]byte("quit\n")) require.NoError(t, err) require.Greater(t, inN, 0) output := [1024]byte{} outN, err := stdout.Read(output[:]) require.Greater(t, outN, 0) require.NoError(t, err) require.Equal(t, "{\n \"eventType\": \"quit\",\n \"message\": \"OK\"\n}\n", string(output[:outN])) } } pluggable-discovery-protocol-handler-2.2.1/dummy-discovery/000077500000000000000000000000001467256101600241055ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/dummy-discovery/.gitignore000066400000000000000000000000441467256101600260730ustar00rootroot00000000000000dummy-discovery dummy-discovery.exe pluggable-discovery-protocol-handler-2.2.1/dummy-discovery/README.md000066400000000000000000000132631467256101600253710ustar00rootroot00000000000000# Arduino pluggable discovery reference implementation The `dummy-discovery` tool is a command line program that interacts via stdio. It accepts commands as plain ASCII strings terminated with LF `\n` and sends response as JSON. The "communication ports" returned by the tool are fake, this discovery is intenteded only for educational and testing purposes. ## How to build Install a recent go environment and run `go build`. The executable `dummy-discovery` will be produced in your working directory. ## Usage After startup, the tool waits for commands. The available commands are: `HELLO`, `START`, `STOP`, `QUIT`, `LIST` and `START_SYNC`. #### HELLO command The `HELLO` command is used to establish the pluggable discovery protocol between client and discovery. The format of the command is: `HELLO ""` for example: `HELLO 1 "Arduino IDE"` or: `HELLO 1 "arduino-cli"` in this case the protocol version requested by the client is `1` (at the moment of writing there were no other revisions of the protocol). The response to the command is: ```json { "eventType": "hello", "protocolVersion": 1, "message": "OK" } ``` `protocolVersion` is the protocol version that the discovery is going to use in the remainder of the communication. #### START command The `START` starts the internal subroutines of the discovery that looks for ports. This command must be called before `LIST` or `START_SYNC`. The response to the start command is: ```json { "eventType": "start", "message": "OK" } ``` #### STOP command The `STOP` command stops the discovery internal subroutines and free some resources. This command should be called if the client wants to pause the discovery for a while. The response to the stop command is: ```json { "eventType": "stop", "message": "OK" } ``` #### QUIT command The `QUIT` command terminates the discovery. The response to quit is: ```json { "eventType": "quit", "message": "OK" } ``` after this output the tool quits. #### LIST command The `LIST` command returns a list of the currently available serial ports. The format of the response is the following: ```json { "eventType": "list", "ports": [ { "address": "1", "label": "Dummy upload port", "protocol": "dummy", "protocolLabel": "Dummy protocol", "properties": { "mac": "73622384782", "pid": "0x0041", "vid": "0x2341" } } ] } ``` #### START_SYNC command The `START_SYNC` command puts the tool in "events" mode: the discovery will send `add` and `remove` events each time a new port is detected or removed respectively. The immediate response to the command is: ```json { "eventType": "start_sync", "message": "OK" } ``` after that the discovery enters in "events" mode. The `add` events looks like the following: ```json "eventType": "add", "port": { "address": "4", "label": "Dummy upload port", "protocol": "dummy", "protocolLabel": "Dummy protocol", "properties": { "mac": "294489539128", "pid": "0x0041", "vid": "0x2341" } } } ``` it basically gather the same information as the `list` event but for a single port. After calling `START_SYNC` a bunch of `add` events may be generated in sequence to report all the ports available at the moment of the start. The `remove` event looks like this: ```json { "eventType": "remove", "port": { "address": "4", "protocol": "dummy" } } ``` in this case only the `address` and `protocol` fields are reported. ### Example of usage A possible transcript of the discovery usage: ``` HELLO 1 "arduino-cli" { "eventType": "hello", "message": "OK", "protocolVersion": 1 } START { "eventType": "start", "message": "OK" } LIST { "eventType": "list", "ports": [ { "address": "1", "label": "Dummy upload port", "protocol": "dummy", "protocolLabel": "Dummy protocol", "properties": { "mac": "73622384782", "pid": "0x0041", "vid": "0x2341" } } ] } STOP { "eventType": "stop", "message": "OK" } START_SYNC { "eventType": "start_sync", "message": "OK" } { "eventType": "add", "port": { "address": "2", "label": "Dummy upload port", "protocol": "dummy", "protocolLabel": "Dummy protocol", "properties": { "mac": "147244769564", "pid": "0x0041", "vid": "0x2341" } } } { "eventType": "add", "port": { "address": "3", "label": "Dummy upload port", "protocol": "dummy", "protocolLabel": "Dummy protocol", "properties": { "mac": "220867154346", "pid": "0x0041", "vid": "0x2341" } } } { "eventType": "add", "port": { "address": "4", "label": "Dummy upload port", "protocol": "dummy", "protocolLabel": "Dummy protocol", "properties": { "mac": "294489539128", "pid": "0x0041", "vid": "0x2341" } } } { "eventType": "remove", "port": { "address": "4", "protocol": "dummy" } } QUIT { "eventType": "quit", "message": "OK" } $ ``` ## Security If you think you found a vulnerability or other security-related bug in this project, please read our [security policy](https://github.com/arduino/pluggable-discovery-protocol-handler/security/policy) and report the bug to our Security Team 🛡️ Thank you! e-mail contact: security@arduino.cc ## License Copyright (c) 2021 ARDUINO SA (www.arduino.cc) The software is released under the GNU General Public License, which covers the main body of the serial-discovery code. The terms of this license can be found at: https://www.gnu.org/licenses/gpl-3.0.en.html See [LICENSE.txt](https://github.com/arduino/pluggable-discovery-protocol-handler/blob/master/LICENSE.txt) for details. pluggable-discovery-protocol-handler-2.2.1/dummy-discovery/args/000077500000000000000000000000001467256101600250415ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/dummy-discovery/args/args.go000066400000000000000000000025151467256101600263270ustar00rootroot00000000000000// // This file is part of dummy-discovery. // // Copyright 2021 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package args import ( "fmt" "os" "time" ) // Tag is the current git tag var Tag = "snapshot" // Timestamp is the current timestamp var Timestamp = "unknown" // Parse arguments passed by the user func Parse() { for _, arg := range os.Args[1:] { if arg == "" { continue } if arg == "-v" || arg == "--version" { fmt.Printf("dummy-discovery %s (build timestamp: %s)\n", Tag, Timestamp) os.Exit(0) } if arg == "-k" { // Emulate crashing discovery go func() { time.Sleep(time.Millisecond * 500) os.Exit(1) }() continue } fmt.Fprintf(os.Stderr, "invalid argument: %s\n", arg) os.Exit(1) } } pluggable-discovery-protocol-handler-2.2.1/dummy-discovery/main.go000066400000000000000000000067501467256101600253700ustar00rootroot00000000000000// // This file is part of dummy-discovery. // // Copyright 2021 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package main import ( "errors" "fmt" "os" "time" "github.com/arduino/go-properties-orderedmap" discovery "github.com/arduino/pluggable-discovery-protocol-handler/v2" "github.com/arduino/pluggable-discovery-protocol-handler/v2/dummy-discovery/args" ) // dummyDiscovery is an example implementation of a Discovery. // It simulates a real implementation of a Discovery by generating // connected ports deterministically, it can also be used for testing // purposes. type dummyDiscovery struct { startSyncCount int closeChan chan<- bool } func main() { args.Parse() dummy := &dummyDiscovery{} server := discovery.NewServer(dummy) if err := server.Run(os.Stdin, os.Stdout); err != nil { os.Exit(1) } } // Hello does nothing. // In a real implementation it could setup background processes // or other kind of resources necessary to discover Ports. func (d *dummyDiscovery) Hello(userAgent string, protocol int) error { return nil } // Quit does nothing. // In a real implementation it can be used to tear down resources // used to discovery Ports. func (d *dummyDiscovery) Quit() {} // Stop is used to stop the goroutine started by StartSync // used to discover ports. func (d *dummyDiscovery) Stop() error { if d.closeChan != nil { d.closeChan <- true close(d.closeChan) d.closeChan = nil } return nil } // StartSync starts the goroutine that generates fake Ports. func (d *dummyDiscovery) StartSync(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) error { d.startSyncCount++ if d.startSyncCount%5 == 0 { return errors.New("could not start_sync every 5 times") } c := make(chan bool) d.closeChan = c // Run synchronous event emitter go func() { var closeChan <-chan bool = c // Output initial port state eventCB("add", createDummyPort()) eventCB("add", createDummyPort()) // Start sending events count := 0 for count < 2 { count++ select { case <-closeChan: return case <-time.After(2 * time.Second): } port := createDummyPort() eventCB("add", port) select { case <-closeChan: return case <-time.After(2 * time.Second): } eventCB("remove", &discovery.Port{ Address: port.Address, Protocol: port.Protocol, }) } errorCB("unrecoverable error, cannot send more events") <-closeChan }() return nil } var dummyCounter = 0 // createDummyPort creates a Port with fake data func createDummyPort() *discovery.Port { dummyCounter++ mac := fmt.Sprintf("%d", dummyCounter*384782) return &discovery.Port{ Address: fmt.Sprintf("%d", dummyCounter), AddressLabel: "Dummy upload port", Protocol: "dummy", ProtocolLabel: "Dummy protocol", HardwareID: mac, Properties: properties.NewFromHashmap(map[string]string{ "vid": "0x2341", "pid": "0x0041", "mac": mac, }), } } pluggable-discovery-protocol-handler-2.2.1/go.mod000066400000000000000000000006551467256101600220610ustar00rootroot00000000000000module github.com/arduino/pluggable-discovery-protocol-handler/v2 go 1.21 toolchain go1.21.1 require ( github.com/arduino/go-paths-helper v1.10.0 github.com/arduino/go-properties-orderedmap v1.8.0 github.com/stretchr/testify v1.8.4 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) pluggable-discovery-protocol-handler-2.2.1/go.sum000066400000000000000000000034071467256101600221040ustar00rootroot00000000000000github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= github.com/arduino/go-paths-helper v1.10.0 h1:oeE6Mcl4lsz+knC3lzaCWkRQa3n3FbwdRSeGhy6uGbM= github.com/arduino/go-paths-helper v1.10.0/go.mod h1:LgEVnv+cqSl05vXD5LaUZGquDsX5OKmPNDJtjTL8928= github.com/arduino/go-properties-orderedmap v1.8.0 h1:wEfa6hHdpezrVOh787OmClsf/Kd8qB+zE3P2Xbrn0CQ= github.com/arduino/go-properties-orderedmap v1.8.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= 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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= pluggable-discovery-protocol-handler-2.2.1/message.go000066400000000000000000000024561467256101600227270ustar00rootroot00000000000000// // This file is part of pluggable-discovery-protocol-handler. // // Copyright 2021 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package discovery type message struct { EventType string `json:"eventType"` Message string `json:"message,omitempty"` Error bool `json:"error,omitempty"` ProtocolVersion int `json:"protocolVersion,omitempty"` Port *Port `json:"port,omitempty"` Ports *[]*Port `json:"ports,omitempty"` } func messageOk(event string) *message { return &message{ EventType: event, Message: "OK", } } func messageError(event, msg string) *message { return &message{ EventType: event, Error: true, Message: msg, } } pluggable-discovery-protocol-handler-2.2.1/package-lock.json000066400000000000000000000466241467256101600241750ustar00rootroot00000000000000{ "name": "pluggable-discovery-protocol-handler", "lockfileVersion": 2, "requires": true, "packages": { "": { "devDependencies": { "ajv-cli": "^5.0.0", "ajv-formats": "^2.1.1" } }, "node_modules/ajv": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.2.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, "node_modules/ajv-cli": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ajv-cli/-/ajv-cli-5.0.0.tgz", "integrity": "sha512-LY4m6dUv44HTyhV+u2z5uX4EhPYTM38Iv1jdgDJJJCyOOuqB8KtZEGjPZ2T+sh5ZIJrXUfgErYx/j3gLd3+PlQ==", "dev": true, "dependencies": { "ajv": "^8.0.0", "fast-json-patch": "^2.0.0", "glob": "^7.1.0", "js-yaml": "^3.14.0", "json-schema-migrate": "^2.0.0", "json5": "^2.1.3", "minimist": "^1.2.0" }, "bin": { "ajv": "dist/index.js" }, "peerDependencies": { "ts-node": ">=9.0.0" }, "peerDependenciesMeta": { "ts-node": { "optional": true } } }, "node_modules/ajv-formats": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, "dependencies": { "ajv": "^8.0.0" }, "peerDependencies": { "ajv": "^8.0.0" }, "peerDependenciesMeta": { "ajv": { "optional": true } } }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" }, "engines": { "node": ">=4" } }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "node_modules/fast-json-patch": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz", "integrity": "sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig==", "dev": true, "dependencies": { "fast-deep-equal": "^2.0.1" }, "engines": { "node": ">= 0.4.0" } }, "node_modules/fast-json-patch/node_modules/fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", "dev": true }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "node_modules/json-schema-migrate": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-2.0.0.tgz", "integrity": "sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ==", "dev": true, "dependencies": { "ajv": "^8.0.0" } }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "bin": { "json5": "lib/cli.js" }, "engines": { "node": ">=6" } }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { "node": "*" } }, "node_modules/minimist": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "dependencies": { "punycode": "^2.1.0" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true } }, "dependencies": { "ajv": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, "ajv-cli": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ajv-cli/-/ajv-cli-5.0.0.tgz", "integrity": "sha512-LY4m6dUv44HTyhV+u2z5uX4EhPYTM38Iv1jdgDJJJCyOOuqB8KtZEGjPZ2T+sh5ZIJrXUfgErYx/j3gLd3+PlQ==", "dev": true, "requires": { "ajv": "^8.0.0", "fast-json-patch": "^2.0.0", "glob": "^7.1.0", "js-yaml": "^3.14.0", "json-schema-migrate": "^2.0.0", "json5": "^2.1.3", "minimist": "^1.2.0" } }, "ajv-formats": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, "requires": { "ajv": "^8.0.0" } }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" } }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-json-patch": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz", "integrity": "sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1" }, "dependencies": { "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", "dev": true } } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" } }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, "json-schema-migrate": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-2.0.0.tgz", "integrity": "sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ==", "dev": true, "requires": { "ajv": "^8.0.0" } }, "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, "json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", "dev": true }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "requires": { "wrappy": "1" } }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true }, "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "requires": { "punycode": "^2.1.0" } }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true } } } pluggable-discovery-protocol-handler-2.2.1/package.json000066400000000000000000000001241467256101600232300ustar00rootroot00000000000000{ "devDependencies": { "ajv-cli": "^5.0.0", "ajv-formats": "^2.1.1" } } pluggable-discovery-protocol-handler-2.2.1/poetry.lock000066400000000000000000000012711467256101600231420ustar00rootroot00000000000000[[package]] name = "codespell" version = "2.1.0" description = "Codespell" category = "dev" optional = false python-versions = ">=3.5" [package.extras] dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency"] hard-encoding-detection = ["chardet"] [metadata] lock-version = "1.1" python-versions = "^3.9" content-hash = "9b82f653df8b27353719532dec8326a8882ac694180086bb6c404dbd6863f4f7" [metadata.files] codespell = [ {file = "codespell-2.1.0-py3-none-any.whl", hash = "sha256:b864c7d917316316ac24272ee992d7937c3519be4569209c5b60035ac5d569b5"}, {file = "codespell-2.1.0.tar.gz", hash = "sha256:19d3fe5644fef3425777e66f225a8c82d39059dcfe9edb3349a8a2cf48383ee5"}, ] pluggable-discovery-protocol-handler-2.2.1/port.go000066400000000000000000000032521467256101600222620ustar00rootroot00000000000000// // This file is part of pluggable-discovery-protocol-handler. // // Copyright 2024 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to modify or // otherwise use the software for commercial activities involving the Arduino // software without disclosing the source code of your own applications. To purchase // a commercial license, send an email to license@arduino.cc. // package discovery import "github.com/arduino/go-properties-orderedmap" // Port is a descriptor for a board port type Port struct { Address string `json:"address"` AddressLabel string `json:"label,omitempty"` Protocol string `json:"protocol,omitempty"` ProtocolLabel string `json:"protocolLabel,omitempty"` Properties *properties.Map `json:"properties,omitempty"` HardwareID string `json:"hardwareId,omitempty"` } // Equals returns true if the given port has the same address and protocol // of the current port. func (p *Port) Equals(o *Port) bool { return p.Address == o.Address && p.Protocol == o.Protocol } func (p *Port) String() string { if p == nil { return "none" } return p.Address } // Clone creates a copy of this Port func (p *Port) Clone() *Port { if p == nil { return nil } res := *p if p.Properties != nil { res.Properties = p.Properties.Clone() } return &res } pluggable-discovery-protocol-handler-2.2.1/pyproject.toml000066400000000000000000000005061467256101600236620ustar00rootroot00000000000000[tool.poetry] name = "pluggable-discovery-protocol-handler" version = "0.1.0" description = "" authors = ["Your Name "] [tool.poetry.dependencies] python = "^3.9" [tool.poetry.dev-dependencies] codespell = "^2.1.0" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" pluggable-discovery-protocol-handler-2.2.1/testdata/000077500000000000000000000000001467256101600225565ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/testdata/netcat/000077500000000000000000000000001467256101600240345ustar00rootroot00000000000000pluggable-discovery-protocol-handler-2.2.1/testdata/netcat/.gitignore000066400000000000000000000000221467256101600260160ustar00rootroot00000000000000netcat netcat.exe pluggable-discovery-protocol-handler-2.2.1/testdata/netcat/main.go000066400000000000000000000024301467256101600253060ustar00rootroot00000000000000// This file is part of pluggable-discovery-protocol-handler. // // Copyright 2024 ARDUINO SA (http://www.arduino.cc/) // // This software is released under the GNU General Public License version 3, // which covers the main part of arduino-cli. // The terms of this license can be found at: // https://www.gnu.org/licenses/gpl-3.0.en.html // // You can be released from the requirements of the above licenses by purchasing // a commercial license. Buying such a license is mandatory if you want to // modify or otherwise use the software for commercial activities involving the // Arduino software without disclosing the source code of your own applications. // To purchase a commercial license, send an email to license@arduino.cc. // Proxy stdin/stdout through a TCP socket. // This program is used for testing purposes, to make it available on all // OS a tool equivalent to UNIX "nc". package main import ( "io" "net" "os" ) func main() { tcpAddr, err := net.ResolveTCPAddr("tcp", os.Args[1]) if err != nil { println("ResolveTCPAddr failed:", err.Error()) os.Exit(1) } conn, err := net.DialTCP("tcp", nil, tcpAddr) if err != nil { println("Dial failed:", err.Error()) os.Exit(1) } go func() { io.Copy(os.Stdout, conn) os.Exit(0) }() io.Copy(conn, os.Stdin) os.Exit(0) }