ci: commit prebuilt torrent bridge binaries (#2878)

* ci: commit prebuilt torrent bridge binaries

Installs no longer compile libtorrent, Boost and OpenSSL through vcpkg on
Windows x64 and Linux x64. A cold vcpkg cache, as after every runner image
update, made the install step take ~35 minutes on Windows.

- scripts/torrent-bridge-prebuilt.cjs uses the committed bundle in
  native/torrent-bridge/prebuilt when its input hash matches, and falls back
  to the source build otherwise. HYDRA_TORRENT_BRIDGE_FROM_SOURCE=1 forces
  the source build.
- The "Torrent bridge prebuilts" workflow rebuilds the bundles when a branch
  push changes the bridge inputs and commits them to that branch.
- Build and release workflows skip the vcpkg cache when the bundle is current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(torrent-bridge): update prebuilt binaries

Built by https://github.com/hydralauncher/hydra/actions/runs/38007780411

* ci: ship torrent bridge notices as one file

The bridge bundles carried one license file per vcpkg port, 150 files in
all. Each bundle now holds a single THIRD_PARTY_NOTICES.txt: ports with the
same license text (all of Boost) share a section, and vcpkg-* build helper
ports, which ship nothing, are left out. Source builds write the same file
into hydra-native.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(torrent-bridge): update prebuilt binaries

Built by https://github.com/hydralauncher/hydra/actions/runs/38008319588

* ci: rename torrent bridge jobs so they don't match required checks

Required checks on main match job names from any workflow, so the bridge
jobs named build (ubuntu-latest) and build (windows-2022) counted as the
required Build checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: keep each torrent bridge artifact to its own platform

Each job uploaded the whole prebuilt folder, so the other platform's
committed bundle from the checkout came along and could overwrite the fresh
one when the artifacts merged. That left a stale Windows bundle on this
branch. Jobs now drop the committed bundles before building, and the commit
job verifies every bundle against the inputs. Changes to the workflow
itself also rebuild the bundles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(torrent-bridge): update prebuilt binaries

Built by https://github.com/hydralauncher/hydra/actions/runs/38008653533

* ci: address torrent bridge prebuilt review

- Skip the prebuilt bridge when HYDRA_TORRENT_SANITIZE=1, so sanitizer
  builds still compile and test the bridge.
- On Linux, check the bundle with ldd and build from source when this
  system lacks the glibc or libstdc++ versions it needs.
- `check` reports the same decision as the install, so forced source builds
  keep the vcpkg cache.
- Pin the actions in the prebuilt workflow to commit SHAs.
- Skip rebuilding when every committed bundle already matches its inputs,
  since MSVC output differs on every build. Manual runs still rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(native): wait for Electron to install before loading the addon

Yarn starts the root postinstall alongside Electron's, which downloads the
runtime and only then writes path.txt. Compiling the torrent bridge used to
take long enough to hide that; with the prebuilt bridge, the load check ran
first and failed with "Electron failed to install correctly".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: fix lint and Sonar findings in the bridge scripts

- Rename usePrebuiltTorrentBridge to installPrebuiltTorrentBridge; the use
  prefix made rules-of-hooks treat it as a React hook.
- Sort hash inputs with an explicit code-unit compare.
- Run ldd from /usr/bin or /bin instead of searching PATH.
- Wait for Electron with an interval instead of awaiting in a loop.
- Normalize line endings with replaceAll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Chubby Granny Chaser <hydralauncher@proton.me>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898283+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Chubby 2026-10-10 02:02:37 +01:00 committed by GitHub
parent 2f0ff26c90
commit dbe3cb61d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 2332 additions and 18 deletions

View file

@ -57,9 +57,15 @@ jobs:
shared-key: native-${{ runner.os }}-${{ runner.arch }}-${{ steps.native-cache.outputs.image }}
cache-bin: false
# A current committed bridge needs no vcpkg packages at all.
- name: Check prebuilt torrent bridge
id: torrent-bridge
run: node scripts/torrent-bridge-prebuilt.cjs check
# vcpkg checks each package ABI, including the compiler and build flags.
# Keep fallback restores within the same runner image and target triplet.
- name: Restore vcpkg binary packages
if: steps.torrent-bridge.outputs.current != 'true'
id: vcpkg-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
@ -77,7 +83,7 @@ jobs:
# Save before packaging so later failures do not discard compiled dependencies.
- name: Save vcpkg binary packages
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
if: steps.torrent-bridge.outputs.current != 'true' && steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
@ -190,9 +196,15 @@ jobs:
shared-key: native-${{ runner.os }}-${{ runner.arch }}-${{ steps.native-cache.outputs.image }}
cache-bin: false
# A current committed bridge needs no vcpkg packages at all.
- name: Check prebuilt torrent bridge
id: torrent-bridge
run: node scripts/torrent-bridge-prebuilt.cjs check
# vcpkg checks each package ABI, including the compiler and build flags.
# Keep fallback restores within the same runner image and target triplet.
- name: Restore vcpkg binary packages
if: steps.torrent-bridge.outputs.current != 'true'
id: vcpkg-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
@ -210,7 +222,7 @@ jobs:
# Save before packaging so later failures do not discard compiled dependencies.
- name: Save vcpkg binary packages
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
if: steps.torrent-bridge.outputs.current != 'true' && steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}

