├── .prettierignore ├── .markdown-link-check.json ├── package.json ├── .gitignore ├── pyproject.toml ├── README.md ├── entitlements.plist ├── .codespellrc ├── go.mod ├── .github ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature-request.yml │ └── bug-report.yml └── workflows │ ├── check-workflows-task.yml │ ├── spell-check-task.yml │ ├── check-markdown-task.yml │ ├── check-license.yml │ ├── check-yaml-task.yml │ ├── check-taskfiles.yml │ ├── check-go-task.yml │ ├── check-go-dependencies-task.yml │ ├── sync-labels.yml │ ├── check-prettier-formatting-task.yml │ ├── publish-go-tester-task.yml │ └── release-go-task.yml ├── version └── version.go ├── args.go ├── .licenses └── mdns-discovery │ └── go │ ├── github.com │ ├── hashicorp │ │ └── mdns.dep.yml │ ├── miekg │ │ └── dns.dep.yml │ └── arduino │ │ └── go-properties-orderedmap.dep.yml │ └── golang.org │ └── x │ ├── sys │ └── unix.dep.yml │ └── net │ ├── ipv4.dep.yml │ ├── ipv6.dep.yml │ ├── internal │ ├── socket.dep.yml │ └── iana.dep.yml │ └── bpf.dep.yml ├── .markdownlint.yml ├── .yamllint.yml ├── .licensed.yml ├── cache.go ├── poetry.lock ├── go.sum ├── main.go ├── Taskfile.yml ├── DistTasks.yml └── LICENSE.txt /.prettierignore: -------------------------------------------------------------------------------- 1 | /.licenses/ 2 | -------------------------------------------------------------------------------- /.markdown-link-check.json: -------------------------------------------------------------------------------- 1 | { 2 | "retryOn429": true, 3 | "retryCount": 3, 4 | "aliveStatusCodes": [200, 206] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "ajv-cli": "^5.0.0", 4 | "ajv-formats": "^2.1.1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build artifacts 2 | /mdns-discovery 3 | !/mdns-discovery/ 4 | mdns-discovery.exe 5 | __pycache__/ 6 | 7 | # IDEs 8 | .idea/ 9 | .vscode/ 10 | *.bak 11 | *.code-workspace 12 | *.sublime-workspace 13 | 14 | /dist 15 | 16 | /node_modules/ 17 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "mdns-discovery" 3 | version = "0.1.0" 4 | description = "" 5 | authors = [] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.9" 9 | 10 | [tool.poetry.dev-dependencies] 11 | yamllint = "^1.26.2" 12 | codespell = "^2.1.0" 13 | 14 | [build-system] 15 | requires = ["poetry-core>=1.0.0"] 16 | build-backend = "poetry.core.masonry.api" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mdns-discovery 2 | 3 | MDNS (Bonjour) pluggable discovery tool 4 | 5 | ## Security 6 | 7 | If you think you found a vulnerability or other security-related bug in this project, please read our 8 | [security policy](https://github.com/arduino/mdns-discovery/security/policy) and report the bug to our Security Team 🛡️ 9 | Thank you! 10 | 11 | e-mail contact: security@arduino.cc 12 | -------------------------------------------------------------------------------- /entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | com.apple.security.network.client 9 | 10 | com.apple.security.network.server 11 | 12 | 13 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc 2 | # See: https://github.com/codespell-project/codespell#using-a-config-file 3 | [codespell] 4 | # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: 5 | ignore-words-list = , 6 | builtin = clear,informal,en-GB_to_en-US 7 | check-filenames = 8 | check-hidden = 9 | skip = ./.git,./.licenses,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock 10 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/arduino/mdns-discovery 2 | 3 | go 1.25.2 4 | 5 | require ( 6 | github.com/arduino/go-properties-orderedmap v1.8.1 7 | github.com/arduino/pluggable-discovery-protocol-handler/v2 v2.2.1 8 | github.com/hashicorp/mdns v1.0.6 9 | ) 10 | 11 | require ( 12 | github.com/arduino/go-paths-helper v1.14.0 // indirect 13 | github.com/miekg/dns v1.1.68 // indirect 14 | golang.org/x/mod v0.24.0 // indirect 15 | golang.org/x/net v0.46.0 // indirect 16 | golang.org/x/sync v0.14.0 // indirect 17 | golang.org/x/sys v0.37.0 // indirect 18 | golang.org/x/tools v0.33.0 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file 2 | version: 2 3 | 4 | updates: 5 | # Configure check for outdated GitHub Actions actions in workflows. 6 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md 7 | # See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 8 | - package-ecosystem: github-actions 9 | directory: / # Check the repository's workflows under /.github/workflows/ 10 | schedule: 11 | interval: daily 12 | labels: 13 | - "topic: infrastructure" 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/template-choosers/general/config.yml 2 | # 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 3 | 4 | blank_issues_enabled: false 5 | contact_links: 6 | - name: Learn about this project 7 | url: https://github.com/arduino/mdns-discovery#readme 8 | about: Information about the project is available here. 9 | - name: Support request 10 | url: https://forum.arduino.cc/ 11 | about: We can help you out on the Arduino Forum! 12 | - name: Discuss development work on the project 13 | url: https://groups.google.com/a/arduino.cc/g/developers 14 | about: Arduino Developers Mailing List 15 | -------------------------------------------------------------------------------- /version/version.go: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of mdns-discovery. 3 | // 4 | // Copyright 2021 ARDUINO SA (http://www.arduino.cc/) 5 | // 6 | // This software is released under the GNU General Public License version 3, 7 | // which covers the main part of arduino-cli. 8 | // The terms of this license can be found at: 9 | // https://www.gnu.org/licenses/gpl-3.0.en.html 10 | // 11 | // You can be released from the requirements of the above licenses by purchasing 12 | // a commercial license. Buying such a license is mandatory if you want to modify or 13 | // otherwise use the software for commercial activities involving the Arduino 14 | // software without disclosing the source code of your own applications. To purchase 15 | // a commercial license, send an email to license@arduino.cc. 16 | // 17 | 18 | package version 19 | 20 | // Version is the current version 21 | var Version = "unknown" 22 | 23 | // Commit is the current git tag 24 | var Commit = "unknown" 25 | 26 | // Timestamp is the current timestamp 27 | var Timestamp = "unknown" 28 | -------------------------------------------------------------------------------- /.github/workflows/check-workflows-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/master/workflow-templates/check-workflows-task.md 2 | name: Check Workflows 3 | 4 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows 5 | on: 6 | push: 7 | paths: 8 | - ".github/workflows/*.ya?ml" 9 | - "Taskfile.ya?ml" 10 | pull_request: 11 | paths: 12 | - ".github/workflows/*.ya?ml" 13 | - "Taskfile.ya?ml" 14 | schedule: 15 | # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. 16 | - cron: "0 8 * * TUE" 17 | workflow_dispatch: 18 | repository_dispatch: 19 | 20 | jobs: 21 | validate: 22 | runs-on: ubuntu-latest 23 | 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v6 27 | 28 | - name: Install Task 29 | uses: arduino/setup-task@v2 30 | with: 31 | repo-token: ${{ secrets.GITHUB_TOKEN }} 32 | version: 3.x 33 | 34 | - name: Validate workflows 35 | run: task --silent ci:validate 36 | -------------------------------------------------------------------------------- /args.go: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of mdns-discovery. 3 | // 4 | // Copyright 2021 ARDUINO SA (http://www.arduino.cc/) 5 | // 6 | // This software is released under the GNU General Public License version 3, 7 | // which covers the main part of arduino-cli. 8 | // The terms of this license can be found at: 9 | // https://www.gnu.org/licenses/gpl-3.0.en.html 10 | // 11 | // You can be released from the requirements of the above licenses by purchasing 12 | // a commercial license. Buying such a license is mandatory if you want to modify or 13 | // otherwise use the software for commercial activities involving the Arduino 14 | // software without disclosing the source code of your own applications. To purchase 15 | // a commercial license, send an email to license@arduino.cc. 16 | // 17 | 18 | package main 19 | 20 | import ( 21 | "fmt" 22 | "os" 23 | 24 | "github.com/arduino/mdns-discovery/version" 25 | ) 26 | 27 | func parseArgs() { 28 | for _, arg := range os.Args[1:] { 29 | if arg == "" { 30 | continue 31 | } 32 | if arg == "-v" || arg == "--version" { 33 | fmt.Printf("mdns-discovery %s (build timestamp: %s)\n", version.Version, version.Timestamp) 34 | os.Exit(0) 35 | } 36 | fmt.Fprintf(os.Stderr, "invalid argument: %s\n", arg) 37 | os.Exit(1) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /.github/workflows/spell-check-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md 2 | name: Spell Check 3 | 4 | env: 5 | # See: https://github.com/actions/setup-python/tree/main#available-versions-of-python 6 | PYTHON_VERSION: "3.9" 7 | 8 | # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows 9 | on: 10 | push: 11 | pull_request: 12 | schedule: 13 | # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. 14 | - cron: "0 8 * * TUE" 15 | workflow_dispatch: 16 | repository_dispatch: 17 | 18 | jobs: 19 | spellcheck: 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - name: Checkout repository 24 | uses: actions/checkout@v6 25 | 26 | - name: Install Python 27 | uses: actions/setup-python@v6 28 | with: 29 | python-version: ${{ env.PYTHON_VERSION }} 30 | 31 | - name: Install Poetry 32 | run: pip install poetry 33 | 34 | - name: Install Task 35 | uses: arduino/setup-task@v2 36 | with: 37 | repo-token: ${{ secrets.GITHUB_TOKEN }} 38 | version: 3.x 39 | 40 | - name: Spell check 41 | run: task general:check-spelling 42 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/github.com/hashicorp/mdns.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/hashicorp/mdns 3 | version: v1.0.6 4 | type: go 5 | summary: 6 | homepage: https://pkg.go.dev/github.com/hashicorp/mdns 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright (c) 2014 HashiCorp, Inc. 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | this software and associated documentation files (the "Software"), to deal in 15 | the Software without restriction, including without limitation the rights to 16 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 17 | the Software, and to permit persons to whom the Software is furnished to do so, 18 | subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 25 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 26 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | notices: [] 30 | -------------------------------------------------------------------------------- /.markdownlint.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown/.markdownlint.yml 2 | # See: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md 3 | # The code style defined in this file is the official standardized style to be used in all Arduino projects and should 4 | # not be modified. 5 | # Note: Rules disabled solely because they are redundant to Prettier are marked with a "Prettier" comment. 6 | 7 | default: false 8 | MD001: false 9 | MD002: false 10 | MD003: false # Prettier 11 | MD004: false # Prettier 12 | MD005: false # Prettier 13 | MD006: false # Prettier 14 | MD007: false # Prettier 15 | MD008: false # Prettier 16 | MD009: 17 | br_spaces: 0 18 | strict: true 19 | list_item_empty_lines: false # Prettier 20 | MD010: false # Prettier 21 | MD011: true 22 | MD012: false # Prettier 23 | MD013: false 24 | MD014: false 25 | MD018: true 26 | MD019: false # Prettier 27 | MD020: true 28 | MD021: false # Prettier 29 | MD022: false # Prettier 30 | MD023: false # Prettier 31 | MD024: false 32 | MD025: 33 | level: 1 34 | front_matter_title: '^\s*"?title"?\s*[:=]' 35 | MD026: false 36 | MD027: false # Prettier 37 | MD028: false 38 | MD029: 39 | style: one 40 | MD030: 41 | ul_single: 1 42 | ol_single: 1 43 | ul_multi: 1 44 | ol_multi: 1 45 | MD031: false # Prettier 46 | MD032: false # Prettier 47 | MD033: false 48 | MD034: false 49 | MD035: false # Prettier 50 | MD036: false 51 | MD037: true 52 | MD038: true 53 | MD039: true 54 | MD040: false 55 | MD041: false 56 | MD042: true 57 | MD043: false 58 | MD044: false 59 | MD045: true 60 | MD046: 61 | style: fenced 62 | MD047: false # Prettier 63 | -------------------------------------------------------------------------------- /.github/workflows/check-markdown-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-markdown-task.md 2 | name: Check Markdown 3 | 4 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows 5 | on: 6 | push: 7 | paths: 8 | - ".github/workflows/check-markdown-task.ya?ml" 9 | - ".markdown-link-check.json" 10 | - "Taskfile.ya?ml" 11 | - "**/.markdownlint*" 12 | - "**.mdx?" 13 | - "**.mkdn" 14 | - "**.mdown" 15 | - "**.markdown" 16 | pull_request: 17 | paths: 18 | - ".github/workflows/check-markdown-task.ya?ml" 19 | - ".markdown-link-check.json" 20 | - "Taskfile.ya?ml" 21 | - "**/.markdownlint*" 22 | - "**.mdx?" 23 | - "**.mkdn" 24 | - "**.mdown" 25 | - "**.markdown" 26 | schedule: 27 | # Run every Tuesday at 8 AM UTC to catch breakage caused by external changes. 28 | - cron: "0 8 * * TUE" 29 | workflow_dispatch: 30 | repository_dispatch: 31 | 32 | jobs: 33 | lint: 34 | runs-on: ubuntu-latest 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v6 39 | 40 | - name: Initialize markdownlint-cli problem matcher 41 | uses: xt0rted/markdownlint-problem-matcher@v3 42 | 43 | - name: Install Task 44 | uses: arduino/setup-task@v2 45 | with: 46 | repo-token: ${{ secrets.GITHUB_TOKEN }} 47 | version: 3.x 48 | 49 | - name: Lint 50 | run: task markdown:lint 51 | 52 | links: 53 | runs-on: ubuntu-latest 54 | 55 | steps: 56 | - name: Checkout repository 57 | uses: actions/checkout@v6 58 | 59 | - name: Install Task 60 | uses: arduino/setup-task@v2 61 | with: 62 | repo-token: ${{ secrets.GITHUB_TOKEN }} 63 | version: 3.x 64 | 65 | - name: Check links 66 | run: task --silent markdown:check-links 67 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-yaml/.yamllint.yml 2 | # See: https://yamllint.readthedocs.io/en/stable/configuration.html 3 | # The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and 4 | # should not be modified. 5 | # Note: Rules disabled solely because they are redundant to Prettier are marked with a "Prettier" comment. 6 | 7 | rules: 8 | braces: 9 | level: error 10 | forbid: non-empty 11 | min-spaces-inside: -1 # Prettier 12 | max-spaces-inside: -1 # Prettier 13 | min-spaces-inside-empty: -1 # Prettier 14 | max-spaces-inside-empty: -1 # Prettier 15 | brackets: 16 | level: error 17 | forbid: non-empty 18 | min-spaces-inside: -1 # Prettier 19 | max-spaces-inside: -1 # Prettier 20 | min-spaces-inside-empty: -1 # Prettier 21 | max-spaces-inside-empty: -1 # Prettier 22 | colons: disable # Prettier 23 | commas: disable # Prettier 24 | comments: disable # Prettier 25 | comments-indentation: disable # Prettier 26 | document-end: disable # Prettier 27 | document-start: disable 28 | empty-lines: disable # Prettier 29 | empty-values: disable 30 | hyphens: disable # Prettier 31 | indentation: disable # Prettier 32 | key-duplicates: disable # Prettier 33 | key-ordering: disable 34 | line-length: 35 | level: warning 36 | max: 120 37 | allow-non-breakable-words: true 38 | allow-non-breakable-inline-mappings: true 39 | new-line-at-end-of-file: disable # Prettier 40 | new-lines: disable # Prettier 41 | octal-values: 42 | level: warning 43 | forbid-implicit-octal: true 44 | forbid-explicit-octal: false 45 | quoted-strings: disable 46 | trailing-spaces: disable # Prettier 47 | truthy: 48 | level: error 49 | allowed-values: 50 | - "true" 51 | - "false" 52 | - "on" # Used by GitHub Actions as a workflow key. 53 | check-keys: true 54 | 55 | yaml-files: 56 | # Source: https://github.com/ikatyang/linguist-languages/blob/master/data/YAML.json (used by Prettier) 57 | - ".clang-format" 58 | - ".clang-tidy" 59 | - ".gemrc" 60 | - ".yamllint" 61 | - "glide.lock" 62 | - "*.yml" 63 | - "*.mir" 64 | - "*.reek" 65 | - "*.rviz" 66 | - "*.sublime-syntax" 67 | - "*.syntax" 68 | - "*.yaml" 69 | - "*.yaml-tmlanguage" 70 | - "*.yaml.sed" 71 | - "*.yml.mysql" 72 | 73 | ignore: | 74 | /.git/ 75 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/forms/platform-dependent/bug-report.yml 2 | # See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms 3 | 4 | name: Feature request 5 | description: Suggest an enhancement to this project. 6 | labels: 7 | - "type: enhancement" 8 | body: 9 | - type: textarea 10 | id: description 11 | attributes: 12 | label: Describe the request 13 | validations: 14 | required: true 15 | - type: textarea 16 | id: current 17 | attributes: 18 | label: Describe the current behavior 19 | description: | 20 | What is the current behavior of mdns-discovery in relation to your request? 21 | How can we reproduce that behavior? 22 | validations: 23 | required: true 24 | - type: input 25 | id: project-version 26 | attributes: 27 | label: mdns-discovery version 28 | description: | 29 | Which version of mdns-discovery are you using? 30 | (output of `mdns-discovery --version`) 31 | _This should be the most recent version available._ 32 | validations: 33 | required: true 34 | - type: dropdown 35 | id: os 36 | attributes: 37 | label: Operating system 38 | description: Which operating system(s) are you using on your computer? 39 | multiple: true 40 | options: 41 | - Windows 42 | - Linux 43 | - macOS 44 | - N/A 45 | validations: 46 | required: true 47 | - type: input 48 | id: os-version 49 | attributes: 50 | label: Operating system version 51 | description: Which version of the operating system are you using on your computer? 52 | validations: 53 | required: true 54 | - type: textarea 55 | id: additional 56 | attributes: 57 | label: Additional context 58 | description: Add any additional information here. 59 | validations: 60 | required: false 61 | - type: checkboxes 62 | id: checklist 63 | attributes: 64 | label: Issue checklist 65 | description: Please double-check that you have done each of the following things before submitting the issue. 66 | options: 67 | - label: I searched for previous requests in [the issue tracker](https://github.com/arduino/mdns-discovery/issues?q=) 68 | required: true 69 | - label: I verified the feature was still missing when using the latest version 70 | required: true 71 | - label: My request contains all necessary details 72 | required: true 73 | -------------------------------------------------------------------------------- /.licensed.yml: -------------------------------------------------------------------------------- 1 | # See: https://github.com/github/licensed/blob/master/docs/configuration.md 2 | sources: 3 | go: true 4 | 5 | apps: 6 | - source_path: ./ 7 | 8 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies/GPL-3.0/.licensed.yml 9 | allowed: 10 | # The following are based on: https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses 11 | - gpl-1.0-or-later 12 | - gpl-1.0+ # Deprecated ID for `gpl-1.0-or-later` 13 | - gpl-2.0-or-later 14 | - gpl-2.0+ # Deprecated ID for `gpl-2.0-or-later` 15 | - gpl-3.0-only 16 | - gpl-3.0 # Deprecated ID for `gpl-3.0-only` 17 | - gpl-3.0-or-later 18 | - gpl-3.0+ # Deprecated ID for `gpl-3.0-or-later` 19 | - lgpl-2.0-or-later 20 | - lgpl-2.0+ # Deprecated ID for `lgpl-2.0-or-later` 21 | - lgpl-2.1-only 22 | - lgpl-2.1 # Deprecated ID for `lgpl-2.1-only` 23 | - lgpl-2.1-or-later 24 | - lgpl-2.1+ # Deprecated ID for `lgpl-2.1-or-later` 25 | - lgpl-3.0-only 26 | - lgpl-3.0 # Deprecated ID for `lgpl-3.0-only` 27 | - lgpl-3.0-or-later 28 | - lgpl-3.0+ # Deprecated ID for `lgpl-3.0-or-later` 29 | - fsfap 30 | - apache-2.0 31 | - artistic-2.0 32 | - clartistic 33 | - sleepycat 34 | - bsl-1.0 35 | - bsd-3-clause 36 | - cecill-2.0 37 | - bsd-3-clause-clear 38 | # "Cryptix General License" - no SPDX ID (https://github.com/spdx/license-list-XML/issues/456) 39 | - ecos-2.0 40 | - ecl-2.0 41 | - efl-2.0 42 | - eudatagrid 43 | - mit 44 | - bsd-2-clause # Subsumed by `bsd-2-clause-views` 45 | - bsd-2-clause-netbsd # Deprecated ID for `bsd-2-clause` 46 | - bsd-2-clause-views # This is the version linked from https://www.gnu.org/licenses/license-list.html#FreeBSD 47 | - bsd-2-clause-freebsd # Deprecated ID for `bsd-2-clause-views` 48 | - ftl 49 | - hpnd 50 | - imatix 51 | - imlib2 52 | - ijg 53 | # "Informal license" - this is a general class of license 54 | - intel 55 | - isc 56 | - mpl-2.0 57 | - ncsa 58 | # "License of Netscape JavaScript" - no SPDX ID 59 | - oldap-2.7 60 | # "License of Perl 5 and below" - possibly `Artistic-1.0-Perl` ? 61 | - cc0-1.0 62 | - cc-pddc 63 | - psf-2.0 64 | - ruby 65 | - sgi-b-2.0 66 | - smlnj 67 | - standardml-nj # Deprecated ID for `smlnj` 68 | - unicode-dfs-2015 69 | - upl-1.0 70 | - unlicense 71 | - vim 72 | - w3c 73 | - wtfpl 74 | - lgpl-2.0-or-later with wxwindows-exception-3.1 75 | - wxwindows # Deprecated ID for `lgpl-2.0-or-later with wxwindows-exception-3.1` 76 | - x11 77 | - xfree86-1.1 78 | - zlib 79 | - zpl-2.0 80 | - zpl-2.1 81 | # The following are based on individual license text 82 | - eupl-1.2 83 | - liliq-r-1.1 84 | - liliq-rplus-1.1 85 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/github.com/miekg/dns.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/miekg/dns 3 | version: v1.1.68 4 | type: go 5 | summary: Package dns implements a full featured interface to the Domain Name System. 6 | homepage: https://pkg.go.dev/github.com/miekg/dns 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: LICENSE 10 | text: "BSD 3-Clause License\n\nCopyright (c) 2009, The Go Authors. Extensions copyright 11 | (c) 2011, Miek Gieben. \nAll rights reserved.\n\nRedistribution and use in source 12 | and binary forms, with or without\nmodification, are permitted provided that the 13 | following conditions are met:\n\n1. Redistributions of source code must retain 14 | the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. 15 | Redistributions in binary form must reproduce the above copyright notice,\n this 16 | list of conditions and the following disclaimer in the documentation\n and/or 17 | other materials provided with the distribution.\n\n3. Neither the name of the 18 | copyright holder nor the names of its\n contributors may be used to endorse 19 | or promote products derived from\n this software without specific prior written 20 | permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" 30 | - sources: COPYRIGHT 31 | text: | 32 | Copyright 2009 The Go Authors. All rights reserved. Use of this source code 33 | is governed by a BSD-style license that can be found in the LICENSE file. 34 | Extensions of the original work are copyright (c) 2011 Miek Gieben 35 | 36 | Copyright 2011 Miek Gieben. All rights reserved. Use of this source code is 37 | governed by a BSD-style license that can be found in the LICENSE file. 38 | 39 | Copyright 2014 CloudFlare. All rights reserved. Use of this source code is 40 | governed by a BSD-style license that can be found in the LICENSE file. 41 | notices: 42 | - sources: AUTHORS 43 | text: Miek Gieben 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/forms/platform-dependent/bug-report.yml 2 | # See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms 3 | 4 | name: Bug report 5 | description: Report a problem with the code or documentation in this repository. 6 | labels: 7 | - "type: imperfection" 8 | body: 9 | - type: textarea 10 | id: description 11 | attributes: 12 | label: Describe the problem 13 | validations: 14 | required: true 15 | - type: textarea 16 | id: reproduce 17 | attributes: 18 | label: To reproduce 19 | description: Provide the specific set of steps we can follow to reproduce the problem. 20 | validations: 21 | required: true 22 | - type: textarea 23 | id: expected 24 | attributes: 25 | label: Expected behavior 26 | description: What would you expect to happen after following those instructions? 27 | validations: 28 | required: true 29 | - type: input 30 | id: project-version 31 | attributes: 32 | label: mdns-discovery version 33 | description: | 34 | Which version of mdns-discovery are you using? 35 | (output of `mdns-discovery --version`) 36 | _This should be the most recent version available._ 37 | validations: 38 | required: true 39 | - type: dropdown 40 | id: os 41 | attributes: 42 | label: Operating system 43 | description: Which operating system(s) are you using on your computer? 44 | multiple: true 45 | options: 46 | - Windows 47 | - Linux 48 | - macOS 49 | - N/A 50 | validations: 51 | required: true 52 | - type: input 53 | id: os-version 54 | attributes: 55 | label: Operating system version 56 | description: Which version of the operating system are you using on your computer? 57 | validations: 58 | required: true 59 | - type: textarea 60 | id: additional 61 | attributes: 62 | label: Additional context 63 | description: Add any additional information here. 64 | validations: 65 | required: false 66 | - type: checkboxes 67 | id: checklist 68 | attributes: 69 | label: Issue checklist 70 | description: Please double-check that you have done each of the following things before submitting the issue. 71 | options: 72 | - label: I searched for previous reports in [the issue tracker](https://github.com/arduino/mdns-discovery/issues?q=) 73 | required: true 74 | - label: I verified the problem still occurs when using the latest version 75 | required: true 76 | - label: My report contains all necessary details 77 | required: true 78 | -------------------------------------------------------------------------------- /.github/workflows/check-license.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-license.md 2 | name: Check License 3 | 4 | env: 5 | # TODO: Define the project's license file name here: 6 | EXPECTED_LICENSE_FILENAME: LICENSE.txt 7 | # SPDX identifier: https://spdx.org/licenses/ 8 | # TODO: Define the project's license type here 9 | EXPECTED_LICENSE_TYPE: GPL-3.0 10 | 11 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows 12 | on: 13 | push: 14 | paths: 15 | - ".github/workflows/check-license.ya?ml" 16 | # See: https://github.com/licensee/licensee/blob/master/docs/what-we-look-at.md#detecting-the-license-file 17 | - "[cC][oO][pP][yY][iI][nN][gG]*" 18 | - "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*" 19 | - "[lL][iI][cC][eE][nN][cCsS][eE]*" 20 | - "[oO][fF][lL]*" 21 | - "[pP][aA][tT][eE][nN][tT][sS]*" 22 | pull_request: 23 | paths: 24 | - ".github/workflows/check-license.ya?ml" 25 | - "[cC][oO][pP][yY][iI][nN][gG]*" 26 | - "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*" 27 | - "[lL][iI][cC][eE][nN][cCsS][eE]*" 28 | - "[oO][fF][lL]*" 29 | - "[pP][aA][tT][eE][nN][tT][sS]*" 30 | workflow_dispatch: 31 | repository_dispatch: 32 | 33 | jobs: 34 | check-license: 35 | runs-on: ubuntu-latest 36 | 37 | steps: 38 | - name: Checkout repository 39 | uses: actions/checkout@v6 40 | 41 | - name: Install Ruby 42 | uses: ruby/setup-ruby@v1 43 | with: 44 | ruby-version: ruby # Install latest version 45 | 46 | - name: Install licensee 47 | run: gem install licensee 48 | 49 | - name: Check license file 50 | run: | 51 | EXIT_STATUS=0 52 | # See: https://github.com/licensee/licensee 53 | LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)" 54 | DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')" 55 | echo "Detected license file: $DETECTED_LICENSE_FILE" 56 | if [ "$DETECTED_LICENSE_FILE" != "\"${EXPECTED_LICENSE_FILENAME}\"" ]; then 57 | echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: $EXPECTED_LICENSE_FILENAME" 58 | EXIT_STATUS=1 59 | fi 60 | DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')" 61 | echo "Detected license type: $DETECTED_LICENSE_TYPE" 62 | if [ "$DETECTED_LICENSE_TYPE" != "\"${EXPECTED_LICENSE_TYPE}\"" ]; then 63 | echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${EXPECTED_LICENSE_TYPE}\"" 64 | EXIT_STATUS=1 65 | fi 66 | exit $EXIT_STATUS 67 | -------------------------------------------------------------------------------- /.github/workflows/check-yaml-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-yaml-task.md 2 | name: Check YAML 3 | 4 | env: 5 | # See: https://github.com/actions/setup-python/tree/main#available-versions-of-python 6 | PYTHON_VERSION: "3.9" 7 | 8 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows 9 | on: 10 | push: 11 | paths: 12 | - ".yamllint*" 13 | - "poetry.lock" 14 | - "pyproject.toml" 15 | # Source: https://github.com/ikatyang/linguist-languages/blob/master/data/YAML.json (used by Prettier) 16 | - "**/.clang-format" 17 | - "**/.clang-tidy" 18 | - "**/.gemrc" 19 | - "**/glide.lock" 20 | - "**.ya?ml*" 21 | - "**.mir" 22 | - "**.reek" 23 | - "**.rviz" 24 | - "**.sublime-syntax" 25 | - "**.syntax" 26 | pull_request: 27 | paths: 28 | - ".yamllint*" 29 | - "poetry.lock" 30 | - "pyproject.toml" 31 | # Source: https://github.com/ikatyang/linguist-languages/blob/master/data/YAML.json (used by Prettier) 32 | - "**/.clang-format" 33 | - "**/.clang-tidy" 34 | - "**/.gemrc" 35 | - "**/glide.lock" 36 | - "**.ya?ml*" 37 | - "**.mir" 38 | - "**.reek" 39 | - "**.rviz" 40 | - "**.sublime-syntax" 41 | - "**.syntax" 42 | workflow_dispatch: 43 | repository_dispatch: 44 | 45 | jobs: 46 | check: 47 | name: ${{ matrix.configuration.name }} 48 | runs-on: ubuntu-latest 49 | 50 | strategy: 51 | fail-fast: false 52 | 53 | matrix: 54 | configuration: 55 | - name: Generate problem matcher output 56 | # yamllint's "github" output type produces annotated diffs, but is not useful to humans reading the log. 57 | format: github 58 | # The other matrix job is used to set the result, so this job is configured to always pass. 59 | continue-on-error: true 60 | - name: Check formatting 61 | # yamllint's "colored" output type is most suitable for humans reading the log. 62 | format: colored 63 | continue-on-error: false 64 | 65 | steps: 66 | - name: Checkout repository 67 | uses: actions/checkout@v6 68 | 69 | - name: Install Python 70 | uses: actions/setup-python@v6 71 | with: 72 | python-version: ${{ env.PYTHON_VERSION }} 73 | 74 | - name: Install Poetry 75 | run: pip install poetry 76 | 77 | - name: Install Task 78 | uses: arduino/setup-task@v2 79 | with: 80 | repo-token: ${{ secrets.GITHUB_TOKEN }} 81 | version: 3.x 82 | 83 | - name: Check YAML 84 | continue-on-error: ${{ matrix.configuration.continue-on-error }} 85 | run: task yaml:lint YAMLLINT_FORMAT=${{ matrix.configuration.format }} 86 | -------------------------------------------------------------------------------- /.github/workflows/check-taskfiles.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md 2 | name: Check Taskfiles 3 | 4 | env: 5 | # See: https://github.com/actions/setup-node/#readme 6 | NODE_VERSION: 16.x 7 | 8 | # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows 9 | on: 10 | create: 11 | push: 12 | paths: 13 | - ".github/workflows/check-taskfiles.ya?ml" 14 | - "package.json" 15 | - "package-lock.json" 16 | - "**/Taskfile.ya?ml" 17 | - "**/DistTasks.ya?ml" 18 | pull_request: 19 | paths: 20 | - ".github/workflows/check-taskfiles.ya?ml" 21 | - "package.json" 22 | - "package-lock.json" 23 | - "**/Taskfile.ya?ml" 24 | - "**/DistTasks.ya?ml" 25 | schedule: 26 | # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. 27 | - cron: "0 8 * * TUE" 28 | workflow_dispatch: 29 | repository_dispatch: 30 | 31 | jobs: 32 | run-determination: 33 | runs-on: ubuntu-latest 34 | outputs: 35 | result: ${{ steps.determination.outputs.result }} 36 | steps: 37 | - name: Determine if the rest of the workflow should run 38 | id: determination 39 | run: | 40 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 41 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 42 | if [[ 43 | "${{ github.event_name }}" != "create" || 44 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 45 | ]]; then 46 | # Run the other jobs. 47 | RESULT="true" 48 | else 49 | # There is no need to run the other jobs. 50 | RESULT="false" 51 | fi 52 | 53 | echo "result=$RESULT" >> $GITHUB_OUTPUT 54 | 55 | validate: 56 | name: Validate ${{ matrix.file }} 57 | needs: run-determination 58 | if: needs.run-determination.outputs.result == 'true' 59 | runs-on: ubuntu-latest 60 | 61 | strategy: 62 | fail-fast: false 63 | 64 | matrix: 65 | file: 66 | - ./**/Taskfile.yml 67 | - ./**/DistTasks.yml 68 | 69 | steps: 70 | - name: Checkout repository 71 | uses: actions/checkout@v6 72 | 73 | - name: Setup Node.js 74 | uses: actions/setup-node@v6 75 | with: 76 | node-version: ${{ env.NODE_VERSION }} 77 | 78 | - name: Download JSON schema for Taskfiles 79 | id: download-schema 80 | uses: carlosperate/download-file-action@v2 81 | with: 82 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json 83 | file-url: https://taskfile.dev/schema.json 84 | location: ${{ runner.temp }}/taskfile-schema 85 | 86 | - name: Install JSON schema validator 87 | run: npm install 88 | 89 | - name: Validate ${{ matrix.file }} 90 | run: | 91 | # See: https://github.com/ajv-validator/ajv-cli#readme 92 | npx \ 93 | --package=ajv-cli \ 94 | --package=ajv-formats \ 95 | ajv validate \ 96 | --all-errors \ 97 | --strict=false \ 98 | -c ajv-formats \ 99 | -s "${{ steps.download-schema.outputs.file-path }}" \ 100 | -d "${{ matrix.file }}" 101 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/golang.org/x/sys/unix.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/sys/unix 3 | version: v0.37.0 4 | type: go 5 | summary: Package unix contains an interface to the low-level operating system primitives. 6 | homepage: https://pkg.go.dev/golang.org/x/sys/unix 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: sys@v0.37.0/LICENSE 10 | text: | 11 | Copyright 2009 The Go Authors. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google LLC nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | - sources: sys@v0.37.0/PATENTS 39 | text: | 40 | Additional IP Rights Grant (Patents) 41 | 42 | "This implementation" means the copyrightable works distributed by 43 | Google as part of the Go project. 44 | 45 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 46 | no-charge, royalty-free, irrevocable (except as stated in this section) 47 | patent license to make, have made, use, offer to sell, sell, import, 48 | transfer and otherwise run, modify and propagate the contents of this 49 | implementation of Go, where such license applies only to those patent 50 | claims, both currently owned or controlled by Google and acquired in 51 | the future, licensable by Google that are necessarily infringed by this 52 | implementation of Go. This grant does not include claims that would be 53 | infringed only as a consequence of further modification of this 54 | implementation. If you or your agent or exclusive licensee institute or 55 | order or agree to the institution of patent litigation against any 56 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 57 | that this implementation of Go or any code incorporated within this 58 | implementation of Go constitutes direct or contributory patent 59 | infringement, or inducement of patent infringement, then any patent 60 | rights granted to you under this License for this implementation of Go 61 | shall terminate as of the date such litigation is filed. 62 | notices: [] 63 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/golang.org/x/net/ipv4.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/net/ipv4 3 | version: v0.46.0 4 | type: go 5 | summary: Package ipv4 implements IP-level socket options for the Internet Protocol 6 | version 4. 7 | homepage: https://pkg.go.dev/golang.org/x/net/ipv4 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: net@v0.46.0/LICENSE 11 | text: | 12 | Copyright 2009 The Go Authors. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google LLC nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | - sources: net@v0.46.0/PATENTS 40 | text: | 41 | Additional IP Rights Grant (Patents) 42 | 43 | "This implementation" means the copyrightable works distributed by 44 | Google as part of the Go project. 45 | 46 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 47 | no-charge, royalty-free, irrevocable (except as stated in this section) 48 | patent license to make, have made, use, offer to sell, sell, import, 49 | transfer and otherwise run, modify and propagate the contents of this 50 | implementation of Go, where such license applies only to those patent 51 | claims, both currently owned or controlled by Google and acquired in 52 | the future, licensable by Google that are necessarily infringed by this 53 | implementation of Go. This grant does not include claims that would be 54 | infringed only as a consequence of further modification of this 55 | implementation. If you or your agent or exclusive licensee institute or 56 | order or agree to the institution of patent litigation against any 57 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 58 | that this implementation of Go or any code incorporated within this 59 | implementation of Go constitutes direct or contributory patent 60 | infringement, or inducement of patent infringement, then any patent 61 | rights granted to you under this License for this implementation of Go 62 | shall terminate as of the date such litigation is filed. 63 | notices: [] 64 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/golang.org/x/net/ipv6.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/net/ipv6 3 | version: v0.46.0 4 | type: go 5 | summary: Package ipv6 implements IP-level socket options for the Internet Protocol 6 | version 6. 7 | homepage: https://pkg.go.dev/golang.org/x/net/ipv6 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: net@v0.46.0/LICENSE 11 | text: | 12 | Copyright 2009 The Go Authors. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google LLC nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | - sources: net@v0.46.0/PATENTS 40 | text: | 41 | Additional IP Rights Grant (Patents) 42 | 43 | "This implementation" means the copyrightable works distributed by 44 | Google as part of the Go project. 45 | 46 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 47 | no-charge, royalty-free, irrevocable (except as stated in this section) 48 | patent license to make, have made, use, offer to sell, sell, import, 49 | transfer and otherwise run, modify and propagate the contents of this 50 | implementation of Go, where such license applies only to those patent 51 | claims, both currently owned or controlled by Google and acquired in 52 | the future, licensable by Google that are necessarily infringed by this 53 | implementation of Go. This grant does not include claims that would be 54 | infringed only as a consequence of further modification of this 55 | implementation. If you or your agent or exclusive licensee institute or 56 | order or agree to the institution of patent litigation against any 57 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 58 | that this implementation of Go or any code incorporated within this 59 | implementation of Go constitutes direct or contributory patent 60 | infringement, or inducement of patent infringement, then any patent 61 | rights granted to you under this License for this implementation of Go 62 | shall terminate as of the date such litigation is filed. 63 | notices: [] 64 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/golang.org/x/net/internal/socket.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/net/internal/socket 3 | version: v0.46.0 4 | type: go 5 | summary: Package socket provides a portable interface for socket system calls. 6 | homepage: https://pkg.go.dev/golang.org/x/net/internal/socket 7 | license: bsd-3-clause 8 | licenses: 9 | - sources: net@v0.46.0/LICENSE 10 | text: | 11 | Copyright 2009 The Go Authors. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google LLC nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | - sources: net@v0.46.0/PATENTS 39 | text: | 40 | Additional IP Rights Grant (Patents) 41 | 42 | "This implementation" means the copyrightable works distributed by 43 | Google as part of the Go project. 44 | 45 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 46 | no-charge, royalty-free, irrevocable (except as stated in this section) 47 | patent license to make, have made, use, offer to sell, sell, import, 48 | transfer and otherwise run, modify and propagate the contents of this 49 | implementation of Go, where such license applies only to those patent 50 | claims, both currently owned or controlled by Google and acquired in 51 | the future, licensable by Google that are necessarily infringed by this 52 | implementation of Go. This grant does not include claims that would be 53 | infringed only as a consequence of further modification of this 54 | implementation. If you or your agent or exclusive licensee institute or 55 | order or agree to the institution of patent litigation against any 56 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 57 | that this implementation of Go or any code incorporated within this 58 | implementation of Go constitutes direct or contributory patent 59 | infringement, or inducement of patent infringement, then any patent 60 | rights granted to you under this License for this implementation of Go 61 | shall terminate as of the date such litigation is filed. 62 | notices: [] 63 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/golang.org/x/net/internal/iana.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/net/internal/iana 3 | version: v0.46.0 4 | type: go 5 | summary: Package iana provides protocol number resources managed by the Internet Assigned 6 | Numbers Authority (IANA). 7 | homepage: https://pkg.go.dev/golang.org/x/net/internal/iana 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: net@v0.46.0/LICENSE 11 | text: | 12 | Copyright 2009 The Go Authors. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google LLC nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | - sources: net@v0.46.0/PATENTS 40 | text: | 41 | Additional IP Rights Grant (Patents) 42 | 43 | "This implementation" means the copyrightable works distributed by 44 | Google as part of the Go project. 45 | 46 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 47 | no-charge, royalty-free, irrevocable (except as stated in this section) 48 | patent license to make, have made, use, offer to sell, sell, import, 49 | transfer and otherwise run, modify and propagate the contents of this 50 | implementation of Go, where such license applies only to those patent 51 | claims, both currently owned or controlled by Google and acquired in 52 | the future, licensable by Google that are necessarily infringed by this 53 | implementation of Go. This grant does not include claims that would be 54 | infringed only as a consequence of further modification of this 55 | implementation. If you or your agent or exclusive licensee institute or 56 | order or agree to the institution of patent litigation against any 57 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 58 | that this implementation of Go or any code incorporated within this 59 | implementation of Go constitutes direct or contributory patent 60 | infringement, or inducement of patent infringement, then any patent 61 | rights granted to you under this License for this implementation of Go 62 | shall terminate as of the date such litigation is filed. 63 | notices: [] 64 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/golang.org/x/net/bpf.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: golang.org/x/net/bpf 3 | version: v0.46.0 4 | type: go 5 | summary: Package bpf implements marshaling and unmarshaling of programs for the Berkeley 6 | Packet Filter virtual machine, and provides a Go implementation of the virtual machine. 7 | homepage: https://pkg.go.dev/golang.org/x/net/bpf 8 | license: bsd-3-clause 9 | licenses: 10 | - sources: net@v0.46.0/LICENSE 11 | text: | 12 | Copyright 2009 The Go Authors. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google LLC nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | - sources: net@v0.46.0/PATENTS 40 | text: | 41 | Additional IP Rights Grant (Patents) 42 | 43 | "This implementation" means the copyrightable works distributed by 44 | Google as part of the Go project. 45 | 46 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 47 | no-charge, royalty-free, irrevocable (except as stated in this section) 48 | patent license to make, have made, use, offer to sell, sell, import, 49 | transfer and otherwise run, modify and propagate the contents of this 50 | implementation of Go, where such license applies only to those patent 51 | claims, both currently owned or controlled by Google and acquired in 52 | the future, licensable by Google that are necessarily infringed by this 53 | implementation of Go. This grant does not include claims that would be 54 | infringed only as a consequence of further modification of this 55 | implementation. If you or your agent or exclusive licensee institute or 56 | order or agree to the institution of patent litigation against any 57 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 58 | that this implementation of Go or any code incorporated within this 59 | implementation of Go constitutes direct or contributory patent 60 | infringement, or inducement of patent infringement, then any patent 61 | rights granted to you under this License for this implementation of Go 62 | shall terminate as of the date such litigation is filed. 63 | notices: [] 64 | -------------------------------------------------------------------------------- /.github/workflows/check-go-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md 2 | name: Check Go 3 | 4 | env: 5 | # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax 6 | GO_VERSION: "1.25.2" 7 | 8 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows 9 | on: 10 | push: 11 | paths: 12 | - ".github/workflows/check-go-task.ya?ml" 13 | - "Taskfile.ya?ml" 14 | - "go.mod" 15 | - "go.sum" 16 | - "**.go" 17 | pull_request: 18 | paths: 19 | - ".github/workflows/check-go-task.ya?ml" 20 | - "Taskfile.ya?ml" 21 | - "go.mod" 22 | - "go.sum" 23 | - "**.go" 24 | workflow_dispatch: 25 | repository_dispatch: 26 | 27 | jobs: 28 | check-errors: 29 | runs-on: ubuntu-latest 30 | 31 | steps: 32 | - name: Checkout repository 33 | uses: actions/checkout@v6 34 | 35 | - name: Install Go 36 | uses: actions/setup-go@v6 37 | with: 38 | go-version: ${{ env.GO_VERSION }} 39 | 40 | - name: Install Task 41 | uses: arduino/setup-task@v2 42 | with: 43 | repo-token: ${{ secrets.GITHUB_TOKEN }} 44 | version: 3.x 45 | 46 | - name: Check for errors 47 | run: task go:vet 48 | 49 | check-outdated: 50 | runs-on: ubuntu-latest 51 | 52 | steps: 53 | - name: Checkout repository 54 | uses: actions/checkout@v6 55 | 56 | - name: Install Go 57 | uses: actions/setup-go@v6 58 | with: 59 | go-version: ${{ env.GO_VERSION }} 60 | 61 | - name: Install Task 62 | uses: arduino/setup-task@v2 63 | with: 64 | repo-token: ${{ secrets.GITHUB_TOKEN }} 65 | version: 3.x 66 | 67 | - name: Modernize usages of outdated APIs 68 | run: task go:fix 69 | 70 | - name: Check if any fixes were needed 71 | run: git diff --color --exit-code 72 | 73 | check-style: 74 | runs-on: ubuntu-latest 75 | 76 | steps: 77 | - name: Checkout repository 78 | uses: actions/checkout@v6 79 | 80 | - name: Install Go 81 | uses: actions/setup-go@v6 82 | with: 83 | go-version: ${{ env.GO_VERSION }} 84 | 85 | - name: Install Task 86 | uses: arduino/setup-task@v2 87 | with: 88 | repo-token: ${{ secrets.GITHUB_TOKEN }} 89 | version: 3.x 90 | 91 | - name: Install golint 92 | run: go install golang.org/x/lint/golint@latest 93 | 94 | - name: Check style 95 | run: task --silent go:lint 96 | 97 | check-formatting: 98 | runs-on: ubuntu-latest 99 | 100 | steps: 101 | - name: Checkout repository 102 | uses: actions/checkout@v6 103 | 104 | - name: Install Go 105 | uses: actions/setup-go@v6 106 | with: 107 | go-version: ${{ env.GO_VERSION }} 108 | 109 | - name: Install Task 110 | uses: arduino/setup-task@v2 111 | with: 112 | repo-token: ${{ secrets.GITHUB_TOKEN }} 113 | version: 3.x 114 | 115 | - name: Format code 116 | run: task go:format 117 | 118 | - name: Check formatting 119 | run: git diff --color --exit-code 120 | 121 | check-config: 122 | name: check-config (${{ matrix.module.path }}) 123 | runs-on: ubuntu-latest 124 | 125 | strategy: 126 | fail-fast: false 127 | 128 | matrix: 129 | module: 130 | # TODO: add paths of all Go modules here 131 | - path: ./ 132 | 133 | steps: 134 | - name: Checkout repository 135 | uses: actions/checkout@v6 136 | 137 | - name: Install Go 138 | uses: actions/setup-go@v6 139 | with: 140 | go-version: ${{ env.GO_VERSION }} 141 | 142 | - name: Run go mod tidy 143 | working-directory: ${{ matrix.module.path }} 144 | run: go mod tidy 145 | 146 | - name: Check whether any tidying was needed 147 | run: git diff --color --exit-code 148 | -------------------------------------------------------------------------------- /cache.go: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of mdns-discovery. 3 | // 4 | // Copyright 2018-2021 ARDUINO SA (http://www.arduino.cc/) 5 | // 6 | // This software is released under the GNU General Public License version 3, 7 | // which covers the main part of arduino-cli. 8 | // The terms of this license can be found at: 9 | // https://www.gnu.org/licenses/gpl-3.0.en.html 10 | // 11 | // You can be released from the requirements of the above licenses by purchasing 12 | // a commercial license. Buying such a license is mandatory if you want to modify or 13 | // otherwise use the software for commercial activities involving the Arduino 14 | // software without disclosing the source code of your own applications. To purchase 15 | // a commercial license, send an email to license@arduino.cc. 16 | // 17 | 18 | package main 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | "sync" 24 | "time" 25 | 26 | discovery "github.com/arduino/pluggable-discovery-protocol-handler/v2" 27 | ) 28 | 29 | // cacheItem stores TTL of discovered ports and its timer to handle TTL. 30 | type cacheItem struct { 31 | timerTTL *time.Timer 32 | ctx context.Context 33 | cancelFunc context.CancelFunc 34 | } 35 | 36 | // portsCached is a cache to store discovered ports with a TTL. 37 | // Ports that reach their TTL are automatically deleted and 38 | // main discovery process is notified. 39 | // All operations on the internal data are thread safe. 40 | type portsCache struct { 41 | data map[string]*cacheItem 42 | dataMutex sync.Mutex 43 | itemsTTL time.Duration 44 | deletionCallback func(port *discovery.Port) 45 | } 46 | 47 | // newCache creates a new portsCache and returns it. 48 | // itemsTTL is the TTL of a single item, when it's reached 49 | // the stored item is deleted. 50 | func newCache(itemsTTL time.Duration, deletionCallback func(port *discovery.Port)) *portsCache { 51 | return &portsCache{ 52 | itemsTTL: itemsTTL, 53 | data: make(map[string]*cacheItem), 54 | deletionCallback: deletionCallback, 55 | } 56 | } 57 | 58 | // storeOrUpdate stores a new port and sets its TTL or 59 | // updates the TTL if already stored. 60 | // Return true if the port TTL has been updated, false otherwise 61 | // storeOrUpdate is thread safe. 62 | func (c *portsCache) storeOrUpdate(port *discovery.Port) bool { 63 | key := fmt.Sprintf("%s:%s %s", port.Address, port.Properties.Get("port"), port.Properties.Get("board")) 64 | c.dataMutex.Lock() 65 | defer c.dataMutex.Unlock() 66 | // We need a cancellable context to avoid leaving 67 | // goroutines hanging if an item's timer TTL is stopped. 68 | ctx, cancelFunc := context.WithCancel(context.Background()) 69 | item, ok := c.data[key] 70 | timerTTL := time.NewTimer(c.itemsTTL) 71 | if ok { 72 | item.timerTTL.Stop() 73 | // If we stop the timer the goroutine that waits 74 | // for it to go off would just hang forever if we 75 | // don't cancel the item's context 76 | item.cancelFunc() 77 | item.timerTTL = timerTTL 78 | item.ctx = ctx 79 | item.cancelFunc = cancelFunc 80 | } else { 81 | item = &cacheItem{ 82 | timerTTL: timerTTL, 83 | ctx: ctx, 84 | cancelFunc: cancelFunc, 85 | } 86 | c.data[key] = item 87 | } 88 | 89 | go func(key string, item *cacheItem, port *discovery.Port) { 90 | select { 91 | case <-item.timerTTL.C: 92 | c.dataMutex.Lock() 93 | defer c.dataMutex.Unlock() 94 | c.deletionCallback(port) 95 | delete(c.data, key) 96 | return 97 | case <-item.ctx.Done(): 98 | // The TTL has been renewed, we also stop the timer 99 | // that keeps track of the TTL. 100 | // The channel of a stopped timer will never fire so 101 | // if keep waiting for it in this goroutine it will 102 | // hang forever. 103 | // Using a context we handle this gracefully. 104 | return 105 | } 106 | }(key, item, port) 107 | 108 | return ok 109 | } 110 | 111 | // clear removes all the stored items and stops their TTL timers. 112 | // clear is thread safe. 113 | func (c *portsCache) clear() { 114 | c.dataMutex.Lock() 115 | defer c.dataMutex.Unlock() 116 | for key, item := range c.data { 117 | item.timerTTL.Stop() 118 | item.cancelFunc() 119 | delete(c.data, key) 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /.github/workflows/check-go-dependencies-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md 2 | name: Check Go Dependencies 3 | 4 | env: 5 | # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax 6 | GO_VERSION: "1.25.2" 7 | 8 | # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows 9 | on: 10 | create: 11 | push: 12 | paths: 13 | - ".github/workflows/check-go-dependencies-task.ya?ml" 14 | - ".licenses/**" 15 | - ".licensed.json" 16 | - ".licensed.ya?ml" 17 | - "Taskfile.ya?ml" 18 | - "**/.gitmodules" 19 | - "**/go.mod" 20 | - "**/go.sum" 21 | pull_request: 22 | paths: 23 | - ".github/workflows/check-go-dependencies-task.ya?ml" 24 | - ".licenses/**" 25 | - ".licensed.json" 26 | - ".licensed.ya?ml" 27 | - "Taskfile.ya?ml" 28 | - "**/.gitmodules" 29 | - "**/go.mod" 30 | - "**/go.sum" 31 | schedule: 32 | # Run periodically to catch breakage caused by external changes. 33 | - cron: "0 8 * * WED" 34 | workflow_dispatch: 35 | repository_dispatch: 36 | 37 | jobs: 38 | run-determination: 39 | runs-on: ubuntu-latest 40 | outputs: 41 | result: ${{ steps.determination.outputs.result }} 42 | steps: 43 | - name: Determine if the rest of the workflow should run 44 | id: determination 45 | run: | 46 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 47 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 48 | if [[ 49 | "${{ github.event_name }}" != "create" || 50 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 51 | ]]; then 52 | # Run the other jobs. 53 | RESULT="true" 54 | else 55 | # There is no need to run the other jobs. 56 | RESULT="false" 57 | fi 58 | 59 | echo "::set-output name=result::$RESULT" 60 | 61 | check-cache: 62 | needs: run-determination 63 | if: needs.run-determination.outputs.result == 'true' 64 | runs-on: ubuntu-latest 65 | 66 | steps: 67 | - name: Checkout repository 68 | uses: actions/checkout@v6 69 | with: 70 | submodules: recursive 71 | 72 | - name: Install licensed 73 | uses: jonabc/setup-licensed@v1 74 | with: 75 | github_token: ${{ secrets.GITHUB_TOKEN }} 76 | version: 3.x 77 | 78 | - name: Install Go 79 | uses: actions/setup-go@v6 80 | with: 81 | go-version: ${{ env.GO_VERSION }} 82 | 83 | - name: Install Task 84 | uses: arduino/setup-task@v2 85 | with: 86 | repo-token: ${{ secrets.GITHUB_TOKEN }} 87 | version: 3.x 88 | 89 | - name: Update dependencies license metadata cache 90 | run: task --silent general:cache-dep-licenses 91 | 92 | - name: Check for outdated cache 93 | id: diff 94 | run: | 95 | git add . 96 | if ! git diff --cached --color --exit-code; then 97 | echo 98 | 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" 99 | exit 1 100 | fi 101 | 102 | # Some might find it convenient to have CI generate the cache rather than setting up for it locally 103 | - name: Upload cache to workflow artifact 104 | if: failure() && steps.diff.outcome == 'failure' 105 | uses: actions/upload-artifact@v6 106 | with: 107 | if-no-files-found: error 108 | include-hidden-files: true 109 | name: dep-licenses-cache 110 | path: .licenses/ 111 | 112 | check-deps: 113 | needs: run-determination 114 | if: needs.run-determination.outputs.result == 'true' 115 | runs-on: ubuntu-latest 116 | 117 | steps: 118 | - name: Checkout repository 119 | uses: actions/checkout@v6 120 | with: 121 | submodules: recursive 122 | 123 | - name: Install licensed 124 | uses: jonabc/setup-licensed@v1 125 | with: 126 | github_token: ${{ secrets.GITHUB_TOKEN }} 127 | version: 3.x 128 | 129 | - name: Install Go 130 | uses: actions/setup-go@v6 131 | with: 132 | go-version: ${{ env.GO_VERSION }} 133 | 134 | - name: Install Task 135 | uses: arduino/setup-task@v2 136 | with: 137 | repo-token: ${{ secrets.GITHUB_TOKEN }} 138 | version: 3.x 139 | 140 | - name: Check for dependencies with unapproved licenses 141 | run: task --silent general:check-dep-licenses 142 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md 2 | name: Sync Labels 3 | 4 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows 5 | on: 6 | push: 7 | paths: 8 | - ".github/workflows/sync-labels.ya?ml" 9 | - ".github/label-configuration-files/*.ya?ml" 10 | pull_request: 11 | paths: 12 | - ".github/workflows/sync-labels.ya?ml" 13 | - ".github/label-configuration-files/*.ya?ml" 14 | schedule: 15 | # Run daily at 8 AM UTC to sync with changes to shared label configurations. 16 | - cron: "0 8 * * *" 17 | workflow_dispatch: 18 | repository_dispatch: 19 | 20 | env: 21 | CONFIGURATIONS_FOLDER: .github/label-configuration-files 22 | CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file- 23 | 24 | jobs: 25 | check: 26 | runs-on: ubuntu-latest 27 | 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@v6 31 | 32 | - name: Download JSON schema for labels configuration file 33 | id: download-schema 34 | uses: carlosperate/download-file-action@v2 35 | with: 36 | file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json 37 | location: ${{ runner.temp }}/label-configuration-schema 38 | 39 | - name: Install JSON schema validator 40 | run: | 41 | sudo npm install \ 42 | --global \ 43 | ajv-cli \ 44 | ajv-formats 45 | 46 | - name: Validate local labels configuration 47 | run: | 48 | # See: https://github.com/ajv-validator/ajv-cli#readme 49 | ajv validate \ 50 | --all-errors \ 51 | -c ajv-formats \ 52 | -s "${{ steps.download-schema.outputs.file-path }}" \ 53 | -d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}" 54 | 55 | download: 56 | needs: check 57 | runs-on: ubuntu-latest 58 | 59 | strategy: 60 | matrix: 61 | filename: 62 | # Filenames of the shared configurations to apply to the repository in addition to the local configuration. 63 | # https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels 64 | - universal.yml 65 | 66 | steps: 67 | - name: Download 68 | uses: carlosperate/download-file-action@v2 69 | with: 70 | file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} 71 | 72 | - name: Pass configuration files to next job via workflow artifact 73 | uses: actions/upload-artifact@v6 74 | with: 75 | path: | 76 | *.yaml 77 | *.yml 78 | if-no-files-found: error 79 | name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }} 80 | 81 | sync: 82 | needs: download 83 | runs-on: ubuntu-latest 84 | 85 | steps: 86 | - name: Set environment variables 87 | run: | 88 | # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable 89 | echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV" 90 | 91 | - name: Determine whether to dry run 92 | id: dry-run 93 | if: > 94 | github.event_name == 'pull_request' || 95 | ( 96 | ( 97 | github.event_name == 'push' || 98 | github.event_name == 'workflow_dispatch' 99 | ) && 100 | github.ref != format('refs/heads/{0}', github.event.repository.default_branch) 101 | ) 102 | run: | 103 | # Use of this flag in the github-label-sync command will cause it to only check the validity of the 104 | # configuration. 105 | echo "::set-output name=flag::--dry-run" 106 | 107 | - name: Checkout repository 108 | uses: actions/checkout@v6 109 | 110 | - name: Download configuration file artifacts 111 | uses: actions/download-artifact@v7 112 | with: 113 | merge-multiple: true 114 | pattern: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}* 115 | path: ${{ env.CONFIGURATIONS_FOLDER }} 116 | 117 | - name: Remove unneeded artifacts 118 | uses: geekyeggo/delete-artifact@v5 119 | with: 120 | name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}* 121 | 122 | - name: Merge label configuration files 123 | run: | 124 | # Merge all configuration files 125 | shopt -s extglob 126 | cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}" 127 | 128 | - name: Install github-label-sync 129 | run: sudo npm install --global github-label-sync 130 | 131 | - name: Sync labels 132 | env: 133 | GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} 134 | run: | 135 | # See: https://github.com/Financial-Times/github-label-sync 136 | github-label-sync \ 137 | --labels "${{ env.MERGED_CONFIGURATION_PATH }}" \ 138 | ${{ steps.dry-run.outputs.flag }} \ 139 | ${{ github.repository }} 140 | -------------------------------------------------------------------------------- /.github/workflows/check-prettier-formatting-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md 2 | name: Check Prettier Formatting 3 | 4 | # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows 5 | on: 6 | push: 7 | paths: 8 | - ".github/workflows/check-prettier-formatting-task.ya?ml" 9 | - "Taskfile.ya?ml" 10 | - "**/.prettierignore" 11 | - "**/.prettierrc*" 12 | # CSS 13 | - "**.css" 14 | - "**.wxss" 15 | # PostCSS 16 | - "**.pcss" 17 | - "**.postcss" 18 | # Less 19 | - "**.less" 20 | # SCSS 21 | - "**.scss" 22 | # GraphQL 23 | - "**.graphqls?" 24 | - "**.gql" 25 | # handlebars 26 | - "**.handlebars" 27 | - "**.hbs" 28 | # HTML 29 | - "**.mjml" 30 | - "**.html?" 31 | - "**.html.hl" 32 | - "**.st" 33 | - "**.xht" 34 | - "**.xhtml" 35 | # Vue 36 | - "**.vue" 37 | # JavaScript 38 | - "**.flow" 39 | - "**._?jsb?" 40 | - "**.bones" 41 | - "**.cjs" 42 | - "**.es6?" 43 | - "**.frag" 44 | - "**.gs" 45 | - "**.jake" 46 | - "**.jscad" 47 | - "**.jsfl" 48 | - "**.js[ms]" 49 | - "**.[mn]js" 50 | - "**.pac" 51 | - "**.wxs" 52 | - "**.[xs]s?js" 53 | - "**.xsjslib" 54 | # JSX 55 | - "**.jsx" 56 | # TypeScript 57 | - "**.ts" 58 | # TSX 59 | - "**.tsx" 60 | # JSON 61 | - "**/.eslintrc" 62 | - "**.json" 63 | - "**.avsc" 64 | - "**.geojson" 65 | - "**.gltf" 66 | - "**.har" 67 | - "**.ice" 68 | - "**.JSON-tmLanguage" 69 | - "**.mcmeta" 70 | - "**.tfstate" 71 | - "**.topojson" 72 | - "**.webapp" 73 | - "**.webmanifest" 74 | - "**.yyp?" 75 | # JSONC 76 | - "**/.babelrc" 77 | - "**/.jscsrc" 78 | - "**/.js[hl]intrc" 79 | - "**.jsonc" 80 | - "**.sublime-*" 81 | # JSON5 82 | - "**.json5" 83 | # Markdown 84 | - "**.mdx?" 85 | - "**.markdown" 86 | - "**.mk?down" 87 | - "**.mdwn" 88 | - "**.mkdn?" 89 | - "**.ronn" 90 | - "**.workbook" 91 | # YAML 92 | - "**/.clang-format" 93 | - "**/.clang-tidy" 94 | - "**/.gemrc" 95 | - "**/glide.lock" 96 | - "**.ya?ml*" 97 | - "**.mir" 98 | - "**.reek" 99 | - "**.rviz" 100 | - "**.sublime-syntax" 101 | - "**.syntax" 102 | pull_request: 103 | paths: 104 | - ".github/workflows/check-prettier-formatting-task.ya?ml" 105 | - "Taskfile.ya?ml" 106 | - "**/.prettierignore" 107 | - "**/.prettierrc*" 108 | # CSS 109 | - "**.css" 110 | - "**.wxss" 111 | # PostCSS 112 | - "**.pcss" 113 | - "**.postcss" 114 | # Less 115 | - "**.less" 116 | # SCSS 117 | - "**.scss" 118 | # GraphQL 119 | - "**.graphqls?" 120 | - "**.gql" 121 | # handlebars 122 | - "**.handlebars" 123 | - "**.hbs" 124 | # HTML 125 | - "**.mjml" 126 | - "**.html?" 127 | - "**.html.hl" 128 | - "**.st" 129 | - "**.xht" 130 | - "**.xhtml" 131 | # Vue 132 | - "**.vue" 133 | # JavaScript 134 | - "**.flow" 135 | - "**._?jsb?" 136 | - "**.bones" 137 | - "**.cjs" 138 | - "**.es6?" 139 | - "**.frag" 140 | - "**.gs" 141 | - "**.jake" 142 | - "**.jscad" 143 | - "**.jsfl" 144 | - "**.js[ms]" 145 | - "**.[mn]js" 146 | - "**.pac" 147 | - "**.wxs" 148 | - "**.[xs]s?js" 149 | - "**.xsjslib" 150 | # JSX 151 | - "**.jsx" 152 | # TypeScript 153 | - "**.ts" 154 | # TSX 155 | - "**.tsx" 156 | # JSON 157 | - "**/.eslintrc" 158 | - "**.json" 159 | - "**.avsc" 160 | - "**.geojson" 161 | - "**.gltf" 162 | - "**.har" 163 | - "**.ice" 164 | - "**.JSON-tmLanguage" 165 | - "**.mcmeta" 166 | - "**.tfstate" 167 | - "**.topojson" 168 | - "**.webapp" 169 | - "**.webmanifest" 170 | - "**.yyp?" 171 | # JSONC 172 | - "**/.babelrc" 173 | - "**/.jscsrc" 174 | - "**/.js[hl]intrc" 175 | - "**.jsonc" 176 | - "**.sublime-*" 177 | # JSON5 178 | - "**.json5" 179 | # Markdown 180 | - "**.mdx?" 181 | - "**.markdown" 182 | - "**.mk?down" 183 | - "**.mdwn" 184 | - "**.mkdn?" 185 | - "**.ronn" 186 | - "**.workbook" 187 | # YAML 188 | - "**/.clang-format" 189 | - "**/.clang-tidy" 190 | - "**/.gemrc" 191 | - "**/glide.lock" 192 | - "**.ya?ml*" 193 | - "**.mir" 194 | - "**.reek" 195 | - "**.rviz" 196 | - "**.sublime-syntax" 197 | - "**.syntax" 198 | workflow_dispatch: 199 | repository_dispatch: 200 | 201 | jobs: 202 | check: 203 | runs-on: ubuntu-latest 204 | 205 | steps: 206 | - name: Checkout repository 207 | uses: actions/checkout@v6 208 | 209 | - name: Install Task 210 | uses: arduino/setup-task@v2 211 | with: 212 | repo-token: ${{ secrets.GITHUB_TOKEN }} 213 | version: 3.x 214 | 215 | - name: Format with Prettier 216 | run: task general:format-prettier 217 | 218 | - name: Check formatting 219 | run: git diff --color --exit-code 220 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "codespell" 3 | version = "2.1.0" 4 | description = "Codespell" 5 | category = "dev" 6 | optional = false 7 | python-versions = ">=3.5" 8 | 9 | [package.extras] 10 | dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency"] 11 | hard-encoding-detection = ["chardet"] 12 | 13 | [[package]] 14 | name = "pathspec" 15 | version = "0.9.0" 16 | description = "Utility library for gitignore style pattern matching of file paths." 17 | category = "dev" 18 | optional = false 19 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" 20 | 21 | [[package]] 22 | name = "pyyaml" 23 | version = "5.4.1" 24 | description = "YAML parser and emitter for Python" 25 | category = "dev" 26 | optional = false 27 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" 28 | 29 | [[package]] 30 | name = "yamllint" 31 | version = "1.26.2" 32 | description = "A linter for YAML files." 33 | category = "dev" 34 | optional = false 35 | python-versions = ">=3.5" 36 | 37 | [package.dependencies] 38 | pathspec = ">=0.5.3" 39 | pyyaml = "*" 40 | 41 | [metadata] 42 | lock-version = "1.1" 43 | python-versions = "^3.9" 44 | content-hash = "5e7ea9a9dbd153e58702281bb1e6efca9e8bddce3f608c3ffd59843f89984f6a" 45 | 46 | [metadata.files] 47 | codespell = [ 48 | {file = "codespell-2.1.0-py3-none-any.whl", hash = "sha256:b864c7d917316316ac24272ee992d7937c3519be4569209c5b60035ac5d569b5"}, 49 | {file = "codespell-2.1.0.tar.gz", hash = "sha256:19d3fe5644fef3425777e66f225a8c82d39059dcfe9edb3349a8a2cf48383ee5"}, 50 | ] 51 | pathspec = [ 52 | {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, 53 | {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, 54 | ] 55 | pyyaml = [ 56 | {file = "PyYAML-5.4.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922"}, 57 | {file = "PyYAML-5.4.1-cp27-cp27m-win32.whl", hash = "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393"}, 58 | {file = "PyYAML-5.4.1-cp27-cp27m-win_amd64.whl", hash = "sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8"}, 59 | {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, 60 | {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, 61 | {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, 62 | {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"}, 63 | {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"}, 64 | {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, 65 | {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, 66 | {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, 67 | {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, 68 | {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"}, 69 | {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"}, 70 | {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, 71 | {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, 72 | {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, 73 | {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, 74 | {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"}, 75 | {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"}, 76 | {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, 77 | {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, 78 | {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, 79 | {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, 80 | {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"}, 81 | {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"}, 82 | {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, 83 | {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, 84 | {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, 85 | ] 86 | yamllint = [ 87 | {file = "yamllint-1.26.2.tar.gz", hash = "sha256:0b08a96750248fdf21f1e8193cb7787554ef75ed57b27f621cd6b3bf09af11a1"}, 88 | ] 89 | -------------------------------------------------------------------------------- /.github/workflows/publish-go-tester-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/publish-go-tester-task.md 2 | name: Publish Tester Build 3 | 4 | # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/publish-go-tester-task.ya?ml" 10 | - "go.mod" 11 | - "go.sum" 12 | - "Taskfile.ya?ml" 13 | - "DistTasks.ya?ml" 14 | - "**.go" 15 | pull_request: 16 | paths: 17 | - ".github/workflows/publish-go-tester-task.ya?ml" 18 | - "go.mod" 19 | - "go.sum" 20 | - "Taskfile.ya?ml" 21 | - "DistTasks.ya?ml" 22 | - "**.go" 23 | workflow_dispatch: 24 | repository_dispatch: 25 | 26 | env: 27 | # As defined by the Taskfile's PROJECT_NAME variable 28 | PROJECT_NAME: mdns-discovery 29 | # As defined by the Taskfile's DIST_DIR variable 30 | DIST_DIR: dist 31 | 32 | jobs: 33 | run-determination: 34 | runs-on: ubuntu-latest 35 | outputs: 36 | result: ${{ steps.determination.outputs.result }} 37 | permissions: {} 38 | steps: 39 | - name: Determine if the rest of the workflow should run 40 | id: determination 41 | run: | 42 | RELEASE_BRANCH_REGEX="refs/heads/v[0-9]+.[0-9]+.x" 43 | TAG_REGEX="refs/tags/.*" 44 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 45 | if [[ 46 | ("${{ github.event_name }}" != "create" || 47 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX) && 48 | ! "${{ github.ref }}" =~ $TAG_REGEX 49 | ]]; then 50 | # Run the other jobs. 51 | RESULT="true" 52 | else 53 | # There is no need to run the other jobs. 54 | RESULT="false" 55 | fi 56 | 57 | echo "result=$RESULT" >> $GITHUB_OUTPUT 58 | 59 | package-name-prefix: 60 | needs: run-determination 61 | if: needs.run-determination.outputs.result == 'true' 62 | runs-on: ubuntu-latest 63 | permissions: {} 64 | outputs: 65 | prefix: ${{ steps.calculation.outputs.prefix }} 66 | steps: 67 | - name: package name prefix calculation 68 | id: calculation 69 | run: | 70 | PACKAGE_NAME_PREFIX="test" 71 | if [ "${{ github.event_name }}" = "pull_request" ]; then 72 | PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}" 73 | fi 74 | PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-" 75 | 76 | echo "prefix=$PACKAGE_NAME_PREFIX" >> $GITHUB_OUTPUT 77 | 78 | build: 79 | needs: package-name-prefix 80 | name: Build ${{ matrix.os.artifact-name }} 81 | runs-on: ${{ matrix.os.runner }} 82 | permissions: 83 | contents: read 84 | 85 | strategy: 86 | matrix: 87 | os: 88 | - task: Windows_32bit 89 | path: "*Windows_32bit.zip" 90 | artifact-name: Windows_X86-32 91 | runner: ubuntu-latest 92 | - task: Windows_64bit 93 | path: "*Windows_64bit.zip" 94 | artifact-name: Windows_X86-64 95 | runner: ubuntu-latest 96 | - task: Windows_ARM64 97 | path: "*Windows_ARM64.zip" 98 | artifact-name: Windows_ARM64 99 | runner: ubuntu-24.04-arm 100 | - task: Linux_32bit 101 | path: "*Linux_32bit.tar.gz" 102 | artifact-name: Linux_X86-32 103 | runner: ubuntu-latest 104 | - task: Linux_64bit 105 | path: "*Linux_64bit.tar.gz" 106 | artifact-name: Linux_X86-64 107 | runner: ubuntu-latest 108 | - task: Linux_ARMv6 109 | path: "*Linux_ARMv6.tar.gz" 110 | artifact-name: Linux_ARMv6 111 | runner: ubuntu-latest 112 | - task: Linux_ARMv7 113 | path: "*Linux_ARMv7.tar.gz" 114 | artifact-name: Linux_ARMv7 115 | runner: ubuntu-latest 116 | - task: Linux_ARM64 117 | path: "*Linux_ARM64.tar.gz" 118 | artifact-name: Linux_ARM64 119 | runner: ubuntu-24.04-arm 120 | - task: macOS_64bit 121 | path: "*macOS_64bit.tar.gz" 122 | artifact-name: macOS_64 123 | runner: ubuntu-latest 124 | - task: macOS_ARM64 125 | path: "*macOS_ARM64.tar.gz" 126 | artifact-name: macOS_ARM64 127 | runner: ubuntu-24.04-arm 128 | 129 | steps: 130 | - name: Checkout repository 131 | uses: actions/checkout@v6 132 | 133 | - name: Install Task 134 | uses: arduino/setup-task@v2 135 | with: 136 | repo-token: ${{ secrets.GITHUB_TOKEN }} 137 | version: 3.x 138 | 139 | - name: Build 140 | run: | 141 | PACKAGE_NAME_PREFIX=${{ needs.package-name-prefix.outputs.prefix }} 142 | export PACKAGE_NAME_PREFIX 143 | task dist:${{ matrix.os.task }} 144 | 145 | # Transfer builds to artifacts job 146 | - name: Upload build artifact 147 | uses: actions/upload-artifact@v6 148 | with: 149 | path: ${{ env.DIST_DIR }}/${{ matrix.os.path }} 150 | name: ${{ matrix.os.artifact-name }} 151 | 152 | checksums: 153 | needs: 154 | - build 155 | - package-name-prefix 156 | runs-on: ubuntu-latest 157 | permissions: 158 | contents: read 159 | 160 | steps: 161 | - name: Download build artifacts 162 | uses: actions/download-artifact@v7 163 | 164 | - name: Create checksum file 165 | run: | 166 | TAG="${{ needs.package-name-prefix.outputs.prefix }}git-snapshot" 167 | declare -a artifacts=($(ls -d */)) 168 | for artifact in ${artifacts[@]} 169 | do 170 | cd $artifact 171 | checksum=$(sha256sum ${{ env.PROJECT_NAME }}_${TAG}*) 172 | cd .. 173 | echo $checksum >> ${TAG}-checksums.txt 174 | done 175 | 176 | - name: Upload checksum artifact 177 | uses: actions/upload-artifact@v6 178 | with: 179 | path: ./*checksums.txt 180 | name: checksums 181 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= 2 | github.com/arduino/go-paths-helper v1.14.0 h1:b4C8KJa7CNz2XnzTWg97M3LAmzWSWrj+m/o5/skzv3Y= 3 | github.com/arduino/go-paths-helper v1.14.0/go.mod h1:dDodKn2ZX4iwuoBMapdDO+5d0oDLBeM4BS0xS4i40Ak= 4 | github.com/arduino/go-properties-orderedmap v1.8.1 h1:nU5S6cXPwMoxZs4ORw61wPTALNfriIduvNB4cxTmNYM= 5 | github.com/arduino/go-properties-orderedmap v1.8.1/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= 6 | github.com/arduino/pluggable-discovery-protocol-handler/v2 v2.2.1 h1:Fw8zKj1b/FkcQrWgN7aBw3ubSxpKIUtdANLXvd1Qdzw= 7 | github.com/arduino/pluggable-discovery-protocol-handler/v2 v2.2.1/go.mod h1:1dgblsmK2iBx3L5iNTyRIokeaxbTLUrYiUbHBK6yC3Y= 8 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 9 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 10 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 11 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 12 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 13 | github.com/hashicorp/mdns v1.0.6 h1:SV8UcjnQ/+C7KeJ/QeVD/mdN2EmzYfcGfufcuzxfCLQ= 14 | github.com/hashicorp/mdns v1.0.6/go.mod h1:X4+yWh+upFECLOki1doUPaKpgNQII9gy4bUdCYKNhmM= 15 | github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= 16 | github.com/miekg/dns v1.1.68 h1:jsSRkNozw7G/mnmXULynzMNIsgY2dHC8LO6U6Ij2JEA= 17 | github.com/miekg/dns v1.1.68/go.mod h1:fujopn7TB3Pu3JM69XaawiU0wqjpL9/8xGop5UrTPps= 18 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 19 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 20 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 21 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 22 | github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= 23 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 24 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 25 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 26 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 27 | golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= 28 | golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= 29 | golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= 30 | golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= 31 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 32 | golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 33 | golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 34 | golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 35 | golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 36 | golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 37 | golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= 38 | golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= 39 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 40 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 41 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 42 | golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= 43 | golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= 44 | golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 45 | golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= 46 | golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= 47 | golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= 48 | golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= 49 | golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= 50 | golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= 51 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 52 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 53 | golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 54 | golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 55 | golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 56 | golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 57 | golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 58 | golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= 59 | golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 60 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 61 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 62 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 63 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 64 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 65 | golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 66 | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 67 | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 68 | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 69 | golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 70 | golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 71 | golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 72 | golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= 73 | golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= 74 | golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= 75 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 76 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 77 | golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= 78 | golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= 79 | golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= 80 | golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= 81 | golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= 82 | golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= 83 | golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= 84 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 85 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 86 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 87 | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 88 | golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 89 | golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 90 | golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= 91 | golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 92 | golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 93 | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= 94 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 95 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 96 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 97 | golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= 98 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 99 | golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= 100 | golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= 101 | golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= 102 | golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= 103 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 104 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 105 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 106 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of mdns-discovery. 3 | // 4 | // Copyright 2018-2021 ARDUINO SA (http://www.arduino.cc/) 5 | // 6 | // This software is released under the GNU General Public License version 3, 7 | // which covers the main part of arduino-cli. 8 | // The terms of this license can be found at: 9 | // https://www.gnu.org/licenses/gpl-3.0.en.html 10 | // 11 | // You can be released from the requirements of the above licenses by purchasing 12 | // a commercial license. Buying such a license is mandatory if you want to modify or 13 | // otherwise use the software for commercial activities involving the Arduino 14 | // software without disclosing the source code of your own applications. To purchase 15 | // a commercial license, send an email to license@arduino.cc. 16 | // 17 | 18 | package main 19 | 20 | import ( 21 | "context" 22 | "fmt" 23 | "io/ioutil" 24 | "log" 25 | "net" 26 | "os" 27 | "strconv" 28 | "strings" 29 | "sync" 30 | "time" 31 | 32 | properties "github.com/arduino/go-properties-orderedmap" 33 | discovery "github.com/arduino/pluggable-discovery-protocol-handler/v2" 34 | "github.com/hashicorp/mdns" 35 | ) 36 | 37 | func main() { 38 | parseArgs() 39 | mdnsDiscovery := &MDNSDiscovery{} 40 | disc := discovery.NewServer(mdnsDiscovery) 41 | if err := disc.Run(os.Stdin, os.Stdout); err != nil { 42 | fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error()) 43 | os.Exit(1) 44 | } 45 | } 46 | 47 | const mdnsServiceName = "_arduino._tcp" 48 | 49 | // Discovered ports stay alive for this amount of time 50 | // since the last time they've been found by an mDNS query. 51 | const portsTTL = time.Second * 60 52 | 53 | // Interval at which we check available network interfaces and call mdns.Query() 54 | const queryInterval = time.Second * 30 55 | 56 | // mdns.Query() will either exit early or timeout after this amount of time 57 | const queryTimeout = time.Second * 15 58 | 59 | // IP address used to check if we're connected to a local network 60 | var ipv4Addr = &net.UDPAddr{ 61 | IP: net.ParseIP("224.0.0.251"), 62 | Port: 5353, 63 | } 64 | 65 | // IP address used to check if IPv6 is supported by the local network 66 | var ipv6Addr = &net.UDPAddr{ 67 | IP: net.ParseIP("ff02::fb"), 68 | Port: 5353, 69 | } 70 | 71 | // QueryParam{} has to select which IP version(s) to use 72 | type connectivity struct { 73 | IPv4 bool 74 | IPv6 bool 75 | } 76 | 77 | // MDNSDiscovery is the implementation of the network pluggable-discovery 78 | type MDNSDiscovery struct { 79 | cancelFunc func() 80 | entriesChan chan *mdns.ServiceEntry 81 | 82 | portsCache *portsCache 83 | } 84 | 85 | // Hello handles the pluggable-discovery HELLO command 86 | func (d *MDNSDiscovery) Hello(userAgent string, protocolVersion int) error { 87 | // The mdns library used has some logs statement that we must disable 88 | log.SetOutput(ioutil.Discard) 89 | return nil 90 | } 91 | 92 | // Stop handles the pluggable-discovery STOP command 93 | func (d *MDNSDiscovery) Stop() error { 94 | if d.cancelFunc != nil { 95 | d.cancelFunc() 96 | d.cancelFunc = nil 97 | } 98 | if d.entriesChan != nil { 99 | close(d.entriesChan) 100 | d.entriesChan = nil 101 | } 102 | if d.portsCache != nil { 103 | d.portsCache.clear() 104 | } 105 | return nil 106 | } 107 | 108 | // Quit handles the pluggable-discovery QUIT command 109 | func (d *MDNSDiscovery) Quit() { 110 | d.Stop() 111 | } 112 | 113 | // StartSync handles the pluggable-discovery START_SYNC command 114 | func (d *MDNSDiscovery) StartSync(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) error { 115 | if d.entriesChan != nil { 116 | return fmt.Errorf("already syncing") 117 | } 118 | 119 | if d.portsCache == nil { 120 | // Initialize the cache if not already done 121 | d.portsCache = newCache(portsTTL, func(port *discovery.Port) { 122 | eventCB("remove", port) 123 | }) 124 | } 125 | 126 | d.entriesChan = make(chan *mdns.ServiceEntry) 127 | go func() { 128 | for entry := range d.entriesChan { 129 | port := toDiscoveryPort(entry) 130 | if port == nil { 131 | continue 132 | } 133 | if updated := d.portsCache.storeOrUpdate(port); !updated { 134 | // Port is not cached so let the user know a new one has been found 135 | eventCB("add", port) 136 | } 137 | } 138 | }() 139 | 140 | // We use a separate channel to consume the events received 141 | // from Query and send them over to d.entriesChan only if 142 | // it's open. 143 | // If we'd have used d.entriesChan to get the events from 144 | // Query we risk panics cause of sends to a closed channel. 145 | // Query doesn't stop right away when we call d.Stop() 146 | // neither we have to any to do it, we can only wait for it 147 | // to return. 148 | queriesChan := make(chan *mdns.ServiceEntry) 149 | 150 | ctx, cancel := context.WithCancel(context.Background()) 151 | go func() { 152 | defer close(queriesChan) 153 | queryLoop(ctx, queriesChan) 154 | }() 155 | go func() { 156 | for entry := range queriesChan { 157 | if d.entriesChan != nil { 158 | d.entriesChan <- entry 159 | } 160 | } 161 | }() 162 | d.cancelFunc = cancel 163 | return nil 164 | } 165 | 166 | func queryLoop(ctx context.Context, queriesChan chan<- *mdns.ServiceEntry) { 167 | for { 168 | var interfaces []net.Interface 169 | var conn connectivity 170 | var wg sync.WaitGroup 171 | 172 | interfaces, err := availableInterfaces() 173 | if err != nil { 174 | goto NEXT 175 | } 176 | 177 | conn = checkConnectivity() 178 | if !conn.available() { 179 | goto NEXT 180 | } 181 | 182 | wg.Add(len(interfaces)) 183 | 184 | for n := range interfaces { 185 | params := makeQueryParams(&interfaces[n], conn, queriesChan) 186 | go func() { 187 | defer wg.Done() 188 | mdns.Query(params) 189 | }() 190 | } 191 | 192 | wg.Wait() 193 | 194 | NEXT: 195 | select { 196 | case <-time.After(queryInterval): 197 | case <-ctx.Done(): 198 | return 199 | } 200 | } 201 | } 202 | 203 | func (conn *connectivity) available() bool { 204 | return conn.IPv4 || conn.IPv6 205 | } 206 | 207 | func checkConnectivity() connectivity { 208 | // We must check if we're connected to a local network, if we don't 209 | // the subsequent mDNS query would fail and return an error. 210 | // If we managed to open a connection close it, mdns.Query opens 211 | // another one on the same IP address we use and it would fail 212 | // if we leave this open. 213 | out := connectivity{ 214 | IPv4: true, 215 | IPv6: true, 216 | } 217 | 218 | // Check if the current network supports IPv6 219 | mconn6, err := net.ListenMulticastUDP("udp6", nil, ipv6Addr) 220 | if err != nil { 221 | out.IPv6 = false 222 | } else { 223 | mconn6.Close() 224 | } 225 | 226 | // And the same for IPv4 227 | mconn4, err := net.ListenMulticastUDP("udp4", nil, ipv4Addr) 228 | if err != nil { 229 | out.IPv4 = false 230 | } else { 231 | mconn4.Close() 232 | } 233 | 234 | return out 235 | } 236 | 237 | func availableInterfaces() ([]net.Interface, error) { 238 | interfaces, err := net.Interfaces() 239 | if err != nil { 240 | return nil, err 241 | } 242 | 243 | var out []net.Interface 244 | for _, netif := range interfaces { 245 | if netif.Flags&net.FlagUp == 0 { 246 | continue 247 | } 248 | 249 | if netif.Flags&net.FlagMulticast == 0 { 250 | continue 251 | } 252 | 253 | if netif.HardwareAddr == nil { 254 | continue 255 | } 256 | 257 | out = append(out, netif) 258 | } 259 | 260 | if len(out) == 0 { 261 | return nil, fmt.Errorf("no valid network interfaces") 262 | } 263 | 264 | return out, nil 265 | } 266 | 267 | func makeQueryParams(netif *net.Interface, conn connectivity, queriesChan chan<- *mdns.ServiceEntry) (params *mdns.QueryParam) { 268 | return &mdns.QueryParam{ 269 | Service: mdnsServiceName, 270 | Domain: "local", 271 | Timeout: queryTimeout, 272 | Interface: netif, 273 | Entries: queriesChan, 274 | WantUnicastResponse: false, 275 | DisableIPv4: !conn.IPv4, 276 | DisableIPv6: !conn.IPv6, 277 | } 278 | } 279 | 280 | func toDiscoveryPort(entry *mdns.ServiceEntry) *discovery.Port { 281 | // Only entries that match the Arduino OTA service name must 282 | // be returned 283 | if !strings.HasSuffix(entry.Name, mdnsServiceName+".local.") { 284 | return nil 285 | } 286 | 287 | ip := "" 288 | if len(entry.AddrV4) > 0 { 289 | ip = entry.AddrV4.String() 290 | } else if len(entry.AddrV6) > 0 { 291 | ip = entry.AddrV6.String() 292 | } 293 | 294 | props := properties.NewMap() 295 | props.Set("hostname", entry.Host) 296 | props.Set("port", strconv.Itoa(entry.Port)) 297 | 298 | for _, field := range entry.InfoFields { 299 | split := strings.Split(field, "=") 300 | if len(split) != 2 { 301 | continue 302 | } 303 | key, value := split[0], split[1] 304 | props.Set(key, value) 305 | if key == "board" { 306 | // duplicate for backwards compatibility 307 | props.Set(".", value) 308 | } 309 | } 310 | 311 | var name string 312 | if split := strings.Split(entry.Host, "."); len(split) > 0 { 313 | // Use the first part of the entry host name to display 314 | // the address label 315 | name = split[0] 316 | } else { 317 | // Fallback 318 | name = entry.Name 319 | } 320 | 321 | return &discovery.Port{ 322 | Address: ip, 323 | AddressLabel: fmt.Sprintf("%s at %s", name, ip), 324 | Protocol: "network", 325 | ProtocolLabel: "Network Port", 326 | Properties: props, 327 | } 328 | } 329 | -------------------------------------------------------------------------------- /Taskfile.yml: -------------------------------------------------------------------------------- 1 | # See: https://taskfile.dev/#/usage 2 | version: "3" 3 | 4 | includes: 5 | dist: ./DistTasks.yml 6 | 7 | vars: 8 | DEFAULT_GO_PACKAGES: 9 | sh: echo $(go list ./... | tr '\n' ' ') 10 | PROJECT_NAME: "mdns-discovery" 11 | DIST_DIR: "dist" 12 | # build vars 13 | COMMIT: 14 | sh: echo "$(git log --no-show-signature -n 1 --format=%h)" 15 | TAG: 16 | sh: echo "$(git tag --points-at=HEAD 2> /dev/null | head -n1)" 17 | TIMESTAMP: 18 | sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" 19 | TIMESTAMP_SHORT: 20 | sh: echo "{{now | date "20060102"}}" 21 | VERSION: "{{if .NIGHTLY}}nightly-{{.TIMESTAMP_SHORT}}{{else if .TAG}}{{.TAG}}{{else}}{{.PACKAGE_NAME_PREFIX}}git-snapshot{{end}}" 22 | CONFIGURATION_PACKAGE: github.com/arduino/mdns-discovery/version 23 | LDFLAGS: > 24 | -ldflags 25 | ' 26 | -X {{.CONFIGURATION_PACKAGE}}.Version={{.VERSION}} 27 | -X {{.CONFIGURATION_PACKAGE}}.Commit={{.COMMIT}} 28 | -X {{.CONFIGURATION_PACKAGE}}.Timestamp={{.TIMESTAMP}} 29 | ' 30 | 31 | tasks: 32 | build: 33 | desc: Build the project 34 | cmds: 35 | - go build -v {{.LDFLAGS}} 36 | 37 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 38 | go:check: 39 | desc: Check for problems with Go code 40 | deps: 41 | - task: go:vet 42 | - task: go:lint 43 | 44 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 45 | go:vet: 46 | desc: Check for errors in Go code 47 | cmds: 48 | - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 49 | 50 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 51 | go:fix: 52 | desc: Modernize usages of outdated APIs 53 | cmds: 54 | - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 55 | 56 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 57 | go:lint: 58 | desc: Lint Go code 59 | cmds: 60 | - | 61 | if ! which golint &>/dev/null; then 62 | echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation" 63 | exit 1 64 | fi 65 | - | 66 | golint \ 67 | {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \ 68 | {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 69 | 70 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 71 | go:format: 72 | desc: Format Go code 73 | cmds: 74 | - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 75 | 76 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml 77 | general:format-prettier: 78 | desc: Format all supported files with Prettier 79 | cmds: 80 | - npx prettier --write . 81 | 82 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml 83 | poetry:install-deps: 84 | desc: Install dependencies managed by Poetry 85 | cmds: 86 | - poetry install --no-root 87 | 88 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml 89 | poetry:update-deps: 90 | desc: Update all dependencies managed by Poetry to their newest versions 91 | cmds: 92 | - poetry update 93 | 94 | docs:generate: 95 | desc: Create all generated documentation content 96 | # This is an "umbrella" task used to call any documentation generation processes the project has. 97 | # It can be left empty if there are none. 98 | 99 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml 100 | markdown:lint: 101 | desc: Check for problems in Markdown files 102 | cmds: 103 | - npx markdownlint-cli "**/*.md" 104 | 105 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml 106 | markdown:fix: 107 | desc: Automatically correct linting violations in Markdown files where possible 108 | cmds: 109 | - npx markdownlint-cli --fix "**/*.md" 110 | 111 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml 112 | markdown:check-links: 113 | desc: Check for broken links 114 | deps: 115 | - task: docs:generate 116 | cmds: 117 | - | 118 | if [[ "{{.OS}}" == "Windows_NT" ]]; then 119 | # npx --call uses the native shell, which makes it too difficult to use npx for this application on Windows, 120 | # so the Windows user is required to have markdown-link-check installed and in PATH. 121 | if ! which markdown-link-check &>/dev/null; then 122 | echo "markdown-link-check not found or not in PATH. Please install: https://github.com/tcort/markdown-link-check#readme" 123 | exit 1 124 | fi 125 | # Default behavior of the task on Windows is to exit the task when the first broken link causes a non-zero 126 | # exit status, but it's better to check all links before exiting. 127 | set +o errexit 128 | STATUS=0 129 | # Using -regex instead of -name to avoid Task's behavior of globbing even when quoted on Windows 130 | # The odd method for escaping . in the regex is required for windows compatibility because mvdan.cc/sh gives 131 | # \ characters special treatment on Windows in an attempt to support them as path separators. 132 | for file in $(find . -regex ".*[.]md"); do 133 | markdown-link-check \ 134 | --quiet \ 135 | --config "./.markdown-link-check.json" \ 136 | "$file" 137 | STATUS=$(( $STATUS + $? )) 138 | done 139 | exit $STATUS 140 | else 141 | npx --package=markdown-link-check --call=' 142 | STATUS=0 143 | for file in $(find . -regex ".*[.]md"); do 144 | markdown-link-check \ 145 | --quiet \ 146 | --config "./.markdown-link-check.json" \ 147 | "$file" 148 | STATUS=$(( $STATUS + $? )) 149 | done 150 | exit $STATUS 151 | ' 152 | fi 153 | 154 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml 155 | ci:validate: 156 | desc: Validate GitHub Actions workflows against their JSON schema 157 | vars: 158 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json 159 | WORKFLOW_SCHEMA_URL: https://json.schemastore.org/github-workflow 160 | WORKFLOW_SCHEMA_PATH: 161 | sh: mktemp -t workflow-schema-XXXXXXXXXX.json 162 | WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}" 163 | cmds: 164 | - | 165 | wget \ 166 | --quiet \ 167 | --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \ 168 | {{.WORKFLOW_SCHEMA_URL}} 169 | - | 170 | npx \ 171 | --package=ajv-cli \ 172 | --package=ajv-formats \ 173 | ajv validate \ 174 | --all-errors \ 175 | --strict=false \ 176 | -c ajv-formats \ 177 | -s "{{.WORKFLOW_SCHEMA_PATH}}" \ 178 | -d "{{.WORKFLOWS_DATA_PATH}}" 179 | 180 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-yaml-task/Taskfile.yml 181 | yaml:lint: 182 | desc: Check for problems with YAML files 183 | deps: 184 | - task: poetry:install-deps 185 | cmds: 186 | - poetry run yamllint --format {{default "colored" .YAMLLINT_FORMAT}} . 187 | 188 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml 189 | general:cache-dep-licenses: 190 | desc: Cache dependency license metadata 191 | cmds: 192 | - | 193 | if ! which licensed &>/dev/null; then 194 | if [[ "{{OS}}" == "windows" ]]; then 195 | echo "Licensed does not have Windows support." 196 | echo "Please use Linux/macOS or download the dependencies cache from the GitHub Actions workflow artifact." 197 | else 198 | echo "licensed not found or not in PATH. Please install: https://github.com/github/licensed#as-an-executable" 199 | fi 200 | exit 1 201 | fi 202 | - licensed cache 203 | 204 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml 205 | general:check-dep-licenses: 206 | desc: Check for unapproved dependency licenses 207 | deps: 208 | - task: general:cache-dep-licenses 209 | cmds: 210 | - licensed status 211 | 212 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml 213 | general:check-spelling: 214 | desc: Check for commonly misspelled words 215 | deps: 216 | - task: poetry:install-deps 217 | cmds: 218 | - poetry run codespell 219 | 220 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml 221 | general:correct-spelling: 222 | desc: Correct commonly misspelled words where possible 223 | deps: 224 | - task: poetry:install-deps 225 | cmds: 226 | - poetry run codespell --write-changes 227 | -------------------------------------------------------------------------------- /.github/workflows/release-go-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/release-go-task.md 2 | name: Release 3 | 4 | env: 5 | # As defined by the Taskfile's PROJECT_NAME variable 6 | PROJECT_NAME: mdns-discovery 7 | # As defined by the Taskfile's DIST_DIR variable 8 | DIST_DIR: dist 9 | # The project's folder on Arduino's download server for uploading builds 10 | AWS_PLUGIN_TARGET: /discovery/mdns-discovery/ 11 | AWS_REGION: "us-east-1" 12 | ARTIFACT_PREFIX: dist- 13 | 14 | on: 15 | push: 16 | tags: 17 | - "v[0-9]+.[0-9]+.[0-9]+*" 18 | 19 | jobs: 20 | create-release-artifacts: 21 | runs-on: ${{ matrix.os.runner }} 22 | permissions: 23 | contents: read 24 | 25 | strategy: 26 | matrix: 27 | os: 28 | - task: Windows_32bit 29 | artifact-suffix: Windows_32bit 30 | runner: ubuntu-latest 31 | - task: Windows_64bit 32 | artifact-suffix: Windows_64bit 33 | runner: ubuntu-latest 34 | - task: Windows_ARM64 35 | artifact-suffix: Windows_ARM64 36 | runner: ubuntu-24.04-arm 37 | - task: Linux_32bit 38 | artifact-suffix: Linux_32bit 39 | runner: ubuntu-latest 40 | - task: Linux_64bit 41 | artifact-suffix: Linux_64bit 42 | runner: ubuntu-latest 43 | - task: Linux_ARMv6 44 | artifact-suffix: Linux_ARMv6 45 | runner: ubuntu-latest 46 | - task: Linux_ARMv7 47 | artifact-suffix: Linux_ARMv7 48 | runner: ubuntu-latest 49 | - task: Linux_ARM64 50 | artifact-suffix: Linux_ARM64 51 | runner: ubuntu-24.04-arm 52 | - task: macOS_64bit 53 | artifact-suffix: macOS_64bit 54 | runner: ubuntu-latest 55 | - task: macOS_ARM64 56 | artifact-suffix: macOS_ARM64 57 | runner: ubuntu-24.04-arm 58 | 59 | steps: 60 | - name: Checkout repository 61 | uses: actions/checkout@v6 62 | with: 63 | fetch-depth: 0 64 | 65 | - name: Create changelog 66 | # Avoid creating the same changelog for each os 67 | if: matrix.os.task == 'Windows_32bit' 68 | uses: arduino/create-changelog@v1 69 | with: 70 | tag-regex: '^v?[0-9]+\.[0-9]+\.[0-9]+.*$' 71 | filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*' 72 | case-insensitive-regex: true 73 | changelog-file-path: "${{ env.DIST_DIR }}/CHANGELOG.md" 74 | 75 | - name: Install Task 76 | uses: arduino/setup-task@v2 77 | with: 78 | repo-token: ${{ secrets.GITHUB_TOKEN }} 79 | version: 3.x 80 | 81 | - name: Build 82 | run: task dist:${{ matrix.os.task }} 83 | 84 | - name: Upload artifacts 85 | uses: actions/upload-artifact@v6 86 | with: 87 | if-no-files-found: error 88 | name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.os.artifact-suffix }} 89 | path: ${{ env.DIST_DIR }} 90 | 91 | notarize-macos: 92 | name: Notarize ${{ matrix.build.folder-suffix }} 93 | runs-on: macos-latest 94 | needs: create-release-artifacts 95 | 96 | env: 97 | GON_CONFIG_PATH: gon.config.hcl 98 | 99 | strategy: 100 | matrix: 101 | build: 102 | - artifact-suffix: macOS_64bit 103 | folder-suffix: darwin_amd64 104 | package-suffix: "macOS_64bit.tar.gz" 105 | - artifact-suffix: macOS_ARM64 106 | folder-suffix: darwin_arm64 107 | package-suffix: "macOS_ARM64.tar.gz" 108 | 109 | steps: 110 | - name: Set environment variables 111 | run: | 112 | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable 113 | echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV" 114 | TAG="${GITHUB_REF/refs\/tags\//}" 115 | echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV 116 | 117 | - name: Checkout repository 118 | uses: actions/checkout@v6 119 | 120 | - name: Download artifacts 121 | uses: actions/download-artifact@v7 122 | with: 123 | name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }} 124 | path: ${{ env.DIST_DIR }} 125 | 126 | - name: Import Code-Signing Certificates 127 | env: 128 | KEYCHAIN: "sign.keychain" 129 | INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" 130 | # Arbitrary password for a keychain that exists only for the duration of the job, so not secret 131 | KEYCHAIN_PASSWORD: keychainpassword 132 | run: | 133 | echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" 134 | security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" 135 | security default-keychain -s "${{ env.KEYCHAIN }}" 136 | security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" 137 | security import \ 138 | "${{ env.INSTALLER_CERT_MAC_PATH }}" \ 139 | -k "${{ env.KEYCHAIN }}" \ 140 | -f pkcs12 \ 141 | -A \ 142 | -T "/usr/bin/codesign" \ 143 | -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" 144 | security set-key-partition-list \ 145 | -S apple-tool:,apple: \ 146 | -s \ 147 | -k "${{ env.KEYCHAIN_PASSWORD }}" \ 148 | "${{ env.KEYCHAIN }}" 149 | 150 | - name: Install gon for code signing and app notarization 151 | run: | 152 | wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip 153 | unzip gon_macos.zip -d /usr/local/bin 154 | 155 | - name: Write gon config to file 156 | # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) 157 | run: | 158 | cat > "${{ env.GON_CONFIG_PATH }}" < ${TAG}-checksums.txt 222 | 223 | - name: Identify Prerelease 224 | # This is a workaround while waiting for create-release action 225 | # to implement auto pre-release based on tag 226 | id: prerelease 227 | run: | 228 | wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.2.0.zip 229 | unzip -p /tmp/3.2.0.zip semver-tool-3.2.0/src/semver >/tmp/semver && chmod +x /tmp/semver 230 | if [[ \ 231 | "$( 232 | /tmp/semver get prerel \ 233 | "${GITHUB_REF/refs\/tags\//}" 234 | )" != \ 235 | "" \ 236 | ]]; then 237 | echo "IS_PRE=true" >> $GITHUB_OUTPUT 238 | fi 239 | 240 | - name: Create Github Release and upload artifacts 241 | uses: ncipollo/release-action@v1 242 | with: 243 | token: ${{ secrets.GITHUB_TOKEN }} 244 | bodyFile: ${{ env.DIST_DIR }}/CHANGELOG.md 245 | draft: false 246 | prerelease: ${{ steps.prerelease.outputs.IS_PRE }} 247 | # NOTE: "Artifact is a directory" warnings are expected and don't indicate a problem 248 | # (all the files we need are in the DIST_DIR root) 249 | artifacts: ${{ env.DIST_DIR }}/* 250 | 251 | - name: configure aws credentials 252 | uses: aws-actions/configure-aws-credentials@v5 253 | with: 254 | role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} 255 | role-session-name: "github_${{ env.PROJECT_NAME }}" 256 | aws-region: ${{ env.AWS_REGION }} 257 | 258 | - name: Upload release files on Arduino downloads servers 259 | run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }} 260 | -------------------------------------------------------------------------------- /DistTasks.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/DistTasks.yml 2 | version: "3" 3 | 4 | # This taskfile is ideally meant to be project agnostic and could be dropped in 5 | # on other Go projects with minimal or no changes. 6 | # 7 | # To use it simply add the following lines to your main taskfile: 8 | # includes: 9 | # dist: ./DistTasks.yml 10 | # 11 | # The following variables must be declared in the including taskfile for the 12 | # build process to work correctly: 13 | # * DIST_DIR: the folder that will contain the final binaries and packages 14 | # * PROJECT_NAME: the name of the project, used in package name 15 | # * VERSION: the version of the project, used in package name and checksum file 16 | # * LD_FLAGS: flags used at build time 17 | # 18 | # The project MUST contain a LICENSE.txt file in the root folder or packaging will fail. 19 | 20 | vars: 21 | CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild" 22 | GO_VERSION: "1.25.2" 23 | CGO_ENABLED: "0" 24 | 25 | tasks: 26 | Windows_32bit: 27 | desc: Builds Windows 32 bit binaries 28 | dir: "{{.DIST_DIR}}" 29 | cmds: 30 | - | 31 | mkdir -p {{.PLATFORM_DIR}} 32 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 33 | docker run \ 34 | -v `pwd`/..:/home/build \ 35 | -w /home/build \ 36 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 37 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 38 | --build-cmd "{{.BUILD_COMMAND}}" \ 39 | -p "{{.BUILD_PLATFORM}}" 40 | zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}} -r 41 | 42 | vars: 43 | PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_386" 44 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe {{.LDFLAGS}}" 45 | BUILD_PLATFORM: "windows/386" 46 | CONTAINER_TAG: "{{.GO_VERSION}}-main" 47 | PACKAGE_PLATFORM: "Windows_32bit" 48 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.zip" 49 | 50 | Windows_64bit: 51 | desc: Builds Windows 64 bit binaries 52 | dir: "{{.DIST_DIR}}" 53 | cmds: 54 | - | 55 | mkdir -p {{.PLATFORM_DIR}} 56 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 57 | docker run \ 58 | -v `pwd`/..:/home/build \ 59 | -w /home/build \ 60 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 61 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 62 | --build-cmd "{{.BUILD_COMMAND}}" \ 63 | -p "{{.BUILD_PLATFORM}}" 64 | zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}} -r 65 | 66 | vars: 67 | PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_amd64" 68 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe {{.LDFLAGS}}" 69 | BUILD_PLATFORM: "windows/amd64" 70 | CONTAINER_TAG: "{{.GO_VERSION}}-main" 71 | PACKAGE_PLATFORM: "Windows_64bit" 72 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.zip" 73 | 74 | Windows_ARM64: 75 | desc: Builds Windows ARM64 binaries 76 | dir: "{{.DIST_DIR}}" 77 | cmds: 78 | - | 79 | mkdir -p {{.PLATFORM_DIR}} 80 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 81 | docker run \ 82 | -v `pwd`/..:/home/build \ 83 | -w /home/build \ 84 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 85 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 86 | --build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \ 87 | -p "{{.BUILD_PLATFORM}}" 88 | zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}} -r 89 | 90 | vars: 91 | PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_arm64" 92 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe {{.LDFLAGS}}" 93 | BUILD_PLATFORM: "windows/arm64" 94 | CONTAINER_TAG: "{{.GO_VERSION}}-windows-arm64-debian12" 95 | PACKAGE_PLATFORM: "Windows_ARM64" 96 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.zip" 97 | 98 | Linux_32bit: 99 | desc: Builds Linux 32 bit binaries 100 | dir: "{{.DIST_DIR}}" 101 | cmds: 102 | - | 103 | mkdir -p {{.PLATFORM_DIR}} 104 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 105 | docker run \ 106 | -v `pwd`/..:/home/build \ 107 | -w /home/build \ 108 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 109 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 110 | --build-cmd "{{.BUILD_COMMAND}}" \ 111 | -p "{{.BUILD_PLATFORM}}" 112 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 113 | 114 | vars: 115 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd32" 116 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 117 | BUILD_PLATFORM: "linux/386" 118 | CONTAINER_TAG: "{{.GO_VERSION}}-main" 119 | PACKAGE_PLATFORM: "Linux_32bit" 120 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 121 | 122 | Linux_64bit: 123 | desc: Builds Linux 64 bit binaries 124 | dir: "{{.DIST_DIR}}" 125 | cmds: 126 | - | 127 | mkdir -p {{.PLATFORM_DIR}} 128 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 129 | docker run \ 130 | -v `pwd`/..:/home/build \ 131 | -w /home/build \ 132 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 133 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 134 | --build-cmd "{{.BUILD_COMMAND}}" \ 135 | -p "{{.BUILD_PLATFORM}}" 136 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 137 | 138 | vars: 139 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd64" 140 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 141 | BUILD_PLATFORM: "linux/amd64" 142 | CONTAINER_TAG: "{{.GO_VERSION}}-main" 143 | PACKAGE_PLATFORM: "Linux_64bit" 144 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 145 | 146 | Linux_ARMv7: 147 | desc: Builds Linux ARMv7 binaries 148 | dir: "{{.DIST_DIR}}" 149 | cmds: 150 | - | 151 | mkdir -p {{.PLATFORM_DIR}} 152 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 153 | docker run \ 154 | -v `pwd`/..:/home/build \ 155 | -w /home/build \ 156 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 157 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 158 | --build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \ 159 | -p "{{.BUILD_PLATFORM}}" 160 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 161 | 162 | vars: 163 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_7" 164 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 165 | BUILD_PLATFORM: "linux/armv7" 166 | CONTAINER_TAG: "{{.GO_VERSION}}-armhf-debian10" 167 | PACKAGE_PLATFORM: "Linux_ARMv7" 168 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 169 | 170 | Linux_ARMv6: 171 | desc: Builds Linux ARMv6 binaries 172 | dir: "{{.DIST_DIR}}" 173 | cmds: 174 | - | 175 | mkdir -p {{.PLATFORM_DIR}} 176 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 177 | docker run \ 178 | -v `pwd`/..:/home/build \ 179 | -w /home/build \ 180 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 181 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 182 | --build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \ 183 | -p "{{.BUILD_PLATFORM}}" 184 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 185 | 186 | vars: 187 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_6" 188 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 189 | BUILD_PLATFORM: "linux/armv6" 190 | CONTAINER_TAG: "{{.GO_VERSION}}-armel-debian12" 191 | PACKAGE_PLATFORM: "Linux_ARMv6" 192 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 193 | 194 | Linux_ARM64: 195 | desc: Builds Linux ARM64 binaries 196 | dir: "{{.DIST_DIR}}" 197 | cmds: 198 | - | 199 | mkdir -p {{.PLATFORM_DIR}} 200 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 201 | docker run \ 202 | -v `pwd`/..:/home/build \ 203 | -w /home/build \ 204 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 205 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 206 | --build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \ 207 | -p "{{.BUILD_PLATFORM}}" 208 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 209 | 210 | vars: 211 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_64" 212 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 213 | BUILD_PLATFORM: "linux/arm64" 214 | CONTAINER_TAG: "{{.GO_VERSION}}-base-arm-debian10" 215 | PACKAGE_PLATFORM: "Linux_ARM64" 216 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 217 | 218 | macOS_64bit: 219 | desc: Builds Mac OS X 64 bit binaries 220 | dir: "{{.DIST_DIR}}" 221 | cmds: 222 | - | 223 | mkdir -p {{.PLATFORM_DIR}} 224 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 225 | docker run \ 226 | -v `pwd`/..:/home/build \ 227 | -w /home/build \ 228 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 229 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 230 | --build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \ 231 | -p "{{.BUILD_PLATFORM}}" 232 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 233 | 234 | vars: 235 | PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_amd64" 236 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 237 | BUILD_PLATFORM: "darwin/amd64" 238 | # We are experiencing the following error with macOS_64bit build: 239 | # 240 | # Undefined symbols for architecture x86_64: 241 | # "_clock_gettime", referenced from: 242 | # _runtime.walltime_trampoline in go.o 243 | # ld: symbol(s) not found for architecture x86_64 244 | # clang: error: linker command failed with exit code 1 (use -v to see invocation) 245 | # 246 | # The reason seems that go 1.16.x use a macos API which is available since 10.12 247 | # https://github.com/techknowlogick/xgo/issues/100#issuecomment-780894190 248 | # 249 | # To compile it we need an SDK >=10.12 so we use the debian10 based container that 250 | # has the SDK 10.14 installed. 251 | CONTAINER_TAG: "{{.GO_VERSION}}-darwin-debian10" 252 | PACKAGE_PLATFORM: "macOS_64bit" 253 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 254 | 255 | macOS_ARM64: 256 | desc: Builds Mac OS X ARM64 binaries 257 | dir: "{{.DIST_DIR}}" 258 | cmds: 259 | - | 260 | mkdir -p {{.PLATFORM_DIR}} 261 | cp ../LICENSE.txt {{.PLATFORM_DIR}} 262 | docker run \ 263 | -v `pwd`/..:/home/build \ 264 | -w /home/build \ 265 | -e CGO_ENABLED={{.CGO_ENABLED}} \ 266 | {{.CONTAINER}}:{{.CONTAINER_TAG}} \ 267 | --build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \ 268 | -p "{{.BUILD_PLATFORM}}" 269 | tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}} 270 | 271 | vars: 272 | PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_arm64" 273 | BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" 274 | BUILD_PLATFORM: "darwin/arm64" 275 | CONTAINER_TAG: "{{.GO_VERSION}}-darwin-arm64-debian10" 276 | PACKAGE_PLATFORM: "macOS_ARM64" 277 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 278 | -------------------------------------------------------------------------------- /.licenses/mdns-discovery/go/github.com/arduino/go-properties-orderedmap.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: github.com/arduino/go-properties-orderedmap 3 | version: v1.8.1 4 | type: go 5 | summary: Package properties is a library for handling maps of hierarchical properties. 6 | homepage: https://pkg.go.dev/github.com/arduino/go-properties-orderedmap 7 | license: gpl-2.0-or-later 8 | licenses: 9 | - sources: LICENSE 10 | text: |2 11 | GNU GENERAL PUBLIC LICENSE 12 | Version 2, June 1991 13 | 14 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | Everyone is permitted to copy and distribute verbatim copies 17 | of this license document, but changing it is not allowed. 18 | 19 | Preamble 20 | 21 | The licenses for most software are designed to take away your 22 | freedom to share and change it. By contrast, the GNU General Public 23 | License is intended to guarantee your freedom to share and change free 24 | software--to make sure the software is free for all its users. This 25 | General Public License applies to most of the Free Software 26 | Foundation's software and to any other program whose authors commit to 27 | using it. (Some other Free Software Foundation software is covered by 28 | the GNU Lesser General Public License instead.) You can apply it to 29 | your programs, too. 30 | 31 | When we speak of free software, we are referring to freedom, not 32 | price. Our General Public Licenses are designed to make sure that you 33 | have the freedom to distribute copies of free software (and charge for 34 | this service if you wish), that you receive source code or can get it 35 | if you want it, that you can change the software or use pieces of it 36 | in new free programs; and that you know you can do these things. 37 | 38 | To protect your rights, we need to make restrictions that forbid 39 | anyone to deny you these rights or to ask you to surrender the rights. 40 | These restrictions translate to certain responsibilities for you if you 41 | distribute copies of the software, or if you modify it. 42 | 43 | For example, if you distribute copies of such a program, whether 44 | gratis or for a fee, you must give the recipients all the rights that 45 | you have. You must make sure that they, too, receive or can get the 46 | source code. And you must show them these terms so they know their 47 | rights. 48 | 49 | We protect your rights with two steps: (1) copyright the software, and 50 | (2) offer you this license which gives you legal permission to copy, 51 | distribute and/or modify the software. 52 | 53 | Also, for each author's protection and ours, we want to make certain 54 | that everyone understands that there is no warranty for this free 55 | software. If the software is modified by someone else and passed on, we 56 | want its recipients to know that what they have is not the original, so 57 | that any problems introduced by others will not reflect on the original 58 | authors' reputations. 59 | 60 | Finally, any free program is threatened constantly by software 61 | patents. We wish to avoid the danger that redistributors of a free 62 | program will individually obtain patent licenses, in effect making the 63 | program proprietary. To prevent this, we have made it clear that any 64 | patent must be licensed for everyone's free use or not licensed at all. 65 | 66 | The precise terms and conditions for copying, distribution and 67 | modification follow. 68 | 69 | GNU GENERAL PUBLIC LICENSE 70 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 71 | 72 | 0. This License applies to any program or other work which contains 73 | a notice placed by the copyright holder saying it may be distributed 74 | under the terms of this General Public License. The "Program", below, 75 | refers to any such program or work, and a "work based on the Program" 76 | means either the Program or any derivative work under copyright law: 77 | that is to say, a work containing the Program or a portion of it, 78 | either verbatim or with modifications and/or translated into another 79 | language. (Hereinafter, translation is included without limitation in 80 | the term "modification".) Each licensee is addressed as "you". 81 | 82 | Activities other than copying, distribution and modification are not 83 | covered by this License; they are outside its scope. The act of 84 | running the Program is not restricted, and the output from the Program 85 | is covered only if its contents constitute a work based on the 86 | Program (independent of having been made by running the Program). 87 | Whether that is true depends on what the Program does. 88 | 89 | 1. You may copy and distribute verbatim copies of the Program's 90 | source code as you receive it, in any medium, provided that you 91 | conspicuously and appropriately publish on each copy an appropriate 92 | copyright notice and disclaimer of warranty; keep intact all the 93 | notices that refer to this License and to the absence of any warranty; 94 | and give any other recipients of the Program a copy of this License 95 | along with the Program. 96 | 97 | You may charge a fee for the physical act of transferring a copy, and 98 | you may at your option offer warranty protection in exchange for a fee. 99 | 100 | 2. You may modify your copy or copies of the Program or any portion 101 | of it, thus forming a work based on the Program, and copy and 102 | distribute such modifications or work under the terms of Section 1 103 | above, provided that you also meet all of these conditions: 104 | 105 | a) You must cause the modified files to carry prominent notices 106 | stating that you changed the files and the date of any change. 107 | 108 | b) You must cause any work that you distribute or publish, that in 109 | whole or in part contains or is derived from the Program or any 110 | part thereof, to be licensed as a whole at no charge to all third 111 | parties under the terms of this License. 112 | 113 | c) If the modified program normally reads commands interactively 114 | when run, you must cause it, when started running for such 115 | interactive use in the most ordinary way, to print or display an 116 | announcement including an appropriate copyright notice and a 117 | notice that there is no warranty (or else, saying that you provide 118 | a warranty) and that users may redistribute the program under 119 | these conditions, and telling the user how to view a copy of this 120 | License. (Exception: if the Program itself is interactive but 121 | does not normally print such an announcement, your work based on 122 | the Program is not required to print an announcement.) 123 | 124 | These requirements apply to the modified work as a whole. If 125 | identifiable sections of that work are not derived from the Program, 126 | and can be reasonably considered independent and separate works in 127 | themselves, then this License, and its terms, do not apply to those 128 | sections when you distribute them as separate works. But when you 129 | distribute the same sections as part of a whole which is a work based 130 | on the Program, the distribution of the whole must be on the terms of 131 | this License, whose permissions for other licensees extend to the 132 | entire whole, and thus to each and every part regardless of who wrote it. 133 | 134 | Thus, it is not the intent of this section to claim rights or contest 135 | your rights to work written entirely by you; rather, the intent is to 136 | exercise the right to control the distribution of derivative or 137 | collective works based on the Program. 138 | 139 | In addition, mere aggregation of another work not based on the Program 140 | with the Program (or with a work based on the Program) on a volume of 141 | a storage or distribution medium does not bring the other work under 142 | the scope of this License. 143 | 144 | 3. You may copy and distribute the Program (or a work based on it, 145 | under Section 2) in object code or executable form under the terms of 146 | Sections 1 and 2 above provided that you also do one of the following: 147 | 148 | a) Accompany it with the complete corresponding machine-readable 149 | source code, which must be distributed under the terms of Sections 150 | 1 and 2 above on a medium customarily used for software interchange; or, 151 | 152 | b) Accompany it with a written offer, valid for at least three 153 | years, to give any third party, for a charge no more than your 154 | cost of physically performing source distribution, a complete 155 | machine-readable copy of the corresponding source code, to be 156 | distributed under the terms of Sections 1 and 2 above on a medium 157 | customarily used for software interchange; or, 158 | 159 | c) Accompany it with the information you received as to the offer 160 | to distribute corresponding source code. (This alternative is 161 | allowed only for noncommercial distribution and only if you 162 | received the program in object code or executable form with such 163 | an offer, in accord with Subsection b above.) 164 | 165 | The source code for a work means the preferred form of the work for 166 | making modifications to it. For an executable work, complete source 167 | code means all the source code for all modules it contains, plus any 168 | associated interface definition files, plus the scripts used to 169 | control compilation and installation of the executable. However, as a 170 | special exception, the source code distributed need not include 171 | anything that is normally distributed (in either source or binary 172 | form) with the major components (compiler, kernel, and so on) of the 173 | operating system on which the executable runs, unless that component 174 | itself accompanies the executable. 175 | 176 | If distribution of executable or object code is made by offering 177 | access to copy from a designated place, then offering equivalent 178 | access to copy the source code from the same place counts as 179 | distribution of the source code, even though third parties are not 180 | compelled to copy the source along with the object code. 181 | 182 | 4. You may not copy, modify, sublicense, or distribute the Program 183 | except as expressly provided under this License. Any attempt 184 | otherwise to copy, modify, sublicense or distribute the Program is 185 | void, and will automatically terminate your rights under this License. 186 | However, parties who have received copies, or rights, from you under 187 | this License will not have their licenses terminated so long as such 188 | parties remain in full compliance. 189 | 190 | 5. You are not required to accept this License, since you have not 191 | signed it. However, nothing else grants you permission to modify or 192 | distribute the Program or its derivative works. These actions are 193 | prohibited by law if you do not accept this License. Therefore, by 194 | modifying or distributing the Program (or any work based on the 195 | Program), you indicate your acceptance of this License to do so, and 196 | all its terms and conditions for copying, distributing or modifying 197 | the Program or works based on it. 198 | 199 | 6. Each time you redistribute the Program (or any work based on the 200 | Program), the recipient automatically receives a license from the 201 | original licensor to copy, distribute or modify the Program subject to 202 | these terms and conditions. You may not impose any further 203 | restrictions on the recipients' exercise of the rights granted herein. 204 | You are not responsible for enforcing compliance by third parties to 205 | this License. 206 | 207 | 7. If, as a consequence of a court judgment or allegation of patent 208 | infringement or for any other reason (not limited to patent issues), 209 | conditions are imposed on you (whether by court order, agreement or 210 | otherwise) that contradict the conditions of this License, they do not 211 | excuse you from the conditions of this License. If you cannot 212 | distribute so as to satisfy simultaneously your obligations under this 213 | License and any other pertinent obligations, then as a consequence you 214 | may not distribute the Program at all. For example, if a patent 215 | license would not permit royalty-free redistribution of the Program by 216 | all those who receive copies directly or indirectly through you, then 217 | the only way you could satisfy both it and this License would be to 218 | refrain entirely from distribution of the Program. 219 | 220 | If any portion of this section is held invalid or unenforceable under 221 | any particular circumstance, the balance of the section is intended to 222 | apply and the section as a whole is intended to apply in other 223 | circumstances. 224 | 225 | It is not the purpose of this section to induce you to infringe any 226 | patents or other property right claims or to contest validity of any 227 | such claims; this section has the sole purpose of protecting the 228 | integrity of the free software distribution system, which is 229 | implemented by public license practices. Many people have made 230 | generous contributions to the wide range of software distributed 231 | through that system in reliance on consistent application of that 232 | system; it is up to the author/donor to decide if he or she is willing 233 | to distribute software through any other system and a licensee cannot 234 | impose that choice. 235 | 236 | This section is intended to make thoroughly clear what is believed to 237 | be a consequence of the rest of this License. 238 | 239 | 8. If the distribution and/or use of the Program is restricted in 240 | certain countries either by patents or by copyrighted interfaces, the 241 | original copyright holder who places the Program under this License 242 | may add an explicit geographical distribution limitation excluding 243 | those countries, so that distribution is permitted only in or among 244 | countries not thus excluded. In such case, this License incorporates 245 | the limitation as if written in the body of this License. 246 | 247 | 9. The Free Software Foundation may publish revised and/or new versions 248 | of the General Public License from time to time. Such new versions will 249 | be similar in spirit to the present version, but may differ in detail to 250 | address new problems or concerns. 251 | 252 | Each version is given a distinguishing version number. If the Program 253 | specifies a version number of this License which applies to it and "any 254 | later version", you have the option of following the terms and conditions 255 | either of that version or of any later version published by the Free 256 | Software Foundation. If the Program does not specify a version number of 257 | this License, you may choose any version ever published by the Free Software 258 | Foundation. 259 | 260 | 10. If you wish to incorporate parts of the Program into other free 261 | programs whose distribution conditions are different, write to the author 262 | to ask for permission. For software which is copyrighted by the Free 263 | Software Foundation, write to the Free Software Foundation; we sometimes 264 | make exceptions for this. Our decision will be guided by the two goals 265 | of preserving the free status of all derivatives of our free software and 266 | of promoting the sharing and reuse of software generally. 267 | 268 | NO WARRANTY 269 | 270 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 271 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 272 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 273 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 274 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 275 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 276 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 277 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 278 | REPAIR OR CORRECTION. 279 | 280 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 281 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 282 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 283 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 284 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 285 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 286 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 287 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 288 | POSSIBILITY OF SUCH DAMAGES. 289 | 290 | END OF TERMS AND CONDITIONS 291 | 292 | How to Apply These Terms to Your New Programs 293 | 294 | If you develop a new program, and you want it to be of the greatest 295 | possible use to the public, the best way to achieve this is to make it 296 | free software which everyone can redistribute and change under these terms. 297 | 298 | To do so, attach the following notices to the program. It is safest 299 | to attach them to the start of each source file to most effectively 300 | convey the exclusion of warranty; and each file should have at least 301 | the "copyright" line and a pointer to where the full notice is found. 302 | 303 | 304 | Copyright (C) 305 | 306 | This program is free software; you can redistribute it and/or modify 307 | it under the terms of the GNU General Public License as published by 308 | the Free Software Foundation; either version 2 of the License, or 309 | (at your option) any later version. 310 | 311 | This program is distributed in the hope that it will be useful, 312 | but WITHOUT ANY WARRANTY; without even the implied warranty of 313 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 314 | GNU General Public License for more details. 315 | 316 | You should have received a copy of the GNU General Public License along 317 | with this program; if not, write to the Free Software Foundation, Inc., 318 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 319 | 320 | Also add information on how to contact you by electronic and paper mail. 321 | 322 | If the program is interactive, make it output a short notice like this 323 | when it starts in an interactive mode: 324 | 325 | Gnomovision version 69, Copyright (C) year name of author 326 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 327 | This is free software, and you are welcome to redistribute it 328 | under certain conditions; type `show c' for details. 329 | 330 | The hypothetical commands `show w' and `show c' should show the appropriate 331 | parts of the General Public License. Of course, the commands you use may 332 | be called something other than `show w' and `show c'; they could even be 333 | mouse-clicks or menu items--whatever suits your program. 334 | 335 | You should also get your employer (if you work as a programmer) or your 336 | school, if any, to sign a "copyright disclaimer" for the program, if 337 | necessary. Here is a sample; alter the names: 338 | 339 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 340 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 341 | 342 | , 1 April 1989 343 | Ty Coon, President of Vice 344 | 345 | This General Public License does not permit incorporating your program into 346 | proprietary programs. If your program is a subroutine library, you may 347 | consider it more useful to permit linking proprietary applications with the 348 | library. If this is what you want to do, use the GNU Lesser General 349 | Public License instead of this License. 350 | notices: [] 351 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------