View file

@ -53,9 +53,15 @@ jobs:
shared-key: native-${{ runner.os }}-${{ runner.arch }}-${{ steps.native-cache.outputs.image }}
cache-bin: false
# A current committed bridge needs no vcpkg packages at all.
- name: Check prebuilt torrent bridge
id: torrent-bridge
run: node scripts/torrent-bridge-prebuilt.cjs check
# vcpkg checks each package ABI, including the compiler and build flags.
# Keep fallback restores within the same runner image and target triplet.
- name: Restore vcpkg binary packages
if: steps.torrent-bridge.outputs.current != 'true'
id: vcpkg-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
@ -73,7 +79,7 @@ jobs:
# Save before packaging so later failures do not discard compiled dependencies.
- name: Save vcpkg binary packages
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
if: steps.torrent-bridge.outputs.current != 'true' && steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}

View file

@ -0,0 +1,153 @@
name: Torrent bridge prebuilts
# Rebuilds the committed libtorrent bridge (native/torrent-bridge/prebuilt) on
# every platform and commits it to the branch the workflow runs on. It runs
# when a branch push changes the bridge inputs, or by hand; until it finishes,
# installs build the bridge from source. Checks on its own commit wait for a
# maintainer to approve them in the Actions tab.
on:
push:
branches-ignore:
- main
- "release/**"
paths:
- "native/torrent-bridge/**"
- "!native/torrent-bridge/prebuilt/**"
- "scripts/build-torrent-bridge.cjs"
- ".github/workflows/torrent-bridge-prebuilt.yml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# MSVC output differs on every build, so rebuilding current bundles would
# only commit new bytes. Manual runs always rebuild.
status:
runs-on: ubuntu-latest
outputs:
stale: ${{ github.event_name == 'workflow_dispatch' || steps.verify.outcome == 'failure' }}
steps:
- name: Check out Git repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Verify prebuilt bridges
id: verify
continue-on-error: true
run: node scripts/torrent-bridge-prebuilt.cjs verify
bridge:
needs: status
if: needs.status.outputs.stale == 'true'
strategy:
matrix:
os: [windows-2022, ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out Git repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Install Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.21.0
- name: Prepare native caches
id: native-cache
shell: pwsh
run: |
$cacheDir = Join-Path $env:RUNNER_TEMP "hydra-vcpkg-archives"
New-Item -ItemType Directory -Force -Path $cacheDir | Out-Null
"VCPKG_DEFAULT_BINARY_CACHE=$cacheDir" >> $env:GITHUB_ENV
$arch = $env:RUNNER_ARCH.ToLowerInvariant()
$platform = if ($env:RUNNER_OS -eq "Windows") { "windows-static" } else { "linux" }
$image = "$env:ImageOS-$env:ImageVersion"
"prefix=v1-vcpkg-$env:RUNNER_OS-$image-$arch-$arch-$platform" >> $env:GITHUB_OUTPUT
# vcpkg checks each package ABI, including the compiler and build flags.
# Keep fallback restores within the same runner image and target triplet.
- name: Restore vcpkg binary packages
id: vcpkg-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ steps.native-cache.outputs.prefix }}-${{ hashFiles('native/torrent-bridge/**/vcpkg*.json', 'native/torrent-bridge/**/triplets/**') }}
restore-keys: |
${{ steps.native-cache.outputs.prefix }}-
- name: Install Linux native build prerequisites
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y build-essential cmake ninja-build pkg-config curl zip unzip tar autoconf automake libtool
# The checkout carries every platform's committed bundle; drop them so
# this job's artifact holds only the one it builds.
- name: Build torrent bridge
shell: bash
run: |
rm -rf native/torrent-bridge/prebuilt
node scripts/torrent-bridge-prebuilt.cjs update
- name: Save vcpkg binary packages
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ steps.vcpkg-cache.outputs.cache-primary-key }}
- name: Upload prebuilt bridge
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: torrent-bridge-${{ matrix.os }}
path: native/torrent-bridge/prebuilt/
if-no-files-found: error
commit:
needs: bridge
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
# Replace every bundle, so files a new build no longer has go away too.
- name: Remove old prebuilt bridges
run: rm -rf native/torrent-bridge/prebuilt
- name: Download prebuilt bridges
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: torrent-bridge-*
merge-multiple: true
path: native/torrent-bridge/prebuilt
- name: Verify prebuilt bridges
run: node scripts/torrent-bridge-prebuilt.cjs verify
# Fails if the branch moved during the build; the new commits may have
# changed the bridge, so run the workflow again.
- name: Commit prebuilt bridges
run: |
git add -A native/torrent-bridge/prebuilt
if git diff --cached --quiet; then
echo "The prebuilt bridges are already up to date."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898283+github-actions[bot]@users.noreply.github.com"
git commit -m "chore(torrent-bridge): update prebuilt binaries" \
-m "Built by $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
git push origin "HEAD:$GITHUB_REF_NAME"

View file

@ -39,6 +39,8 @@ After installing dependencies, `postinstall` now builds the Rust native addon au
The native build includes a Rust wrapper around pinned libtorrent. Development and packaged torrenting no longer require Python.
On Windows x64 and Linux x64, the libtorrent bridge comes prebuilt from `native/torrent-bridge/prebuilt`, so installs skip compiling libtorrent through vcpkg. Other platforms build it from source. When a branch push changes `native/torrent-bridge` or `scripts/build-torrent-bridge.cjs`, the "Torrent bridge prebuilts" workflow rebuilds the binaries and commits them to that branch; until then, installs build the bridge from source. Set `HYDRA_TORRENT_BRIDGE_FROM_SOURCE=1` to always build it from source.
## Contributors
<a href="https://github.com/hydralauncher/hydra/graphs/contributors">

View file

@ -0,0 +1,934 @@
Third-party notices for the libtorrent bridge (x64-linux).
========================================================================
boost-algorithm, boost-align, boost-array, boost-asio, boost-assert, boost-beast, boost-bind, boost-chrono, boost-cmake, boost-compat, boost-concept-check, boost-config, boost-container, boost-container-hash, boost-context, boost-conversion, boost-core, boost-crc, boost-date-time, boost-describe, boost-detail, boost-dynamic-bitset, boost-endian, boost-exception, boost-function, boost-function-types, boost-fusion, boost-headers, boost-integer, boost-intrusive, boost-io, boost-iterator, boost-json, boost-lexical-cast, boost-logic, boost-math, boost-move, boost-mp11, boost-mpl, boost-multi-index, boost-multiprecision, boost-numeric-conversion, boost-optional, boost-pool, boost-predef, boost-preprocessor, boost-random, boost-range, boost-ratio, boost-regex, boost-scope-exit, boost-smart-ptr, boost-static-assert, boost-static-string, boost-system, boost-throw-exception, boost-tokenizer, boost-tuple, boost-type-index, boost-type-traits, boost-typeof, boost-unordered, boost-utility, boost-variant, boost-variant2, boost-winapi
========================================================================
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
========================================================================
libdatachannel, libjuice
========================================================================
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
========================================================================
libtorrent
========================================================================
LICENSE:
Copyright (c) 2003-2020, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
puff.c
Copyright (C) 2002, 2003 Mark Adler
For conditions of distribution and use, see copyright notice in puff.h
version 1.7, 3 Mar 2003
puff.c is a simple inflate written to be an unambiguous way to specify the
deflate format. It is not written for speed but rather simplicity. As a
side benefit, this code might actually be useful when small code is more
important than speed, such as bootstrap applications. For typical deflate
data, zlib's inflate() is about four times as fast as puff(). zlib's
inflate compiles to around 20K on my machine, whereas puff.c compiles to
around 4K on my machine (a PowerPC using GNU cc). If the faster decode()
function here is used, then puff() is only twice as slow as zlib's
inflate().
All dynamically allocated memory comes from the stack. The stack required
is less than 2K bytes. This code is compatible with 16-bit int's and
assumes that long's are at least 32 bits. puff.c uses the short data type,
assumed to be 16 bits, for arrays in order to conserve memory. The code
works whether integers are stored big endian or little endian.
In the comments below are "Format notes" that describe the inflate process
and document some of the less obvious aspects of the format. This source
code is meant to supplement RFC 1951, which formally describes the deflate
format:
http://www.zlib.org/rfc-deflate.html
------------------------------------------------------------------------------
bindings/python/src/
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
ed25519 implementation based on:
Copyright (c) 2015 Orson Peters <orsonpeters@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no event will the
authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
original software. If you use this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as
being the original software.
3. This notice may not be removed or altered from any source distribution.
------------------------------------------------------------------------------
src/sha1.cpp include/libtorrent/aux_/sha1.hpp
SHA-1 in C
By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
------------------------------------------------------------------------------
include/libtorrent/_aux/route.h
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)route.h 8.3 (Berkeley) 4/19/94
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
------------------------------------------------------------------------------
src/sha256.cpp
SHA-256. Adapted from LibTomCrypt. This code is Public Domain
puff.hpp:
/* puff.h
Copyright (C) 2002, 2003 Mark Adler, all rights reserved
version 1.7, 3 Mar 2002
This software is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Mark Adler madler@alumni.caltech.edu
*/
#ifndef PUFF_HPP_INCLUDED
#define PUFF_HPP_INCLUDED
/*
* See puff.c for purpose and usage.
*/
int puff(unsigned char *dest, /* pointer to destination pointer */
unsigned long *destlen, /* amount of output space */
const unsigned char *source, /* pointer to source data pointer */
unsigned long *sourcelen); /* amount of input available */
#endif // PUFF_HPP_INCLUDED
LICENSE:
BSD 3-Clause License
Copyright (c) 2016, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================
nlohmann-json
========================================================================
MIT License
Copyright (c) 2013-2025 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
openssl
========================================================================
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
========================================================================
plog
========================================================================
MIT License
Copyright (c) 2022 Sergey Podobry
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
usrsctp
========================================================================
Copyright (c) 2015, Randall Stewart and Michael Tuexen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of usrsctp nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1 @@
a0f1ad0defc5851d978f5ddd4db7a7caa62c0b650923f554e2e7ab1622b0fdc0

View file

@ -0,0 +1,934 @@
Third-party notices for the libtorrent bridge (x64-windows-static).
========================================================================
boost-algorithm, boost-align, boost-array, boost-asio, boost-assert, boost-beast, boost-bind, boost-chrono, boost-cmake, boost-compat, boost-concept-check, boost-config, boost-container, boost-container-hash, boost-context, boost-conversion, boost-core, boost-crc, boost-date-time, boost-describe, boost-detail, boost-dynamic-bitset, boost-endian, boost-exception, boost-function, boost-function-types, boost-fusion, boost-headers, boost-integer, boost-intrusive, boost-io, boost-iterator, boost-json, boost-lexical-cast, boost-logic, boost-math, boost-move, boost-mp11, boost-mpl, boost-multi-index, boost-multiprecision, boost-numeric-conversion, boost-optional, boost-pool, boost-predef, boost-preprocessor, boost-random, boost-range, boost-ratio, boost-regex, boost-scope-exit, boost-smart-ptr, boost-static-assert, boost-static-string, boost-system, boost-throw-exception, boost-tokenizer, boost-tuple, boost-type-index, boost-type-traits, boost-typeof, boost-unordered, boost-utility, boost-variant, boost-variant2, boost-winapi
========================================================================
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
========================================================================
libdatachannel, libjuice
========================================================================
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
========================================================================
libtorrent
========================================================================
LICENSE:
Copyright (c) 2003-2020, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
puff.c
Copyright (C) 2002, 2003 Mark Adler
For conditions of distribution and use, see copyright notice in puff.h
version 1.7, 3 Mar 2003
puff.c is a simple inflate written to be an unambiguous way to specify the
deflate format. It is not written for speed but rather simplicity. As a
side benefit, this code might actually be useful when small code is more
important than speed, such as bootstrap applications. For typical deflate
data, zlib's inflate() is about four times as fast as puff(). zlib's
inflate compiles to around 20K on my machine, whereas puff.c compiles to
around 4K on my machine (a PowerPC using GNU cc). If the faster decode()
function here is used, then puff() is only twice as slow as zlib's
inflate().
All dynamically allocated memory comes from the stack. The stack required
is less than 2K bytes. This code is compatible with 16-bit int's and
assumes that long's are at least 32 bits. puff.c uses the short data type,
assumed to be 16 bits, for arrays in order to conserve memory. The code
works whether integers are stored big endian or little endian.
In the comments below are "Format notes" that describe the inflate process
and document some of the less obvious aspects of the format. This source
code is meant to supplement RFC 1951, which formally describes the deflate
format:
http://www.zlib.org/rfc-deflate.html
------------------------------------------------------------------------------
bindings/python/src/
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
ed25519 implementation based on:
Copyright (c) 2015 Orson Peters <orsonpeters@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no event will the
authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
original software. If you use this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as
being the original software.
3. This notice may not be removed or altered from any source distribution.
------------------------------------------------------------------------------
src/sha1.cpp include/libtorrent/aux_/sha1.hpp
SHA-1 in C
By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
------------------------------------------------------------------------------
include/libtorrent/_aux/route.h
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)route.h 8.3 (Berkeley) 4/19/94
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
------------------------------------------------------------------------------
src/sha256.cpp
SHA-256. Adapted from LibTomCrypt. This code is Public Domain
puff.hpp:
/* puff.h
Copyright (C) 2002, 2003 Mark Adler, all rights reserved
version 1.7, 3 Mar 2002
This software is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Mark Adler madler@alumni.caltech.edu
*/
#ifndef PUFF_HPP_INCLUDED
#define PUFF_HPP_INCLUDED
/*
* See puff.c for purpose and usage.
*/
int puff(unsigned char *dest, /* pointer to destination pointer */
unsigned long *destlen, /* amount of output space */
const unsigned char *source, /* pointer to source data pointer */
unsigned long *sourcelen); /* amount of input available */
#endif // PUFF_HPP_INCLUDED
LICENSE:
BSD 3-Clause License
Copyright (c) 2016, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================
nlohmann-json
========================================================================
MIT License
Copyright (c) 2013-2025 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
openssl
========================================================================
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
========================================================================
plog
========================================================================
MIT License
Copyright (c) 2022 Sergey Podobry
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
usrsctp
========================================================================
Copyright (c) 2015, Randall Stewart and Michael Tuexen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of usrsctp nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1 @@
a0f1ad0defc5851d978f5ddd4db7a7caa62c0b650923f554e2e7ab1622b0fdc0

View file

@ -3,10 +3,14 @@ const path = require("node:path");
const util = require("node:util");
const childProcess = require("node:child_process");
const { buildTorrentBridge } = require("./build-torrent-bridge.cjs");
const {
installPrebuiltTorrentBridge,
} = require("./torrent-bridge-prebuilt.cjs");
const execFile = util.promisify(childProcess.execFile);
const MAX_COMMAND_OUTPUT_BYTES = 10 * 1024 * 1024;
const NATIVE_LOAD_TIMEOUT_MS = 30_000;
const ELECTRON_INSTALL_TIMEOUT_MS = 10 * 60_000;
const projectRoot = process.cwd();
const manifestPath = path.join(
@ -90,6 +94,38 @@ const copySidecarLibrariesOnWindows = async () => {
}
};
// Yarn runs this postinstall alongside Electron's, which downloads the
// runtime and then writes path.txt. Wait for it before loading the addon.
const waitForElectron = async () => {
if (
process.env.ELECTRON_SKIP_BINARY_DOWNLOAD ||
process.env.ELECTRON_OVERRIDE_DIST_PATH
) {
return;
}
const pathFile = path.join(
path.dirname(require.resolve("electron/package.json")),
"path.txt"
);
if (fs.existsSync(pathFile)) return;
const deadline = Date.now() + ELECTRON_INSTALL_TIMEOUT_MS;
await new Promise((resolve, reject) => {
const timer = setInterval(() => {
if (fs.existsSync(pathFile)) {
clearInterval(timer);
resolve();
} else if (Date.now() > deadline) {
clearInterval(timer);
reject(
new Error("Timed out waiting for Electron to finish installing")
);
}
}, 1000);
});
};
const build = async () => {
const sourceLibraryName = sourceLibraryNameByPlatform[process.platform];
@ -110,7 +146,8 @@ const build = async () => {
}
console.log("Building hydra-native Rust addon...");
const torrentLibraryDir = buildTorrentBridge();
const torrentLibraryDir =
installPrebuiltTorrentBridge() ?? buildTorrentBridge();
const cargoArgs = [
"build",
@ -145,6 +182,7 @@ const build = async () => {
// Verify with the actual application runtime, not a potentially incompatible
// system Node.js. Fail installation before the user opens the download UI.
await waitForElectron();
await run(
require("electron"),
[

View file

@ -7,6 +7,7 @@ const root = path.resolve(__dirname, "..");
const source = path.join(root, "native", "torrent-bridge");
const manifest = require(path.join(source, "vcpkg.json"));
const baseline = manifest["builtin-baseline"];
const NOTICES = "THIRD_PARTY_NOTICES.txt";
const run = (command, args, options = {}) => {
const result = cp.spawnSync(command, args, {
cwd: root,
@ -175,38 +176,67 @@ function copyRuntimeLibraries(stage, output) {
}
}
function copyDependencyNotices(installed, triplet, output) {
// One notice file for every port built into the bridge. Ports with the same
// license text (all of Boost, for one) share a section; vcpkg-* ports are
// build helpers and ship nothing.
function writeDependencyNotices(installed, triplet, file) {
const share = path.join(installed, triplet, "share");
const licenses = path.join(output, "licenses");
fs.mkdirSync(licenses, { recursive: true });
for (const name of fs.readdirSync(share)) {
const portsByText = new Map();
for (const name of fs.readdirSync(share).sort()) {
const copyright = path.join(share, name, "copyright");
if (fs.existsSync(copyright))
fs.copyFileSync(copyright, path.join(licenses, `${name}.txt`));
if (name.startsWith("vcpkg-") || !fs.existsSync(copyright)) continue;
const text = fs
.readFileSync(copyright, "utf8")
.replace(/\r\n?/g, "\n")
.trim();
portsByText.set(text, [...(portsByText.get(text) ?? []), name]);
}
const rule = "=".repeat(72);
const sections = [...portsByText].map(
([text, names]) => `${rule}\n${names.join(", ")}\n${rule}\n\n${text}\n`
);
fs.writeFileSync(
file,
[`Third-party notices for the libtorrent bridge (${triplet}).\n`]
.concat(sections)
.join("\n")
);
}
// Where the bridge's runtime files go, with the dependency manifest.
function prepareTorrentBridgeOutput() {
const output = path.join(root, "hydra-native");
fs.mkdirSync(output, { recursive: true });
// Older builds wrote one notice file per port.
fs.rmSync(path.join(output, "licenses"), { recursive: true, force: true });
fs.copyFileSync(
path.join(source, "vcpkg.json"),
path.join(output, "torrent-dependencies.json")
);
return output;
}
function buildTorrentBridge() {
function getTriplet() {
if (!["x64", "arm64"].includes(process.arch))
throw new Error(`Unsupported architecture: ${process.arch}`);
const arch = process.arch;
const platform = {
win32: "windows-static",
linux: "linux",
darwin: "osx",
}[process.platform];
if (!platform) throw new Error(`Unsupported platform: ${process.platform}`);
return `${process.arch}-${platform}`;
}
// Builds, tests and stages the bridge. Returns where its files landed.
function compileTorrentBridge() {
const triplet = getTriplet();
// The manifest baseline pins libtorrent, Boost, OpenSSL and WebRTC.
const cache =
process.env.HYDRA_NATIVE_CACHE ||
path.join(os.homedir(), ".cache", "hydra");
const { vcpkg, executable } = ensureVcpkg(cache);
const { cmake, ctest } = resolveCmakeTools(executable);
const triplet = `${arch}-${platform}`;
const build = path.join(
source,
"build",
@ -220,7 +250,7 @@ function buildTorrentBridge() {
source,
"-B",
build,
...getGeneratorArgs(arch),
...getGeneratorArgs(process.arch),
`-DCMAKE_TOOLCHAIN_FILE=${path.join(vcpkg, "scripts", "buildsystems", "vcpkg.cmake")}`,
`-DVCPKG_INSTALLED_DIR=${installed}`,
`-DVCPKG_TARGET_TRIPLET=${triplet}`,
@ -231,13 +261,26 @@ function buildTorrentBridge() {
run(cmake, ["--build", build, "--config", "Release", "--parallel"]);
run(ctest, ["--test-dir", build, "-C", "Release", "--output-on-failure"]);
run(cmake, ["--install", build, "--config", "Release"]);
return { triplet, stage, installed };
}
const output = path.join(root, "hydra-native");
fs.mkdirSync(output, { recursive: true });
function buildTorrentBridge() {
const { triplet, stage, installed } = compileTorrentBridge();
const output = prepareTorrentBridgeOutput();
copyRuntimeLibraries(stage, output);
copyDependencyNotices(installed, triplet, output);
writeDependencyNotices(installed, triplet, path.join(output, NOTICES));
return path.join(stage, "lib");
}
module.exports = { buildTorrentBridge };
module.exports = {
root,
source,
getTriplet,
compileTorrentBridge,
NOTICES,
copyRuntimeLibraries,
writeDependencyNotices,
prepareTorrentBridgeOutput,
buildTorrentBridge,
};
if (require.main === module) buildTorrentBridge();

View file

@ -0,0 +1,190 @@
// Committed builds of the libtorrent bridge, so installs skip compiling
// libtorrent, Boost and OpenSSL through vcpkg. Each bundle records a hash of
// the bridge inputs; a bundle whose hash no longer matches is ignored and the
// bridge is built from source instead.
//
// node scripts/torrent-bridge-prebuilt.cjs update Rebuild this platform's bundle
// node scripts/torrent-bridge-prebuilt.cjs check Report whether it is current
// node scripts/torrent-bridge-prebuilt.cjs verify Fail if any bundle is stale
//
// The "Torrent bridge prebuilts" workflow runs `update` on every platform and
// commits the results. Bundles are skipped when HYDRA_TORRENT_BRIDGE_FROM_SOURCE=1
// or HYDRA_TORRENT_SANITIZE=1, and on Linux systems that cannot load them.
const fs = require("node:fs");
const path = require("node:path");
const crypto = require("node:crypto");
const cp = require("node:child_process");
const {
root,
source,
NOTICES,
getTriplet,
compileTorrentBridge,
copyRuntimeLibraries,
writeDependencyNotices,
prepareTorrentBridgeOutput,
} = require("./build-torrent-bridge.cjs");
const prebuiltRoot = path.join(source, "prebuilt");
const STAMP = "inputs.sha256";
// Build output and bundles live in the source folder but never shape the binary.
const ignoredSourceDirs = new Set(["build", "prebuilt", "vcpkg_installed"]);
function listInputs() {
const files = [path.join(__dirname, "build-torrent-bridge.cjs")];
const walk = (dir) => {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const location = path.join(dir, entry.name);
if (!entry.isDirectory()) files.push(location);
else if (dir !== source || !ignoredSourceDirs.has(entry.name))
walk(location);
}
};
walk(source);
// Code-unit order, so every machine and locale hashes files the same way.
return files
.map((file) => path.relative(root, file).split(path.sep).join("/"))
.sort((a, b) => Number(a > b) - Number(a < b));
}
function hashInputs() {
const hash = crypto.createHash("sha256");
for (const file of listInputs()) {
// Line endings depend on the checkout, not on what gets built.
const content = fs
.readFileSync(path.join(root, file), "utf8")
.replaceAll("\r\n", "\n");
hash.update(`${file}\0${content}\0`);
}
return hash.digest("hex");
}
function getBundle() {
const triplet = getTriplet();
const dir = path.join(prebuiltRoot, triplet);
const stampPath = path.join(dir, STAMP);
const stamp = fs.existsSync(stampPath)
? fs.readFileSync(stampPath, "utf8").trim()
: null;
return { triplet, dir, stamp, isCurrent: stamp === hashInputs() };
}
// Sanitizer builds and explicit requests need the bridge compiled here.
function isSourceBuildForced() {
return (
process.env.HYDRA_TORRENT_BRIDGE_FROM_SOURCE === "1" ||
process.env.HYDRA_TORRENT_SANITIZE === "1"
);
}
// The Linux bundle needs the glibc and libstdc++ versions of the image that
// built it; ldd names any this system lacks.
function findMissingLinuxDependencies(dir) {
if (process.platform !== "linux") return null;
const ldd = ["/usr/bin/ldd", "/bin/ldd"].find((file) => fs.existsSync(file));
if (!ldd) return "ldd was not found";
const library = path.join(dir, "lib", "libhydra_torrent_bridge.so");
const result = cp.spawnSync(ldd, [library], { encoding: "utf8" });
const missing = `${result.stdout ?? ""}${result.stderr ?? ""}`
.split("\n")
.filter((line) => line.includes("not found"))
.map((line) => line.trim());
if (missing.length) return missing.join("; ");
if (result.error || result.status !== 0) return "ldd could not inspect it";
return null;
}
// Why this system cannot use its committed bundle, or null when it can.
function getBundleProblem({ triplet, dir, stamp, isCurrent }) {
if (isSourceBuildForced()) return "a source build was requested";
if (!stamp) return `there is no prebuilt torrent bridge for ${triplet}`;
if (!isCurrent)
return `the prebuilt torrent bridge for ${triplet} is out of date. Run the "Torrent bridge prebuilts" workflow on this branch to refresh it`;
const missing = findMissingLinuxDependencies(dir);
if (missing)
return `this system cannot load the prebuilt torrent bridge (${missing})`;
return null;
}
function warn(message) {
console.warn(process.env.GITHUB_ACTIONS ? `::warning::${message}` : message);
}
// Installs the committed bundle into hydra-native and returns the folder to
// link against, or null when the bridge must be built from source.
function installPrebuiltTorrentBridge() {
const bundle = getBundle();
const problem = getBundleProblem(bundle);
if (problem) {
// A missing bundle or a requested source build is expected; others are not.
const report = bundle.stamp && !isSourceBuildForced() ? warn : console.log;
report(`Building the torrent bridge from source: ${problem}.`);
return null;
}
const { triplet, dir } = bundle;
const output = prepareTorrentBridgeOutput();
copyRuntimeLibraries(dir, output);
fs.copyFileSync(path.join(dir, NOTICES), path.join(output, NOTICES));
console.log(`Using the prebuilt torrent bridge for ${triplet}.`);
return path.join(dir, "lib");
}
function updatePrebuilt() {
const { triplet, stage, installed } = compileTorrentBridge();
const dir = path.join(prebuiltRoot, triplet);
fs.rmSync(dir, { recursive: true, force: true });
for (const name of ["bin", "lib"]) {
const location = path.join(stage, name);
if (fs.existsSync(location))
fs.cpSync(location, path.join(dir, name), { recursive: true });
}
writeDependencyNotices(installed, triplet, path.join(dir, NOTICES));
fs.writeFileSync(path.join(dir, STAMP), `${hashInputs()}\n`);
console.log(`Updated the prebuilt torrent bridge in ${dir}`);
}
function check() {
const problem = getBundleProblem(getBundle());
const isCurrent = problem === null;
console.log(
isCurrent
? "The prebuilt torrent bridge is usable."
: `Not usable: ${problem}.`
);
if (process.env.GITHUB_OUTPUT)
fs.appendFileSync(process.env.GITHUB_OUTPUT, `current=${isCurrent}\n`);
}
// Fails unless every bundle, whatever its platform, matches the inputs.
function verify() {
const hash = hashInputs();
const stale = fs.readdirSync(prebuiltRoot).filter((triplet) => {
const stampPath = path.join(prebuiltRoot, triplet, STAMP);
return (
!fs.existsSync(stampPath) ||
fs.readFileSync(stampPath, "utf8").trim() !== hash
);
});
if (stale.length) {
console.error(`Out of date prebuilt torrent bridges: ${stale.join(", ")}`);
process.exit(1);
}
console.log("Every prebuilt torrent bridge matches its inputs.");
}
module.exports = { installPrebuiltTorrentBridge };
if (require.main === module) {
const command = process.argv[2];
if (command === "update") updatePrebuilt();
else if (command === "check") check();
else if (command === "verify") verify();
else {
console.error(
"Usage: node scripts/torrent-bridge-prebuilt.cjs <update|check|verify>"
);
process.exit(1);
}
}