From 4727f22ed89e7776c338843e229ad5a33b2aa48d Mon Sep 17 00:00:00 2001
From: Var Bhat
Date: Thu, 26 Aug 2021 02:23:47 +0530
Subject: [PATCH] first commit
---
.github/FUNDING.yml | 3 +
.github/dependabot.yml | 16 +
.github/workflows/build.yml | 32 +
.github/workflows/docker.yml | 45 +
Dockerfile | 13 +
LICENSE | 674 ++++
Makefile | 41 +
NOTICE.txt | 5 +
README.md | 93 +
docs/API.md | 97 +
docs/CONTRIBUTING.md | 31 +
docs/build.md | 50 +
docs/config.md | 16 +
docs/database.md | 24 +
docs/deploy.md | 169 +
docs/docker.md | 35 +
docs/features.md | 29 +
docs/screenshots.md | 54 +
docs/usage.md | 62 +
exatorrent.go | 54 +
go.mod | 87 +
go.sum | 1070 +++++++
internal/core/auth.go | 185 ++
internal/core/cache.go | 45 +
internal/core/connection.go | 151 +
internal/core/engine.go | 584 ++++
internal/core/get.go | 334 ++
internal/core/getspec.go | 121 +
internal/core/init.go | 310 ++
internal/core/routine.go | 103 +
internal/core/serve.go | 226 ++
internal/core/socket.go | 995 ++++++
internal/core/statsapi.go | 85 +
internal/core/storage.go | 12 +
internal/core/storage_cgo.go | 40 +
internal/core/vars.go | 540 ++++
internal/core/version.go | 3 +
internal/db/db.go | 116 +
internal/db/psqlfilestatedb.go | 65 +
internal/db/psqllockstatedb.go | 46 +
internal/db/psqlpc.go | 52 +
internal/db/psqltorrentdb.go | 109 +
internal/db/psqltorrentuserdb.go | 109 +
internal/db/psqltrackerdb.go | 68 +
internal/db/psqluserdb.go | 139 +
internal/db/sqlite3filestatedb.go | 73 +
internal/db/sqlite3lockstatedb.go | 66 +
internal/db/sqlite3pc.go | 81 +
internal/db/sqlite3torrentdb.go | 196 ++
internal/db/sqlite3torrentuserdb.go | 120 +
internal/db/sqlite3trackerdb.go | 90 +
internal/db/sqlite3userdb.go | 191 ++
internal/web/.gitignore | 2 +
internal/web/.npmrc | 1 +
internal/web/.prettierignore | 3 +
internal/web/.prettierrc | 6 +
internal/web/esbuild.config.js | 46 +
internal/web/package-lock.json | 2732 +++++++++++++++++
internal/web/package.json | 38 +
internal/web/src/Index.svelte | 69 +
internal/web/src/index.html | 12 +
internal/web/src/index.ts | 5 +
internal/web/src/partials/About.svelte | 23 +
internal/web/src/partials/Disconnect.svelte | 45 +
internal/web/src/partials/File.svelte | 90 +
internal/web/src/partials/Index.svelte | 167 +
.../web/src/partials/Notifications.svelte | 41 +
internal/web/src/partials/ProgStat.svelte | 28 +
internal/web/src/partials/Settings.svelte | 385 +++
internal/web/src/partials/Signin.svelte | 103 +
internal/web/src/partials/Stats.svelte | 170 +
internal/web/src/partials/Top.svelte | 67 +
internal/web/src/partials/Torrent.svelte | 684 +++++
internal/web/src/partials/TorrentCard.svelte | 225 ++
internal/web/src/partials/Torrents.svelte | 49 +
internal/web/src/partials/User.svelte | 37 +
internal/web/src/partials/Useredit.svelte | 120 +
internal/web/src/partials/Users.svelte | 273 ++
internal/web/src/partials/core.ts | 517 ++++
internal/web/tailwind.config.cjs | 26 +
internal/web/tsconfig.json | 9 +
internal/web/web.go | 30 +
82 files changed, 13958 insertions(+)
create mode 100644 .github/FUNDING.yml
create mode 100644 .github/dependabot.yml
create mode 100644 .github/workflows/build.yml
create mode 100644 .github/workflows/docker.yml
create mode 100644 Dockerfile
create mode 100644 LICENSE
create mode 100644 Makefile
create mode 100644 NOTICE.txt
create mode 100644 README.md
create mode 100644 docs/API.md
create mode 100644 docs/CONTRIBUTING.md
create mode 100644 docs/build.md
create mode 100644 docs/config.md
create mode 100644 docs/database.md
create mode 100644 docs/deploy.md
create mode 100644 docs/docker.md
create mode 100644 docs/features.md
create mode 100644 docs/screenshots.md
create mode 100644 docs/usage.md
create mode 100644 exatorrent.go
create mode 100644 go.mod
create mode 100644 go.sum
create mode 100644 internal/core/auth.go
create mode 100644 internal/core/cache.go
create mode 100644 internal/core/connection.go
create mode 100644 internal/core/engine.go
create mode 100644 internal/core/get.go
create mode 100644 internal/core/getspec.go
create mode 100644 internal/core/init.go
create mode 100644 internal/core/routine.go
create mode 100644 internal/core/serve.go
create mode 100644 internal/core/socket.go
create mode 100644 internal/core/statsapi.go
create mode 100644 internal/core/storage.go
create mode 100644 internal/core/storage_cgo.go
create mode 100644 internal/core/vars.go
create mode 100644 internal/core/version.go
create mode 100644 internal/db/db.go
create mode 100644 internal/db/psqlfilestatedb.go
create mode 100644 internal/db/psqllockstatedb.go
create mode 100644 internal/db/psqlpc.go
create mode 100644 internal/db/psqltorrentdb.go
create mode 100644 internal/db/psqltorrentuserdb.go
create mode 100644 internal/db/psqltrackerdb.go
create mode 100644 internal/db/psqluserdb.go
create mode 100644 internal/db/sqlite3filestatedb.go
create mode 100644 internal/db/sqlite3lockstatedb.go
create mode 100644 internal/db/sqlite3pc.go
create mode 100644 internal/db/sqlite3torrentdb.go
create mode 100644 internal/db/sqlite3torrentuserdb.go
create mode 100644 internal/db/sqlite3trackerdb.go
create mode 100644 internal/db/sqlite3userdb.go
create mode 100644 internal/web/.gitignore
create mode 100644 internal/web/.npmrc
create mode 100644 internal/web/.prettierignore
create mode 100644 internal/web/.prettierrc
create mode 100644 internal/web/esbuild.config.js
create mode 100644 internal/web/package-lock.json
create mode 100644 internal/web/package.json
create mode 100644 internal/web/src/Index.svelte
create mode 100644 internal/web/src/index.html
create mode 100644 internal/web/src/index.ts
create mode 100644 internal/web/src/partials/About.svelte
create mode 100644 internal/web/src/partials/Disconnect.svelte
create mode 100644 internal/web/src/partials/File.svelte
create mode 100644 internal/web/src/partials/Index.svelte
create mode 100644 internal/web/src/partials/Notifications.svelte
create mode 100644 internal/web/src/partials/ProgStat.svelte
create mode 100644 internal/web/src/partials/Settings.svelte
create mode 100644 internal/web/src/partials/Signin.svelte
create mode 100644 internal/web/src/partials/Stats.svelte
create mode 100644 internal/web/src/partials/Top.svelte
create mode 100644 internal/web/src/partials/Torrent.svelte
create mode 100644 internal/web/src/partials/TorrentCard.svelte
create mode 100644 internal/web/src/partials/Torrents.svelte
create mode 100644 internal/web/src/partials/User.svelte
create mode 100644 internal/web/src/partials/Useredit.svelte
create mode 100644 internal/web/src/partials/Users.svelte
create mode 100644 internal/web/src/partials/core.ts
create mode 100644 internal/web/tailwind.config.cjs
create mode 100644 internal/web/tsconfig.json
create mode 100644 internal/web/web.go
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..d467cb50
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+ko_fi: varbhat
+liberapay: varbhat
+custom: "https://www.paypal.me/varbhat"
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..01d72b9a
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,16 @@
+version: 2
+updates:
+ - package-ecosystem: "gomod"
+ directory: "/"
+ schedule:
+ interval: "daily"
+
+ - package-ecosystem: "npm"
+ directory: "/internal/web"
+ schedule:
+ interval: "daily"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..9d78fec8
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,32 @@
+name: Build exatorrent
+
+on:
+ push:
+ tags:
+ - v*
+
+jobs:
+ build:
+ if: ${{ github.owner }} == "varbhat"
+ runs-on: ubuntu-latest
+
+ container:
+ image: "ghcr.io/varbhat/void-container:glibc"
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ steps:
+ - name: Prepare container
+ run: |
+ xbps-install -Syu || xbps-install -yu xbps
+ xbps-install -yu
+ - name: Install Packages
+ run: xbps-install -Sy git curl bash make go nodejs cross-x86_64-linux-musl cross-aarch64-linux-musl github-cli
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ - name: Build exatorrent
+ run: go mod tidy && make web && make app-linux-amd64 && make app-linux-arm64 && make checksum
+ - name: Publish Releases
+ run: |
+ gh config set prompt disabled
+ gh release create $(git tag -l | tail -n1) -t $(git tag -l | tail -n1) -p build/*
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 00000000..592c1410
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,45 @@
+name: Create and publish Container Images
+
+on:
+ push:
+ tags:
+ - v*
+
+jobs:
+ build-container-images:
+ if: ${{ github.owner }} == "varbhat"
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Setup QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: Setup Docker Buildx
+ uses: docker/setup-buildx-action@v1
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build the amd64 image
+ run: docker buildx build --load --platform "linux/amd64" . --tag ghcr.io/varbhat/exatorrent:amd64
+
+ - name: Build the arm64 image
+ run: docker buildx build --load --platform "linux/arm64" . --tag ghcr.io/varbhat/exatorrent:arm64
+
+ - name: Push Images
+ run: docker push ghcr.io/varbhat/exatorrent -a
+
+ - name: Create and Push Manifest
+ run: |
+ docker manifest create ghcr.io/varbhat/exatorrent:latest ghcr.io/varbhat/exatorrent:amd64 ghcr.io/varbhat/exatorrent:arm64
+ docker manifest push ghcr.io/varbhat/exatorrent:latest
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..36cf5f2e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,13 @@
+FROM ghcr.io/varbhat/void-container:musl AS build
+RUN xbps-install -Syu || xbps-install -yu xbps
+RUN xbps-install -yu
+RUN xbps-install -Sy git curl bash make go nodejs gcc
+WORKDIR /exa
+ADD . /exa
+RUN go mod tidy && make web && make app
+
+FROM gcr.io/distroless/base
+COPY --from=build --chown=1000:1000 /exa/build/exatorrent /exatorrent
+USER 1000:1000
+WORKDIR /exa
+ENTRYPOINT ["/exatorrent"]
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..f288702d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..04a4f243
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+SHELL = /usr/bin/env sh
+APP_NAME = exatorrent
+PACKAGES ?= ./...
+MAIN_SOURCE = exatorrent.go
+.DEFAULT_GOAL := help
+
+##help: Display list of commands
+.PHONY: help
+help: Makefile
+ @printf "Options:\n"
+ @sed -n 's|^##||p' $<
+
+##web: Build the Web Client
+.PHONY: web
+web:
+ cd internal/web && npm install && npm run build
+
+##app: Build the Application
+.PHONY: app
+app:
+ env CGO_ENABLED=1 go build -trimpath -buildmode=pie -ldflags '-extldflags "-static -s -w"' -o build/$(APP_NAME) $(MAIN_SOURCE)
+
+##app-linux-amd64: Build the Application for linux (amd64)
+.PHONY: app-linux-amd64
+app-linux-amd64:
+ env CGO_ENABLED=1 GOOS="linux" GOARCH="amd64" CC="x86_64-linux-musl-gcc" CXX="x86_64-linux-musl-g++" go build -trimpath -buildmode=pie -ldflags '-extldflags "-static -s -w"' -o build/$(APP_NAME)-linux-amd64 $(MAIN_SOURCE)
+
+##app-linux-arm64: Build the Application for linux (arm64)
+.PHONY: app-linux-arm64
+app-linux-arm64:
+ env CGO_ENABLED=1 GOOS="linux" GOARCH="arm64" CC="aarch64-linux-musl-gcc" CXX="aarch64-linux-musl-g++" go build -trimpath -buildmode=pie -ldflags '-extldflags "-static -s -w"' -o build/$(APP_NAME)-linux-arm64 $(MAIN_SOURCE)
+
+##checksum: Generate sha256 checksums for the builds
+.PHONY: checksum
+checksum:
+ cd build && sha256sum -b * > checksums_sha256.txt
+
+##run: Runs the build
+.PHONY: run
+run:
+ cd build && ./exatorrent*
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 00000000..8da417c5
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,5 @@
+This product includes software from the anacrolix/torrent project
+ * License : Mozilla Public License 2.0
+
+This product includes icons from tailwindlabs/heroicons
+ * License : MIT
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..837fb430
--- /dev/null
+++ b/README.md
@@ -0,0 +1,93 @@
+exatorrent
+self-hostable torrent client
+
+
+Screenshots • Releases • Features • Installation • Usage • Docker • Build • License
+
+
+
+## Introduction
+exatorrent is [BitTorrent](https://www.bittorrent.org/) Client written in [Go](https://go.dev/).
+It can be run locally or be hosted in Remote Server with good resources
+to use that Server as [SeedBox](https://en.wikipedia.org/wiki/Seedbox).
+It is Single Completely Statically Linked Binary with Zero External Dependencies .
+
+exatorrent is simple yet feature-rich . It is
+lightweight and light on resources. It comes with Beautiful Responsive Web Client written in Svelte and Typescript ,
+but thanks to documented [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) [API](docs/API.md) of exatorrent , you can also write your own client if you want to.
+
+exatorrent can operate in Optional Multi-User Mode administrated by admin user/s
+but it can successfully be used by Single-User as well.
+Torrented Files are stored in local disk of device where it's run, which are then retrievable or streamable via HTTP.
+
+
+
+
+
More Screenshots →
+
+
+
+## Installation
+exatorrent can be installed in 3 ways.
+* **Releases:** You can download binary for your OS from [Releases](https://github.com/varbhat/exatorrent/releases/latest) . Mark it as executable and run it . Refer [Usage](docs/usage.md) .
+ ```bash
+ wget https://github.com/varbhat/exatorrent/releases/download/latest/exatorrent-linux-amd64
+ chmod u+x ./exatorrent-linux-amd64
+ ./exatorrent-linux-amd64
+ ```
+ * **Docker:** exatorrent can also be run inside Docker ( or Podman ). See [Docker Docs](docs/docker.md) .
+ ```bash
+ docker pull ghcr.io/varbhat/exatorrent:latest
+ docker run -p 5000:5000 -p 42069:42069 -v /path/to/directory:/exa/exadir ghcr.io/varbhat/exatorrent:latest
+ ```
+ * **Build:** exatorrent is open source and can be built from sources . See [Build Docs](docs/build.md) .
+ ```bash
+ make web && make app
+ ```
+Note that **Username** and **Password** of Default User created on first run are `adminuser` and `adminpassword` respectively. You can change Password later but Username of Account can't be changed after creation. Refer [Usage](docs/usage.md#-admin) .
+
+[Github Actions](https://github.com/features/actions) is used to build and publish [Releases](https://github.com/varbhat/exatorrent/releases/latest) and [Docker/Podman Images](https://ghcr.io/varbhat/exatorrent) of exatorrent .
+
+If you want to deploy `exatorrent` on server , please also refer [Deploy Docs](docs/deploy.md) .
+
+## Features
+* Single Executable File with No Dependencies
+* Small in Size
+* Cross Platform
+* Download (or Build ) Single Executable Binary and run . That's it
+* Open and Stream Torrents in your Browser
+* Add Torrents by Magnet or by Infohash or Torrent File
+* Individual File Control (Start, Stop or Delete )
+* Stop , Remove or Delete Torrent
+* Persistent between Sessions
+* Stop Torrent once SeedRatio is reached (Optional)
+* Powered by [anacrolix/torrent](https://github.com/anacrolix/torrent)
+* Download/Upload [Rate limiter](https://github.com/varbhat/exatorrent/blob/main/docs/usage.md#rate-limiter) (Optional)
+* Apply [Blocklist](docs/usage.md#blocklist) (Optional)
+* [Configurable](docs/config.md) via Config File but works fine with Zero Configuration
+* Share Files by Unlocking Torrent or Lock Torrent (protect by Auth) to prevent External Access
+* Retrieve or Stream Files via HTTP
+* Multi-Users with Authentication
+* Auto Add Trackers to Torrent from TrackerList URL
+* Auto Fetch Torrent Metainfo from Online/Local Metainfo Cache
+* Download Directory as Zip or as Tarball
+* Stream directly on Browser or [VLC](https://www.videolan.org/vlc/) or [mpv](https://mpv.io/) or other Media Players
+* [Documented API](docs/API.md)
+* Uses Sqlite3 (embedded database with no setup and no configuration) by Default for [Database](docs/database.md) but PostgreSQL can be used instead too
+
+
+
Read More →
+
+
+## Help
+
+Communication about the project is primarily through [Discussions](https://github.com/varbhat/exatorrent/discussions) and the [Issues](https://github.com/varbhat/exatorrent/issues).
+
+## Contribute
+You are welcome to contribute . Please Read the [contributing docs](docs/CONTRIBUTING.md) first.
+
+## Sponsor
+If you like this Project , please consider this as an opportunity to sponsor / donate to this project . This would help me maintain this project and also work on other Open Source Projects . Use [Liberapay](https://liberapay.com/varbhat) , [Paypal](https://www.paypal.me/varbhat) , [Ko-fi](https://ko-fi.com/varbhat) or [UPI](https://en.wikipedia.org/wiki/Unified_Payments_Interface) (VPA: `mailvarbhat@okhdfcbank`) to Sponsor / Donate to this Project .
+
+## License
+[GPL-v3](LICENSE)
diff --git a/docs/API.md b/docs/API.md
new file mode 100644
index 00000000..48c057b9
--- /dev/null
+++ b/docs/API.md
@@ -0,0 +1,97 @@
+exatorrent comes with beautiful performant Web Client written in svelte+Typescript but also comes with documented API so that custom clients(TUI, android app ,desktop app,etc.) can be created for it.
+
+Here lies the documented API reference.
+
+## Authentication
+
+exatorrent has authentication and if the connection is not authenticated, it cannot make API request.
+
+exatorrent has user system. user is structure as defined below.
+
+```go
+type User struct {
+ Username string
+ Password string
+ Token string
+ UserType int // 0 for User,1 for Admin,-1 for Disabled
+ CreatedAt time.Time
+}
+```
+
+Length of Username and Password fields of User must be more than 5. CreatedAt field stores the creation time of User. UserType field denotes whether the User is Admin / User / Disabled.
+if UserType field is 0 , User is Disabled and cannot connect to server. if UserType field is 0 , then the User is Normal User and can connect to server and perform normal operations. if UserType field is 1 ,then the User is Admin User and can connect to server. Admin User can also perform Administration Operations in addition to normal Operations. Token field contains unique random UUID token issued to User which can be used by User to Authenticate.
+
+exatorrent looks whether `session_token` cookie is present in request and if the cookie is present, it validates value of `session_token` as `Token` , and if `Token` is valid, User will be authenticated.
+
+if `session_token` cookie is not present , exatorrent looks whether Query named "token" is present in request's URL and if query named "token" is present , it validates value of `token` query as `Token` , and if `Token` is valid , User will be authenticated.
+
+If both `session_token` cookie and `token` query string are not present OR, value presented in cookie or query is invalid, `basic_auth` will be issued, and if Basic Authentication's values filled by connection are valid, then the User will be authenticated.
+
+After User is authenticated, `session_token` cookie with `Token` value will be set by exatorrent.
+
+Briefly , Connection can be authenticated by Cookie with token ,or URL Query with token , or by Basic Auth(Username and Password).
+
+
+exatorrent's WebSocket API endpoint `/api/socket` is protected by Authentication and only Authenticated User(Normal User or Admin User) can connect to WebSocket API. Note that Disabled User cannot connect to WebSocket API. Also, Only ONE WebSocket connection is allowed per User(existing WebSocket connection of User gets disconnected on new WebSocket connection of User)
+
+Endpoint `/api/auth` is also provided where you can `POST` json request
+
+```json
+{
+ "data1": "yourusernamehere",
+ "data2": "yourpasswordhere"
+}
+```
+
+to get `Token` and `UserType` of the User. Response will be of the form ,
+
+```json
+{
+ "usertype": "user",
+ "session": "uniqueuuidsession"
+}
+```
+
+# WebSocket API
+
+exatorrent has WebSocket API which provides API to control exatorrent . Note that there is seperate HTTP API Endpoint to retrieve / stream Torrent Files for which websocket will not be used and is documented later.
+
+Only Authenticated User who is not `disabled` can connect to WebSocket API . Only ONE WebSocket connection is allowed per User(existing WebSocket connection of User gets disconnected on new WebSocket connection of User).
+
+Communication in exatorrent WebSocket is done through JSON . exatorrent WebSocket Only accepts JSON requests of the form,
+
+```json
+{
+ "command": "commandstring",
+ "data1": "data1string",
+ "data2": "data2string",
+ "data3": "data3string",
+ "aop": 0
+}
+```
+
+if json request is not of the form mentioned above , json
+
+```json
+{
+ "type": "resp",
+ "state": "error",
+ "msg":"invalid command"
+}
+```
+
+will be sent back as response.
+
+
+command field of json request represents command that needs to be done. `data1` , `data2` and `data3` fields of json request represents data. `aop` field specifies whether json request is admin request or not. if `aop` field is 1 and user is admin, then exatorrent considers it as admin command (note that if users who are not admins send this,they are not valuated). better omit `aop` field if request is not admin request.
+
+
+## Stream Requests
+
+Some Requests namely `getalltorrents` , `gettorrents` , `gettorrentinfo` are stream requests . They continuously send data regularly with 5 seconds gap in between. This is useful , say for showing progress of Torrent . There can be only 1 Stream at a time , so if you request new stream , old stream stops . you can also stop stream by sending request `{"command":"stopstream"}` . This stops stream if any do exist.
+
+## Reference
+Please Read [wshandler](https://github.com/varbhat/exatorrent/blob/main/internal/core/socket.go#L108) to get more details about API
+
+
+
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
new file mode 100644
index 00000000..3ae550ca
--- /dev/null
+++ b/docs/CONTRIBUTING.md
@@ -0,0 +1,31 @@
+Thank you for your interest in `exatorrent` . We highly appreciate it . You are welcome to contribute to `exatorrent` . But, please read this document completely .
+
+**Please ask first before starting work on any significant new features**
+
+It's never a fun experience to have your pull request declined after investing a lot of time and effort into a new feature. To avoid this from happening, we request that contributors create [an issue](https://github.com/varbhat/exatorrent/issues) or use [discussions](https://github.com/varbhat/exatorrent/discussions) to first discuss any **significant** new features.
+
+
+**Everyone is welcome to contribute**
+
+You are welcome to contribute . We only care about quality contributions . Consider this as Great Opportunity to contribute towards Open Source Software that will benefit the community and which will stay Open Source forever.
+
+If you know [Go](https://go.dev) Programming Language , you can contribute to `exatorrent` by solving issues , finding bugs(if they exist) , adding new features if it can benefit the community (Please ask before if you are adding new features; see above).
+Note that `exatorrent` except Web Client has been completely written in `Go` .
+
+Web Client of `exatorrent` has been written in [Svelte](https://svelte.dev/) + [TypeScript](https://www.typescriptlang.org/) . Note that TypeScript is Typed Javascript that prevents many mistakes that are possible when using Javascript .
+[Tailwind](https://tailwindcss.com/) CSS framework has been used for the UI . If you know Svelte / TypeScript / Tailwindcss , you can contribute towards improving Web Client . If you find any bugs in Web Client , please Open issue.
+If you have expertise in UI/UX , you can work towards making Web Client more awesome and improving UI/UX of Web Client . If you are designer , you can contribute towards creating good identity (logo , favicon and other visual identities) for exatorrent .
+
+Although we prefer Pull Requests , you are welcome to request new Feature in [Issues](https://github.com/varbhat/exatorrent/issues) or [Discussions](https://github.com/varbhat/exatorrent/discussions) . Please include `Feature Request` in the title of post .
+
+**Code must be Formatted**
+
+All `go` code must be formatted using `gofmt` . All Web code must be formatted using `Prettier` (with config existing in `web` subfolder).
+
+**Improve Documentation**
+
+You are free to improve Documentation of `exatorrent` .
+
+**Spread the Word about exatorrent**
+
+If you like `exatorrent` , popularize `exatorrent` by spreading and talking good things about it.
diff --git a/docs/build.md b/docs/build.md
new file mode 100644
index 00000000..8f41a9da
--- /dev/null
+++ b/docs/build.md
@@ -0,0 +1,50 @@
+# Build Docs
+This Documents how to build `exatorrent` from sources .
+
+`exatorrent` is written in [Go](https://golang.org) . As such you need `go` to be installed in order to compile .
+
+`exatorrent` is dependent on [sqlite3](https://www.sqlite.org) ( used as database ) and [libutp](https://github.com/anacrolix/go-libutp) ( used for uTP connections ) . As such , you also require C and C++ compilers to be installed in order to compile . [gcc](https://gcc.gnu.org/) is preferred but [clang](https://clang.llvm.org/) also compiles well . There is no need to install any `devel` packages or `sqlite` or headers in system to compile `exatorrent` , as Source comes bundeled with drivers [`crawshaw/sqlite`](https://github.com/crawshaw/sqlite) and [`libutp`](https://github.com/anacrolix/go-libutp) and C compiler is used to compile cgo code .
+
+
+`exatorrent` comes with beautiful , small and performant Web Client . It is written in [Svelte](https://svelte.dev/) + [TypeScript](https://www.typescriptlang.org/) . It gets bundled with amazing [esbuild](https://esbuild.github.io/) and the built web client is then embedded within the binary using Go's [embed](https://pkg.go.dev/embed) . [Node.js](https://nodejs.org/) is thus required to build Web Client . Note that Node.js is required only to build Web Client written in Svelte and not required thereafter (i.e exatorrent is not dependent on Node.js and Node.js in only required to build Web Client ).
+
+
+For sake of Convenience although not necessary to build `exatorrent` , Build commands of `exatorrent` are written in [Makefile](../Makefile) . Install [`make`](https://www.gnu.org/software/make/) to execute make commands . Note that you can also manually type build commands instead of using `make` .
+
+
+## Requirements
+
+* [go](https://golang.org)
+* [gcc](https://gcc.gnu.org/)
+* [make](https://www.gnu.org/software/make/) ( to execute make commands )
+
+Requirements to build Web Client :
+* [Node.js](https://nodejs.org/) (`node` and `npm` must be available )
+
+## Build
+Since Web Client will be embedded within final binary , Web Client needs to be built first .
+
+Web Client can be built by :
+
+```bash
+make web
+```
+
+After building web client , `exatorrent` can be built by :
+```bash
+make app
+```
+
+You can see built `exatorrent` in `build` directory .
+
+If you don't have `make` installed , you can execute these commands manually to build exatorrent :
+```bash
+cd internal/web && npm install && npm run build
+cd ../..
+env CGO_ENABLED=1 go build -trimpath -buildmode=pie -ldflags '-extldflags "-static -s -w"' -o build/exatorrent exatorrent.go
+```
+## Notes
+* See [Building Docker/Podman Images](./docker.md#building-podman--docker-container-image) if you want to build `exatorrent` Docker / Podman Images .
+* If you don't want to build Web Client or want to skip building Web Client , you can do it by creating empty / dummy `index.html` file at `internal/web/build` directory ( Create `build` folder if it didn't exist ) . Note that Web Client will not be available then .
+
+
diff --git a/docs/config.md b/docs/config.md
new file mode 100644
index 00000000..74067ffa
--- /dev/null
+++ b/docs/config.md
@@ -0,0 +1,16 @@
+`exatorrent` is fully configurable . This page details configurations that are possible in `exatorrent`
+
+
+## Options that are configurable during Runtime
+
+There are options that can be configured during runtime and without restarting `exatorrent` . It can also be configured through Web Client (or API) . See [EngConfig](https://github.com/varbhat/exatorrent/blob/main/internal/core/vars.go#L352) for more details about the engconfig.
+
+When exatorrent gets started, it checks whether engconfig.json file is present in config directory (which is subdirectory of main directory of exatorrent) and if json is valid configuration, it gets applied. also, when you change the configuration during runtime, the json file gets updated. You can generate sample engconfig(so that you can modify it to set value you want it to have) by passing flag `-engc` while starting the program.
+
+## Options that are not configurable during runtime
+
+Many of configuration of torrent engine `anacrolix/torrent` are only applied at start of engine and cannot be configurable during runtime. See [TorConfig](https://github.com/varbhat/exatorrent/blob/main/internal/core/vars.go#L42) for more details.
+
+Note that most of torcconfig maps to [ClientConfig](https://github.com/anacrolix/torrent/blob/master/config.go#L23)
+
+You can generate sample torcconfig(so that you can modify it to set value you want it to have) by passing flag `-torc` while starting the program. Note that if you don't want to configure , set it's value as `null` .
diff --git a/docs/database.md b/docs/database.md
new file mode 100644
index 00000000..9076d921
--- /dev/null
+++ b/docs/database.md
@@ -0,0 +1,24 @@
+To make things persistent between sessions , `exatorrent` uses database . But because `exatorrent` uses awesome `sqlite3` which comes embedded within `exatorrent` , you barely notice it.
+Instead of `sqlite3` , you can also use `postgresql` if you want to. Know that both `sqlite` and `postgresql` are provided as choices of Database Implementations . When in doubt, use `sqlite3`(which is used by `exatorrent` as default
+,i.e , don't worry about configuring Database at all.
+
+
+Note that once you start using one Database , you must stick to it . You cannot jump between Database Implementations and if you do , you loose data.
+
+### Data Stored in Database
+
+1. Users and their data
+2. Trackers
+3. State of Torrent
+4. Piece Completion State of Torrent
+5. State of Files of Torrent
+6. Lock State of Torrent
+
+
+## Postgresql
+
+Normally you will be fine using `sqlite3` which `exatorrent` uses by default , which you don't need to setup and configure. But , Postgresql is also provided as choice . If you want to try out Postgresql as Database (Note that you can't switch back to sqlite later) , follow instructions below :
+
+* Create Postgresql Database . Remember it's credentials .
+* Remember format for Connection URL: `postgres://username:password@localhost:5432/database_name`
+* You need to pass connection URL to `exatorrent` . You can either set `DATABASE_URL` environment variable as connection URL or you can write connection URL to file at `/config/psqlconfig.txt` . If you want sample connection URL written at `psqlconfig.txt` , pass `-psql` flag to `exatorrent`
diff --git a/docs/deploy.md b/docs/deploy.md
new file mode 100644
index 00000000..43ba9f14
--- /dev/null
+++ b/docs/deploy.md
@@ -0,0 +1,169 @@
+# Deploy Docs
+This Documents some things on deployment of `exatorrent` .
+
+# Run as Seperate User
+Create new seperate user and group to run `exatorrent` . In this document , we assume that `exatorrent` is run as `exatorrent` user and `exatorrent` group but any name is fine . Run `exatorrent` as seperate user and group .
+
+# Service
+Using Services help to make sure that `exatorrent` will be running even after reboot and better logging by service Manager . Below are example Service files for `Runit` , `Systemd` , `Sysvinit` and `Openrc` . Modify them to suit your system .
+
+## Runit
+`run` file of `exatorrent` is as below .
+
+```sh
+#!/bin/sh
+cd /path/to/directory
+exec chpst -u exatorrent:exatorrent /path/to/exatorrent
+```
+
+## Systemd
+Systemd unit file `exatorrent.service` is as follows :
+
+```
+[Unit]
+Description=exatorrent
+
+[Service]
+Type=simple
+Restart=always
+RestartSec=5s
+User=exatorrent
+Group=exatorrent
+WorkingDirectory=/path/to/directory
+ExecStart=/path/to/exatorrent
+
+[Install]
+WantedBy=multi-user.target
+```
+
+## Sysvinit
+Sysvinit script is as follows:
+
+```sh
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: exatorrent
+# Required-Start: $remote_fs $network
+# Required-Stop: $remote_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: starts exatorrent
+# Description: exatorrent is torrent client
+### END INIT INFO
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+NAME=exatorrent
+USER=exatorrent
+DESC="exatorrent"
+DAEMON_PATH=/path/to/exatorrent/bin/dir
+PIDFILE=/run/$NAME.pid
+LOGFILE=/var/log/$NAME.log
+TIMEOUT=30
+SCRIPTNAME=/etc/init.d/$NAME
+
+case "$1" in
+ start)
+ echo "Starting $DESC"
+ start-stop-daemon --start --background --oknodo --startas $DAEMON --chdir $DAEMON_PATH --chuid $USER --exec $DAEMON_PATH/$NAME --
+ ;;
+ stop)
+ echo "Stoping $DESC"
+ start-stop-daemon --stop --quiet --oknodo --retry=0/10/TERM/5/KILL/5 --exec $DAEMON_PATH/$NAME
+ ;;
+ status)
+ start-stop-daemon --status --exec $DAEMON_PATH/$NAME && exit_status=$? || exit_status=$?
+ case "$exit_status" in
+ 0) echo "The '$DESC' is running." ;;
+ *) echo "The '$DESC' is not running." ;;
+ esac
+ ;;
+ restart)
+ echo "Restarting $DESC: "
+ sh $0 stop
+ sleep 20
+ mv --backup=numbered $LOGFILE $LOGFILE.1
+ sh $0 start
+ ;;
+esac
+exit 0
+```
+
+## openrc
+
+Openrc `run` file is as follows :
+
+```sh
+#!/sbin/openrc-run
+description="exatorrent"
+
+depend() {
+ need net
+ after firewall
+}
+
+start() {
+ ebegin "Starting exatorrent"
+ start-stop-daemon --start --background --chdir /path/to/exatorrent/dir --exec /path/to/exatorrent/dir/exatorrent --
+ eend $?
+}
+
+stop() {
+ local rv=0
+ ebegin "Stopping exatorrent"
+ start-stop-daemon --stop --quiet --oknodo --retry=0/10/TERM/5/KILL/5 --exec /path/to/exatorrent/dir/exatorrent
+ eend $?
+}
+```
+
+
+
+# Reverse Proxy
+We recommend running `exatorrent` behind reverse proxy . Below are example configurations of Nginx , Haproxy and Caddy made to reverse proxy `exatorrent` . Please don't put Basic Auth or any kind of custom auth / request modification system as Authentication is handled by `exatorrent` itself . `/api/socket` is WebSocket endpoint and Reverse Proxying server must not hinder it .
+
+## Nginx
+
+```Nginx
+server {
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+ ssl_certificate /path/to/tls/tls.crt;
+ ssl_certificate_key /path/to/tls/tls.key;
+
+ server_name the.domain.tld;
+
+ location / {
+ proxy_pass http://localhost:5000;
+ # proxy_pass http://unix:/path/to/exatorrent/unixsocket;
+ }
+
+ location /api/socket {
+ proxy_pass http://localhost:5000/api/socket;
+ # proxy_pass http://unix:/path/to/exatorrent/unixsocket:/api/socket;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "Upgrade";
+ proxy_set_header Host $host;
+ }
+
+}
+```
+
+## Haproxy
+
+```HAProxy
+frontend proxy
+ #bind *:80
+ bind *:443 ssl crt /path/to/tls/cert.pem
+ default_backend exatorrent
+
+backend exatorrent
+ server exatorrent localhost:5000
+```
+
+## Caddy
+
+```
+https://the.domain.tld {
+ reverse_proxy * localhost:5000
+}
+```
diff --git a/docs/docker.md b/docs/docker.md
new file mode 100644
index 00000000..f605804a
--- /dev/null
+++ b/docs/docker.md
@@ -0,0 +1,35 @@
+`exatorrent` can be run inside Podman / Docker Container
+
+## Podman
+[Podman](https://github.com/containers/podman) is drop-in replacement for Docker . Podman has several advantages over Docker . `exatorrent` can be run in `podman` . If you prefer `podman` , you can alias it to `docker`
+
+```bash
+alias docker=podman
+```
+
+## Podman / Docker Image
+Podman / Docker Images of `exatorrent` are officially available for `amd64` and `arm64` architectures . They are built on release of new version by Github Actions and are Hosted and available at [Github Container Registry](https://ghcr.io/varbhat/exatorrent) . Podman / Docker images of `exatorrent` can be pulled by
+
+```bash
+docker pull ghcr.io/varbhat/exatorrent:latest
+```
+
+This pulls latest version of `exatorrent` Podman / Docker Image
+
+## Building Podman / Docker Container Image
+Podman / Docker Image of `exatorrent` can also be built in your machine if you intend to build . Following commands will build `exatorrent` Podman / Docker Image .
+
+```bash
+git clone https://github.com/varbhat/exatorrent
+cd exatorrent
+docker build -t "exatorrent" .
+```
+
+## Usage
+Podman / Docker Image of `exatorrent` can be run by following command
+
+```bash
+docker run -p 5000:5000 -p 42069:42069 -v /path/to/directory:/exa/exadir ghcr.io/varbhat/exatorrent:latest
+# docker run -p 5000:5000 -p 42069:42069 -v /path/to/directory:/exa/exadir exatorrent
+```
+5000 port is default port where Web Client and API are served . `42069` is default port for Torrent Client where Torrent Transfers occur. So, they need to be exposed . Also Refer [Usage](usage.md) .
diff --git a/docs/features.md b/docs/features.md
new file mode 100644
index 00000000..8f8ae340
--- /dev/null
+++ b/docs/features.md
@@ -0,0 +1,29 @@
+exatorrent is [BitTorrent](https://www.bittorrent.org) Client . It is written in `go` . It is made to be hosted in Servers to turn them into Torrent Server / Seedbox . It can also be run locally ( it's totally worthy because `exatorrent` provides several features not found in other Torrent Clients ) as well .
+
+exatorrent is small in size and comes with no bloat . It is compiled statically into Single Executable Binary file and is dependent on nothing . No libraries , No frameworks are required to run exatorrent . Just download exatorrent which is single Binary Executable and run it . That's it . You can also build `exatorrent` from sources as `exatorrent` is open source . Thus , deploying / running `exatorrent` is very easy .
+
+`exatorrent` built binary executables are provided with each new [releases](https://github.com/varbhat/exatorrent/releases/latest) . Docker / Podman Images are also provided .
+
+`exatorrent` is cross platform and can run on all major platforms . It can be run on [Linux](https://www.kernel.org/) , [Android](https://www.android.com/) ( through [Termux](https://termux.com/) ) , [Macos](https://developer.apple.com/macos/) and [Windows](https://www.microsoft.com/en-in/windows) . Linux users can Download Executable Binaries from [Releases](https://github.com/varbhat/exatorrent/releases/latest) or use [Docker/Podman](./docker.md) or [Build](./build.md) from Sources . Android Termux Users can run the Linux Builds from [Releases](https://github.com/varbhat/exatorrent/releases/latest) . Windows Users are advised to use [Docker](https://docs.docker.com/docker-for-windows/install/) (refer [docker docs](./docker.md) ) or use [WSL2](https://docs.microsoft.com/en-us/windows/wsl/) or [Build](./build.md) from Sources. Macos users are advised to use [Docker](https://docs.docker.com/docker-for-mac/install/) (refer [docker docs](./docker.md) ) or [Build](./build.md) from Sources .
+
+You can Open and Stream Torrents in your Browser using exatorrent . You can Add Torrents by Magnet or by Infohash or Torrent File . Each file in Torrent can be Started , Stopped or Deleted . Torrents can be Started , Stopped , Removed or Deleted . And all these things persist between sessions , i.e even if you restart `exatorrent` , these things do persist .
+
+
+If you want to , then `exatorrent` can stop Torrents on reaching certain seedratio (which you need to set). You can also apply Blocklist to block peers if you want to. You can also Rate Limit `exatorrent` .
+
+`exatorrent` works perfectly fine without any configuration , but if you need to configure `exatorrent` , `exatorrent` can be fully configured with configuration files .
+
+
+Files downloaded via Torrenting in `exatorrent` can be retrieved or streamed or shared ( with auth protection of course ) . Directories can be retrieved as Zip / Tarballs .
+
+
+`exatorrent` is multi-users (with admin users as administrators ) but also works fine in single user context . All users are authenticated to access `exatorrent` .
+
+
+`exatorrent` has few niceties like Adding Trackers to Torrent from TrackerList URL/s (which you can configure ofcourse ) which increases Peers thus making Torrenting faster . Also , it can fetch Torrent metainfo from Online Cache (ex. [iTorrents.org](https://itorrents.org/) or Local Cache thus making fetching of Torrent metainfo faster .
+
+`exatorrent` uses `sqlite` as it's [database](./database.md) but `postgresql` can be used as well.
+
+Video / Audio files can be streamed directly in Browser . They can also streamed directly on [VLC](https://www.videolan.org/vlc/) or [mpv](https://mpv.io/) or other Media Players .
+
+`exatorrent` has [documented API](./API.md) that enables you to create other Clients for `exatorrent` and integrate other services with `exatorrent` .
diff --git a/docs/screenshots.md b/docs/screenshots.md
new file mode 100644
index 00000000..9f46cd8d
--- /dev/null
+++ b/docs/screenshots.md
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/usage.md b/docs/usage.md
new file mode 100644
index 00000000..0724cf82
--- /dev/null
+++ b/docs/usage.md
@@ -0,0 +1,62 @@
+## Usage
+```bash
+Usage of exatorrent:
+ -addr Listen Address (Default: ":5000")
+ -admin Default admin username (Default Username: "adminuser" and Default Password: "adminpassword")
+ -cert Path to TLS Certificate (Required for HTTPS)
+ -dir exatorrent Directory (Default: "exadir")
+ -engc Generate Custom Engine Configuration
+ -key Path to TLS Key (Required for HTTPS)
+ -psql Generate Sample Postgresql Connection URL
+ -torc Generate Custom Torrent Client Configuration
+ -unix Unix Socket Path
+ -help Print this Help
+ ```
+
+ ### `-addr`
+Listen Address of `exatorrent` . It specifies the TCP address for the `exatorrent` to listen on . It's of form `host:port` . The host must be a literal IP address, or a host name that can be resolved to IP addresses. The port must be a literal port number or a service name. If the host is a literal IPv6 address it must be enclosed in square brackets, as in `[2001:db8::1]:80` or `[fe80::1%zone]:80`.
+
+Default Listen Address is `:5000` . Open http://localhost:5000 or http://0.0.0.0:5000 or http://127.0.0.1:5000 to use `exatorrent` Web Client if exatorrent is listening on Default Address .
+
+Valid Listen Addresses include `localhost:9999` , `0.0.0.0:3456` , `127.0.0.1:7777` , `[0:0:0:0:0:0:0:1]:5000` , `x.x.x.x:port` , `[x:x:x:x:x:x:x:x]:port` .
+
+### `-admin`
+Usernames of Users in `exatorrent` can't be changed after User is created . It must be choosen while creating User and can't be changed later . Note that password can be changed anytime later .
+
+On the first use of `exatorrent` , `exatorrent` creates Admin user with username `adminuser` and password `adminpassword` . Since this username `adminuser` can't be changed later on , you can customize it before first run itself by passing your desired username to `-admin` flag.
+
+```bash
+exatorrent -admin "mycustomadminusername"
+```
+
+You are advised to use custom username for default admin using this flag . You can always change password of default admin or other users later .
+
+### `-cert`
+If HTTPS needs to be served , Path to TLS Certificate must be specified in this flag . Note that `-cert` flag is also necessary along with this flag to serve HTTPS .
+
+### `-key`
+If HTTPS needs to be served , Path to TLS Key must be specified in this flag . Note that `-cert` flag is also necessary along with this flag to serve HTTPS .
+
+### `-unix`
+This flag specifies file path where Unix Socket must be served . This flag is alternative to `-addr` flag and works only on Operating Systems that support [Unix Sockets](https://en.wikipedia.org/wiki/Unix_domain_socket) .
+
+### `-dir`
+`exatorrent` always operates in specific directory and never leaves beyond that directory . It stores File downloaded through Torrents , Torrent Metadata Files , Sqlite3 Database files if any , Configuration files in this directory.
+
+`-dir` flag specifies the directory where `exatorrent` must store the data .
+
+### `-engc`
+Writes Sample Runtime-Configurable Engine connection URL to `/config/engconfig.json` . All Runtime-Configurable Settings are configured in this file . You can change it anytime in Client .
+
+### `-torc`
+Writes Sample Torrent Client connection URL to `/config/clientconfig.json` . These settings cannot be configured during runtime and must only be configured before starting `exatorrent` .
+
+### `-psql`
+Writes Sample Postgresql connection URL to `/config/psqlconfig.txt` . Instead of reading configuration URL from env variable `DATABASE_URL` , reads `DATABASE_URL` from file . Refer [Database Docs](database.md) for more details .
+
+
+## Blocklist
+Blocklist of PeerGuardian Text Lists (P2P) Format can be placed at `/config/blocklist` to apply blocking based upon blocklist . You are also required to set `IPBlocklist` value of `clentconfig.json` to `true` . Note that Blocklist can't be changed during runtime .
+
+## Rate Limiter
+`UploadLimiterLimit` , `UploadLimiterBurst` , `DownloadLimiterLimit` , `DownloadLimiterBurst` values of `clientconfig.json` can be used to Rate Limit `exatorrent` .
diff --git a/exatorrent.go b/exatorrent.go
new file mode 100644
index 00000000..91f396a3
--- /dev/null
+++ b/exatorrent.go
@@ -0,0 +1,54 @@
+package main
+
+import (
+ "net"
+ "net/http"
+ "os"
+ "os/signal"
+ "syscall"
+
+ "github.com/varbhat/exatorrent/internal/core"
+ "github.com/varbhat/exatorrent/internal/web"
+)
+
+const Version string = "src"
+
+func main() {
+ core.Initialize()
+
+ http.HandleFunc("/api/socket", core.SocketAPI)
+ http.HandleFunc("/api/auth", core.AuthCheck)
+ http.HandleFunc("/api/stream/", core.StreamFile)
+ http.HandleFunc("/api/torrent/", core.TorrentServe)
+ http.Handle("/", web.FrontEndHandler)
+
+ if core.Flagconfig.UnixSocket != "" {
+ // Run under specified Unix Socket Path
+ core.Info.Println("Starting server at Path (Unix Socket)", core.Flagconfig.UnixSocket)
+ usock, err := net.Listen("unix", core.Flagconfig.UnixSocket)
+ if err != nil {
+ core.Err.Fatalln("Failed listening", err)
+ }
+ go func() {
+ if core.Flagconfig.TLSCertPath != "" && core.Flagconfig.TLSKeyPath != "" {
+ core.Info.Println("Serving the HTTPS with TLS Cert ", core.Flagconfig.TLSCertPath, " and TLS Key", core.Flagconfig.TLSKeyPath)
+ core.Err.Fatal(http.ServeTLS(usock, nil, core.Flagconfig.TLSCertPath, core.Flagconfig.TLSKeyPath))
+ } else {
+ core.Err.Fatal(http.Serve(usock, nil))
+ }
+ }()
+ c := make(chan os.Signal, 1)
+ signal.Notify(c, os.Interrupt, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
+ <-c
+ _ = usock.Close()
+ } else {
+ // Run under specified Port
+ core.Info.Println("Starting server on", core.Flagconfig.ListenAddress)
+ if core.Flagconfig.TLSCertPath != "" && core.Flagconfig.TLSKeyPath != "" {
+ core.Info.Println("Serving the HTTPS with TLS Cert ", core.Flagconfig.TLSCertPath, " and TLS Key", core.Flagconfig.TLSKeyPath)
+ core.Err.Fatal(http.ListenAndServeTLS(core.Flagconfig.ListenAddress, core.Flagconfig.TLSCertPath, core.Flagconfig.TLSKeyPath, nil))
+ } else {
+ core.Err.Fatal(http.ListenAndServe(core.Flagconfig.ListenAddress, nil))
+ }
+ }
+}
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..83445bf2
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,87 @@
+module github.com/varbhat/exatorrent
+
+go 1.17
+
+require (
+ crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508
+ github.com/anacrolix/go-libutp v1.0.4
+ github.com/anacrolix/log v0.9.0
+ github.com/anacrolix/torrent v1.30.4
+ github.com/google/uuid v1.3.0
+ github.com/gorilla/websocket v1.4.2
+ github.com/jackc/pgx/v4 v4.13.0
+ github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
+ github.com/shirou/gopsutil v3.21.7+incompatible
+ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
+ golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
+)
+
+require (
+ github.com/RoaringBitmap/roaring v0.9.4 // indirect
+ github.com/StackExchange/wmi v1.2.1 // indirect
+ github.com/anacrolix/chansync v0.1.0 // indirect
+ github.com/anacrolix/confluence v1.8.0 // indirect
+ github.com/anacrolix/dht/v2 v2.10.3 // indirect
+ github.com/anacrolix/envpprof v1.1.1 // indirect
+ github.com/anacrolix/missinggo v1.3.0 // indirect
+ github.com/anacrolix/missinggo/perf v1.0.0 // indirect
+ github.com/anacrolix/missinggo/v2 v2.5.2 // indirect
+ github.com/anacrolix/mmsg v1.0.0 // indirect
+ github.com/anacrolix/multiless v0.1.1-0.20210529082330-de2f6cf29619 // indirect
+ github.com/anacrolix/stm v0.3.0 // indirect
+ github.com/anacrolix/sync v0.4.0 // indirect
+ github.com/anacrolix/upnp v0.1.2-0.20200416075019-5e9378ed1425 // indirect
+ github.com/anacrolix/utp v0.1.0 // indirect
+ github.com/benbjohnson/immutable v0.3.0 // indirect
+ github.com/bits-and-blooms/bitset v1.2.0 // indirect
+ github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/dustin/go-humanize v1.0.0 // indirect
+ github.com/edsrzf/mmap-go v1.0.0 // indirect
+ github.com/elliotchance/orderedmap v1.4.0 // indirect
+ github.com/go-ole/go-ole v1.2.5 // indirect
+ github.com/google/btree v1.0.1 // indirect
+ github.com/huandu/xstrings v1.3.2 // indirect
+ github.com/jackc/chunkreader/v2 v2.0.1 // indirect
+ github.com/jackc/pgconn v1.10.0 // indirect
+ github.com/jackc/pgio v1.0.0 // indirect
+ github.com/jackc/pgpassfile v1.0.0 // indirect
+ github.com/jackc/pgproto3/v2 v2.1.1 // indirect
+ github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
+ github.com/jackc/pgtype v1.8.1 // indirect
+ github.com/jackc/puddle v1.1.3 // indirect
+ github.com/mschoch/smat v0.2.0 // indirect
+ github.com/pion/datachannel v1.4.21 // indirect
+ github.com/pion/dtls/v2 v2.0.9 // indirect
+ github.com/pion/ice/v2 v2.1.12 // indirect
+ github.com/pion/interceptor v0.0.15 // indirect
+ github.com/pion/logging v0.2.2 // indirect
+ github.com/pion/mdns v0.0.5 // indirect
+ github.com/pion/randutil v0.1.0 // indirect
+ github.com/pion/rtcp v1.2.6 // indirect
+ github.com/pion/rtp v1.7.2 // indirect
+ github.com/pion/sctp v1.7.12 // indirect
+ github.com/pion/sdp/v3 v3.0.4 // indirect
+ github.com/pion/srtp/v2 v2.0.5 // indirect
+ github.com/pion/stun v0.3.5 // indirect
+ github.com/pion/transport v0.12.3 // indirect
+ github.com/pion/turn/v2 v2.0.5 // indirect
+ github.com/pion/udp v0.1.1 // indirect
+ github.com/pion/webrtc/v3 v3.0.32 // indirect
+ github.com/pkg/errors v0.9.1 // indirect
+ github.com/rs/dnscache v0.0.0-20210201191234-295bba877686 // indirect
+ github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
+ github.com/spaolacci/murmur3 v1.1.0 // indirect
+ github.com/tklauser/go-sysconf v0.3.8 // indirect
+ github.com/tklauser/numcpus v0.3.0 // indirect
+ github.com/willf/bitset v1.1.11 // indirect
+ github.com/willf/bloom v2.0.3+incompatible // indirect
+ go.etcd.io/bbolt v1.3.6 // indirect
+ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
+ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
+ golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 // indirect
+ golang.org/x/text v0.3.6 // indirect
+ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
+)
+
+exclude github.com/willf/bitset v1.2.0
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..79a6f9c2
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,1070 @@
+bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
+bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM=
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo=
+crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797 h1:yDf7ARQc637HoxDho7xjqdvO5ZA2Yb+xzv/fOnnvZzw=
+crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oXPKINnZ8mcqnye1EkVkqsectk=
+crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
+crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 h1:fILCBBFnjnrQ0whVJlGhfv1E/QiaFDNtGFBObEVRnYg=
+crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
+dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU=
+dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
+dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
+dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
+git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
+github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
+github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w=
+github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI=
+github.com/RoaringBitmap/roaring v0.4.18/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI=
+github.com/RoaringBitmap/roaring v0.4.21/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
+github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
+github.com/RoaringBitmap/roaring v0.5.5/go.mod h1:puNo5VdzwbaIQxSiDIwfXl4Hnc+fbovcX4IW/dSTtUk=
+github.com/RoaringBitmap/roaring v0.6.0/go.mod h1:WZ83fjBF/7uBHi6QoFyfGL4+xuV4Qn+xFkm4+vSzrhE=
+github.com/RoaringBitmap/roaring v0.9.4 h1:ckvZSX5gwCRaJYBNe7syNawCU5oruY9gQmjXlp4riwo=
+github.com/RoaringBitmap/roaring v0.9.4/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA=
+github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
+github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
+github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
+github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
+github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
+github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
+github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
+github.com/alexflint/go-arg v1.1.0/go.mod h1:3Rj4baqzWaGGmZA2+bVTV8zQOZEjBQAPBnL5xLT+ftY=
+github.com/alexflint/go-arg v1.2.0/go.mod h1:3Rj4baqzWaGGmZA2+bVTV8zQOZEjBQAPBnL5xLT+ftY=
+github.com/alexflint/go-arg v1.3.0/go.mod h1:9iRbDxne7LcR/GSvEr7ma++GLpdIU1zrghf2y2768kM=
+github.com/alexflint/go-scalar v1.0.0/go.mod h1:GpHzbCOZXEKMEcygYQ5n/aa4Aq84zbxjy3MxYW0gjYw=
+github.com/anacrolix/chansync v0.0.0-20210524073341-a336ebc2de92/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
+github.com/anacrolix/chansync v0.1.0 h1:4cIfJmEV8sYkSEMW2AXnPjX6iQT4plqELJ65pLna6OA=
+github.com/anacrolix/chansync v0.1.0/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
+github.com/anacrolix/confluence v1.7.1-0.20210221224747-9cb14aa2c53a/go.mod h1:T0JHvSaf9UfoiUdCtCOUuRroHm/tauUJTbLc6/vd5YA=
+github.com/anacrolix/confluence v1.7.1-0.20210221225853-90405640e928/go.mod h1:NoLcfoRet+kYttjLXJRmh4qBVrylJsfIItik5GGj21A=
+github.com/anacrolix/confluence v1.7.1-0.20210311004351-d642adb8546c/go.mod h1:KCZ3eObqKECNeZg0ekAoJVakHMP3gAdR8i0bQ26IkzM=
+github.com/anacrolix/confluence v1.8.0 h1:JRLJ+7AjqpquyAkVmlLrhrfRCwc5G1qSvUQOAfzd0ps=
+github.com/anacrolix/confluence v1.8.0/go.mod h1:GsPP6ikA8h/CU7ExbuMOswpzZpPdf1efDPu4rVXL43g=
+github.com/anacrolix/dht v0.0.0-20180412060941-24cbf25b72a4 h1:0yHJvFiGQhJ1gSHJOR8xzmnx45orEt7uiIB6guf0+zc=
+github.com/anacrolix/dht v0.0.0-20180412060941-24cbf25b72a4/go.mod h1:hQfX2BrtuQsLQMYQwsypFAab/GvHg8qxwVi4OJdR1WI=
+github.com/anacrolix/dht/v2 v2.0.1/go.mod h1:GbTT8BaEtfqab/LPd5tY41f3GvYeii3mmDUK300Ycyo=
+github.com/anacrolix/dht/v2 v2.2.1-0.20191103020011-1dba080fb358/go.mod h1:d7ARx3WpELh9uOEEr0+8wvQeVTOkPse4UU6dKpv4q0E=
+github.com/anacrolix/dht/v2 v2.3.2-0.20200103043204-8dce00767ebd/go.mod h1:cgjKyErDnKS6Mej5D1fEqBKg3KwFF2kpFZJp3L6/fGI=
+github.com/anacrolix/dht/v2 v2.5.1-0.20200317023935-129f05e9b752/go.mod h1:7RLvyOjm+ZPA7vgFRP+1eRjFzrh27p/nF0VCk5LcjoU=
+github.com/anacrolix/dht/v2 v2.8.0/go.mod h1:RjeKbveVwjnaVj5os4y/NQwqEoDWHigo5rdge9MP52k=
+github.com/anacrolix/dht/v2 v2.8.1-0.20210221225335-7a6713a749f9/go.mod h1:p7fLHxqc1mtrFGXfJ226Fo2akG3Pv8ngCTnYAzVJXa4=
+github.com/anacrolix/dht/v2 v2.8.1-0.20210311003418-13622df072ae/go.mod h1:wLmYr78fBu4KfUUkFZyGFFwDPDw9EHL5x8c632XCZzs=
+github.com/anacrolix/dht/v2 v2.9.1/go.mod h1:ZyYcIQinN/TE3oKONCchQOLjhYR786Jaxz3jsBtih4A=
+github.com/anacrolix/dht/v2 v2.10.0/go.mod h1:KC51tqylRYBu82RM5pEYf+g1n7db+F0tOJqSbCjjZWc=
+github.com/anacrolix/dht/v2 v2.10.3 h1:15MpbQ9arTuCte5peEr20UbBeSxiwB4QZdrhXca+DmE=
+github.com/anacrolix/dht/v2 v2.10.3/go.mod h1:TYqXd2uf0Ro7x3SFZcmit1qFrQFryA/R7bvlllBqnZM=
+github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
+github.com/anacrolix/envpprof v1.0.0/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
+github.com/anacrolix/envpprof v1.0.1/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4=
+github.com/anacrolix/envpprof v1.1.0/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4=
+github.com/anacrolix/envpprof v1.1.1 h1:sHQCyj7HtiSfaZAzL2rJrQdyS7odLqlwO6nhk/tG/j8=
+github.com/anacrolix/envpprof v1.1.1/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4=
+github.com/anacrolix/go-libutp v0.0.0-20180522111405-6baeb806518d/go.mod h1:beQSaSxwH2d9Eeu5ijrEnHei5Qhk+J6cDm1QkWFru4E=
+github.com/anacrolix/go-libutp v1.0.2/go.mod h1:uIH0A72V++j0D1nnmTjjZUiH/ujPkFxYWkxQ02+7S0U=
+github.com/anacrolix/go-libutp v1.0.4 h1:95sv09MoNQbgEJqJLrotglFnVBAiMx1tyl6xMAmnAgg=
+github.com/anacrolix/go-libutp v1.0.4/go.mod h1:8vSGX5g0b4eebsDBNVQHUXSCwYaN18Lnkse0hUW8/5w=
+github.com/anacrolix/log v0.0.0-20180412014343-2323884b361d/go.mod h1:sf/7c2aTldL6sRQj/4UKyjgVZBu2+M2z9wf7MmwPiew=
+github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
+github.com/anacrolix/log v0.3.1-0.20190913000754-831e4ffe0174/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
+github.com/anacrolix/log v0.3.1-0.20191001111012-13cede988bcd/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
+github.com/anacrolix/log v0.4.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
+github.com/anacrolix/log v0.5.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
+github.com/anacrolix/log v0.6.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
+github.com/anacrolix/log v0.6.1-0.20200416071330-f58a030e6149/go.mod h1:s5yBP/j046fm9odtUTbHOfDUq/zh1W8OkPpJtnX0oQI=
+github.com/anacrolix/log v0.7.1-0.20200604014615-c244de44fd2d/go.mod h1:s5yBP/j046fm9odtUTbHOfDUq/zh1W8OkPpJtnX0oQI=
+github.com/anacrolix/log v0.8.0/go.mod h1:s5yBP/j046fm9odtUTbHOfDUq/zh1W8OkPpJtnX0oQI=
+github.com/anacrolix/log v0.9.0 h1:HD1Ml3WV/6lRbITKqi5EIS3e9rVOGHej5V9UaQA4cvY=
+github.com/anacrolix/log v0.9.0/go.mod h1:s5yBP/j046fm9odtUTbHOfDUq/zh1W8OkPpJtnX0oQI=
+github.com/anacrolix/missinggo v0.0.0-20180522035225-b4a5853e62ff/go.mod h1:b0p+7cn+rWMIphK1gDH2hrDuwGOcbB6V4VXeSsEfHVk=
+github.com/anacrolix/missinggo v0.0.0-20180725070939-60ef2fbf63df/go.mod h1:kwGiTUTZ0+p4vAz3VbAI5a30t2YbvemcmspjKwrAz5s=
+github.com/anacrolix/missinggo v0.2.1-0.20190310234110-9fbdc9f242a8/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo=
+github.com/anacrolix/missinggo v1.1.0/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo=
+github.com/anacrolix/missinggo v1.1.2-0.20190815015349-b888af804467/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo=
+github.com/anacrolix/missinggo v1.2.1/go.mod h1:J5cMhif8jPmFoC3+Uvob3OXXNIhOUikzMt+uUjeM21Y=
+github.com/anacrolix/missinggo v1.3.0 h1:06HlMsudotL7BAELRZs0yDZ4yVXsHXGi323QBjAVASw=
+github.com/anacrolix/missinggo v1.3.0/go.mod h1:bqHm8cE8xr+15uVfMG3BFui/TxyB6//H5fwlq/TeqMc=
+github.com/anacrolix/missinggo/perf v1.0.0 h1:7ZOGYziGEBytW49+KmYGTaNfnwUqP1HBsy6BqESAJVw=
+github.com/anacrolix/missinggo/perf v1.0.0/go.mod h1:ljAFWkBuzkO12MQclXzZrosP5urunoLS0Cbvb4V0uMQ=
+github.com/anacrolix/missinggo/v2 v2.2.0/go.mod h1:o0jgJoYOyaoYQ4E2ZMISVa9c88BbUBVQQW4QeRkNCGY=
+github.com/anacrolix/missinggo/v2 v2.2.1-0.20191103010835-12360f38ced0/go.mod h1:ZzG3/cc3t+5zcYWAgYrJW0MBsSwNwOkTlNquBbP51Bc=
+github.com/anacrolix/missinggo/v2 v2.3.0/go.mod h1:ZzG3/cc3t+5zcYWAgYrJW0MBsSwNwOkTlNquBbP51Bc=
+github.com/anacrolix/missinggo/v2 v2.3.1/go.mod h1:3XNH0OEmyMUZuvXmYdl+FDfXd0vvSZhvOLy8CFx8tLg=
+github.com/anacrolix/missinggo/v2 v2.4.1-0.20200227072623-f02f6484f997/go.mod h1:KY+ij+mWvwGuqSuecLjjPv5LFw5ICUc1UvRems3VAZE=
+github.com/anacrolix/missinggo/v2 v2.5.0/go.mod h1:HYuCbwvJXY3XbcmcIcTgZXHleoDXawxPWx/YiPzFzV0=
+github.com/anacrolix/missinggo/v2 v2.5.1-0.20210520011502-b3d95d6b1d02/go.mod h1:WEjqh2rmKECd0t1VhQkLGTdIWXO6f6NLjp5GlMZ+6FA=
+github.com/anacrolix/missinggo/v2 v2.5.1/go.mod h1:WEjqh2rmKECd0t1VhQkLGTdIWXO6f6NLjp5GlMZ+6FA=
+github.com/anacrolix/missinggo/v2 v2.5.2-0.20210623112532-e21e4ddc477d/go.mod h1:WEjqh2rmKECd0t1VhQkLGTdIWXO6f6NLjp5GlMZ+6FA=
+github.com/anacrolix/missinggo/v2 v2.5.2 h1:hT9z1wGNc512Z53giT71kuPUNUREH9OGc6ppdaDjZ3s=
+github.com/anacrolix/missinggo/v2 v2.5.2/go.mod h1:yNvsLrtZYRYCOI+KRH/JM8TodHjtIE/bjOGhQaLOWIE=
+github.com/anacrolix/mmsg v0.0.0-20180515031531-a4a3ba1fc8bb/go.mod h1:x2/ErsYUmT77kezS63+wzZp8E3byYB0gzirM/WMBLfw=
+github.com/anacrolix/mmsg v1.0.0 h1:btC7YLjOn29aTUAExJiVUhQOuf/8rhm+/nWCMAnL3Hg=
+github.com/anacrolix/mmsg v1.0.0/go.mod h1:x8kRaJY/dCrY9Al0PEcj1mb/uFHwP6GCJ9fLl4thEPc=
+github.com/anacrolix/multiless v0.0.0-20191223025854-070b7994e841/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
+github.com/anacrolix/multiless v0.0.0-20200413040533-acfd16f65d5d/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
+github.com/anacrolix/multiless v0.0.0-20210222022749-ef43011a77ec/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
+github.com/anacrolix/multiless v0.1.1-0.20210520040635-10ee7b5f3cff/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
+github.com/anacrolix/multiless v0.1.1-0.20210529082330-de2f6cf29619 h1:ZkusP2EHxvxm+IymiKJ8DBVE/E6fJkb8K/2+GXZpjAY=
+github.com/anacrolix/multiless v0.1.1-0.20210529082330-de2f6cf29619/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
+github.com/anacrolix/stm v0.1.0/go.mod h1:ZKz7e7ERWvP0KgL7WXfRjBXHNRhlVRlbBQecqFtPq+A=
+github.com/anacrolix/stm v0.1.1-0.20191106051447-e749ba3531cf/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg=
+github.com/anacrolix/stm v0.2.0/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg=
+github.com/anacrolix/stm v0.2.1-0.20201002073511-c35a2c748c6a/go.mod h1:spImf/rXwiAUoYYJK1YCZeWkpaHZ3kzjGFjwK5OStfU=
+github.com/anacrolix/stm v0.2.1-0.20210310231625-45c211559de6/go.mod h1:spImf/rXwiAUoYYJK1YCZeWkpaHZ3kzjGFjwK5OStfU=
+github.com/anacrolix/stm v0.3.0-alpha h1:yhOHk1NPkpGKqCAOB4XkgFXwB5Eh2KU/WVMksNnxr2Y=
+github.com/anacrolix/stm v0.3.0-alpha/go.mod h1:spImf/rXwiAUoYYJK1YCZeWkpaHZ3kzjGFjwK5OStfU=
+github.com/anacrolix/stm v0.3.0 h1:peQncJSNJtk1YBrFbW0DLKYqll+sa0kOk8EvXRcO+wA=
+github.com/anacrolix/stm v0.3.0/go.mod h1:spImf/rXwiAUoYYJK1YCZeWkpaHZ3kzjGFjwK5OStfU=
+github.com/anacrolix/sync v0.0.0-20171108081538-eee974e4f8c1/go.mod h1:+u91KiUuf0lyILI6x3n/XrW7iFROCZCG+TjgK8nW52w=
+github.com/anacrolix/sync v0.0.0-20180611022320-3c4cb11f5a01/go.mod h1:+u91KiUuf0lyILI6x3n/XrW7iFROCZCG+TjgK8nW52w=
+github.com/anacrolix/sync v0.0.0-20180808010631-44578de4e778/go.mod h1:s735Etp3joe/voe2sdaXLcqDdJSay1O0OPnM0ystjqk=
+github.com/anacrolix/sync v0.2.0/go.mod h1:BbecHL6jDSExojhNtgTFSBcdGerzNc64tz3DCOj/I0g=
+github.com/anacrolix/sync v0.3.0/go.mod h1:BbecHL6jDSExojhNtgTFSBcdGerzNc64tz3DCOj/I0g=
+github.com/anacrolix/sync v0.4.0 h1:T+MdO/u87ir/ijWsTFsPYw5jVm0SMm4kVpg8t4KF38o=
+github.com/anacrolix/sync v0.4.0/go.mod h1:BbecHL6jDSExojhNtgTFSBcdGerzNc64tz3DCOj/I0g=
+github.com/anacrolix/tagflag v0.0.0-20180109131632-2146c8d41bf0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
+github.com/anacrolix/tagflag v0.0.0-20180605133421-f477c8c2f14c/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
+github.com/anacrolix/tagflag v0.0.0-20180803105420-3a8ff5428f76/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
+github.com/anacrolix/tagflag v1.0.0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
+github.com/anacrolix/tagflag v1.0.1/go.mod h1:gb0fiMQ02qU1djCSqaxGmruMvZGrMwSReidMB0zjdxo=
+github.com/anacrolix/tagflag v1.1.0/go.mod h1:Scxs9CV10NQatSmbyjqmqmeQNwGzlNe0CMUMIxqHIG8=
+github.com/anacrolix/tagflag v1.1.1-0.20200411025953-9bb5209d56c2/go.mod h1:Scxs9CV10NQatSmbyjqmqmeQNwGzlNe0CMUMIxqHIG8=
+github.com/anacrolix/tagflag v1.2.0/go.mod h1:Scxs9CV10NQatSmbyjqmqmeQNwGzlNe0CMUMIxqHIG8=
+github.com/anacrolix/tagflag v1.3.0/go.mod h1:Scxs9CV10NQatSmbyjqmqmeQNwGzlNe0CMUMIxqHIG8=
+github.com/anacrolix/torrent v0.0.0-20180622074351-fefeef4ee9eb/go.mod h1:3vcFVxgOASslNXHdivT8spyMRBanMCenHRpe0u5vpBs=
+github.com/anacrolix/torrent v1.7.1/go.mod h1:uvOcdpOjjrAq3uMP/u1Ide35f6MJ/o8kMnFG8LV3y6g=
+github.com/anacrolix/torrent v1.9.0/go.mod h1:jJJ6lsd2LD1eLHkUwFOhy7I0FcLYH0tHKw2K7ZYMHCs=
+github.com/anacrolix/torrent v1.11.0/go.mod h1:FwBai7SyOFlflvfEOaM88ag/jjcBWxTOqD6dVU/lKKA=
+github.com/anacrolix/torrent v1.15.0/go.mod h1:MFc6KcbpAyfwGqOyRkdarUK9QnKA/FkVg0usFk1OQxU=
+github.com/anacrolix/torrent v1.22.0/go.mod h1:GWTwQkOAilf0LR3C6A74XEkWPg0ejfFD9GcEIe57ess=
+github.com/anacrolix/torrent v1.23.0/go.mod h1:737rU+al1LBWEs3IHBystZvsbg24iSP+8Gb25Vc/s5U=
+github.com/anacrolix/torrent v1.25.1-0.20210221061757-051093ca31f5/go.mod h1:737rU+al1LBWEs3IHBystZvsbg24iSP+8Gb25Vc/s5U=
+github.com/anacrolix/torrent v1.25.1-0.20210224024805-693c30dd889e/go.mod h1:d4V6QqkInfQidWVk8b8hMv8mtciswNitI1A2BiRSQV0=
+github.com/anacrolix/torrent v1.28.1-0.20210622065255-582f0ccd48a0/go.mod h1:15VRIA5/DwqbqETbKo3fzlC4aSbB0iMoo10ng3mzAbE=
+github.com/anacrolix/torrent v1.29.0/go.mod h1:40Hf2bWxFqTbTWbrdig57JnmYLCjShbWWjdbB3VN5n4=
+github.com/anacrolix/torrent v1.30.4 h1:xZXQo1kL7NqRN/wY2OumUrGM4ekq9dyMFdKtF293gPU=
+github.com/anacrolix/torrent v1.30.4/go.mod h1:IUGa0cjbz4vo2S0jNx2RQXAiCew+WITcUoxaw2gF20o=
+github.com/anacrolix/upnp v0.1.1/go.mod h1:LXsbsp5h+WGN7YR+0A7iVXm5BL1LYryDev1zuJMWYQo=
+github.com/anacrolix/upnp v0.1.2-0.20200416075019-5e9378ed1425 h1:/Wi6l2ONI1FUFWN4cBwHOO90V4ylp4ud/eov6GUcVFk=
+github.com/anacrolix/upnp v0.1.2-0.20200416075019-5e9378ed1425/go.mod h1:Pz94W3kl8rf+wxH3IbCa9Sq+DTJr8OSbV2Q3/y51vYs=
+github.com/anacrolix/utp v0.0.0-20180219060659-9e0e1d1d0572/go.mod h1:MDwc+vsGEq7RMw6lr2GKOEqjWny5hO5OZXRVNaBJ2Dk=
+github.com/anacrolix/utp v0.1.0 h1:FOpQOmIwYsnENnz7tAGohA+r6iXpRjrq8ssKSre2Cp4=
+github.com/anacrolix/utp v0.1.0/go.mod h1:MDwc+vsGEq7RMw6lr2GKOEqjWny5hO5OZXRVNaBJ2Dk=
+github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
+github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
+github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
+github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
+github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
+github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
+github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
+github.com/benbjohnson/immutable v0.2.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI=
+github.com/benbjohnson/immutable v0.3.0 h1:TVRhuZx2wG9SZ0LRdqlbs9S5BZ6Y24hJEHTCgWHZEIw=
+github.com/benbjohnson/immutable v0.3.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
+github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
+github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
+github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
+github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
+github.com/bradfitz/iter v0.0.0-20190303215204-33e6a9893b0c/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
+github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaqKnf+7Qs6GbEPfd4iMOitWzXJx8=
+github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8/go.mod h1:spo1JLcs67NmW1aVLEgtA8Yy1elc+X8y5SRW1sFW4Og=
+github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
+github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
+github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
+github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
+github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
+github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
+github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
+github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
+github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
+github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
+github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
+github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
+github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
+github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
+github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
+github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
+github.com/elliotchance/orderedmap v1.2.0/go.mod h1:8hdSl6jmveQw8ScByd3AaNHNk51RhbTazdqtTty+NFw=
+github.com/elliotchance/orderedmap v1.3.0/go.mod h1:8hdSl6jmveQw8ScByd3AaNHNk51RhbTazdqtTty+NFw=
+github.com/elliotchance/orderedmap v1.4.0 h1:wZtfeEONCbx6in1CZyE6bELEt/vFayMvsxqI5SgsR+A=
+github.com/elliotchance/orderedmap v1.4.0/go.mod h1:wsDwEaX5jEoyhbs7x93zk2H/qv0zwuhg4inXhDkYqys=
+github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
+github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
+github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
+github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
+github.com/frankban/quicktest v1.9.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
+github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
+github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
+github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
+github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
+github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
+github.com/glycerine/go-unsnap-stream v0.0.0-20210130063903-47dfef350d96/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
+github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
+github.com/glycerine/goconvey v0.0.0-20190315024820-982ee783a72e/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
+github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
+github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
+github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
+github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
+github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
+github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
+github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
+github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
+github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
+github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
+github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
+github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
+github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
+github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
+github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20190309154008-847fc94819f9/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
+github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
+github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/gosuri/uilive v0.0.0-20170323041506-ac356e6e42cd/go.mod h1:qkLSc0A5EXSP6B04TrN4oQoxqFI7A8XvoXSlJi8cwk8=
+github.com/gosuri/uilive v0.0.3/go.mod h1:qkLSc0A5EXSP6B04TrN4oQoxqFI7A8XvoXSlJi8cwk8=
+github.com/gosuri/uiprogress v0.0.0-20170224063937-d0567a9d84a1/go.mod h1:C1RTYn4Sc7iEyf6j8ft5dyoZ4212h8G1ol9QQluh5+0=
+github.com/gosuri/uiprogress v0.0.1/go.mod h1:C1RTYn4Sc7iEyf6j8ft5dyoZ4212h8G1ol9QQluh5+0=
+github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
+github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
+github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
+github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
+github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
+github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
+github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
+github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
+github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
+github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
+github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
+github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo=
+github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
+github.com/huandu/xstrings v1.2.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
+github.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
+github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
+github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
+github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
+github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
+github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
+github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
+github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
+github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
+github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
+github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
+github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
+github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
+github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
+github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY=
+github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
+github.com/jackc/pgconn v1.10.0 h1:4EYhlDVEMsJ30nNj0mmgwIUXoq7e9sMJrVC2ED6QlCU=
+github.com/jackc/pgconn v1.10.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
+github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
+github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
+github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
+github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c=
+github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc=
+github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
+github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
+github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
+github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
+github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
+github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
+github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
+github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
+github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
+github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
+github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI=
+github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
+github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
+github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
+github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
+github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
+github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
+github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM=
+github.com/jackc/pgtype v1.8.1 h1:9k0IXtdJXHJbyAWQgbWr1lU+MEhPXZz6RIXxfR5oxXs=
+github.com/jackc/pgtype v1.8.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
+github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
+github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
+github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
+github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
+github.com/jackc/pgx/v4 v4.13.0 h1:JCjhT5vmhMAf/YwBHLvrBn4OGdIQBiFG6ym8Zmdx570=
+github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpznYDF0=
+github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jackc/puddle v1.1.3 h1:JnPg/5Q9xVJGfjsO5CPUOjnJps1JaRUm8I9FXVCFK94=
+github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
+github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
+github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
+github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
+github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
+github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
+github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
+github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
+github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
+github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw=
+github.com/lucas-clemente/quic-go v0.18.0/go.mod h1:yXttHsSNxQi8AWijC/vLP+OJczXqzHSOcJrM5ITUlCg=
+github.com/lucas-clemente/quic-go v0.19.3/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8=
+github.com/lukechampine/stm v0.0.0-20191022212748-05486c32d236/go.mod h1:wTLsd5FC9rts7GkMpsPGk64CIuea+03yaLAp19Jmlg8=
+github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
+github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
+github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
+github.com/marten-seemann/qpack v0.2.0/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc=
+github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc=
+github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
+github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs=
+github.com/marten-seemann/qtls-go1-15 v0.1.0/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I=
+github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
+github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/mattn/go-sqlite3 v1.7.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v1.13.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v2.0.2+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
+github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
+github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
+github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
+github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
+github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
+github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
+github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
+github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
+github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
+github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
+github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
+github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
+github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
+github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
+github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
+github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
+github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
+github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
+github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
+github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
+github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
+github.com/onsi/ginkgo v1.16.1/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E=
+github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
+github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
+github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
+github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg=
+github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
+github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
+github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
+github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
+github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
+github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
+github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
+github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
+github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
+github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
+github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
+github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
+github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
+github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
+github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
+github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
+github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
+github.com/pion/datachannel v1.4.21 h1:3ZvhNyfmxsAqltQrApLPQMhSFNA+aT87RqyCq4OXmf0=
+github.com/pion/datachannel v1.4.21/go.mod h1:oiNyP4gHx2DIwRzX/MFyH0Rz/Gz05OgBlayAI2hAWjg=
+github.com/pion/dtls/v2 v2.0.1/go.mod h1:uMQkz2W0cSqY00xav7WByQ4Hb+18xeQh2oH2fRezr5U=
+github.com/pion/dtls/v2 v2.0.2/go.mod h1:27PEO3MDdaCfo21heT59/vsdmZc0zMt9wQPcSlLu/1I=
+github.com/pion/dtls/v2 v2.0.4/go.mod h1:qAkFscX0ZHoI1E07RfYPoRw3manThveu+mlTDdOxoGI=
+github.com/pion/dtls/v2 v2.0.7/go.mod h1:QuDII+8FVvk9Dp5t5vYIMTo7hh7uBkra+8QIm7QGm10=
+github.com/pion/dtls/v2 v2.0.9 h1:7Ow+V++YSZQMYzggI0P9vLJz/hUFcffsfGMfT/Qy+u8=
+github.com/pion/dtls/v2 v2.0.9/go.mod h1:O0Wr7si/Zj5/EBFlDzDd6UtVxx25CE1r7XM7BQKYQho=
+github.com/pion/ice v0.7.18 h1:KbAWlzWRUdX9SmehBh3gYpIFsirjhSQsCw6K2MjYMK0=
+github.com/pion/ice v0.7.18/go.mod h1:+Bvnm3nYC6Nnp7VV6glUkuOfToB/AtMRZpOU8ihuf4c=
+github.com/pion/ice/v2 v2.0.15/go.mod h1:ZIiVGevpgAxF/cXiIVmuIUtCb3Xs4gCzCbXB6+nFkSI=
+github.com/pion/ice/v2 v2.1.7/go.mod h1:kV4EODVD5ux2z8XncbLHIOtcXKtYXVgLVCeVqnpoeP0=
+github.com/pion/ice/v2 v2.1.10/go.mod h1:kV4EODVD5ux2z8XncbLHIOtcXKtYXVgLVCeVqnpoeP0=
+github.com/pion/ice/v2 v2.1.12 h1:ZDBuZz+fEI7iDifZCYFVzI4p0Foy0YhdSSZ87ZtRcRE=
+github.com/pion/ice/v2 v2.1.12/go.mod h1:ovgYHUmwYLlRvcCLI67PnQ5YGe+upXZbGgllBDG/ktU=
+github.com/pion/interceptor v0.0.9/go.mod h1:dHgEP5dtxOTf21MObuBAjJeAayPxLUAZjerGH8Xr07c=
+github.com/pion/interceptor v0.0.12/go.mod h1:qzeuWuD/ZXvPqOnxNcnhWfkCZ2e1kwwslicyyPnhoK4=
+github.com/pion/interceptor v0.0.13/go.mod h1:svsW2QoLHLoGLUr4pDoSopGBEWk8FZwlfxId/OKRKzo=
+github.com/pion/interceptor v0.0.15 h1:pQFkBUL8akUHiGoFr+pM94Q/15x7sLFh0K3Nj+DCC6s=
+github.com/pion/interceptor v0.0.15/go.mod h1:pg3J253eGi5bqyKzA74+ej5Y19ez2jkWANVnF+Z9Dfk=
+github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
+github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
+github.com/pion/mdns v0.0.4/go.mod h1:R1sL0p50l42S5lJs91oNdUL58nm0QHrhxnSegr++qC0=
+github.com/pion/mdns v0.0.5 h1:Q2oj/JB3NqfzY9xGZ1fPzZzK7sDSD8rZPOvcIQ10BCw=
+github.com/pion/mdns v0.0.5/go.mod h1:UgssrvdD3mxpi8tMxAXbsppL3vJ4Jipw1mTCW+al01g=
+github.com/pion/quic v0.1.1/go.mod h1:zEU51v7ru8Mp4AUBJvj6psrSth5eEFNnVQK5K48oV3k=
+github.com/pion/quic v0.1.4/go.mod h1:dBhNvkLoQqRwfi6h3Vqj3IcPLgiW7rkZxBbRdp7Vzvk=
+github.com/pion/randutil v0.0.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8=
+github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA=
+github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8=
+github.com/pion/rtcp v1.2.3/go.mod h1:zGhIv0RPRF0Z1Wiij22pUt5W/c9fevqSzT4jje/oK7I=
+github.com/pion/rtcp v1.2.4/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0=
+github.com/pion/rtcp v1.2.6 h1:1zvwBbyd0TeEuuWftrd/4d++m+/kZSeiguxU61LFWpo=
+github.com/pion/rtcp v1.2.6/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0=
+github.com/pion/rtp v1.6.0/go.mod h1:QgfogHsMBVE/RFNno467U/KBqfUywEH+HK+0rtnwsdI=
+github.com/pion/rtp v1.6.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
+github.com/pion/rtp v1.6.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
+github.com/pion/rtp v1.6.5/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
+github.com/pion/rtp v1.7.0/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
+github.com/pion/rtp v1.7.1 h1:hCaxfVgPGt13eF/Tu9RhVn04c+dAcRZmhdDWqUE13oY=
+github.com/pion/rtp v1.7.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
+github.com/pion/rtp v1.7.2 h1:HCDKDCixh7PVjkQTsqHAbk1lg+bx059EHxcnyl42dYs=
+github.com/pion/rtp v1.7.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
+github.com/pion/sctp v1.7.10/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
+github.com/pion/sctp v1.7.11/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
+github.com/pion/sctp v1.7.12 h1:GsatLufywVruXbZZT1CKg+Jr8ZTkwiPnmUC/oO9+uuY=
+github.com/pion/sctp v1.7.12/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s=
+github.com/pion/sdp/v2 v2.4.0/go.mod h1:L2LxrOpSTJbAns244vfPChbciR/ReU1KWfG04OpkR7E=
+github.com/pion/sdp/v3 v3.0.4 h1:2Kf+dgrzJflNCSw3TV5v2VLeI0s/qkzy2r5jlR0wzf8=
+github.com/pion/sdp/v3 v3.0.4/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk=
+github.com/pion/srtp v1.5.1/go.mod h1:B+QgX5xPeQTNc1CJStJPHzOlHK66ViMDWTT0HZTCkcA=
+github.com/pion/srtp v1.5.2 h1:25DmvH+fqKZDqvX64vTwnycVwL9ooJxHF/gkX16bDBY=
+github.com/pion/srtp v1.5.2/go.mod h1:NiBff/MSxUwMUwx/fRNyD/xGE+dVvf8BOCeXhjCXZ9U=
+github.com/pion/srtp/v2 v2.0.1/go.mod h1:c8NWHhhkFf/drmHTAblkdu8++lsISEBBdAuiyxgqIsE=
+github.com/pion/srtp/v2 v2.0.2/go.mod h1:VEyLv4CuxrwGY8cxM+Ng3bmVy8ckz/1t6A0q/msKOw0=
+github.com/pion/srtp/v2 v2.0.5 h1:ks3wcTvIUE/GHndO3FAvROQ9opy0uLELpwHJaQ1yqhQ=
+github.com/pion/srtp/v2 v2.0.5/go.mod h1:8k6AJlal740mrZ6WYxc4Dg6qDqqhxoRG2GSjlUhDF0A=
+github.com/pion/stun v0.3.5 h1:uLUCBCkQby4S1cf6CGuR9QrVOKcvUwFeemaC865QHDg=
+github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA=
+github.com/pion/transport v0.6.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE=
+github.com/pion/transport v0.8.10/go.mod h1:tBmha/UCjpum5hqTWhfAEs3CO4/tHSg0MYRhSzR+CZ8=
+github.com/pion/transport v0.10.0/go.mod h1:BnHnUipd0rZQyTVB2SBGojFHT9CBt5C5TcsJSQGkvSE=
+github.com/pion/transport v0.10.1/go.mod h1:PBis1stIILMiis0PewDw91WJeLJkyIMcEk+DwKOzf4A=
+github.com/pion/transport v0.12.1/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q=
+github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q=
+github.com/pion/transport v0.12.3 h1:vdBfvfU/0Wq8kd2yhUMSDB/x+O4Z9MYVl2fJ5BT4JZw=
+github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A=
+github.com/pion/turn/v2 v2.0.4/go.mod h1:1812p4DcGVbYVBTiraUmP50XoKye++AMkbfp+N27mog=
+github.com/pion/turn/v2 v2.0.5 h1:iwMHqDfPEDEOFzwWKT56eFmh6DYC6o/+xnLAEzgISbA=
+github.com/pion/turn/v2 v2.0.5/go.mod h1:APg43CFyt/14Uy7heYUOGWdkem/Wu4PhCO/bjyrTqMw=
+github.com/pion/udp v0.1.0/go.mod h1:BPELIjbwE9PRbd/zxI/KYBnbo7B6+oA6YuEaNE8lths=
+github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
+github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
+github.com/pion/webrtc/v2 v2.2.26/go.mod h1:XMZbZRNHyPDe1gzTIHFcQu02283YO45CbiwFgKvXnmc=
+github.com/pion/webrtc/v3 v3.0.11/go.mod h1:WEvXneGTeqNmiR59v5jTsxMc4yXQyOQcRsrdAbNwSEU=
+github.com/pion/webrtc/v3 v3.0.27/go.mod h1:QpLDmsU5a/a05n230gRtxZRvfHhFzn9ukGUL2x4G5ic=
+github.com/pion/webrtc/v3 v3.0.32 h1:5J+zNep9am8Swh6kEMp+LaGXNvn6qQWpGkLBnVW44L4=
+github.com/pion/webrtc/v3 v3.0.32/go.mod h1:wX3V5dQQUGCifhT1mYftC2kCrDQX6ZJ3B7Yad0R9JK0=
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
+github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
+github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
+github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
+github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
+github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
+github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
+github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
+github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
+github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
+github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
+github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
+github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
+github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
+github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
+github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rs/dnscache v0.0.0-20190621150935-06bb5526f76b/go.mod h1:qe5TWALJ8/a1Lqznoc5BDHpYX/8HU60Hm2AwRmqzxqA=
+github.com/rs/dnscache v0.0.0-20210201191234-295bba877686 h1:IJ6Df0uxPDtNoByV0KkzVKNseWvZFCNM/S9UoyOMCSI=
+github.com/rs/dnscache v0.0.0-20210201191234-295bba877686/go.mod h1:qe5TWALJ8/a1Lqznoc5BDHpYX/8HU60Hm2AwRmqzxqA=
+github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
+github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
+github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
+github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
+github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8=
+github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5PCi+MFsC7HjREoAz1BU+Mq60+05gifQSsHSDG/8=
+github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
+github.com/shirou/gopsutil v3.21.7+incompatible h1:g/wcPHcuCQvHSePVofjQljd2vX4ty0+J6VoMB+NPcdk=
+github.com/shirou/gopsutil v3.21.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
+github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
+github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
+github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
+github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
+github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
+github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0=
+github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
+github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=
+github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
+github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI=
+github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU=
+github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag=
+github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg=
+github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw=
+github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y=
+github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
+github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q=
+github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ=
+github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I=
+github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0=
+github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ=
+github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk=
+github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
+github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
+github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
+github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/assertions v0.0.0-20190215210624-980c5ac6f3ac/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
+github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs=
+github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
+github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
+github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE=
+github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
+github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
+github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
+github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
+github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
+github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/syncthing/syncthing v0.14.48-rc.4/go.mod h1:nw3siZwHPA6M8iSfjDCWQ402eqvEIasMQOE8nFOxy7M=
+github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
+github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
+github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
+github.com/tinylib/msgp v1.1.1/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
+github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
+github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
+github.com/tklauser/go-sysconf v0.3.8 h1:41Nq9J+pxKud4IQ830J5LlS5nl67dVQC7AuisUooaOU=
+github.com/tklauser/go-sysconf v0.3.8/go.mod h1:z4zYWRS+X53WUKtBcmDg1comV3fPhdQnzasnIHUoLDU=
+github.com/tklauser/numcpus v0.2.3/go.mod h1:vpEPS/JC+oZGGQ/My/vJnNsvMDQL6PwOqt8dsCw5j+E=
+github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
+github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
+github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
+github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
+github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
+github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
+github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
+github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
+github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
+github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
+github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
+github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
+github.com/willf/bitset v1.1.11 h1:N7Z7E9UvjW+sGsEl7k/SJrvY2reP1A07MrGuCjIOjRE=
+github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
+github.com/willf/bloom v0.0.0-20170505221640-54e3b963ee16/go.mod h1:MmAltL9pDMNTrvUkxdg0k0q5I0suxmuwp3KbyrZLOZ8=
+github.com/willf/bloom v2.0.3+incompatible h1:QDacWdqcAUI1MPOwIQZRy9kOR7yxfyEmxX8Wdm2/JPA=
+github.com/willf/bloom v2.0.3+incompatible/go.mod h1:MmAltL9pDMNTrvUkxdg0k0q5I0suxmuwp3KbyrZLOZ8=
+github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
+go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
+go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
+go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
+go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
+go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
+go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
+go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
+go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
+go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
+go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
+go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
+go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
+golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
+golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
+golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
+golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
+golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
+golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190318221613-d196dffd7c2b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191125084936-ffdde1057850/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/net v0.0.0-20210420210106-798c2154c571/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
+golang.org/x/net v0.0.0-20210427231257-85d9c07bbe3a/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
+golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c=
+golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190910064555-bbd175535a8b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191126131656-8a8471f7e56d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 h1:ikCpsnYR+Ew0vu99XlDp55lGgDJdIMx3f4a18jfse/s=
+golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
+golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200928182047-19e03678916f/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
+golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
+google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
+google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
+google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
+google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
+google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
+google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
+google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
+gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
+gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
+gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
+gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
+honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
+rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
+sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
+sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
+sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
+sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
diff --git a/internal/core/auth.go b/internal/core/auth.go
new file mode 100644
index 00000000..eff811a0
--- /dev/null
+++ b/internal/core/auth.go
@@ -0,0 +1,185 @@
+package core
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+ "net/http"
+ "time"
+
+ "github.com/google/uuid"
+)
+
+func AuthCheck(w http.ResponseWriter, r *http.Request) {
+ var username string
+ var usertype int
+ var token string
+ var err error
+ if r.Method == http.MethodPost {
+ c, err := r.Cookie("session_token")
+ if err != nil {
+ if val := r.URL.Query().Get("token"); val != "" {
+ username, usertype, err = Engine.UDb.ValidateToken(val)
+ if err != nil {
+ username, usertype, token, err = rauthHelper(w, r)
+ if err != nil {
+ Warn.Printf("not authorized (%s)\n", r.RemoteAddr)
+ http.Error(w, "invalid credentials", http.StatusBadRequest)
+ return
+ }
+ } else {
+ token = val
+ }
+ } else {
+ username, usertype, token, err = rauthHelper(w, r)
+ if err != nil {
+ Warn.Printf("not authorized (%s)\n", r.RemoteAddr)
+ http.Error(w, "invalid credentials", http.StatusBadRequest)
+ return
+ }
+ }
+ } else {
+ username, usertype, err = Engine.UDb.ValidateToken(c.Value)
+ if err != nil {
+ username, usertype, token, err = rauthHelper(w, r)
+ if err != nil {
+ Warn.Printf("not authorized (%s)\n", r.RemoteAddr)
+ http.Error(w, "invalid credentials", http.StatusBadRequest)
+ return
+ }
+ } else {
+ token = c.Value
+ }
+ }
+ } else {
+ username, usertype, token, err = authHelper(w, r)
+ if err != nil {
+ Warn.Printf("%s (%s)\n", err, r.RemoteAddr)
+ return
+ }
+ }
+ var cmsg []byte
+ if usertype == 0 {
+ cmsg, err = json.Marshal(&ConnectionMsg{Type: "user", Session: token})
+ } else if usertype == 1 {
+ cmsg, err = json.Marshal(&ConnectionMsg{Type: "admin", Session: token})
+ } else if usertype == -1 {
+ cmsg, err = json.Marshal(&ConnectionMsg{Type: "disabled", Session: token})
+ }
+ if err != nil {
+ return
+ }
+ _, err = w.Write(cmsg)
+ if err != nil {
+ return
+ }
+ Info.Printf("User %s (%s) Authenticated", username, r.RemoteAddr)
+
+}
+
+func authHelper(w http.ResponseWriter, r *http.Request) (username string, usertype int, token string, err error) {
+ c, err := r.Cookie("session_token")
+ if err != nil {
+ if val := r.URL.Query().Get("token"); val != "" {
+ username, usertype, err = Engine.UDb.ValidateToken(val)
+ if err != nil {
+ return bauthHelper(w, r)
+ }
+ token = val
+ } else {
+ return bauthHelper(w, r)
+ }
+ } else {
+ username, usertype, err = Engine.UDb.ValidateToken(c.Value)
+ if err != nil {
+ return bauthHelper(w, r)
+ }
+ token = c.Value
+ }
+ return username, usertype, token, nil
+}
+
+func bauthHelper(w http.ResponseWriter, r *http.Request) (username string, usertype int, token string, err error) {
+ defer func() {
+ if r := recover(); r != nil { // uuid may panic
+ username = ""
+ usertype = -1
+ token = ""
+ err = fmt.Errorf("uuid error")
+ return
+ }
+ }()
+ var password string
+ var ok bool
+ w.Header().Set("WWW-Authenticate", `Basic realm="Protected"`)
+ username, password, ok = r.BasicAuth()
+ if !ok {
+ http.Error(w, "Not authorized", http.StatusUnauthorized)
+ return "", -1, "", fmt.Errorf("not authorized")
+ }
+
+ if len(username) < 5 || len(password) < 5 {
+ http.Error(w, "Not authorized", http.StatusUnauthorized)
+ return "", -1, "", fmt.Errorf("not authorized")
+ }
+
+ usertype, ok = Engine.UDb.Validate(username, password)
+ if !ok {
+ http.Error(w, "Not authorized", http.StatusUnauthorized)
+ return "", -1, "", fmt.Errorf("not authorized")
+ }
+ token = uuid.New().String()
+ err = Engine.UDb.SetToken(username, token)
+ if err != nil {
+ http.Error(w, "Not authorized", http.StatusUnauthorized)
+ return "", -1, "", fmt.Errorf("not authorized")
+ }
+ http.SetCookie(w, &http.Cookie{
+ Name: "session_token",
+ Path: "/",
+ Value: token,
+ Expires: time.Now().Add(48 * time.Hour),
+ SameSite: http.SameSiteStrictMode,
+ })
+ return username, usertype, token, nil
+}
+
+func rauthHelper(w http.ResponseWriter, r *http.Request) (username string, usertype int, token string, err error) {
+ defer func() {
+ if r := recover(); r != nil { // uuid may panic
+ username = ""
+ usertype = -1
+ token = ""
+ err = fmt.Errorf("uuid error")
+ return
+ }
+ }()
+ var ok bool
+ var cred ConReq
+ reqreader := io.LimitReader(r.Body, 1048576) // 1MB limiter
+ err = json.NewDecoder(reqreader).Decode(&cred)
+ if err != nil {
+ return "", -1, "", err
+ }
+ if len(cred.Data1) < 5 || len(cred.Data2) < 5 {
+ return "", -1, "", fmt.Errorf("invalid credentials")
+ }
+ usertype, ok = Engine.UDb.Validate(cred.Data1, cred.Data2)
+ if !ok {
+ return "", -1, "", fmt.Errorf("invalid credentials")
+ }
+ token = uuid.New().String()
+ err = Engine.UDb.SetToken(cred.Data1, token)
+ if err != nil {
+ return "", -1, "", fmt.Errorf("not authorized")
+ }
+ http.SetCookie(w, &http.Cookie{
+ Name: "session_token",
+ Path: "/",
+ Value: token,
+ Expires: time.Now().Add(48 * time.Hour),
+ SameSite: http.SameSiteStrictMode,
+ })
+ username = cred.Data1
+ return username, usertype, token, nil
+}
diff --git a/internal/core/cache.go b/internal/core/cache.go
new file mode 100644
index 00000000..3702227f
--- /dev/null
+++ b/internal/core/cache.go
@@ -0,0 +1,45 @@
+package core
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+func AddMetaCache(ih metainfo.Hash, mi metainfo.MetaInfo) {
+ // create .torrent file
+ if w, err := os.Stat(Dirconfig.CacheDir); err == nil && w.IsDir() {
+ cacheFilePath := filepath.Join(Dirconfig.CacheDir, fmt.Sprintf("%s.torrent", ih.HexString()))
+ // only create the cache file if not exists
+ if _, err := os.Stat(cacheFilePath); os.IsNotExist(err) {
+ cf, err := os.Create(cacheFilePath)
+ if err == nil {
+ werr := mi.Write(cf)
+ if werr != nil {
+ Warn.Println("failed to create torrent file ", err)
+ }
+ Info.Println("created torrent cache file", ih.HexString())
+ } else {
+ Warn.Println("failed to create torrent file ", err)
+ }
+ _ = cf.Close()
+ }
+ }
+
+}
+
+func RemMetaCache(ih metainfo.Hash) {
+ _ = os.Remove(filepath.Join(Dirconfig.CacheDir, fmt.Sprintf("%s.torrent", ih.HexString())))
+}
+
+func GetMetaCache(ih metainfo.Hash) (spec *torrent.TorrentSpec, reterr error) {
+ return SpecfromPath(filepath.Join(Dirconfig.CacheDir, fmt.Sprintf("%s.torrent", ih.HexString())))
+}
+
+func EmptyMetaCache() {
+ _ = os.Remove(Dirconfig.CacheDir)
+ checkDir(Dirconfig.CacheDir)
+}
diff --git a/internal/core/connection.go b/internal/core/connection.go
new file mode 100644
index 00000000..2fa2a8a1
--- /dev/null
+++ b/internal/core/connection.go
@@ -0,0 +1,151 @@
+package core
+
+import (
+ "encoding/json"
+ "sync"
+ "time"
+
+ "github.com/gorilla/websocket"
+)
+
+// Hub
+type Hub struct {
+ sync.RWMutex
+ Conns map[string]*UserConn
+}
+
+func (h *Hub) Add(Uc *UserConn) {
+ conn, ok := h.Conns[Uc.Username]
+ if ok && conn != nil {
+ conn.Close()
+ }
+ h.Lock()
+ h.Conns[Uc.Username] = Uc
+ h.Unlock()
+
+ Info.Printf("User %s (%s) Connected\n", Uc.Username, Uc.Conn.RemoteAddr().String())
+}
+
+func (h *Hub) SendMsg(User string, Type string, State string, Resp string) {
+ if User != "" {
+ conn, ok := h.Conns[User]
+ if ok && conn != nil {
+ _ = conn.SendMsg(Type, State, Resp)
+ }
+ }
+}
+
+func (h *Hub) SendMsgU(User string, Type string, Infohash string, State string, Resp string) {
+ if User != "" {
+ conn, ok := h.Conns[User]
+ if ok && conn != nil {
+ _ = conn.SendMsgU(Type, State, Infohash, Resp)
+ }
+ }
+}
+
+func (h *Hub) Remove(Uc *UserConn) {
+ if Uc == nil {
+ return
+ }
+ h.Lock()
+ defer h.Unlock()
+ conn, ok := h.Conns[Uc.Username]
+ if ok && conn != nil {
+ if conn.Time == Uc.Time {
+ delete(h.Conns, Uc.Username)
+ Info.Printf("User %s (%s) Disconnected\n", Uc.Username, Uc.Conn.RemoteAddr().String())
+ }
+ }
+}
+
+func (h *Hub) RemoveUser(Username string) {
+ conn, ok := h.Conns[Username]
+ if ok && conn != nil {
+ conn.Close()
+ }
+}
+
+func (h *Hub) ListUsers() (ret []byte) {
+ var userconnmsg []*UserConnMsg
+ h.Lock()
+ defer h.Unlock()
+ for name, user := range h.Conns {
+ var usermsg UserConnMsg
+ if user != nil {
+ usermsg.Username = name
+ usermsg.IsAdmin = user.IsAdmin
+ usermsg.Time = user.Time
+ }
+ userconnmsg = append(userconnmsg, &usermsg)
+ }
+ ret, _ = json.Marshal(DataMsg{Type: "userconn", Data: userconnmsg})
+ return
+}
+
+var MainHub Hub = Hub{
+ RWMutex: sync.RWMutex{},
+ Conns: make(map[string]*UserConn),
+}
+
+// UserConn
+type UserConn struct {
+ Sendmu sync.Mutex
+ Username string
+ IsAdmin bool
+ Time time.Time
+ Conn *websocket.Conn
+ Stream sync.Mutex
+ Streamers MutInt
+}
+
+func NewUserConn(Username string, Conn *websocket.Conn, IsAdmin bool) (uc *UserConn) {
+ uc = &UserConn{
+ Username: Username,
+ Conn: Conn,
+ IsAdmin: IsAdmin,
+ Time: time.Now(),
+ }
+ MainHub.Add(uc)
+ return
+}
+
+func (uc *UserConn) SendMsg(Type string, State string, Msg string) (err error) {
+ resp, _ := json.Marshal(Resp{Type: Type, State: State, Msg: Msg})
+ err = uc.Send(resp)
+ return
+}
+
+func (uc *UserConn) SendMsgU(Type string, State string, Infohash string, Msg string) (err error) {
+ resp, _ := json.Marshal(Resp{Type: Type, State: State, Infohash: Infohash, Msg: Msg})
+ err = uc.Send(resp)
+ return
+}
+
+func (uc *UserConn) Send(v []byte) (err error) {
+ uc.Sendmu.Lock()
+ _ = uc.Conn.SetWriteDeadline(time.Now().Add(writeWait))
+ err = uc.Conn.WriteMessage(websocket.TextMessage, v)
+ uc.Sendmu.Unlock()
+ if err != nil {
+ Err.Println(err)
+ uc.Close()
+ return
+ }
+ return
+}
+
+func (uc *UserConn) StopStream() {
+ uc.Streamers.Inc()
+ uc.Stream.Lock()
+ Info.Println("Stopped Stream for ", uc.Username)
+ uc.Stream.Unlock()
+ uc.Streamers.Dec()
+}
+
+func (uc *UserConn) Close() {
+ uc.Sendmu.Lock()
+ _ = uc.Conn.Close()
+ uc.Sendmu.Unlock()
+ MainHub.Remove(uc)
+}
diff --git a/internal/core/engine.go b/internal/core/engine.go
new file mode 100644
index 00000000..66d1a4ba
--- /dev/null
+++ b/internal/core/engine.go
@@ -0,0 +1,584 @@
+package core
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+ "strings"
+
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/varbhat/exatorrent/internal/db"
+)
+
+type Eng struct {
+ Tconfig TorConfig
+ Econfig EngConfig
+ PsqlCon string
+
+ Torc *torrent.Client
+
+ PcDb db.PcDb
+ TorDb db.TorrentDb
+ TrackerDB db.TrackerDb
+ FsDb db.FileStateDb
+ LsDb db.LockStateDb
+ UDb db.UserDb
+ TUDb db.TorrentUserDb
+}
+
+// AddfromSpec Adds Torrent by Torrent Spec
+func AddfromSpec(User string, spec *torrent.TorrentSpec, dontstart bool, nofsdb bool) {
+ if spec == nil {
+ return
+ }
+
+ if Engine.Econfig.GetDTU() {
+ RemTrackersSpec(spec)
+ }
+
+ Info.Println("Adding Torrent")
+ var trnt *torrent.Torrent
+ var new bool
+ var err error
+
+ // Add Torrent to Bittorrent Client
+ if Engine.Torc != nil {
+ trnt, new, err = Engine.Torc.AddTorrentSpec(spec)
+ if err != nil {
+ Warn.Println("Error adding Torrent Spec", err)
+ MainHub.SendMsgU(User, "nfn", trnt.InfoHash().HexString(), "error", "Error adding Torrent Spec")
+ return
+ }
+
+ if !new {
+ Info.Printf("Torrent %s is not new", spec.InfoHash)
+ MainHub.SendMsgU(User, "nfn", trnt.InfoHash().HexString(), "warning", "Torrent is not new")
+ if User != "" {
+ _ = Engine.TUDb.Add(User, trnt.InfoHash())
+ }
+ return
+ }
+ if Engine.Econfig.GetLBD() {
+ _ = Engine.LsDb.Lock(spec.InfoHash)
+ Info.Println("lock of torrent ", spec.InfoHash, " is set to true (due to config option)")
+ }
+ } else {
+ Err.Println("Torrent Client is nil")
+ return
+ }
+
+ if User != "" {
+ _ = Engine.TUDb.Add(User, trnt.InfoHash())
+ Info.Println("Torrent: ", spec.InfoHash, " User: ", User)
+ }
+
+ // Add Trackers to Torrent
+ count := Engine.TrackerDB.Count()
+ if count > 0 && (len(Engine.Econfig.TrackerListURLs) != 0 || len(trnt.Metainfo().AnnounceList) == 0) {
+ trnt.AddTrackers([][]string{Engine.TrackerDB.Get()})
+ Info.Println("Added ", count, " Trackers for Added Torrent")
+ }
+
+ ih := trnt.InfoHash()
+ hasadded := Engine.TorDb.Exists(ih)
+ if !hasadded {
+ _ = Engine.TorDb.Add(ih)
+ Info.Println("Added Torrent to Torrent Database")
+ }
+
+ var cancelled Mutbool
+
+ go func() {
+ defer func() {
+ if err := recover(); err != nil {
+ Warn.Println(err)
+ }
+ }()
+
+ var notmerged bool = true
+ if !Engine.Econfig.GetDLC() {
+ Info.Println("Getting Metainfo from Local Cache")
+ sp, err := GetMetaCache(ih)
+ if err != nil {
+ Info.Println("Torrent Metainfo is not present in Cache", err)
+ notmerged = true
+ } else {
+
+ if !(cancelled.Get()) {
+ if Engine.Econfig.GetDTC() {
+ RemTrackersSpec(sp)
+ }
+ if sp != nil {
+ err := trnt.MergeSpec(sp)
+ if err != nil {
+ Warn.Println(err)
+ notmerged = true
+ } else {
+ Info.Println("Torrent Metainfo merged from Local Cache")
+ MainHub.SendMsgU(User, "nfn", ih.HexString(), "info", "Metainfo of Torrent "+ih.HexString()+" merged from Local Cache")
+ notmerged = false
+ }
+ }
+ }
+ }
+ }
+
+ if len(Engine.Econfig.GetOCU()) != 0 && notmerged {
+ Info.Println("Torrent Metainfo requested from Online Cache")
+ uspec, err := SpecfromURL(fmt.Sprintf(Engine.Econfig.GetOCU(), strings.TrimSpace(trnt.InfoHash().HexString())))
+ if err != nil {
+ Warn.Println(err)
+ } else {
+ if !(cancelled.Get()) {
+ if Engine.Econfig.GetDTC() {
+ RemTrackersSpec(uspec)
+ }
+ if uspec != nil {
+ trmerr := trnt.MergeSpec(uspec)
+ if trmerr != nil {
+ Warn.Println(err)
+ return
+ }
+ Info.Println("Torrent Metainfo merged form Online Cache")
+ MainHub.SendMsgU(User, "nfn", ih.HexString(), "info", "Metainfo of Torrent merged from Online Cache")
+ }
+ }
+ }
+ }
+
+ }()
+
+ select {
+ case <-Engine.Torc.Closed():
+ cancelled.Set(true)
+ Warn.Println("Torrent Client Closed! So,Torrent Not Started")
+ MainHub.SendMsgU(User, "nfn", ih.HexString(), "error", "Torrent Client Closed! So,Torrent Not Added")
+ case <-trnt.Closed():
+ cancelled.Set(true)
+ Warn.Println("Torrent Task that was being added was Deleted !")
+ MainHub.SendMsgU(User, "nfn", ih.HexString(), "warning", "Torrent Task cancelled = true that was being added was Deleted !")
+ case <-trnt.GotInfo():
+ Info.Println("Torrent ", ih, " is Loaded")
+ MainHub.SendMsgU(User, "nfn", ih.HexString(), "info", "Torrent is Loaded")
+ if !dontstart {
+ go StartTorrent(User, ih, nofsdb)
+ }
+ if !Engine.Econfig.GetDLC() {
+ AddMetaCache(ih, trnt.Metainfo())
+ }
+ }
+}
+
+// StartTorrent Starts Torrent given infohash
+func StartTorrent(User string, infohash metainfo.Hash, nofsdb bool) {
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ Info.Println("Starting Torrent for Infohash ", infohash)
+
+ t, err := Engine.TorDb.GetTorrent(infohash)
+ if err != nil {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println(err)
+ return
+ }
+ if t.Started {
+ Info.Println("Already Started")
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "info", "Torrent is Already Started")
+ }
+
+ trnt, ok := Engine.Torc.Torrent(infohash)
+ if !ok {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println("Error fetching torrent of infohash ", infohash, " from the client")
+ return
+ }
+
+ if trnt.Info() != nil {
+ trnt.AllowDataUpload()
+ trnt.AllowDataDownload()
+ // start file by setting the priority
+ for _, f := range trnt.Files() {
+ f.SetPriority(torrent.PiecePriorityNormal)
+ }
+ } else {
+ Warn.Println("Torrent can't be Started Because Metainfo is not yet recieved")
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent couldn't be Started Because Metainfo is not yet recieved")
+ return
+ }
+ err = Engine.TorDb.Start(infohash)
+ if err != nil {
+ Warn.Println(err)
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent couldn't be Started")
+ return
+ }
+
+ if !nofsdb {
+ err = Engine.FsDb.Delete(infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+ }
+
+ Info.Println("Torrent ", infohash, " Started by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "Torrent Started")
+}
+
+// StopTorrent Stops Torrent given infohash
+func StopTorrent(User string, infohash metainfo.Hash) {
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ Warn.Println("Stopping Torrent for Infohash ", infohash)
+
+ t, err := Engine.TorDb.GetTorrent(infohash)
+ if err != nil {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println(err)
+ return
+ }
+ if !t.Started {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "info", "Torrent Already Stopped !")
+ Warn.Println("Already stopped")
+ }
+
+ trnt, ok := Engine.Torc.Torrent(infohash)
+ if !ok {
+ Warn.Println("Error fetching torrent of infohash ", infohash, " from the client")
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+
+ if trnt.Info() != nil {
+ trnt.DisallowDataUpload()
+ trnt.DisallowDataDownload()
+ for _, f := range trnt.Files() {
+ f.SetPriority(torrent.PiecePriorityNone)
+ }
+
+ } else {
+ Warn.Println("Torrent can't be Stopped Because Metainfo is not yet recieved")
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent couldn't be Stopped Because Metainfo is not yet recieved")
+ return
+ }
+
+ err = Engine.TorDb.SetStarted(infohash, false)
+ if err != nil {
+ Warn.Println(err)
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent couldn't be Stopped")
+ return
+ }
+
+ err = Engine.FsDb.Delete(infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+
+ Info.Println("Torrent ", infohash, " Stopped by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "Torrent Stopped")
+}
+
+// RemoveTorrent Removes Torrent from Torrent Client
+func RemoveTorrent(User string, infohash metainfo.Hash) {
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ StopTorrent(User, infohash)
+ Warn.Println("Removing Torrent of Infohash ", infohash)
+
+ trnt, ok := Engine.Torc.Torrent(infohash)
+ if !ok {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println("Error fetching torrent of infohash ", infohash, " from the client")
+ return
+ }
+
+ trnt.Drop()
+
+ err := Engine.TorDb.Delete(infohash)
+ if err != nil {
+ Warn.Println(err)
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent couldn't be Removed")
+ }
+
+ err = Engine.FsDb.Delete(infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+ Info.Println("Torrent ", infohash, " Removed by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "Torrent Removed")
+}
+
+// DeleteTorrent in addition to Removing Torrent from Client also Deletes it from Storage
+func DeleteTorrent(User string, infohash metainfo.Hash) {
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ RemoveTorrent(User, infohash)
+
+ var err error
+ if infohash.HexString() != "" {
+ err = os.RemoveAll(filepath.Join(Dirconfig.TrntDir, infohash.HexString()))
+ if err != nil {
+ Warn.Println(err)
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ } else {
+ Warn.Println("Unknown Error")
+ return
+ }
+
+ Engine.PcDb.Delete(infohash)
+
+ err = Engine.TUDb.RemoveAllMi(infohash)
+ if err != nil {
+ Warn.Println(err)
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent couldn't be Deleted")
+ }
+
+ _ = Engine.LsDb.Unlock(infohash)
+
+ if !Engine.Econfig.DRCI() {
+ RemMetaCache(infohash)
+ }
+ Info.Println("Torrent ", infohash, " Deleted by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "Torrent Deleted")
+}
+
+// StartFile Starts File in Torrent given infohash and Filepath
+func StartFile(User string, infohash metainfo.Hash, fp string) {
+ fp = filepath.ToSlash(fp)
+ if fp == "" {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Filepath Invalid!")
+ return
+ }
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+ Info.Println("Starting File in Torrent for Infohash ", infohash, "and Filepath ", fp)
+
+ t, ok := Engine.Torc.Torrent(infohash)
+ if !ok {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println("Error fetching torrent of infohash ", infohash, " from the client")
+ return
+ }
+
+ // Get File from Given Torrent
+ var f *torrent.File
+ if t.Info() != nil {
+ for _, file := range t.Files() {
+ if file.Path() == fp {
+ f = file
+ break
+ }
+ }
+ } else {
+ Warn.Println("File ", fp, "can't be Started Because Metainfo is not yet recieved")
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "File "+fp+" couldn't be Started Because Metainfo is not yet recieved")
+ return
+ }
+
+ // If File is missing , return the error
+ if f == nil {
+ Warn.Printf("%s not present", fp)
+ MainHub.SendMsgU(User, "error", infohash.HexString(), "info", "File"+fp+" not present")
+ return
+ }
+
+ // Set Priority to Normal / Start the Torrent
+ f.SetPriority(torrent.PiecePriorityNormal)
+
+ var err error
+ err = Engine.FsDb.Deletefile(fp, infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+
+ if !Engine.TorDb.HasStarted(infohash.HexString()) {
+ err = Engine.FsDb.Add(f.Path(), infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+
+ }
+
+ Info.Println("File", fp, "of Torrent", infohash, " Started by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "File "+fp+" started")
+
+}
+
+// StopFile Stops File in Torrent given infohash and Filepath
+func StopFile(User string, infohash metainfo.Hash, fp string) {
+ fp = filepath.ToSlash(fp)
+ if fp == "" {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Filepath Invalid!")
+ return
+ }
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ Warn.Println("Stopping File in Torrent for Infohash ", infohash, "and Filepath ", fp)
+
+ t, ok := Engine.Torc.Torrent(infohash)
+ if !ok {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println("Error fetching torrent of infohash ", infohash, " from the client")
+ return
+ }
+
+ // Get File from Given Torrent
+ var f *torrent.File
+ if t.Info() != nil {
+ for _, file := range t.Files() {
+ if file.Path() == fp {
+ f = file
+ break
+ }
+ }
+ } else {
+ Warn.Println("File ", fp, "can't be Stopped Because Metainfo is not yet recieved")
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "File "+fp+" couldn't be Stopped Because Metainfo is not yet recieved")
+ return
+ }
+
+ // If File is missing , return the error
+ if f == nil {
+ Warn.Printf("%s not present", fp)
+ MainHub.SendMsgU(User, infohash.HexString(), "error", "info", "File"+fp+" not present")
+ return
+ }
+
+ // Set Priority to None ( Stop the File)
+ f.SetPriority(torrent.PiecePriorityNone)
+
+ var err error
+ err = Engine.FsDb.Deletefile(fp, infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+
+ if Engine.TorDb.HasStarted(infohash.HexString()) {
+ err = Engine.FsDb.Add(f.Path(), infohash)
+ if err != nil {
+ Warn.Println(err)
+ }
+ }
+
+ Info.Println("File", fp, "of Torrent", infohash, " Stopped by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "File "+fp+" stopped")
+}
+
+// DeleteFilePath deletes the file or Folder
+func DeleteFilePath(User string, infohash metainfo.Hash, fp string) {
+ if fp == "" {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Filepath Invalid!")
+ return
+ }
+ if infohash.HexString() == "" {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Infohash Invalid!")
+ return
+ }
+
+ fp = filepath.ToSlash(fp)
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ Warn.Println("Deleting File in Torrent for Infohash ", infohash, "and Filepath ", fp)
+
+ _, ok := Engine.Torc.Torrent(infohash)
+ if ok {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Currently Present in Client. Please Remove it from Torrent Client First!")
+ return
+ }
+
+ file := filepath.Join(Dirconfig.TrntDir, infohash.HexString(), filepath.FromSlash(fp))
+ if !strings.HasPrefix(file, filepath.Join(Dirconfig.TrntDir, infohash.HexString())) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "FilePath Invalid!")
+ return
+ }
+ if file == filepath.Join(Dirconfig.TrntDir, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Cannot Delete whole Torrent Directory")
+ return
+ }
+
+ err := os.RemoveAll(file)
+ if err != nil {
+ Warn.Println("DeleteFile error by Username: ", User, "Filepath: ", fp, " ", err)
+ MainHub.SendMsgU(User, "error", infohash.HexString(), "info", "Error removing File "+fp)
+ return
+ }
+
+ Info.Println("File", fp, "of Torrent", infohash, " Deleted by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "File"+fp+" Deleted")
+}
+
+// AbandonTorrent unlinks Torrent from User
+func AbandonTorrent(User string, infohash metainfo.Hash) {
+
+ err := Engine.TUDb.Remove(User, infohash)
+ if err != nil {
+ Warn.Println("AbandonTorrent error", err)
+ MainHub.SendMsgU(User, "error", infohash.HexString(), "info", "AbandonTorrent error")
+ return
+ }
+
+ Info.Println("User ", User, " abandoned ", infohash)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "Torrent Abandoned")
+}
+
+// AddTrackerstoTorrent Adds Tracker to Torrent
+func AddTrackerstoTorrent(User string, infohash metainfo.Hash, announcelist [][]string) {
+ if User != "" {
+ if !Engine.TUDb.HasUser(User, infohash.HexString()) {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ return
+ }
+ }
+
+ trnt, ok := Engine.Torc.Torrent(infohash)
+ if !ok {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Torrent Not Present!")
+ Warn.Println("Error fetching torrent of infohash ", infohash, " from the client")
+ return
+ }
+
+ if !(Engine.Econfig.GetDTU()) {
+ trnt.AddTrackers(announcelist)
+ } else {
+ MainHub.SendMsgU(User, "nfn", infohash.HexString(), "error", "Trackers Couldn't be Added!")
+ return
+ }
+
+ Info.Println("Trackers added to torrent ", infohash, "by ", User)
+ MainHub.SendMsgU(User, "resp", infohash.HexString(), "success", "Trackers added")
+}
diff --git a/internal/core/get.go b/internal/core/get.go
new file mode 100644
index 00000000..60b5f15d
--- /dev/null
+++ b/internal/core/get.go
@@ -0,0 +1,334 @@
+package core
+
+import (
+ "bytes"
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+type Torrent1 struct {
+ Infohash string `json:"infohash"`
+ Name string `json:"name,omitempty"`
+ BytesCompleted int64 `json:"bytescompleted,omitempty"`
+ BytesMissing int64 `json:"bytesmissing,omitempty"`
+ Length int64 `json:"length,omitempty"`
+ State string `json:"state"`
+ Seeding bool `json:"seeding,omitempty"`
+}
+
+type Torrent2 struct {
+ Torrent1
+ StartedAt time.Time `json:"startedat"`
+ AddedAt time.Time `json:"addedat"`
+}
+
+type FileInfo struct {
+ BytesCompleted int64 `json:"bytescompleted"`
+ DisplayPath string `json:"displaypath"`
+ Length int64 `json:"length"`
+ Offset int64 `json:"offset"`
+ Path string `json:"path"`
+ Priority byte `json:"priority"`
+}
+
+type FsFileInfo struct {
+ Name string `json:"name"`
+ Path string `json:"path"`
+ Size int64 `json:"size"`
+ IsDir bool `json:"isdir"`
+}
+
+func GetTorrents(lt []metainfo.Hash) (ret []byte) {
+ var tinits []*Torrent1
+ for _, ih := range lt {
+ var tinit Torrent1
+ tinit.Infohash = ih.HexString()
+ tinits = append(tinits, &tinit)
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ tinit.State = "removed"
+ continue
+ }
+ tinit.Name = t.Name()
+ if t == nil || t.Info() == nil {
+ tinit.State = "loading"
+ continue
+ }
+ if Engine.TorDb.HasStarted(ih.HexString()) {
+ tinit.State = "active"
+ } else {
+ tinit.State = "inactive"
+ }
+ tinit.Length = t.Length()
+ tinit.BytesCompleted = t.BytesCompleted()
+ tinit.BytesMissing = t.BytesMissing()
+ tinit.Seeding = t.Seeding()
+ }
+ ret, _ = json.Marshal(DataMsg{Type: "torrentstream", Data: tinits})
+ return
+}
+
+func GetTorrentInfo(ih metainfo.Hash) (ret []byte) {
+ var tinit Torrent1
+ tinit.Infohash = ih.HexString()
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ tinit.State = "removed"
+ ret, _ = json.Marshal(DataMsg{Type: "torrentinfo", Data: tinit})
+ return
+ }
+ tinit.Name = t.Name()
+ if t == nil || t.Info() == nil {
+ tinit.State = "loading"
+ ret, _ = json.Marshal(DataMsg{Type: "torrentinfo", Data: tinit})
+ return
+ }
+ if Engine.TorDb.HasStarted(ih.HexString()) {
+ tinit.State = "active"
+ } else {
+ tinit.State = "inactive"
+ }
+ tinit.Length = t.Length()
+ tinit.BytesCompleted = t.BytesCompleted()
+ tinit.BytesMissing = t.BytesMissing()
+ tinit.Seeding = t.Seeding()
+ ret, _ = json.Marshal(DataMsg{Type: "torrentinfo", Data: tinit})
+ return
+}
+
+func GetTorrentInfoStat(ih metainfo.Hash) (ret []byte) {
+ trnt, err := Engine.TorDb.GetTorrent(ih)
+ if err == nil {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentinfostat", Data: trnt})
+ }
+ return
+}
+
+func GetTorrentStats(ih metainfo.Hash) (ret []byte) {
+ defer func() {
+ if r := recover(); r != nil {
+ Warn.Println("There was Panic in GetTorrentStats")
+ }
+ }()
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentstats", Data: nil})
+ return
+ }
+ if t == nil || t.Info() == nil {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentstats", Data: nil})
+ return
+ }
+ ts := t.Stats()
+ ret, _ = json.Marshal(DataMsg{Data: &ts, Infohash: ih.HexString(), Type: "torrentstats"})
+ return
+}
+
+func GetFsDirInfo(ih metainfo.Hash, fp string) (ret []byte) {
+ fp = filepath.ToSlash(fp)
+ ret, _ = json.Marshal(DataMsg{Type: "fsdirinfo", Data: nil})
+ ihs := ih.HexString()
+ if ihs == "" {
+ Warn.Println("empty infohash")
+ return
+ }
+ dirpath := filepath.Join(Dirconfig.TrntDir, ihs, fp)
+
+ if !strings.HasPrefix(dirpath, filepath.Join(Dirconfig.TrntDir, ihs)) {
+ return
+ }
+ rl, err := os.ReadDir(filepath.FromSlash(dirpath))
+ if err != nil {
+ Warn.Println(err.Error())
+ return
+ }
+
+ var retfiles []FsFileInfo
+ for _, eachdirentry := range rl {
+ var retfile FsFileInfo
+ inf, err := eachdirentry.Info()
+ if err != nil {
+ continue
+ }
+ retfile.Name = inf.Name()
+ retfile.IsDir = inf.IsDir()
+ retfile.Size = inf.Size()
+ retfile.Path = filepath.ToSlash(filepath.Join(fp, retfile.Name))
+ retfiles = append(retfiles, retfile)
+ }
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "fsdirinfo", Data: retfiles})
+ return
+}
+
+func GetFsFileInfo(ih metainfo.Hash, fp string) (ret []byte) {
+ fp = filepath.ToSlash(fp)
+ ret, _ = json.Marshal(DataMsg{Type: "fsfileinfo", Data: nil})
+ ihs := ih.HexString()
+ if ihs == "" {
+ Warn.Println("empty infohash")
+ return
+ }
+ dirpath := filepath.Join(Dirconfig.TrntDir, ihs, fp)
+
+ if !strings.HasPrefix(dirpath, filepath.Join(Dirconfig.TrntDir, ihs)) {
+ return
+ }
+ var retfile FsFileInfo
+ inf, err := os.Stat(filepath.FromSlash(dirpath))
+ if err != nil {
+ Warn.Println("GetFsFileInfo Error", err)
+ return
+ }
+ retfile.Name = inf.Name()
+ retfile.IsDir = inf.IsDir()
+ retfile.Size = inf.Size()
+ retfile.Path = fp
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "fsfileinfo", Data: retfile})
+ return
+}
+
+func GetTorrentFiles(ih metainfo.Hash) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentfiles", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+
+ var retfiles []FileInfo
+ for _, file := range t.Files() {
+ if file == nil {
+ continue
+ }
+ var retfile FileInfo
+ retfile.BytesCompleted = file.BytesCompleted()
+ retfile.DisplayPath = file.DisplayPath()
+ retfile.Length = file.Length()
+ retfile.Offset = file.Offset()
+ retfile.Path = file.Path()
+ retfile.Priority = byte(file.Priority())
+
+ retfiles = append(retfiles, retfile)
+ }
+
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentfiles", Data: retfiles})
+ return
+}
+
+func GetTorrentFileInfo(ih metainfo.Hash, fp string) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentfileinfo", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+
+ // Get File from Given Torrent
+ var file *torrent.File
+ for _, f := range t.Files() {
+ if f.Path() == fp {
+ file = f
+ break
+ }
+ }
+
+ if file == nil {
+ return
+ }
+ var retfile FileInfo
+ retfile.BytesCompleted = file.BytesCompleted()
+ retfile.DisplayPath = file.DisplayPath()
+ retfile.Length = file.Length()
+ retfile.Offset = file.Offset()
+ retfile.Path = file.Path()
+ retfile.Priority = byte(file.Priority())
+
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentfileinfo", Data: retfile})
+ return
+}
+
+func GetTorrentPieceStateRuns(ih metainfo.Hash) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentpiecestateruns", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentpiecestateruns", Data: t.PieceStateRuns()})
+ return
+}
+
+func GetTorrentKnownSwarm(ih metainfo.Hash) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentknownswarm", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentknownswarm", Data: t.KnownSwarm()})
+ return
+}
+
+func GetTorrentNumpieces(ih metainfo.Hash) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentnumpieces", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentnumpieces", Data: t.NumPieces()})
+ return
+}
+
+func GetTorrentMetainfo(ih metainfo.Hash) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentmetainfo", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+ mi := t.Metainfo()
+ mi.CreatedBy = "exatorrent"
+ var tmi bytes.Buffer
+ err := mi.Write(&tmi)
+ if err != nil {
+ return
+ }
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentmetainfo", Data: tmi.Bytes()})
+ return
+}
+
+func GetTorrentPeerConns(ih metainfo.Hash) (ret []byte) {
+ ret, _ = json.Marshal(DataMsg{Type: "torrentpeerconns", Data: nil})
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ return
+ }
+ if t == nil || t.Info() == nil {
+ return
+ }
+
+ ret, _ = json.Marshal(DataMsg{Infohash: ih.HexString(), Type: "torrentpeerconns", Data: t.PeerConns()})
+ return
+}
diff --git a/internal/core/getspec.go b/internal/core/getspec.go
new file mode 100644
index 00000000..6d103620
--- /dev/null
+++ b/internal/core/getspec.go
@@ -0,0 +1,121 @@
+package core
+
+import (
+ "bytes"
+ "encoding/base64"
+ "fmt"
+ "io"
+ "net/http"
+ "os"
+ "strings"
+
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+// SpecfromURL Returns Torrent Spec from HTTP URL
+func SpecfromURL(torrentURL string) (spec *torrent.TorrentSpec, reterr error) {
+ // TorrentSpecFromMetaInfo may panic if the info is malformed
+ defer func() {
+ if r := recover(); r != nil {
+ reterr = fmt.Errorf("SpecfromURL: error loading spec from URL")
+ }
+ reterr = nil
+ }()
+
+ Info.Println("Adding Torrent from Torrent URL ", torrentURL)
+
+ torrentURL = strings.TrimSpace(torrentURL)
+ resp, reterr := http.Get(torrentURL)
+ if reterr != nil {
+ return
+ }
+
+ // Limit Response
+ lr := io.LimitReader(resp.Body, 20971520) // 20MB
+ info, reterr := metainfo.Load(lr)
+ if reterr != nil {
+ _ = resp.Body.Close()
+ return
+ }
+ spec = torrent.TorrentSpecFromMetaInfo(info)
+ _ = resp.Body.Close()
+ return
+}
+
+// SpecfromPath Returns Torrent Spec from File Path
+func SpecfromPath(path string) (spec *torrent.TorrentSpec, reterr error) {
+ // TorrentSpecFromMetaInfo may panic if the info is malformed
+ defer func() {
+ if r := recover(); r != nil {
+ reterr = fmt.Errorf("SpecfromPath: error loading new torrent from file %s: %v+", path, r)
+ }
+ }()
+
+ fi, err := os.Stat(path)
+
+ if os.IsNotExist(err) {
+ return nil, fmt.Errorf("file doesn't exist")
+ }
+
+ if fi.IsDir() {
+ Err.Println("Directory Present instead of file")
+ return nil, fmt.Errorf("directory present")
+ }
+
+ Info.Println("Getting Torrent Metainfo from File Path", path)
+
+ info, reterr := metainfo.LoadFromFile(path)
+ if reterr != nil {
+ return
+ }
+ spec = torrent.TorrentSpecFromMetaInfo(info)
+ return
+}
+
+// SpecfromBytes Returns Torrent Spec from Bytes
+func SpecfromBytes(trnt []byte) (spec *torrent.TorrentSpec, reterr error) {
+ // TorrentSpecFromMetaInfo may panic if the info is malformed
+ defer func() {
+ if r := recover(); r != nil {
+ reterr = fmt.Errorf("SpecfromBytes: error loading new torrent from bytes")
+ }
+ }()
+ Info.Println("Getting Torrent Metainfo from Torrent Bytes")
+ info, reterr := metainfo.Load(bytes.NewReader(trnt))
+ if reterr != nil {
+ return nil, reterr
+ }
+ spec = torrent.TorrentSpecFromMetaInfo(info)
+ return
+}
+
+// SpecfromB64String Returns Torrent Spec from Base64 Encoded Torrent File
+func SpecfromB64String(trnt string) (spec *torrent.TorrentSpec, reterr error) {
+ t, err := base64.StdEncoding.DecodeString(trnt)
+ if err != nil {
+ return nil, err
+ }
+ return SpecfromBytes(t)
+}
+
+// MetafromHex returns metainfo.Hash from given infohash string
+func MetafromHex(infohash string) (h metainfo.Hash, err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ err = fmt.Errorf("error parsing string to InfoHash")
+ }
+ }()
+
+ h = metainfo.NewHashFromHex(infohash)
+
+ return h, nil
+}
+
+// RemTrackersSpec removes trackers from torrent.Spec
+func RemTrackersSpec(spec *torrent.TorrentSpec) {
+ if spec == nil {
+ return
+ }
+ spec.Trackers = [][]string{}
+}
diff --git a/internal/core/init.go b/internal/core/init.go
new file mode 100644
index 00000000..bf8c0816
--- /dev/null
+++ b/internal/core/init.go
@@ -0,0 +1,310 @@
+package core
+
+import (
+ "bufio"
+ "encoding/json"
+ "errors"
+ "flag"
+ "fmt"
+ "io/fs"
+ "log"
+ "os"
+ "os/signal"
+ "path/filepath"
+ "syscall"
+
+ utp "github.com/anacrolix/go-libutp"
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/anacrolix/torrent/storage"
+ "github.com/varbhat/exatorrent/internal/db"
+)
+
+func checkDir(dir string) {
+ fi, err := os.Stat(dir)
+
+ if err != nil {
+ if errors.Is(err, fs.ErrNotExist) {
+ er := os.MkdirAll(dir, 0755)
+ if er != nil {
+ Err.Fatalln("Error Creating Directory")
+ }
+ return
+ } else {
+ Err.Fatalf("Error Stat Directory %s ( %s ) \n", dir, err.Error())
+ return
+ }
+ }
+
+ if fi != nil {
+ if !fi.IsDir() {
+ Err.Fatalln("Non-Directory File Present")
+ return
+ }
+ } else {
+ Err.Fatalln("Error Stat Directory ", dir)
+
+ }
+}
+
+func Initialize() {
+ var cfilename string
+ var torcc bool
+ var psql bool
+ var engc bool
+ var err error
+ var auser string
+
+ flag.Usage = func() {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "exatorrent is bittorrent client\n\n")
+
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
+
+ flag.VisitAll(func(f *flag.Flag) {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), " -%-5v %v\n", f.Name, f.Usage)
+ })
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), " -%-5v %v\n", "help", " Print this Help")
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nVersion: %s", Version)
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nLicense: GPLv3")
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nSource : https://github.com/varbhat/exatorrent\n")
+ }
+
+ flag.StringVar(&Flagconfig.ListenAddress, "addr", ":5000", ` Listen Address (Default: ":5000")`)
+ flag.StringVar(&Flagconfig.UnixSocket, "unix", "", ` Unix Socket Path`)
+ flag.StringVar(&Flagconfig.TLSKeyPath, "key", "", " Path to TLS Key (Required for HTTPS)")
+ flag.StringVar(&Flagconfig.TLSCertPath, "cert", "", " Path to TLS Certificate (Required for HTTPS)")
+ flag.StringVar(&Dirconfig.DirPath, "dir", "exadir", ` exatorrent Directory (Default: "exadir")`)
+ flag.StringVar(&auser, "admin", "adminuser", ` Default admin username (Default Username: "adminuser" and Default Password: "adminpassword")`)
+ flag.BoolVar(&psql, "psql", false, " Generate Sample Postgresql Connection URL")
+ flag.BoolVar(&engc, "engc", false, " Generate Custom Engine Configuration")
+ flag.BoolVar(&torcc, "torc", false, " Generate Custom Torrent Client Configuration")
+ flag.Parse()
+
+ if len(flag.Args()) != 0 {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Invalid Flags Provided: %s\n\n", flag.Args())
+ flag.Usage()
+ return
+ }
+
+ // Display All Flag Configurations Provided to exatorrent
+ if Flagconfig.UnixSocket != "" {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nUnix Socket Path => %s", Flagconfig.UnixSocket)
+ } else {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nAddress => %s", Flagconfig.ListenAddress)
+ }
+ if Flagconfig.TLSKeyPath != "" {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nTLS Key Path => %s", Flagconfig.TLSKeyPath)
+ }
+ if Flagconfig.TLSCertPath != "" {
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nTLS Certificate Path => %s", Flagconfig.TLSCertPath)
+ }
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nDirectory => %s\n\n", Dirconfig.DirPath)
+
+ // Create Required SubDirectories if not present
+ checkDir(Dirconfig.DirPath)
+ Dirconfig.ConfigDir = filepath.Join(Dirconfig.DirPath, "config")
+ checkDir(Dirconfig.ConfigDir)
+ Dirconfig.CacheDir = filepath.Join(Dirconfig.DirPath, "cache")
+ checkDir(Dirconfig.CacheDir)
+ Dirconfig.DataDir = filepath.Join(Dirconfig.DirPath, "data")
+ checkDir(Dirconfig.DataDir)
+ Dirconfig.TrntDir = filepath.Join(Dirconfig.DirPath, "torrents")
+ checkDir(Dirconfig.TrntDir)
+
+ // Load Torrent Client Configuration
+ cfilename = filepath.Join(Dirconfig.ConfigDir, "clientconfig.json")
+ _, cfileerr := os.Stat(cfilename)
+ if cfileerr == nil {
+ var e error
+ cf, e := os.Open(cfilename)
+ if e != nil {
+ Err.Fatalln("Error Opening ", cfilename)
+ }
+ if cf != nil {
+ e = json.NewDecoder(cf).Decode(&Engine.Tconfig)
+ if e != nil {
+ Err.Fatalln("Error Decoding ", cfilename)
+ }
+ Info.Println("Torrent Client Configuration is now loaded from ", cfilename)
+ torcc = true
+ _ = cf.Close()
+ }
+ } else if os.IsNotExist(cfileerr) && torcc {
+ jfile, _ := json.MarshalIndent(Engine.Tconfig, "", "\t")
+ _ = os.WriteFile(cfilename, jfile, 0644)
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nSample Torrent Client Configuration has been written at %s\n", cfilename)
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Please Customize Torrent Client Configuration File %s if required , and restart\n", cfilename)
+ os.Exit(0)
+ }
+
+ // Load Custom Engine Configuration
+ Engine.Econfig = EngConfig{GlobalSeedRatio: 0, OnlineCacheURL: "https://itorrents.org/torrent/%s.torrent", SRRefresh: 150, TrackerRefresh: 60, TrackerListURLs: []string{"https://ngosang.github.io/trackerslist/trackers_best.txt"}}
+ // You can also add these "https://newtrackon.com/api/stable" , "https://cdn.jsdelivr.net/gh/XIU2/TrackersListCollection@master/best.txt"
+ cfilename = filepath.Join(Dirconfig.ConfigDir, "engconfig.json")
+ _, cfileerr = os.Stat(cfilename)
+ if cfileerr == nil {
+ var e error
+ cf, e := os.Open(cfilename)
+ if e != nil {
+ Err.Fatalln("Error Opening ", cfilename)
+ } else {
+ if cf != nil {
+ e = json.NewDecoder(cf).Decode(&Engine.Econfig)
+ if e != nil {
+ Err.Fatalln("Error Decoding ", cfilename)
+ }
+ Info.Printf("Engine Configuration %+v is now loaded\n", Engine.Econfig)
+ engc = true
+ _ = cf.Close()
+ }
+ }
+ } else if os.IsNotExist(cfileerr) && engc {
+ _ = Engine.Econfig.WriteConfig()
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nSample Engine Configuration has been written at %s\n", cfilename)
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Please Customize Engine Configuration File %s if required , and restart\n", cfilename)
+ os.Exit(0)
+ }
+
+ // Read Postgresql Secret
+ cfilename = filepath.Join(Dirconfig.ConfigDir, "psqlconfig.txt")
+ _, cfileerr = os.Stat(cfilename)
+ if cfileerr == nil {
+ pfile, err := os.Open(cfilename)
+ if err != nil {
+ Err.Fatalln("Error Reading Postgresql Connection URL: ", err)
+ }
+ defer pfile.Close()
+
+ scanner := bufio.NewScanner(pfile)
+ for scanner.Scan() {
+ Engine.PsqlCon = scanner.Text()
+ psql = true
+ Info.Println("Postgresql Connection URL at", cfilename, " has been Read")
+ break
+ }
+
+ if err := scanner.Err(); err != nil {
+ Err.Fatalln("Error Reading Postgresql Connection URL: ", err)
+ }
+ } else {
+ Engine.PsqlCon = os.Getenv("DATABASE_URL")
+ if len(Engine.PsqlCon) != 0 {
+ psql = true
+ _ = os.Unsetenv("DATABASE_URL")
+ }
+ }
+ if os.IsNotExist(cfileerr) && psql {
+ _ = os.WriteFile(cfilename, []byte("postgres://username:password@localhost:5432/database_name"), 0644)
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "\nSample Postgresql Connection URL has been written at %s\n", cfilename)
+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Please Enter your Postgresql Connection URL at File %s , and restart\n", cfilename)
+ os.Exit(0)
+ }
+
+ tc := Engine.Tconfig.ToTorrentConfig()
+
+ // Set Different Logger for UTP
+ utp.Logger = log.New(os.Stderr, "[UTP ] ", log.LstdFlags) // Info Logger
+
+ if psql {
+
+ Engine.TorDb = &db.PsqlTrntDb{}
+ Engine.TorDb.Open(Engine.PsqlCon)
+
+ Engine.FsDb = &db.PsqlFsDb{}
+ Engine.FsDb.Open(Engine.PsqlCon)
+
+ Engine.LsDb = &db.PsqlLsDb{}
+ Engine.LsDb.Open(Engine.PsqlCon)
+
+ Engine.UDb = &db.PsqlUserDb{}
+ Engine.UDb.Open(Engine.PsqlCon)
+
+ Engine.TUDb = &db.PsqlTrntUserDb{}
+ Engine.TUDb.Open(Engine.PsqlCon)
+
+ Engine.TrackerDB = &db.PsqlTDb{}
+ Engine.TrackerDB.Open(Engine.PsqlCon)
+
+ Engine.PcDb, err = db.NewPsqlPieceCompletion(Engine.PsqlCon)
+
+ if err != nil {
+ Err.Fatalln("Unable to Connect to Postgresql for PieceCompletion")
+ }
+
+ } else {
+ sqliteSetup(tc)
+ }
+
+ _, err = os.Stat(filepath.Join(Dirconfig.DataDir, ".adminadded"))
+ if errors.Is(err, os.ErrNotExist) {
+ Info.Println(`Adding Admin user with username "` + auser + `" and password "adminpassword"`)
+ er := Engine.UDb.Add(auser, "adminpassword", 1)
+ if er != nil {
+ Err.Fatalln("Unable to add admin user to adminless exatorrent instance", er)
+ }
+ _, er = os.Create(filepath.Join(Dirconfig.DataDir, ".adminadded"))
+ if er != nil {
+ Err.Fatalln(er)
+ }
+ }
+
+ tc.DefaultStorage = storage.NewFileWithCustomPathMakerAndCompletion(Dirconfig.TrntDir, func(baseDir string, info *metainfo.Info, infoHash metainfo.Hash) string {
+ return filepath.Join(baseDir, infoHash.HexString())
+ }, Engine.PcDb)
+
+ Engine.Torc, err = torrent.NewClient(tc)
+ if err != nil {
+ Err.Fatalln("Unable to Create Torrent Client ", err)
+ } else {
+ Info.Println("Torrent Client Created")
+ }
+
+ go func() {
+ defer func() {
+ if err := recover(); err != nil {
+ Warn.Println(err)
+ }
+ }()
+ stopsignal := make(chan os.Signal, 5)
+ signal.Notify(stopsignal, os.Interrupt, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
+ sig := <-stopsignal
+ fmt.Fprintf(os.Stderr, "\n")
+ Warn.Println("Recieved ", sig)
+ Warn.Println("Closing exatorrent")
+ Engine.TorDb.Close()
+ Engine.TrackerDB.Close()
+ Engine.TUDb.Close()
+ _ = Engine.PcDb.Close() // Close PcDb at the end
+ // Stop The Engine
+ Engine.Torc.Close()
+ os.Exit(1)
+ }()
+
+ //Recover Torrents from Database
+ torlist, err := Engine.TorDb.GetTorrents()
+ if err != nil {
+ Err.Fatalln("Error Recovering Torrents")
+ }
+ for _, eachtrnt := range torlist {
+ go func(started bool, infohash metainfo.Hash) {
+ AddfromSpec("", &torrent.TorrentSpec{InfoHash: infohash}, true, true)
+ if started {
+ StartTorrent("", infohash, true)
+ }
+ flist := Engine.FsDb.Get(infohash)
+ if started {
+ for _, f := range flist {
+ StopFile("", infohash, f)
+ }
+ } else {
+ for _, f := range flist {
+ StartFile("", infohash, f)
+ }
+ }
+ }(eachtrnt.Started, eachtrnt.Infohash)
+ }
+
+ go UpdateTrackers()
+ go TorrentRoutine()
+
+}
diff --git a/internal/core/routine.go b/internal/core/routine.go
new file mode 100644
index 00000000..752ab930
--- /dev/null
+++ b/internal/core/routine.go
@@ -0,0 +1,103 @@
+package core
+
+import (
+ "bufio"
+ "net/http"
+ "strings"
+ "time"
+)
+
+// UpdateTrackers Updates the Trackers from TrackerURL
+func UpdateTrackers() {
+ defer func() {
+ if err := recover(); err != nil {
+ Warn.Println(err)
+ }
+ }()
+ for {
+ updatetrackers()
+ // Pause UpdateTrackers() every Engine.Econfig.TrackerRefresh Minutes
+ time.Sleep(time.Minute * time.Duration(Engine.Econfig.GetTR()))
+ }
+
+}
+
+// TorrentRoutine Stops Torrent on Reaching Global SeedRatio
+func TorrentRoutine() {
+ defer func() {
+ if err := recover(); err != nil {
+ Warn.Println(err)
+ }
+ }()
+ for range time.Tick(time.Minute * time.Duration(Engine.Econfig.GetSRR())) {
+ stoponseedratio(Engine.Econfig.GetGSR())
+ }
+}
+
+func updatetrackers() {
+ for _, url := range Engine.Econfig.GetTLU() {
+ resp, err := http.Get(url)
+ if err != nil {
+ Warn.Println("TrackerList URL: ", url, " is Invalid")
+ continue
+ }
+
+ // Add Trackers to txtlines string slice
+ scanner := bufio.NewScanner(resp.Body)
+ scanner.Split(bufio.ScanLines)
+
+ var trackerpertrurl int
+ for scanner.Scan() {
+ line := strings.TrimSpace(scanner.Text())
+ if line == "" {
+ continue
+ }
+ Engine.TrackerDB.Add(line)
+ trackerpertrurl++
+ }
+
+ _ = resp.Body.Close()
+ Info.Println("Loaded ", trackerpertrurl, " trackers from ", url)
+ }
+
+ Info.Println("Loaded ", Engine.TrackerDB.Count(), " trackers in total , eliminating duplicates")
+
+ // Add Trackers to Every Torrents
+ trckrs := [][]string{Engine.TrackerDB.Get()}
+ en := Engine.Torc
+ if en != nil {
+ for _, trnt := range en.Torrents() {
+ if trnt != nil {
+ trnt.AddTrackers(trckrs)
+ }
+ }
+ Info.Println("Added Loaded Trackers to Torrents")
+ }
+}
+
+func stoponseedratio(sr float64) {
+ if sr != 0 {
+ if Engine.Torc != nil {
+ trnts := Engine.Torc.Torrents()
+
+ for _, trnt := range trnts {
+ if trnt == nil {
+ continue
+ }
+ if trnt.Info() == nil {
+ continue
+ }
+
+ stats := trnt.Stats()
+
+ seedratio := float64(stats.BytesWrittenData.Int64()) / float64(stats.BytesReadData.Int64())
+
+ // stops task on reaching ratio
+ if seedratio >= sr {
+ Warn.Printf("Torrent %s Stopped on Reaching Global SeedRatio", trnt.InfoHash())
+ go StopTorrent("", trnt.InfoHash())
+ }
+ }
+ }
+ }
+}
diff --git a/internal/core/serve.go b/internal/core/serve.go
new file mode 100644
index 00000000..1f8a591e
--- /dev/null
+++ b/internal/core/serve.go
@@ -0,0 +1,226 @@
+package core
+
+import (
+ "archive/tar"
+ "archive/zip"
+ "fmt"
+ "io"
+ "io/fs"
+ "net/http"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "github.com/anacrolix/torrent"
+)
+
+func TorrentServe(w http.ResponseWriter, r *http.Request) {
+ parts := strings.Split(r.URL.Path, "/")
+ if !(len(parts) > 4) {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ if Engine.LsDb.IsLocked(parts[3]) {
+ u, ut, _, err := authHelper(w, r)
+ if err != nil {
+ Err.Println(err)
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ if ut != 1 {
+ if ut == -1 {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ if !Engine.TUDb.HasUser(u, parts[3]) {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ }
+ }
+ if val := r.URL.Query().Get("dl"); val != "" {
+ file := filepath.Join(Dirconfig.TrntDir, filepath.Join(parts[3:]...))
+ if !strings.HasPrefix(file, filepath.Join(Dirconfig.TrntDir, parts[3])) {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ info, err := os.Stat(file)
+ if err != nil {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ } else if info.IsDir() {
+ if val == "tar" {
+ TarDir(file, w, path.Base(r.URL.Path))
+ return
+ } else if val == "zip" {
+ ZipDir(file, w, path.Base(r.URL.Path))
+ return
+ }
+ }
+ }
+ http.StripPrefix("/api/torrent/", http.FileServer(http.Dir(Dirconfig.TrntDir))).ServeHTTP(w, r)
+}
+
+func StreamFile(w http.ResponseWriter, r *http.Request) {
+ parts := strings.Split(r.URL.Path, "/")
+ if !(len(parts) > 4) {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ if Engine.LsDb.IsLocked(parts[3]) {
+ u, ut, _, err := authHelper(w, r)
+ if err != nil {
+ Err.Println(err)
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ if ut != 1 {
+ if ut == -1 {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ if !Engine.TUDb.HasUser(u, parts[3]) {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ }
+ }
+ ih, err := MetafromHex(parts[3])
+ if err != nil {
+ Warn.Println(err)
+ return
+ }
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ Warn.Println("Error fetching torrent of infohash ", ih, " from the client")
+ return
+ }
+
+ if t.Info() == nil {
+ Warn.Println("Metainfo not yet recieved")
+ http.Error(w, "Metainfo not yet recieved", http.StatusNotFound)
+ return
+ }
+
+ // Get File from Given Torrent
+ reqpath := strings.Join(parts[4:], "/")
+ var f *torrent.File
+ for _, file := range t.Files() {
+ if file.Path() == reqpath {
+ f = file
+ break
+ }
+ }
+ if f == nil {
+ http.Error(w, "404 Not Found", http.StatusNotFound)
+ return
+ }
+ filereader := f.NewReader()
+ defer filereader.Close()
+ filereader.SetReadahead(48 << 20)
+ http.ServeContent(w, r, reqpath, time.Time{}, filereader)
+}
+
+func TarDir(dirpath string, w http.ResponseWriter, name string) {
+ w.Header().Set("Content-Type", "application/x-tar")
+ w.Header().Set("Content-disposition", `attachment; filename="`+name+`.tar"`)
+ w.WriteHeader(http.StatusOK)
+ tw := tar.NewWriter(w)
+ defer tw.Close()
+
+ _ = filepath.WalkDir(dirpath, func(p string, de fs.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+
+ info, ierr := de.Info()
+ if ierr != nil {
+ return ierr
+ }
+
+ if !info.Mode().IsRegular() {
+ return nil
+ }
+
+ rel, err := filepath.Rel(dirpath, p)
+ if err != nil {
+ return err
+ }
+ f, err := os.Open(p)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ h, err := tar.FileInfoHeader(info, "")
+ if err != nil {
+ return err
+ }
+ h.Name = rel
+ if err := tw.WriteHeader(h); err != nil {
+ return err
+ }
+ n, err := io.Copy(tw, f)
+ if info.Size() != n {
+ return fmt.Errorf("mismatch of size with %s", rel)
+ }
+ return err
+ })
+}
+
+func ZipDir(dirpath string, w http.ResponseWriter, name string) {
+ w.Header().Set("Content-Type", "application/zip")
+ w.Header().Set("Content-disposition", `attachment; filename="`+name+`.zip"`)
+ w.WriteHeader(http.StatusOK)
+ zw := zip.NewWriter(w)
+ defer zw.Close()
+
+ _ = filepath.WalkDir(dirpath, func(p string, de fs.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+
+ info, ierr := de.Info()
+ if ierr != nil {
+ return ierr
+ }
+
+ if !info.Mode().IsRegular() {
+ return nil
+ }
+
+ rel, err := filepath.Rel(dirpath, p)
+ if err != nil {
+ return err
+ }
+ f, err := os.Open(p)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ h, err := zip.FileInfoHeader(info)
+ if err != nil {
+ return err
+ }
+
+ h.Name = rel
+ //h.Method = zip.Deflate
+
+ zf, err := zw.CreateHeader(h)
+ if err != nil {
+ return err
+ }
+
+ n, err := io.Copy(zf, f)
+ if info.Size() != n {
+ return fmt.Errorf("mismatch of size with %s", rel)
+ }
+
+ return err
+
+ })
+
+}
diff --git a/internal/core/socket.go b/internal/core/socket.go
new file mode 100644
index 00000000..20b8eef2
--- /dev/null
+++ b/internal/core/socket.go
@@ -0,0 +1,995 @@
+package core
+
+import (
+ "bufio"
+ "bytes"
+ "encoding/base64"
+ "encoding/json"
+ "net/http"
+ "os"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/google/uuid"
+ "github.com/gorilla/websocket"
+ "github.com/shirou/gopsutil/disk"
+)
+
+var upgrader = websocket.Upgrader{
+ ReadBufferSize: 1024,
+ WriteBufferSize: 1024,
+}
+
+const (
+ // Time allowed to write a message to the peer.
+ writeWait = 10 * time.Second
+
+ // Time allowed to read the next pong message from the peer.
+ pongWait = 60 * time.Second
+
+ // Send pings to peer with this period. Must be less than pongWait.
+ pingPeriod = (pongWait * 9) / 10
+
+ // Maximum message size allowed from peer.
+ maxMessageSize = 31457280 // 30 MB
+)
+
+func SocketAPI(w http.ResponseWriter, r *http.Request) {
+ username, usertype, _, err := authHelper(w, r)
+ if err != nil {
+ Warn.Printf("%s (%s)\n", err, r.RemoteAddr)
+ return
+ }
+ var admin bool
+ if usertype == 1 {
+ admin = true
+ } else if usertype == -1 {
+ Err.Println("Disabled User denied to Connect", username)
+ http.Error(w, "User Disabled", http.StatusUnauthorized)
+ return
+ }
+ conn, err := upgrader.Upgrade(w, r, nil)
+ if err != nil {
+ Warn.Println(err)
+ return
+ }
+ conn.SetReadLimit(maxMessageSize)
+ _ = conn.SetReadDeadline(time.Now().Add(pongWait))
+ conn.SetPongHandler(func(string) error { _ = conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })
+
+ Uc := NewUserConn(username, conn, admin)
+
+ // Ping Handler
+ go func() {
+ ticker := time.NewTicker(pingPeriod)
+ defer func() {
+ ticker.Stop()
+ }()
+
+ var perr error
+
+ for {
+ <-ticker.C
+ Uc.Sendmu.Lock()
+ _ = Uc.Conn.SetWriteDeadline(time.Now().Add(writeWait))
+ perr = Uc.Conn.WriteMessage(websocket.PingMessage, nil)
+ Uc.Sendmu.Unlock()
+ if perr != nil {
+ Uc.Close()
+ return
+ }
+ }
+ }()
+
+ var Req []byte
+ for {
+ _, Req, err = Uc.Conn.ReadMessage()
+ if err != nil {
+ if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
+ Warn.Printf("WebSocket Unexpected Close: %v", err)
+ }
+ Uc.Close()
+ return
+ }
+ var resp ConReq
+ err = json.Unmarshal(Req, &resp)
+ if err != nil {
+ _ = Uc.SendMsg("resp", "error", "incorrect request")
+ continue
+ }
+ go wshandler(Uc, &resp)
+ }
+}
+
+func wshandler(uc *UserConn, req *ConReq) {
+ if len(req.Command) == 0 {
+ _ = uc.SendMsg("resp", "error", "no command sent")
+ return
+ }
+
+ // Admin Operations
+ if uc.IsAdmin && req.Aop == 1 {
+ switch req.Command {
+ // parse these in normal block
+ case "abandontorrent":
+ case "removetorrent":
+ case "addtrackerstotorrent":
+ case "starttorrent":
+ case "stoptorrent":
+ case "startfile":
+ case "stopfile":
+ case "deletefilepath":
+ case "deletetorrent":
+ //
+ case "adduser":
+ if !(len(req.Data1) > 5 || len(req.Data2) > 5) {
+ _ = uc.SendMsg("resp", "error", "length of username and password must be more than 5")
+ return
+ }
+ var err error
+ if req.Data3 == "admin" {
+ err = Engine.UDb.Add(req.Data1, req.Data2, 1) // Admin
+ } else if req.Data3 == "user" {
+ err = Engine.UDb.Add(req.Data1, req.Data2, 0) // User
+ } else if req.Data3 == "disabled" {
+ err = Engine.UDb.Add(req.Data1, req.Data2, -1) // Disabled
+ } else {
+ _ = uc.SendMsg("resp", "error", "incorrect adduser request")
+ return
+ }
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "Error Adding User to Database")
+ return
+ }
+ _ = uc.SendMsg("resp", "success", req.Data1+" User Added")
+ Info.Println("New User ", req.Data1, " added by ", uc.Username)
+ return
+ case "removeuser":
+ if !(len(req.Data1) > 5) {
+ _ = uc.SendMsg("resp", "error", "length of username must be more than 5")
+ return
+ }
+ if req.Data1 == uc.Username {
+ _ = uc.SendMsg("resp", "error", "you cannot remove yourself")
+ return
+ }
+ err := Engine.UDb.Delete(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "Error Removing User from Database")
+ return
+ }
+ err = Engine.TUDb.RemoveAll(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "Error Deleting User Records from Database")
+ return
+ }
+ MainHub.RemoveUser(req.Data1)
+ _ = uc.SendMsg("resp", "success", req.Data1+" User Removed")
+ Info.Println("User ", req.Data1, " is removed by ", uc.Username)
+ return
+ case "getalltorrents":
+ uc.Streamers.Inc()
+ uc.Stream.Lock()
+ defer uc.Streamers.Dec()
+ defer uc.Stream.Unlock()
+
+ files, ferr := os.ReadDir(Dirconfig.TrntDir)
+ if ferr != nil {
+ Warn.Println(ferr)
+ return
+ }
+
+ var lt []metainfo.Hash = make([]metainfo.Hash, 0)
+ for _, file := range files {
+ if file.IsDir() {
+ tm, terr := MetafromHex(file.Name())
+ if terr != nil {
+ Warn.Println(terr)
+ Warn.Println("Non Torrent Directories found in ", Dirconfig.TrntDir, file, file.Name())
+ }
+ lt = append(lt, tm)
+ } else {
+ Warn.Println("Non Torrent Directories found in ", Dirconfig.TrntDir, file, file.Name())
+ }
+ }
+
+ var err error
+ Info.Println("Starting getalltorrents for ", uc.Username)
+ for uc.Streamers.Get() == 1 {
+ err = uc.Send(GetTorrents(lt))
+ if err != nil {
+ return
+ }
+ if uc.Streamers.Get() == 1 {
+ time.Sleep(time.Second * 5) // Stream Every 5 Seconds
+ }
+ }
+ Info.Println("Stopped getalltorrents for ", uc.Username)
+ return
+ case "listalltorrents":
+ files, ferr := os.ReadDir(Dirconfig.TrntDir)
+ if ferr != nil {
+ Warn.Println(ferr)
+ return
+ }
+ var lt []metainfo.Hash = make([]metainfo.Hash, 0)
+ for _, file := range files {
+ if file.IsDir() {
+ tm, terr := MetafromHex(file.Name())
+ if terr != nil {
+ Warn.Println(terr)
+ Warn.Println("Non Torrent Directories found in ", Dirconfig.TrntDir, file, file.Name())
+ }
+ lt = append(lt, tm)
+ } else {
+ Warn.Println("Non Torrent Directories found in ", Dirconfig.TrntDir, file, file.Name())
+ }
+ }
+ _ = uc.Send(GetTorrents(lt))
+ return
+ case "listtorrentsforuser":
+ if req.Data1 != "" {
+ ret, _ := json.Marshal(DataMsg{Type: "torrentsforuser", Data: Engine.TUDb.ListTorrents(req.Data1)})
+ _ = uc.Send(ret)
+ } else {
+ _ = uc.SendMsg("resp", "error", "username is empty")
+ }
+ return
+ case "getusers":
+ retusers := Engine.UDb.GetUsers()
+ ret, _ := json.Marshal(DataMsg{Type: "users", Data: retusers})
+ _ = uc.Send(ret)
+ return
+ case "updatepw":
+ defer func() {
+ if r := recover(); r != nil { // uuid may panic
+ _ = uc.SendMsg("resp", "error", "uuid error")
+ Warn.Println("uuid error")
+ return
+ }
+ }()
+ if req.Data1 == "" {
+ _ = uc.SendMsg("resp", "error", "request error")
+ return
+ }
+ err := Engine.UDb.UpdatePw(req.Data1, req.Data2)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", err.Error())
+ }
+ MainHub.RemoveUser(req.Data1)
+ err = Engine.UDb.SetToken(req.Data1, uuid.New().String())
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", err.Error())
+ }
+ _ = uc.SendMsg("resp", "success", "Password of "+req.Data1+" updated")
+ return
+ case "revoketoken":
+ defer func() {
+ if r := recover(); r != nil { // uuid may panic
+ _ = uc.SendMsg("resp", "error", "uuid error")
+ Warn.Println("uuid error")
+ return
+ }
+ }()
+ if req.Data1 == "" {
+ _ = uc.SendMsg("resp", "error", "request error")
+ return
+ }
+ MainHub.RemoveUser(req.Data1)
+ err := Engine.UDb.SetToken(req.Data1, uuid.New().String())
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", err.Error())
+ }
+ _ = uc.SendMsg("resp", "success", "revoked token of "+req.Data1)
+ return
+ case "changeusertype":
+ Info.Println(uc.Username, "has requested to change usertype of ", req.Data1, " to ", req.Data2)
+ if req.Data1 == "" {
+ _ = uc.SendMsg("resp", "error", "username can be empty")
+ Warn.Println("Usertype change request of ", uc.Username, " failed")
+ return
+ }
+ if req.Data1 == uc.Username {
+ _ = uc.SendMsg("resp", "error", "you can't change usertype of yourself")
+ Warn.Println("Usertype change request of ", uc.Username, " failed")
+ return
+ }
+ MainHub.RemoveUser(req.Data1)
+ err := Engine.UDb.ChangeType(req.Data1, req.Data2)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", err.Error())
+ }
+ _ = uc.SendMsg("resp", "success", "changed usertype of "+req.Data1+" to "+req.Data2)
+ Info.Println(uc.Username, "has changed usertype of ", req.Data1, " to ", req.Data2)
+ return
+ case "machinfo":
+ ret, _ := json.Marshal(DataMsg{Type: "machinfo", Data: MachInfo})
+ _ = uc.Send(ret)
+ return
+ case "machstats":
+ MachStats.LoadStats(".")
+ ret, _ := json.Marshal(DataMsg{Type: "machstats", Data: MachStats})
+ _ = uc.Send(ret)
+ return
+ case "torcstatus":
+ var torcstatus bytes.Buffer
+ Engine.Torc.WriteStatus(&torcstatus)
+ ret, _ := json.Marshal(DataMsg{Type: "torcstatus", Data: torcstatus.String()})
+ _ = uc.Send(ret)
+ return
+ case "getconfig":
+ Configmu.Lock()
+ ret, _ := json.Marshal(DataMsg{Type: "engconf", Data: Engine.Econfig})
+ Configmu.Unlock()
+ _ = uc.Send(ret)
+ return
+ case "updateconfig":
+ if req.Data1 == "" {
+ _ = uc.SendMsg("resp", "error", "empty config file")
+ return
+ }
+ configfile, berr := base64.StdEncoding.DecodeString(req.Data1)
+ if berr != nil {
+ _ = uc.SendMsg("resp", "error", "error decoding config file")
+ return
+ }
+ var newconfig EngConfig
+ berr = json.Unmarshal(configfile, &newconfig)
+ if berr != nil {
+ _ = uc.SendMsg("resp", "error", "error decoding config file")
+ return
+ }
+ Configmu.Lock()
+ Engine.Econfig = newconfig
+ _ = Engine.Econfig.WriteConfig()
+ Info.Println("Torrent Configuration has been Updated by ", uc.Username)
+ Configmu.Unlock()
+ _ = uc.SendMsg("resp", "success", "New Torrent Config File has been set successfully")
+ return
+ case "listusersfortorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "listusersfortorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ ret, _ := json.Marshal(DataMsg{Type: "usersfortorrent", Infohash: ih.HexString(), Data: Engine.TUDb.ListUsers(ih)})
+ _ = uc.Send(ret)
+ return
+ case "listuserconns":
+ _ = uc.Send(MainHub.ListUsers())
+ return
+ case "kickuser":
+ MainHub.RemoveUser(req.Data1)
+ _ = uc.SendMsg("resp", "success", "kicked "+req.Data1)
+ return
+ case "changedataload":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "stopfile: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ t, ok := Engine.Torc.Torrent(ih)
+ if !ok {
+ _ = uc.SendMsgU("nfn", ih.HexString(), "error", "Torrent Not Present!")
+ Warn.Println("Error fetching torrent of infohash ", ih, " from the client")
+ return
+ }
+
+ if t.Info() != nil {
+ if req.Data2 == "upload" {
+ if req.Data3 == "disallow" {
+ t.DisallowDataUpload()
+ _ = uc.SendMsg("resp", "success", "Disallowed Data Upload for torrent "+ih.HexString())
+ return
+ } else if req.Data3 == "allow" {
+ t.AllowDataUpload()
+ _ = uc.SendMsg("resp", "success", "Allowed Data Upload for torrent "+ih.HexString())
+ return
+ } else {
+ _ = uc.SendMsg("resp", "error", "invalid request")
+ return
+ }
+ } else if req.Data2 == "download" {
+ if req.Data3 == "disallow" {
+ t.DisallowDataDownload()
+ _ = uc.SendMsg("resp", "success", "Disallowed Data Download for torrent "+ih.HexString())
+ return
+ } else if req.Data3 == "allow" {
+ t.AllowDataDownload()
+ _ = uc.SendMsg("resp", "success", "Allowed Data Download for torrent "+ih.HexString())
+ return
+ } else {
+ _ = uc.SendMsg("resp", "error", "invalid request")
+ return
+ }
+ } else {
+ _ = uc.SendMsg("resp", "error", "invalid request")
+ return
+ }
+ }
+ return
+ case "nooftrackersintrackerdb":
+ ret, _ := json.Marshal(DataMsg{Type: "nooftrackersintrackerdb", Data: Engine.TrackerDB.Count()})
+ _ = uc.Send(ret)
+ return
+ case "deletetrackersintrackerdb":
+ if req.Data1 == "all" {
+ Engine.TrackerDB.DeleteAll()
+ Info.Println("Deleted All Trackers from TrackerDB")
+ _ = uc.SendMsg("resp", "success", "Deleted All Trackers from TrackerDB")
+ return
+ }
+ notobedeleted, err := strconv.Atoi(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "invalid request")
+ return
+ }
+ Engine.TrackerDB.DeleteN(notobedeleted)
+ Info.Println("Deleted ", req.Data1, " no of Trackers from TrackerDB")
+ _ = uc.SendMsg("resp", "success", "Deleted "+req.Data1+" trackers from TrackerDB")
+ return
+ case "trackerdbrefresh":
+ Info.Println("TrackerDB Refresh command has been issued by", uc.Username)
+ updatetrackers()
+ _ = uc.SendMsg("resp", "success", "Fetched Trackers from Tracker URLs and Updated TrackerDB")
+ return
+ case "stoponseedratio":
+ Info.Println("stoponseedratio command has been issued by ", uc.Username)
+ if req.Data1 == "" {
+ stoponseedratio(Engine.Econfig.GetGSR())
+ _ = uc.SendMsg("resp", "success", "Stopped Torrents which have reached seedratio defined in config")
+ return
+
+ }
+ if sr, err := strconv.ParseFloat(req.Data1, 64); err == nil {
+ stoponseedratio(sr)
+ _ = uc.SendMsg("resp", "success", "Stopped Torrents which have reached seedratio = "+req.Data1)
+ return
+ }
+ _ = uc.SendMsg("resp", "error", "Invalid request")
+ return
+ default:
+ _ = uc.SendMsg("resp", "error", "invalid admin command")
+ return
+ }
+ }
+
+ switch req.Command {
+ case "addmagnet":
+ tspec, terr := torrent.TorrentSpecFromMagnetUri(req.Data1)
+ if terr != nil {
+ _ = uc.SendMsg("resp", "error", "incorrect torrent spec")
+ return
+ }
+ if req.Data2 == "true" {
+ go AddfromSpec(uc.Username, tspec, true, false)
+ } else {
+ go AddfromSpec(uc.Username, tspec, false, false)
+ }
+ _ = uc.SendMsgU("resp", "success", tspec.InfoHash.HexString(), "torrent spec added")
+ return
+ case "addtorrent":
+ tspec, terr := SpecfromB64String(req.Data1)
+ if terr != nil {
+ _ = uc.SendMsg("resp", "error", "incorrect torrent spec")
+ return
+ }
+ if req.Data2 == "true" {
+ go AddfromSpec(uc.Username, tspec, true, false)
+ } else {
+ go AddfromSpec(uc.Username, tspec, false, false)
+ }
+ _ = uc.SendMsgU("resp", "success", tspec.InfoHash.HexString(), "torrent spec added")
+ return
+ case "addinfohash":
+ ih, terr := MetafromHex(req.Data1)
+ if terr != nil {
+ _ = uc.SendMsg("resp", "error", "incorrect Infohash")
+ return
+ }
+ tspec := &torrent.TorrentSpec{InfoHash: ih}
+ if req.Data2 == "true" {
+ go AddfromSpec(uc.Username, tspec, true, false)
+ } else {
+ go AddfromSpec(uc.Username, tspec, false, false)
+ }
+ _ = uc.SendMsgU("resp", "success", ih.HexString(), "torrent spec added")
+ return
+ case "starttorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "starttorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go StartTorrent("", ih, false)
+ return
+ }
+ go StartTorrent(uc.Username, ih, false)
+ return
+ case "stoptorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "stoptorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go StopTorrent("", ih)
+ return
+ }
+ go StopTorrent(uc.Username, ih)
+ return
+ case "startfile":
+ if req.Data2 == "" {
+ _ = uc.SendMsg("resp", "error", "no path provided")
+ return
+ }
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "startfile: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go StartFile("", ih, req.Data2)
+ return
+ }
+ go StartFile(uc.Username, ih, req.Data2)
+ return
+ case "stopfile":
+ if req.Data2 == "" {
+ _ = uc.SendMsg("resp", "error", "no path provided")
+ return
+ }
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "stopfile: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go StopFile("", ih, req.Data2)
+ return
+ }
+ go StopFile(uc.Username, ih, req.Data2)
+ return
+ case "deletefilepath":
+ if req.Data2 == "" {
+ _ = uc.SendMsg("resp", "error", "no path provided")
+ return
+ }
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "deletefilepath: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go DeleteFilePath("", ih, req.Data2)
+ return
+ }
+ go DeleteFilePath(uc.Username, ih, req.Data2)
+ return
+ case "deletetorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "deletetorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go DeleteTorrent("", ih)
+ return
+ }
+ go DeleteTorrent(uc.Username, ih)
+ uc.StopStream()
+ return
+ case "removetorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "removetorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go RemoveTorrent("", ih)
+ return
+ }
+ go RemoveTorrent(uc.Username, ih)
+ return
+ case "abandontorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "abandontorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+ if uc.IsAdmin && req.Aop == 1 {
+ go AbandonTorrent(req.Data2, ih)
+ return
+ }
+ go AbandonTorrent(uc.Username, ih)
+ return
+ case "gettorrents":
+ uc.Streamers.Inc()
+ uc.Stream.Lock()
+ defer uc.Streamers.Dec()
+ defer uc.Stream.Unlock()
+
+ lt := Engine.TUDb.ListTorrents(uc.Username)
+ var err error
+ Info.Println("Starting gettorrents for ", uc.Username)
+ for uc.Streamers.Get() == 1 {
+ err = uc.Send(GetTorrents(lt))
+ if err != nil {
+ return
+ }
+ if uc.Streamers.Get() == 1 {
+ time.Sleep(time.Second * 5) // Stream Every 5 Seconds
+ }
+ }
+ Info.Println("Stopped gettorrents for ", uc.Username)
+ return
+ case "listtorrents":
+ _ = uc.Send(GetTorrents(Engine.TUDb.ListTorrents(uc.Username)))
+ return
+ case "gettorrentinfo":
+ uc.Streamers.Inc()
+ uc.Stream.Lock()
+ defer uc.Streamers.Dec()
+ defer uc.Stream.Unlock()
+
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentinfo: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ Info.Println("Starting gettorrentinfo for ", uc.Username)
+
+ for uc.Streamers.Get() == 1 {
+ err = uc.Send(GetTorrentInfo(ih))
+ if err != nil {
+ return
+ }
+ if uc.Streamers.Get() == 1 {
+ time.Sleep(time.Second * 5) // Stream Every 5 Seconds
+ }
+ }
+ Info.Println("Stopped gettorrentinfo for ", uc.Username)
+ return
+ case "listtorrentinfo":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "listtorrentinfo: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ _ = uc.Send(GetTorrentInfo(ih))
+ return
+ case "gettorrentstats":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentstats: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentStats(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentinfostat":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentinfostat: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentInfoStat(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentfiles":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentfiles: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentFiles(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "getfsdirinfo":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "getfsdirinfo: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetFsDirInfo(ih, filepath.Clean(req.Data2)))
+ if err != nil {
+ return
+ }
+ return
+ case "getfsfileinfo":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "getfsfileinfo: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetFsFileInfo(ih, filepath.Clean(req.Data2)))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentfileinfo":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentfileinfo: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentFileInfo(ih, filepath.Clean(req.Data2)))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentpiecestateruns":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentpiecestateruns: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentPieceStateRuns(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "istorrentlocked":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "istorrentlocked: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+
+ ret, _ := json.Marshal(DataMsg{Type: "torrentlockstate", Infohash: ih.HexString(), Data: Engine.LsDb.IsLocked(ih.HexString())})
+ _ = uc.Send(ret)
+ return
+ case "toggletorrentlock":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "toggletorrentlock: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ } else {
+ _, err = os.Stat(filepath.Join(Dirconfig.TrntDir, ih.HexString()))
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+
+ if Engine.LsDb.IsLocked(ih.HexString()) {
+ _ = Engine.LsDb.Unlock(ih)
+ Info.Println("lock of torrent ", ih.HexString(), " is set to false by ", uc.Username)
+ _ = uc.SendMsgU("resp", "success", ih.HexString(), "lock of torrent "+ih.HexString()+" is set to false")
+ } else {
+ _ = Engine.LsDb.Lock(ih)
+ Info.Println("lock of torrent ", ih.HexString(), " is set to true by ", uc.Username)
+ _ = uc.SendMsgU("resp", "success", ih.HexString(), "lock of torrent "+ih.HexString()+" is set to true")
+ }
+ return
+ case "addtrackerstotorrent":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "addtrackerstotorrent: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ if req.Data2 == "" {
+ _ = uc.SendMsg("resp", "error", "Invalid Request")
+ }
+ // Add Trackers to txtlines string slice
+ trackerlist, berr := base64.StdEncoding.DecodeString(req.Data2)
+ if berr != nil {
+ _ = uc.SendMsg("resp", "error", "trackerlist error")
+ return
+ }
+ tlr := bytes.NewReader(trackerlist)
+ scanner := bufio.NewScanner(tlr)
+ scanner.Split(bufio.ScanLines)
+
+ var trackerno int
+ var al []string
+ for scanner.Scan() {
+ line := strings.TrimSpace(scanner.Text())
+ if line == "" {
+ continue
+ }
+ al = append(al, line)
+ trackerno++
+ }
+ Info.Println("Read ", trackerno, " Trackers from Trackerlist uploaded by ", uc.Username)
+ if uc.IsAdmin && req.Aop == 1 {
+ go AddTrackerstoTorrent("", ih, [][]string{al})
+ } else {
+ go AddTrackerstoTorrent(uc.Username, ih, [][]string{al})
+ }
+ return
+ case "updatepw":
+ err := Engine.UDb.UpdatePw(uc.Username, req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", err.Error())
+ }
+ return
+ case "stopstream":
+ uc.StopStream()
+ return
+ case "diskusage":
+ var diskusage DiskUsageStat
+ if stat, err := disk.Usage(Dirconfig.TrntDir); err == nil {
+ diskusage.UsedPercent = stat.UsedPercent
+ diskusage.Free = stat.Free
+ diskusage.Total = stat.Total
+ diskusage.Used = stat.Used
+ }
+ ret, _ := json.Marshal(DataMsg{Type: "diskusage", Data: diskusage})
+ _ = uc.Send(ret)
+ return
+ case "gettorrentknownswarm":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentknownswarm: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentKnownSwarm(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentnumpieces":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentnumpieces: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentNumpieces(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentmetainfo":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentmetainfo: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentMetainfo(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "gettorrentpeerconns":
+ ih, err := MetafromHex(req.Data1)
+ if err != nil {
+ _ = uc.SendMsg("resp", "error", "gettorrentpeerconns: infohash couldn't be parsed "+req.Data1)
+ return
+ }
+
+ if !uc.IsAdmin {
+ if !Engine.TUDb.HasUser(uc.Username, ih.HexString()) {
+ _ = uc.SendMsg("resp", "error", "torrent doesn't exist")
+ return
+ }
+ }
+ err = uc.Send(GetTorrentPeerConns(ih))
+ if err != nil {
+ return
+ }
+ return
+ case "version":
+ ret, _ := json.Marshal(DataMsg{Type: "version", Data: Version})
+ _ = uc.Send(ret)
+ return
+ default:
+ _ = uc.SendMsg("resp", "error", "invalid command")
+ }
+}
diff --git a/internal/core/statsapi.go b/internal/core/statsapi.go
new file mode 100644
index 00000000..d1d43a5d
--- /dev/null
+++ b/internal/core/statsapi.go
@@ -0,0 +1,85 @@
+package core
+
+import (
+ "os"
+ "runtime"
+ "time"
+
+ "github.com/pbnjay/memory"
+
+ "github.com/shirou/gopsutil/cpu"
+ "github.com/shirou/gopsutil/disk"
+ "github.com/shirou/gopsutil/host"
+ "github.com/shirou/gopsutil/mem"
+)
+
+type machInfo struct {
+ Arch string `json:"arch"`
+ NumberCPUs int `json:"numbercpu"`
+ CPUModel string `json:"cpumodel"`
+ HostName string `json:"hostname"`
+ Platform string `json:"platform"`
+ OS string `json:"os"`
+ TotalMem uint64 `json:"totalmem"`
+ GoVersion string `json:"goversion"`
+ StartedAt time.Time `json:"startedat"`
+}
+
+type machStats struct {
+ CPU float64 `json:"cpucycles"`
+ DiskFree uint64 `json:"diskfree"`
+ DiskUsedPercent float64 `json:"diskpercent"`
+ MemUsedPercent float64 `json:"mempercent"`
+ GoMemory int64 `json:"gomem"`
+ GoMemorySys int64 `json:"gomemsys"`
+ GoRoutines int `json:"goroutines"`
+}
+
+var MachInfo machInfo = loadMachInfo()
+var MachStats machStats
+
+func loadMachInfo() (retmachinfo machInfo) {
+ hostInfo, err := host.Info()
+ if err == nil && hostInfo != nil {
+ retmachinfo.OS = hostInfo.Platform + " " + hostInfo.PlatformVersion
+ retmachinfo.Platform = hostInfo.OS
+ }
+
+ cpuInfo, err := cpu.Info()
+ if err == nil && len(cpuInfo) > 0 {
+ retmachinfo.CPUModel = cpuInfo[0].ModelName
+ }
+
+ retmachinfo.HostName, _ = os.Hostname()
+ retmachinfo.GoVersion = runtime.Version()
+ retmachinfo.TotalMem = memory.TotalMemory()
+ retmachinfo.Arch = runtime.GOARCH
+ retmachinfo.NumberCPUs = runtime.NumCPU()
+ retmachinfo.StartedAt = time.Now()
+ return retmachinfo
+}
+
+func (s *machStats) LoadStats(diskDir string) {
+ //count cpu cycles between last count
+ if cpu, err := cpu.Percent(0, false); err == nil {
+ if len(cpu) > 0 {
+ s.CPU = cpu[0]
+ }
+ }
+ //count disk usage
+ if stat, err := disk.Usage(diskDir); err == nil {
+ s.DiskUsedPercent = stat.UsedPercent
+ s.DiskFree = stat.Free
+ }
+ //count memory usage
+ if stat, err := mem.VirtualMemory(); err == nil {
+ s.MemUsedPercent = stat.UsedPercent
+ }
+ //count total bytes allocated by the go runtime
+ memStats := runtime.MemStats{}
+ runtime.ReadMemStats(&memStats)
+ s.GoMemory = int64(memStats.Alloc)
+ s.GoMemorySys = int64(memStats.Sys)
+ //count current number of goroutines
+ s.GoRoutines = runtime.NumGoroutine()
+}
diff --git a/internal/core/storage.go b/internal/core/storage.go
new file mode 100644
index 00000000..dd395eb0
--- /dev/null
+++ b/internal/core/storage.go
@@ -0,0 +1,12 @@
+//go:build !cgo
+// +build !cgo
+
+package core
+
+import (
+ "github.com/anacrolix/torrent"
+)
+
+func sqliteSetup(tc *torrent.ClientConfig) {
+ Err.Fatalln("Postgresql Connection URL was not provided")
+}
diff --git a/internal/core/storage_cgo.go b/internal/core/storage_cgo.go
new file mode 100644
index 00000000..b525aa3a
--- /dev/null
+++ b/internal/core/storage_cgo.go
@@ -0,0 +1,40 @@
+//go:build cgo
+// +build cgo
+
+package core
+
+import (
+ "path/filepath"
+
+ "github.com/anacrolix/torrent"
+ "github.com/varbhat/exatorrent/internal/db"
+)
+
+func sqliteSetup(tc *torrent.ClientConfig) {
+ var err error
+
+ Engine.TorDb = &db.Sqlite3Db{}
+ Engine.TorDb.Open(filepath.Join(Dirconfig.DataDir, "torc.db"))
+
+ Engine.TrackerDB = &db.SqliteTdb{}
+ Engine.TrackerDB.Open(filepath.Join(Dirconfig.DataDir, "trackers.db"))
+
+ Engine.FsDb = &db.SqliteFSDb{}
+ Engine.FsDb.Open(filepath.Join(Dirconfig.DataDir, "filestate.db"))
+
+ Engine.LsDb = &db.SqliteLSDb{}
+ Engine.LsDb.Open(filepath.Join(Dirconfig.DataDir, "lockstate.db"))
+
+ Engine.UDb = &db.Sqlite3UserDb{}
+ Engine.UDb.Open(filepath.Join(Dirconfig.DataDir, "user.db"))
+
+ Engine.TUDb = &db.SqliteTorrentUserDb{}
+ Engine.TUDb.Open(filepath.Join(Dirconfig.DataDir, "torrentuser.db"))
+
+ Engine.PcDb, err = db.NewSqlitePieceCompletion(Dirconfig.DataDir)
+
+ if err != nil {
+ Err.Fatalln("Unable to create sqlite3 database for PieceCompletion")
+ }
+
+}
diff --git a/internal/core/vars.go b/internal/core/vars.go
new file mode 100644
index 00000000..15fcaf45
--- /dev/null
+++ b/internal/core/vars.go
@@ -0,0 +1,540 @@
+package core
+
+import (
+ "encoding/json"
+ "fmt"
+ "log"
+ "net"
+ "net/http"
+ "os"
+ "path/filepath"
+ "sync"
+ "time"
+
+ anaclog "github.com/anacrolix/log"
+ "github.com/anacrolix/torrent"
+ "github.com/anacrolix/torrent/iplist"
+ "github.com/anacrolix/torrent/mse"
+ "golang.org/x/time/rate"
+)
+
+var (
+ Engine Eng
+ Info = log.New(os.Stderr, "[INFO] ", log.LstdFlags) // Info Logger
+ Warn = log.New(os.Stderr, "[WARN] ", log.LstdFlags) // Logger for Warnings
+ Err = log.New(os.Stderr, "[ERR ] ", log.LstdFlags) // Error Logger
+ Flagconfig = struct { // Configuration for HTTP Handlers
+ ListenAddress string
+ UnixSocket string
+ TLSKeyPath string
+ TLSCertPath string
+ }{}
+ Dirconfig = struct {
+ DirPath string
+ ConfigDir string
+ CacheDir string
+ DataDir string
+ TrntDir string
+ }{}
+ Configmu sync.Mutex //TODO
+)
+
+type TorConfig struct {
+ ListenHost *string
+ ListenPort *int
+ NoDefaultPortForwarding *bool
+ UpnpID *string
+ DisableTrackers *bool
+ DisablePEX *bool
+ NoDHT *bool
+ PeriodicallyAnnounceTorrentsToDht *bool
+ NoUpload *bool
+ DisableAggressiveUpload *bool
+ Seed *bool
+ UploadLimiterLimit *float64
+ UploadLimiterBurst *int
+ DownloadLimiterLimit *float64
+ DownloadLimiterBurst *int
+ MaxUnverifiedBytes *int64
+ PeerID *string
+ DisableUTP *bool
+ DisableTCP *bool
+ HeaderObfuscationPolicy *string
+ CryptoProvides *uint32
+ IPBlocklist *bool
+ DisableIPv6 *bool
+ DisableIPv4 *bool
+ DisableIPv4Peers *bool
+ Debug *bool
+ Logger *bool
+ HTTPUserAgent *string
+ ExtendedHandshakeClientVersion *string
+ Bep20 *string
+ NominalDialTimeout *int64
+ MinDialTimeout *int64
+ EstablishedConnsPerTorrent *int
+ HalfOpenConnsPerTorrent *int
+ TotalHalfOpenConns *int
+ TorrentPeersHighWater *int
+ TorrentPeersLowWater *int
+ HandshakesTimeout *int64
+ PublicIP4 *string
+ PublicIP6 *string
+ DisableAcceptRateLimiting *bool
+ DropDuplicatePeerIds *bool
+ DropMutuallyCompletePeers *bool
+ AcceptPeerConnections *bool
+ DisableWebtorrent *bool
+ DisableWebseeds *bool
+}
+
+func (t *TorConfig) ToTorrentConfig() (tc *torrent.ClientConfig) {
+ tc = torrent.NewDefaultClientConfig()
+
+ tc.Logger = anaclog.Discard // Discard Logging of Torrent Client by Default
+
+ tc.HTTPProxy = http.ProxyFromEnvironment // Use Proxy Variables from Environment
+
+ if t.ListenHost != nil {
+ tc.ListenHost = func(string) string { return *t.ListenHost }
+ Info.Println("ListenHost of Torrent Client has been set to ", t.ListenHost)
+ }
+
+ if t.ListenPort != nil {
+ tc.ListenPort = *t.ListenPort
+ Info.Println("ListenPort of Torrent Client has been set to ", tc.ListenPort)
+ }
+
+ if t.NoDefaultPortForwarding != nil {
+ tc.NoDefaultPortForwarding = *t.NoDefaultPortForwarding
+ Info.Println("NoDefaultPortForwarding of Torrent Client has been set to ", tc.NoDefaultPortForwarding)
+ }
+
+ if t.UpnpID != nil {
+ tc.UpnpID = *t.UpnpID
+ Info.Println("UpnpID of Torrent Client has been set to ", tc.UpnpID)
+ }
+
+ if t.DisableTrackers != nil {
+ tc.DisableTrackers = *t.DisableTrackers
+ Info.Println("DisableTrackers of Torrent Client has been set to ", tc.DisableTrackers)
+ }
+
+ if t.DisablePEX != nil {
+ tc.DisablePEX = *t.DisablePEX
+ Info.Println("DisablePEX of Torrent Client has been set to ", tc.DisablePEX)
+ }
+
+ if t.NoDHT != nil {
+ tc.NoDHT = *t.NoDHT
+ Info.Println("NoDHT of Torrent Client has been set to ", tc.NoDHT)
+ }
+
+ if t.PeriodicallyAnnounceTorrentsToDht != nil {
+ tc.PeriodicallyAnnounceTorrentsToDht = *t.PeriodicallyAnnounceTorrentsToDht
+ Info.Println("PeriodicallyAnnounceTorrentsToDht has been set to", tc.PeriodicallyAnnounceTorrentsToDht)
+ }
+
+ if t.NoUpload != nil {
+ tc.NoUpload = *t.NoUpload
+ Info.Println("NoUpload of Torrent Client has been set to ", tc.NoUpload)
+ }
+
+ if t.DisableAggressiveUpload != nil {
+ tc.DisableAggressiveUpload = *t.DisableAggressiveUpload
+ Info.Println("DisableAggressiveUpload of Torrent Client has been set to ", tc.DisableAggressiveUpload)
+ }
+
+ if t.Seed != nil {
+ tc.Seed = *t.Seed
+ Info.Println("Seed of Torrent Client has been set to ", tc.Seed)
+ }
+
+ if t.UploadLimiterLimit != nil && t.UploadLimiterBurst != nil {
+ tc.UploadRateLimiter = rate.NewLimiter(rate.Limit(*t.UploadLimiterLimit), *t.UploadLimiterBurst)
+ Info.Println("Upload Rate Limiter is now Active with ", t.UploadLimiterLimit, " as limit and ", t.UploadLimiterBurst, " as Burst")
+ }
+
+ if t.DownloadLimiterLimit != nil && t.DownloadLimiterBurst != nil {
+ tc.DownloadRateLimiter = rate.NewLimiter(rate.Limit(*t.DownloadLimiterLimit), *t.DownloadLimiterBurst)
+ Info.Println("Download Rate Limiter is now Active with ", t.DownloadLimiterLimit, " as limit and ", t.DownloadLimiterBurst, " as Burst")
+ }
+
+ if t.MaxUnverifiedBytes != nil {
+ tc.MaxUnverifiedBytes = *t.MaxUnverifiedBytes
+ Info.Println("MaxUnverifiedBytes of Torrent Client has been set to ", tc.MaxUnverifiedBytes)
+ }
+
+ if t.PeerID != nil {
+ tc.PeerID = *t.PeerID
+ Info.Println("PeerID of Torrent Client has been set to ", tc.PeerID)
+ }
+
+ if t.DisableUTP != nil {
+ tc.DisableUTP = *t.DisableUTP
+ Info.Println("DisableUTP of Torrent Client has been set to ", tc.DisableUTP)
+ }
+
+ if t.DisableTCP != nil {
+ tc.DisableTCP = *t.DisableTCP
+ Info.Println("DisableTCP of Torrent Client has been set to ", tc.DisableTCP)
+ }
+
+ if t.HeaderObfuscationPolicy != nil {
+ if *t.HeaderObfuscationPolicy == "notpreferred" {
+ tc.HeaderObfuscationPolicy = torrent.HeaderObfuscationPolicy{
+ RequirePreferred: false,
+ Preferred: false,
+ }
+ } else if *t.HeaderObfuscationPolicy == "preferred" {
+ tc.HeaderObfuscationPolicy = torrent.HeaderObfuscationPolicy{
+ RequirePreferred: false,
+ Preferred: true,
+ }
+ } else if *t.HeaderObfuscationPolicy == "requirepreferred" {
+ tc.HeaderObfuscationPolicy = torrent.HeaderObfuscationPolicy{
+ RequirePreferred: true,
+ Preferred: true,
+ }
+ }
+ Info.Println("HeaderObfuscationPolicy of Torrent Client has been set")
+ }
+
+ if t.CryptoProvides != nil {
+ if *t.CryptoProvides == 1 {
+ tc.CryptoProvides = mse.CryptoMethodPlaintext
+ } else if *t.CryptoProvides == 2 {
+ tc.CryptoProvides = mse.CryptoMethodRC4
+ } else if *t.CryptoProvides == 3 {
+ tc.CryptoProvides = mse.AllSupportedCrypto
+ }
+ Info.Println("CryptoProvides of Torrent Client has been set")
+ }
+
+ if t.IPBlocklist != nil {
+ if *t.IPBlocklist {
+ Info.Println("Trying to Read Torrent Client Blocklist from", filepath.Join(Dirconfig.ConfigDir, "blocklist"))
+ blockfile, err := os.Open(filepath.Join(Dirconfig.ConfigDir, "blocklist"))
+ if err != nil {
+ Err.Println("Please put your Blocklist at", filepath.Join(Dirconfig.ConfigDir, "blocklist"))
+ Err.Fatalln("Error Opening Blocklist: ", err)
+ }
+ defer blockfile.Close()
+
+ // Read blocklist
+ tc.IPBlocklist, err = iplist.NewFromReader(blockfile)
+ if err != nil {
+ Err.Fatalln("Invalid Blocklist: ", err)
+ }
+
+ Info.Println("Loading blocklist of ", tc.IPBlocklist.NumRanges(), " Ranges")
+ }
+ }
+
+ if t.DisableIPv6 != nil {
+ tc.DisableIPv6 = *t.DisableIPv6
+ Info.Println("DisableIPv6 of Torrent Client has been set to ", tc.DisableIPv6)
+ }
+
+ if t.DisableIPv4 != nil {
+ tc.DisableIPv4 = *t.DisableIPv4
+ Info.Println("DisableIPv4 of Torrent Client has been set to ", tc.DisableIPv4)
+ }
+
+ if t.DisableIPv4Peers != nil {
+ tc.DisableIPv4Peers = *t.DisableIPv4Peers
+ Info.Println("DisableIPv4Peers of Torrent Client has been set to ", tc.DisableIPv4Peers)
+ }
+
+ if t.Debug != nil {
+ tc.Debug = *t.Debug
+ Info.Println("Debug has been set to ", tc.Debug)
+ }
+
+ if t.Logger != nil {
+ if *t.Logger {
+ tc.Logger = anaclog.Logger{
+ LoggerImpl: anaclog.StreamLogger{
+ W: os.Stderr,
+ Fmt: func(msg anaclog.Msg) []byte {
+ var pc [1]uintptr
+ msg.Callers(1, pc[:])
+ return []byte(fmt.Sprintf("[TORC] %s %s\n", time.Now().Format("2006/01/02 03:04:05"), msg.Text()))
+ },
+ },
+ }
+ }
+ }
+
+ if t.HTTPUserAgent != nil {
+ tc.HTTPUserAgent = *t.HTTPUserAgent
+ Info.Println("HTTP User Agent of Torrent Client has been set to ", tc.HTTPUserAgent)
+ }
+
+ if t.ExtendedHandshakeClientVersion != nil {
+ tc.ExtendedHandshakeClientVersion = *t.ExtendedHandshakeClientVersion
+ Info.Println("ExtendedHandshakeClientVersion of Torrent Client has been set to ", tc.ExtendedHandshakeClientVersion)
+ }
+ if t.NominalDialTimeout != nil {
+ tc.NominalDialTimeout = time.Duration(*t.NominalDialTimeout)
+ Info.Println("NominalDialTimeout of Torrent Client has been set to ", tc.NominalDialTimeout)
+ }
+ if t.MinDialTimeout != nil {
+ tc.MinDialTimeout = time.Duration(*t.MinDialTimeout)
+ Info.Println("MinDialTimeout of Torrent Client has been set to ", tc.MinDialTimeout)
+ }
+ if t.EstablishedConnsPerTorrent != nil {
+ tc.EstablishedConnsPerTorrent = *t.EstablishedConnsPerTorrent
+ Info.Println("EstablishedConnsPerTorrent of Torrent Client has been set to ", tc.EstablishedConnsPerTorrent)
+ }
+ if t.HalfOpenConnsPerTorrent != nil {
+ tc.HalfOpenConnsPerTorrent = *t.HalfOpenConnsPerTorrent
+ Info.Println("HalfOpenConnsPerTorrent of Torrent Client has been set to ", tc.HalfOpenConnsPerTorrent)
+ }
+
+ if t.TotalHalfOpenConns != nil {
+ tc.TotalHalfOpenConns = *t.TotalHalfOpenConns
+ Info.Println("TotalHalfOpenConns of Torrent Client has been set to ", tc.TotalHalfOpenConns)
+ }
+ if t.TorrentPeersHighWater != nil {
+ tc.TorrentPeersHighWater = *t.TorrentPeersHighWater
+ Info.Println("TorrentPeersHighWater of Torrent Client has been set to ", tc.TorrentPeersHighWater)
+ }
+ if t.TorrentPeersLowWater != nil {
+ tc.TorrentPeersLowWater = *t.TorrentPeersLowWater
+ Info.Println("TorrentPeersLowWater of Torrent Client has been set to ", tc.TorrentPeersLowWater)
+ }
+
+ if t.HandshakesTimeout != nil {
+ tc.HandshakesTimeout = time.Duration(*t.HandshakesTimeout)
+ Info.Println("HandshakesTimeout of Torrent Client has been set to ", tc.HandshakesTimeout)
+ }
+ if t.PublicIP4 != nil {
+ tc.PublicIp4 = net.ParseIP(*t.PublicIP4)
+ Info.Println("PublicIpv4 of Torrent Client has been set to ", *t.PublicIP4)
+ }
+
+ if t.PublicIP6 != nil {
+ tc.PublicIp6 = net.ParseIP(*t.PublicIP6)
+ Info.Println("PublicIpv6 of Torrent Client has been set to ", *t.PublicIP6)
+ }
+
+ if t.DisableAcceptRateLimiting != nil {
+ tc.DisableAcceptRateLimiting = *t.DisableAcceptRateLimiting
+ Info.Println("DisableAcceptRateLimiting of Torrent Client has been set to ", tc.DisableAcceptRateLimiting)
+ }
+ if t.DropDuplicatePeerIds != nil {
+ tc.DropDuplicatePeerIds = *t.DropDuplicatePeerIds
+ Info.Println("DropDuplicatePeerIds of Torrent Client has been set to ", tc.DropDuplicatePeerIds)
+ }
+ if t.DropMutuallyCompletePeers != nil {
+ tc.DropMutuallyCompletePeers = *t.DropMutuallyCompletePeers
+ Info.Println("DropMutuallyCompletePeers of Torrent Client has been set to ", tc.DropMutuallyCompletePeers)
+ }
+ if t.AcceptPeerConnections != nil {
+ tc.AcceptPeerConnections = *t.AcceptPeerConnections
+ Info.Println("AcceptPeerConnections of Torrent Client has been set to ", tc.AcceptPeerConnections)
+ }
+
+ if t.DisableWebtorrent != nil {
+ tc.DisableWebtorrent = *t.DisableWebtorrent
+ Info.Println("DisableWebtorrent of Torrent Client has been set to ", tc.DisableWebtorrent)
+ }
+
+ if t.DisableWebseeds != nil {
+ tc.DisableWebseeds = *t.DisableWebseeds
+ Info.Println("DisableWebseeds of Torrent Client has been set to ", tc.DisableWebseeds)
+ }
+ return
+}
+
+// EngConfig is Engine Configuration Structure which doesn't require restart of Torrent Client
+type EngConfig struct {
+ DisableLocalCache bool `json:"disableonlinecache"` // Disables Local Torrent Storage
+ OnlineCacheURL string `json:"onlinecacheurl"` // Default is https://itorrents.org/torrent/%s.torrent , Setting Empty Disables OnlineCache
+
+ TrackerRefresh int64 `json:"trackerrefreshinterval"` // In Minutes
+ TrackerListURLs []string `json:"trackerlisturls"` // Default List is []string{"https://ngosang.github.io/trackerslist/trackers_best.txt"}
+
+ DisAllowTrackersUser bool `json:"disallowtrackersforuser"` // If set to true , Remove all Trackers that is Added by User to magnet/torrent file. Also disallow adding trackers to torrent
+ DisAllowTrackersCache bool `json:"disallowtrackersforcache"` // If set to true , Remove all Trackers from Torrent File fetched from Online/Local Cache
+
+ GlobalSeedRatio float64 `json:"globalseedratio"` // Stops Torrent on Reaching Provided SeedRatio
+ SRRefresh int64 `json:"seedratiocheckinterval"` // In Minutes
+ DontRemoveCacheInfo bool `json:"dontremovecacheinfo"` // When Torrent is Deleted from Storage, it's cache file(.torrent) from Local Cache is not Deleted
+
+ LockbyDefault bool `json:"lockbydefault"` // If set to true , locks every torrent on Add
+}
+
+func (ec *EngConfig) GetDTU() (ret bool) {
+ Configmu.Lock()
+ ret = ec.DisAllowTrackersUser
+ Configmu.Unlock()
+ return
+}
+
+func (ec *EngConfig) GetDTC() (ret bool) {
+ Configmu.Lock()
+ ret = ec.DisAllowTrackersCache
+ Configmu.Unlock()
+ return
+}
+
+func (ec *EngConfig) GetDLC() (ret bool) {
+ Configmu.Lock()
+ ret = ec.DisableLocalCache
+ Configmu.Unlock()
+ return
+}
+func (ec *EngConfig) GetOCU() (ret string) {
+ Configmu.Lock()
+ ret = ec.OnlineCacheURL
+ Configmu.Unlock()
+ return
+}
+func (ec *EngConfig) GetTR() (ret int64) {
+ Configmu.Lock()
+ ret = ec.TrackerRefresh
+ if ret < 0 {
+ ret = 0
+ }
+ Configmu.Unlock()
+ return
+}
+func (ec *EngConfig) GetTLU() (ret []string) {
+ Configmu.Lock()
+ ret = ec.TrackerListURLs
+ Configmu.Unlock()
+ return
+}
+
+func (ec *EngConfig) GetGSR() (ret float64) {
+ Configmu.Lock()
+ ret = ec.GlobalSeedRatio
+ Configmu.Unlock()
+ return
+}
+func (ec *EngConfig) GetSRR() (ret int64) {
+ Configmu.Lock()
+ ret = ec.SRRefresh
+ if ret < 0 {
+ ret = 0
+ }
+ Configmu.Unlock()
+ return
+}
+
+func (ec *EngConfig) GetLBD() (ret bool) {
+ Configmu.Lock()
+ ret = ec.LockbyDefault
+ Configmu.Unlock()
+ return
+}
+
+func (ec *EngConfig) WriteConfig() (err error) {
+ _ = os.Remove(filepath.Join(Dirconfig.ConfigDir, "engconfig.json"))
+ f, err := os.OpenFile(filepath.Join(Dirconfig.ConfigDir, "engconfig.json"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
+ if err != nil {
+ return
+ }
+ jfile, _ := json.MarshalIndent(ec, "", "\t")
+ _, _ = f.Write(jfile)
+ if err = f.Close(); err != nil {
+ return
+ }
+ return
+}
+
+func (ec *EngConfig) DRCI() (ret bool) {
+ Configmu.Lock()
+ ret = ec.DontRemoveCacheInfo
+ Configmu.Unlock()
+ return
+}
+
+type ConReq struct {
+ Command string `json:"command"`
+ Data1 string `json:"data1"`
+ Data2 string `json:"data2"`
+ Data3 string `json:"data3"`
+ Aop int `json:"aop"`
+}
+
+type Resp struct {
+ Type string `json:"type"`
+ State string `json:"state"`
+ Infohash string `json:"infohash,omitempty"`
+ Msg string `json:"message"`
+}
+
+type DataMsg struct {
+ Type string `json:"type"`
+ Data interface{} `json:"data,omitempty"`
+ Infohash string `json:"infohash,omitempty"`
+}
+
+type ConnectionMsg struct {
+ Type string `json:"usertype"`
+ Session string `json:"session"`
+}
+
+type DiskUsageStat struct {
+ Total uint64 `json:"total"`
+ Free uint64 `json:"free"`
+ Used uint64 `json:"used"`
+ UsedPercent float64 `json:"usedPercent"`
+}
+
+type UserConnMsg struct {
+ Username string `json:"username"`
+ IsAdmin bool `json:"isadmin"`
+ Time time.Time `json:"contime"`
+}
+
+type Mutbool struct {
+ sync.Mutex
+ val bool
+}
+
+func (M *Mutbool) Set(v bool) {
+ M.Lock()
+ M.val = v
+ M.Unlock()
+}
+
+func (M *Mutbool) Get() (ret bool) {
+ M.Lock()
+ ret = M.val
+ M.Unlock()
+ return
+}
+
+type MutInt struct {
+ sync.Mutex
+ val int
+}
+
+func (M *MutInt) Set(v int) {
+ M.Lock()
+ M.val = v
+ M.Unlock()
+}
+
+func (M *MutInt) Get() (ret int) {
+ M.Lock()
+ ret = M.val
+ M.Unlock()
+ return
+}
+
+func (M *MutInt) Inc() {
+ M.Lock()
+ M.val++
+ M.Unlock()
+}
+
+func (M *MutInt) Dec() {
+ M.Lock()
+ M.val--
+ M.Unlock()
+}
diff --git a/internal/core/version.go b/internal/core/version.go
new file mode 100644
index 00000000..6eed34d9
--- /dev/null
+++ b/internal/core/version.go
@@ -0,0 +1,3 @@
+package core
+
+const Version string = "v0.0.1"
diff --git a/internal/db/db.go b/internal/db/db.go
new file mode 100644
index 00000000..796209a0
--- /dev/null
+++ b/internal/db/db.go
@@ -0,0 +1,116 @@
+package db
+
+import (
+ "fmt"
+ "log"
+ "os"
+ "time"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/anacrolix/torrent/storage"
+)
+
+var DbL = log.New(os.Stderr, "[DB] ", log.LstdFlags) // Database Logger
+
+// MetafromHex returns metainfo.Hash from given infohash string
+func MetafromHex(infohash string) (h metainfo.Hash, err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ err = fmt.Errorf("error parsing string to InfoHash")
+ }
+ }()
+
+ h = metainfo.NewHashFromHex(infohash)
+
+ return h, nil
+}
+
+// Interfaces
+
+type TorrentDb interface {
+ Open(string)
+ Close()
+ Exists(metainfo.Hash) bool
+ Add(metainfo.Hash) error
+ Delete(metainfo.Hash) error
+ Start(metainfo.Hash) error
+ SetStarted(metainfo.Hash, bool) error
+ HasStarted(string) bool
+ GetTorrent(metainfo.Hash) (*Torrent, error)
+ GetTorrents() ([]*Torrent, error)
+}
+
+type TrackerDb interface {
+ Open(string)
+ Close()
+ Add(string)
+ Delete(string)
+ DeleteN(int)
+ DeleteAll()
+ Count() int64
+ Get() []string
+}
+
+type FileStateDb interface {
+ Open(string)
+ Close()
+ Add(string, metainfo.Hash) error
+ Get(metainfo.Hash) []string
+ Deletefile(string, metainfo.Hash) error
+ Delete(metainfo.Hash) error
+}
+
+type LockStateDb interface {
+ Open(string)
+ Close()
+ Lock(metainfo.Hash) error
+ Unlock(metainfo.Hash) error
+ IsLocked(string) bool
+}
+
+type UserDb interface {
+ Open(string)
+ Close()
+ Add(string, string, int) error // Username , Password , Usertype
+ ChangeType(string, string) error
+ Delete(string) error
+ UpdatePw(string, string) error
+ GetUsers() []*User
+ Validate(string, string) (int, bool)
+ ValidateToken(string) (string, int, error)
+ SetToken(string, string) error
+}
+
+type TorrentUserDb interface {
+ Open(string)
+ Close()
+ Add(string, metainfo.Hash) error
+ Remove(string, metainfo.Hash) error
+ RemoveAll(string) error
+ RemoveAllMi(metainfo.Hash) error
+ HasUser(string, string) bool
+ ListTorrents(string) []metainfo.Hash
+ ListUsers(metainfo.Hash) []string
+}
+
+type PcDb interface {
+ storage.PieceCompletion
+ Delete(metainfo.Hash)
+}
+
+// Struct
+
+type Torrent struct {
+ Infohash metainfo.Hash
+ Started bool
+ AddedAt time.Time
+ StartedAt time.Time
+}
+
+type User struct {
+ Username string
+ Password string `json:"-"`
+ Token string
+ UserType int // 0 for User,1 for Admin,-1 for Disabled
+ CreatedAt time.Time
+}
diff --git a/internal/db/psqlfilestatedb.go b/internal/db/psqlfilestatedb.go
new file mode 100644
index 00000000..7db1473f
--- /dev/null
+++ b/internal/db/psqlfilestatedb.go
@@ -0,0 +1,65 @@
+package db
+
+import (
+ "context"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/jackc/pgx/v4/pgxpool"
+)
+
+type PsqlFsDb struct {
+ Db *pgxpool.Pool
+}
+
+func (db *PsqlFsDb) Open(dburl string) {
+ var err error
+ db.Db, err = pgxpool.Connect(context.Background(), dburl)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ _, err = db.Db.Exec(context.Background(), `create table if not exists filestatedb (filepath text,infohash text, unique(filepath, infohash));`)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *PsqlFsDb) Close() {
+ db.Db.Close()
+}
+
+func (db *PsqlFsDb) Add(fp string, ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `insert into filestatedb (filepath,infohash) values ($1,$2) on conflict (filepath,infohash) do nothing;`, fp, ih.HexString())
+ return
+}
+
+func (db *PsqlFsDb) Get(ih metainfo.Hash) (ret []string) {
+ ret = make([]string, 0)
+ rows, err := db.Db.Query(context.Background(), `select filepath from filestatedb WHERE infohash=$1;`, ih.HexString())
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+
+ for rows.Next() {
+ var fpstring string
+ err = rows.Scan(&fpstring)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+ ret = append(ret, fpstring)
+ }
+
+ return
+}
+
+func (db *PsqlFsDb) Deletefile(fp string, ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from filestatedb where filepath=$1 and infohash=$2;`, fp, ih.HexString())
+ return err
+}
+
+func (db *PsqlFsDb) Delete(ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from filestatedb where infohash=$1;`, ih.HexString())
+ return
+}
diff --git a/internal/db/psqllockstatedb.go b/internal/db/psqllockstatedb.go
new file mode 100644
index 00000000..5c2f80d7
--- /dev/null
+++ b/internal/db/psqllockstatedb.go
@@ -0,0 +1,46 @@
+package db
+
+import (
+ "context"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/jackc/pgx/v4/pgxpool"
+)
+
+type PsqlLsDb struct {
+ Db *pgxpool.Pool
+}
+
+func (db *PsqlLsDb) Open(dburl string) {
+ var err error
+ db.Db, err = pgxpool.Connect(context.Background(), dburl)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ _, err = db.Db.Exec(context.Background(), `create table if not exists lockstatedb (infohash text primary key);`)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *PsqlLsDb) Close() {
+ db.Db.Close()
+}
+
+func (db *PsqlLsDb) Lock(m metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `insert into lockstatedb (infohash) values ($1) on conflict (infohash) do nothing;`, m.HexString())
+ return
+}
+
+func (db *PsqlLsDb) Unlock(m metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from lockstatedb where infohash=$1;`, m.HexString())
+ return
+}
+
+func (db *PsqlLsDb) IsLocked(m string) (b bool) {
+ if db.Db.QueryRow(context.Background(), `select true from lockstatedb where infohash=$1;`, m).Scan(&b) != nil {
+ return false
+ }
+ return
+}
diff --git a/internal/db/psqlpc.go b/internal/db/psqlpc.go
new file mode 100644
index 00000000..5113f786
--- /dev/null
+++ b/internal/db/psqlpc.go
@@ -0,0 +1,52 @@
+package db
+
+import (
+ "context"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/anacrolix/torrent/storage"
+ "github.com/jackc/pgx/v4/pgxpool"
+)
+
+type psqlPieceCompletion struct {
+ db *pgxpool.Pool
+}
+
+func NewPsqlPieceCompletion(databaseurl string) (ret *psqlPieceCompletion, err error) {
+ db, err := pgxpool.Connect(context.Background(), databaseurl)
+ if err != nil {
+ return
+ }
+
+ _, err = db.Exec(context.Background(), `create table if not exists pcomp (infohash text,pindex integer,complete boolean, unique(infohash, pindex));`)
+ if err != nil {
+ db.Close()
+ return
+ }
+
+ ret = &psqlPieceCompletion{db: db}
+ return
+}
+
+func (me *psqlPieceCompletion) Get(pk metainfo.PieceKey) (c storage.Completion, err error) {
+ if me.db.QueryRow(context.Background(), `select complete from pcomp where infohash=$1 and pindex=$2;`, pk.InfoHash.HexString(), pk.Index).Scan(&c.Complete) == nil {
+ c.Ok = true
+ }
+ return
+}
+
+func (me *psqlPieceCompletion) Set(pk metainfo.PieceKey, b bool) (err error) {
+ _, err = me.db.Exec(context.Background(), `insert into pcomp (infohash,pindex,complete) values ($1,$2,$3) on conflict (infohash,pindex) do update set complete=$3;`, pk.InfoHash.HexString(), pk.Index, b)
+ return
+}
+
+func (me *psqlPieceCompletion) Delete(m metainfo.Hash) {
+ if me != nil {
+ _, _ = me.db.Exec(context.Background(), `delete from pcomp where infohash=$1;`, m.HexString())
+ }
+}
+
+func (me *psqlPieceCompletion) Close() error {
+ me.db.Close()
+ return nil
+}
diff --git a/internal/db/psqltorrentdb.go b/internal/db/psqltorrentdb.go
new file mode 100644
index 00000000..51486e03
--- /dev/null
+++ b/internal/db/psqltorrentdb.go
@@ -0,0 +1,109 @@
+package db
+
+import (
+ "context"
+ "time"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/jackc/pgx/v4/pgxpool"
+)
+
+type PsqlTrntDb struct {
+ Db *pgxpool.Pool
+}
+
+func (db *PsqlTrntDb) Open(dburl string) {
+ var err error
+ db.Db, err = pgxpool.Connect(context.Background(), dburl)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+ _, err = db.Db.Exec(context.Background(), `create table if not exists torrent (infohash text primary key,started boolean,addedat timestamptz,startedat timestamptz);`)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *PsqlTrntDb) Close() {
+ db.Db.Close()
+}
+
+func (db *PsqlTrntDb) Exists(ih metainfo.Hash) (ret bool) {
+ var err error
+ row := db.Db.QueryRow(context.Background(), `select true from torrent where infohash=$1;`, ih.HexString())
+ err = row.Scan(&ret)
+ if err != nil {
+ return false
+ }
+ return
+}
+
+func (db *PsqlTrntDb) HasStarted(ih string) (ret bool) {
+ row := db.Db.QueryRow(context.Background(), `select started from torrent where infohash=$1;`, ih)
+ err := row.Scan(&ret)
+ if err != nil {
+ return false
+ }
+ return
+}
+
+func (db *PsqlTrntDb) Add(ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `insert into torrent (infohash,started,addedat,startedat) values ($1,$2,$3,$4) on conflict (infohash) do update set startedat=$4;`, ih.HexString(), false, time.Now(), time.Now())
+ return
+}
+
+func (db *PsqlTrntDb) Delete(ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from torrent where infohash=$1;`, ih.HexString())
+ return
+}
+
+func (db *PsqlTrntDb) Start(ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `update torrent set started=$1,startedat=$2 where infohash=$3;`, true, time.Now(), ih.HexString())
+ return
+}
+
+func (db *PsqlTrntDb) SetStarted(ih metainfo.Hash, inp bool) (err error) {
+ _, err = db.Db.Exec(context.Background(), `update torrent set started=$1 where infohash=$2;`, inp, ih.HexString())
+ return
+}
+
+func (db *PsqlTrntDb) GetTorrent(ih metainfo.Hash) (*Torrent, error) {
+ var trnt Torrent
+ var infoh string
+ row := db.Db.QueryRow(context.Background(), `select * from torrent where infohash=$1;`, ih.HexString())
+ err := row.Scan(&infoh, &trnt.Started, &trnt.AddedAt, &trnt.StartedAt)
+ if err != nil {
+ return nil, err
+ }
+ trnt.Infohash = ih
+ return &trnt, nil
+}
+
+func (db *PsqlTrntDb) GetTorrents() (Trnts []*Torrent, err error) {
+ Trnts = make([]*Torrent, 0)
+ rows, err := db.Db.Query(context.Background(), `select * from torrent;`)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+
+ for rows.Next() {
+ var trnt Torrent
+ var ih string
+ err = rows.Scan(&ih, &trnt.Started, &trnt.AddedAt, &trnt.StartedAt)
+ if err != nil {
+ DbL.Println(err)
+ return Trnts, err
+ }
+
+ trnt.Infohash, err = MetafromHex(ih)
+ if err != nil {
+ DbL.Println(err)
+
+ return Trnts, err
+ }
+ Trnts = append(Trnts, &trnt)
+ }
+
+ return Trnts, rows.Err()
+}
diff --git a/internal/db/psqltorrentuserdb.go b/internal/db/psqltorrentuserdb.go
new file mode 100644
index 00000000..e8c7bed8
--- /dev/null
+++ b/internal/db/psqltorrentuserdb.go
@@ -0,0 +1,109 @@
+package db
+
+import (
+ "context"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/jackc/pgx/v4/pgxpool"
+)
+
+type PsqlTrntUserDb struct {
+ Db *pgxpool.Pool
+}
+
+func (db *PsqlTrntUserDb) Open(dburl string) {
+ var err error
+ db.Db, err = pgxpool.Connect(context.Background(), dburl)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+ _, err = db.Db.Exec(context.Background(), `create table if not exists torrentuserdb (username text,infohash text, unique(username,infohash));`)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *PsqlTrntUserDb) Close() {
+ db.Db.Close()
+}
+
+func (db *PsqlTrntUserDb) Add(username string, ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `insert into torrentuserdb (username,infohash) values ($1,$2) on conflict (username,infohash) do nothing;`, username, ih.HexString())
+ return
+}
+
+func (db *PsqlTrntUserDb) Remove(username string, ih metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from torrentuserdb where username=$1 and infohash=$2;`, username, ih.HexString())
+ return
+}
+
+func (db *PsqlTrntUserDb) RemoveAll(username string) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from torrentuserdb where username=$1;`, username)
+ return
+}
+
+func (db *PsqlTrntUserDb) RemoveAllMi(mi metainfo.Hash) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from torrentuserdb where infohash=$1;`, mi.HexString())
+ return
+}
+
+func (db *PsqlTrntUserDb) HasUser(username string, ih string) (ret bool) {
+ var err error
+ row := db.Db.QueryRow(context.Background(), `select true from torrentuserdb where username=$1 and infohash=$2;`, username, ih)
+ err = row.Scan(&ret)
+ if err != nil {
+ return false
+ }
+ return
+}
+
+func (db *PsqlTrntUserDb) ListTorrents(username string) (ret []metainfo.Hash) {
+ rows, err := db.Db.Query(context.Background(), `select infohash from torrentuserdb where username=$1;`, username)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+
+ for rows.Next() {
+ var ih string
+ err = rows.Scan(&ih)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+
+ infoh, err := MetafromHex(ih)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+ ret = append(ret, infoh)
+ }
+
+ return
+
+}
+
+func (db *PsqlTrntUserDb) ListUsers(mi metainfo.Hash) (ret []string) {
+ ret = make([]string, 0)
+
+ rows, err := db.Db.Query(context.Background(), `select username from torrentuserdb where infohash=$1;`, mi.HexString())
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+
+ for rows.Next() {
+ var username string
+ err = rows.Scan(&username)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+
+ ret = append(ret, username)
+ }
+
+ return
+
+}
diff --git a/internal/db/psqltrackerdb.go b/internal/db/psqltrackerdb.go
new file mode 100644
index 00000000..06c99b21
--- /dev/null
+++ b/internal/db/psqltrackerdb.go
@@ -0,0 +1,68 @@
+package db
+
+import (
+ "context"
+
+ "github.com/jackc/pgx/v4/pgxpool"
+)
+
+type PsqlTDb struct {
+ Db *pgxpool.Pool
+}
+
+func (db *PsqlTDb) Open(dburl string) {
+ var err error
+ db.Db, err = pgxpool.Connect(context.Background(), dburl)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ _, err = db.Db.Exec(context.Background(), `create table if not exists trackerdb (url text primary key);`)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *PsqlTDb) Close() {
+ db.Db.Close()
+}
+
+func (db *PsqlTDb) Add(url string) {
+ _, _ = db.Db.Exec(context.Background(), `insert into trackerdb (url) values ($1) on conflict (url) do nothing;`, url)
+}
+
+func (db *PsqlTDb) Delete(url string) {
+ _, _ = db.Db.Exec(context.Background(), `delete from trackerdb where url=$1;`, url)
+}
+
+func (db *PsqlTDb) DeleteN(count int) {
+ _, _ = db.Db.Exec(context.Background(), `delete from trackerdb where url in (select url from trackerdb limit $1);`, count)
+}
+
+func (db *PsqlTDb) DeleteAll() {
+ _, _ = db.Db.Exec(context.Background(), `delete from trackerdb;`)
+}
+
+func (db *PsqlTDb) Count() (ret int64) {
+ row := db.Db.QueryRow(context.Background(), `select count(*) from trackerdb;`)
+ _ = row.Scan(&ret)
+ return
+}
+
+func (db *PsqlTDb) Get() (ret []string) {
+ rows, err := db.Db.Query(context.Background(), `select url from trackerdb;`)
+ if err != nil {
+ DbL.Println(err)
+ }
+
+ for rows.Next() {
+ var tr string
+ err := rows.Scan(&tr)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+ ret = append(ret, tr)
+ }
+ return
+}
diff --git a/internal/db/psqluserdb.go b/internal/db/psqluserdb.go
new file mode 100644
index 00000000..e5634034
--- /dev/null
+++ b/internal/db/psqluserdb.go
@@ -0,0 +1,139 @@
+package db
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/google/uuid"
+ "github.com/jackc/pgx/v4/pgxpool"
+ "golang.org/x/crypto/bcrypt"
+)
+
+type PsqlUserDb struct {
+ Db *pgxpool.Pool
+}
+
+func (db *PsqlUserDb) Open(dburl string) {
+ var err error
+ db.Db, err = pgxpool.Connect(context.Background(), dburl)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ _, err = db.Db.Exec(context.Background(), `create table if not exists userdb (username text unique,password text,token text unique,usertype integer,createdat timestamptz);`)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *PsqlUserDb) Close() {
+ db.Db.Close()
+}
+
+func (db *PsqlUserDb) Add(Username string, Password string, UserType int) (err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ err = fmt.Errorf("uuid error") // uuid may panic
+ }
+ }()
+ if len(Username) < 5 || len(Password) < 5 {
+ return fmt.Errorf("username or password size too small")
+ }
+ bytes, err := bcrypt.GenerateFromPassword([]byte(Password), 10)
+ if err != nil {
+ return
+ }
+ _, err = db.Db.Exec(context.Background(), `insert into userdb (username,password,token,usertype,createdat) values ($1,$2,$3,$4,$5);`, Username, string(bytes), uuid.New().String(), UserType, time.Now())
+ return
+}
+
+func (db *PsqlUserDb) Delete(username string) (err error) {
+ _, err = db.Db.Exec(context.Background(), `delete from userdb where username=$1;`, username)
+ return
+}
+
+func (db *PsqlUserDb) GetID(username string) (ret int64) {
+ ret = -1
+ row := db.Db.QueryRow(context.Background(), `select userid from userdb where username=$1;`, username)
+ _ = row.Scan(&ret)
+ return
+}
+
+func (db *PsqlUserDb) UpdatePw(Username string, Password string) (err error) {
+ if len(Password) < 5 {
+ return fmt.Errorf("username or password size too small")
+ }
+ bytes, err := bcrypt.GenerateFromPassword([]byte(Password), 10)
+ if err != nil {
+ return
+ }
+ _, err = db.Db.Exec(context.Background(), `update userdb set password=$1 where username=$2;`, string(bytes), Username)
+ return
+}
+
+func (db *PsqlUserDb) ChangeType(Username string, Type string) (err error) {
+ if len(Username) == 0 {
+ return fmt.Errorf("empty username")
+ }
+ var ut int
+ if Type == "admin" {
+ ut = 1
+ } else if Type == "user" {
+ ut = 0
+ } else if Type == "disabled" {
+ ut = -1
+ } else {
+ return fmt.Errorf("unknown type")
+ }
+ _, err = db.Db.Exec(context.Background(), `update userdb set usertype=$1 where username=$2;`, ut, Username)
+ return
+}
+
+func (db *PsqlUserDb) GetUsers() (ret []*User) {
+ ret = make([]*User, 0)
+
+ rows, err := db.Db.Query(context.Background(), `select * from userdb;`)
+ if err != nil {
+ DbL.Println(err)
+ }
+
+ for rows.Next() {
+ var user User
+ err := rows.Scan(&user.Username, &user.Password, &user.Token, &user.UserType, &user.CreatedAt)
+ if err != nil {
+ DbL.Println(err)
+ return
+ }
+ ret = append(ret, &user)
+ }
+ return
+}
+
+func (db *PsqlUserDb) Validate(Username string, Password string) (ut int, b bool) {
+ var pw string
+ row := db.Db.QueryRow(context.Background(), `select usertype,password from userdb where username=$1;`, Username)
+ err := row.Scan(&ut, &pw)
+ if err != nil {
+ return ut, false
+ }
+ err = bcrypt.CompareHashAndPassword([]byte(pw), []byte(Password))
+ return ut, err == nil
+}
+
+func (db *PsqlUserDb) SetToken(Username string, Token string) (err error) {
+ _, err = db.Db.Exec(context.Background(), `update userdb set token=$1 where username=$2;`, Token, Username)
+ return
+}
+
+func (db *PsqlUserDb) ValidateToken(Token string) (user string, ut int, err error) {
+ if Token == "" {
+ return "", -1, fmt.Errorf("token is empty")
+ }
+ row := db.Db.QueryRow(context.Background(), `select username,usertype from userdb where token=$1;`, Token)
+ err = row.Scan(&user, &ut)
+ if err != nil {
+ return "", -1, err
+ }
+ return
+}
diff --git a/internal/db/sqlite3filestatedb.go b/internal/db/sqlite3filestatedb.go
new file mode 100644
index 00000000..4c7400de
--- /dev/null
+++ b/internal/db/sqlite3filestatedb.go
@@ -0,0 +1,73 @@
+package db
+
+import (
+ "sync"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+type SqliteFSDb struct {
+ Db *sqlite.Conn
+ mu sync.Mutex
+}
+
+func (db *SqliteFSDb) Open(fp string) {
+ var err error
+
+ db.Db, err = sqlite.OpenConn(fp, 0)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ err = sqlitex.ExecScript(db.Db, `create table if not exists filestatedb (filepath text,infohash text, unique(filepath, infohash));`)
+
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteFSDb) Close() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err := db.Db.Close()
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteFSDb) Add(fp string, ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `insert into filestatedb (filepath,infohash) values (?,?) on conflict (filepath,infohash) do nothing;`, nil, fp, ih.HexString())
+ return
+}
+
+func (db *SqliteFSDb) Get(ih metainfo.Hash) (ret []string) {
+ ret = make([]string, 0)
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(
+ db.Db, `select filepath from filestatedb where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = append(ret, stmt.GetText("filepath"))
+ return nil
+ }, ih.HexString())
+
+ return
+}
+
+func (db *SqliteFSDb) Delete(ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from filestatedb where infohash=?;`, nil, ih.HexString())
+ return
+}
+
+func (db *SqliteFSDb) Deletefile(fp string, ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from filestatedb where filepath=? and infohash=?;`, nil, fp, ih.HexString())
+ return err
+}
diff --git a/internal/db/sqlite3lockstatedb.go b/internal/db/sqlite3lockstatedb.go
new file mode 100644
index 00000000..71212a22
--- /dev/null
+++ b/internal/db/sqlite3lockstatedb.go
@@ -0,0 +1,66 @@
+package db
+
+import (
+ "sync"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+type SqliteLSDb struct {
+ Db *sqlite.Conn
+ mu sync.Mutex
+}
+
+func (db *SqliteLSDb) Open(fp string) {
+ var err error
+
+ db.Db, err = sqlite.OpenConn(fp, 0)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ err = sqlitex.ExecScript(db.Db, `create table if not exists lockstatedb (infohash text primary key);`)
+
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteLSDb) Close() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err := db.Db.Close()
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteLSDb) Lock(m metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `insert into lockstatedb (infohash) values (?) on conflict (infohash) do nothing;`, nil, m.HexString())
+ return
+}
+
+func (db *SqliteLSDb) Unlock(m metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from lockstatedb where infohash=?;`, nil, m.HexString())
+ return
+}
+
+func (db *SqliteLSDb) IsLocked(m string) (b bool) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ if sqlitex.Exec(
+ db.Db, `select 1 from lockstatedb where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ b = true
+ return nil
+ }, m) != nil {
+ return false
+ }
+ return
+}
diff --git a/internal/db/sqlite3pc.go b/internal/db/sqlite3pc.go
new file mode 100644
index 00000000..616354ed
--- /dev/null
+++ b/internal/db/sqlite3pc.go
@@ -0,0 +1,81 @@
+//go:build cgo && !nosqlite
+// +build cgo,!nosqlite
+
+package db
+
+import (
+ "path/filepath"
+ "sync"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+
+ "github.com/anacrolix/torrent/metainfo"
+ "github.com/anacrolix/torrent/storage"
+)
+
+type sqlitePieceCompletion struct {
+ mu sync.Mutex
+ db *sqlite.Conn
+}
+
+func NewSqlitePieceCompletion(dir string) (ret *sqlitePieceCompletion, err error) {
+ p := filepath.Join(dir, "pcomp.db")
+ db, err := sqlite.OpenConn(p, 0)
+ if err != nil {
+ return
+ }
+ err = sqlitex.ExecScript(db, `create table if not exists pcomp (infohash text, pindex integer, complete boolean, unique(infohash, pindex));`)
+ if err != nil {
+ _ = db.Close()
+ return
+ }
+ ret = &sqlitePieceCompletion{db: db}
+ return
+}
+
+func (me *sqlitePieceCompletion) Get(pk metainfo.PieceKey) (c storage.Completion, err error) {
+ me.mu.Lock()
+ defer me.mu.Unlock()
+ err = sqlitex.Exec(
+ me.db, `select complete from pcomp where infohash=? and pindex=?;`,
+ func(stmt *sqlite.Stmt) error {
+ c.Complete = stmt.ColumnInt(0) != 0
+ c.Ok = true
+ return nil
+ },
+ pk.InfoHash.HexString(), pk.Index)
+ return
+}
+
+func (me *sqlitePieceCompletion) Set(pk metainfo.PieceKey, b bool) error {
+ me.mu.Lock()
+ defer me.mu.Unlock()
+ return sqlitex.Exec(
+ me.db,
+ `insert into pcomp (infohash,pindex,complete) values (?,?,?) on conflict (infohash,pindex) do update set complete=?;`,
+ nil,
+ pk.InfoHash.HexString(), pk.Index, b, b)
+}
+
+func (me *sqlitePieceCompletion) Delete(m metainfo.Hash) {
+ me.mu.Lock()
+ defer me.mu.Unlock()
+ if me.db != nil {
+ _ = sqlitex.Exec(
+ me.db,
+ `delete from pcomp where infohash=?;`,
+ nil,
+ m.HexString())
+ }
+}
+
+func (me *sqlitePieceCompletion) Close() (err error) {
+ me.mu.Lock()
+ defer me.mu.Unlock()
+ if me.db != nil {
+ err = me.db.Close()
+ me.db = nil
+ }
+ return
+}
diff --git a/internal/db/sqlite3torrentdb.go b/internal/db/sqlite3torrentdb.go
new file mode 100644
index 00000000..d487ebaa
--- /dev/null
+++ b/internal/db/sqlite3torrentdb.go
@@ -0,0 +1,196 @@
+//go:build cgo
+// +build cgo
+
+package db
+
+import (
+ "fmt"
+ "sync"
+ "time"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+type Sqlite3Db struct {
+ Db *sqlite.Conn
+ mu sync.Mutex
+}
+
+func (db *Sqlite3Db) Open(fp string) {
+ var err error
+
+ db.Db, err = sqlite.OpenConn(fp, 0)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ err = sqlitex.ExecScript(db.Db, `create table if not exists torrent (infohash text primary key,started boolean,addedat text,startedat text);`)
+
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *Sqlite3Db) Close() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err := db.Db.Close()
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *Sqlite3Db) Exists(ih metainfo.Hash) (ret bool) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+
+ serr := sqlitex.Exec(
+ db.Db, `select 1 from torrent where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = stmt.ColumnInt(0) == 1
+ return nil
+ }, ih.HexString())
+ if serr != nil {
+ return false
+ }
+ return
+}
+
+func (db *Sqlite3Db) IsLocked(ih string) (ret bool) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(
+ db.Db, `select locked from torrent where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = stmt.ColumnInt(0) != 0
+ return nil
+ }, ih)
+
+ return
+}
+
+func (db *Sqlite3Db) HasStarted(ih string) (ret bool) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(
+ db.Db, `select started from torrent where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = stmt.ColumnInt(0) != 0
+ return nil
+ }, ih)
+
+ return
+}
+
+func (db *Sqlite3Db) SetLocked(ih string, b bool) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `update torrent set locked=? where infohash=?;`, nil, b, ih)
+ return
+}
+
+func (db *Sqlite3Db) Add(ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ tn := time.Now().Format(time.RFC3339)
+ err = sqlitex.Exec(db.Db, `insert into torrent (infohash,started,addedat,startedat) values (?,?,?,?) on conflict (infohash) do update set startedat=?;`, nil, ih.HexString(), 0, tn, tn, tn)
+ return
+}
+
+func (db *Sqlite3Db) Delete(ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from torrent where infohash=?;`, nil, ih.HexString())
+ return
+}
+
+func (db *Sqlite3Db) Start(ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ tn := time.Now().Format(time.RFC3339)
+ err = sqlitex.Exec(db.Db, `update torrent set started=?,startedat=? where infohash=?;`, nil, 1, tn, ih.HexString())
+ return
+}
+
+func (db *Sqlite3Db) SetStarted(ih metainfo.Hash, inp bool) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `update torrent set started=? where infohash=?;`, nil, inp, ih.HexString())
+ return
+}
+
+func (db *Sqlite3Db) GetTorrent(ih metainfo.Hash) (*Torrent, error) {
+ var trnt Torrent
+ var exists bool
+ var serr error
+ var terr error
+
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ serr = sqlitex.Exec(
+ db.Db, `select * from torrent where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ exists = true
+ trnt.Infohash = ih
+ trnt.Started = stmt.ColumnInt(1) != 0
+ trnt.AddedAt, terr = time.Parse(time.RFC3339, stmt.GetText("addedat"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ trnt.StartedAt, terr = time.Parse(time.RFC3339, stmt.GetText("startedat"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ return nil
+ }, ih.HexString())
+
+ if serr != nil {
+ return nil, serr
+ }
+ if !exists {
+ return nil, fmt.Errorf("Torrent doesn't exist")
+ }
+ return &trnt, nil
+}
+
+func (db *Sqlite3Db) GetTorrents() (Trnts []*Torrent, err error) {
+ Trnts = make([]*Torrent, 0)
+
+ var serr error
+ var terr error
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ serr = sqlitex.Exec(
+ db.Db, `select * from torrent;`,
+ func(stmt *sqlite.Stmt) error {
+ var trnt Torrent
+ trnt.Infohash, terr = MetafromHex(stmt.GetText("infohash"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ trnt.Started = stmt.ColumnInt(1) != 0
+ trnt.AddedAt, terr = time.Parse(time.RFC3339, stmt.GetText("addedat"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ trnt.StartedAt, terr = time.Parse(time.RFC3339, stmt.GetText("startedat"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ Trnts = append(Trnts, &trnt)
+ return nil
+ })
+ if serr != nil {
+ return Trnts, serr
+ }
+
+ return Trnts, nil
+}
diff --git a/internal/db/sqlite3torrentuserdb.go b/internal/db/sqlite3torrentuserdb.go
new file mode 100644
index 00000000..1fdf8afc
--- /dev/null
+++ b/internal/db/sqlite3torrentuserdb.go
@@ -0,0 +1,120 @@
+//go:build cgo
+// +build cgo
+
+package db
+
+import (
+ "sync"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+
+ "github.com/anacrolix/torrent/metainfo"
+)
+
+type SqliteTorrentUserDb struct {
+ Db *sqlite.Conn
+ mu sync.Mutex
+}
+
+func (db *SqliteTorrentUserDb) Open(fp string) {
+ var err error
+
+ db.Db, err = sqlite.OpenConn(fp, 0)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ err = sqlitex.ExecScript(db.Db, `create table if not exists torrentuserdb (username text,infohash text, unique(username,infohash));`)
+
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteTorrentUserDb) Close() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err := db.Db.Close()
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteTorrentUserDb) Add(username string, ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `insert into torrentuserdb (username,infohash) values (?,?) on conflict (username,infohash) do nothing;`, nil, username, ih.HexString())
+ return
+}
+
+func (db *SqliteTorrentUserDb) Remove(username string, ih metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from torrentuserdb where username=? and infohash=?;`, nil, username, ih.HexString())
+ return
+}
+
+func (db *SqliteTorrentUserDb) RemoveAll(username string) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from torrentuserdb where username=?;`, nil, username)
+ return
+}
+
+func (db *SqliteTorrentUserDb) RemoveAllMi(mi metainfo.Hash) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from torrentuserdb where infohash=?;`, nil, mi.HexString())
+ return
+}
+
+func (db *SqliteTorrentUserDb) HasUser(username string, ih string) (ret bool) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+
+ serr := sqlitex.Exec(
+ db.Db, `select 1 from torrentuserdb where username=? and infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = stmt.ColumnInt(0) == 1
+ return nil
+ }, username, ih)
+ if serr != nil {
+ return false
+ }
+ return
+}
+
+func (db *SqliteTorrentUserDb) ListTorrents(username string) (ret []metainfo.Hash) {
+ ret = make([]metainfo.Hash, 0)
+ db.mu.Lock()
+ defer db.mu.Unlock()
+
+ _ = sqlitex.Exec(
+ db.Db, `select infohash from torrentuserdb where username=?;`,
+ func(stmt *sqlite.Stmt) error {
+ tm, terr := MetafromHex(stmt.GetText("infohash"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ ret = append(ret, tm)
+ return nil
+ }, username)
+ return
+}
+
+func (db *SqliteTorrentUserDb) ListUsers(mi metainfo.Hash) (ret []string) {
+ ret = make([]string, 0)
+ db.mu.Lock()
+ defer db.mu.Unlock()
+
+ _ = sqlitex.Exec(
+ db.Db, `select username from torrentuserdb where infohash=?;`,
+ func(stmt *sqlite.Stmt) error {
+ username := stmt.GetText("username")
+ ret = append(ret, username)
+ return nil
+ }, mi.HexString())
+ return
+}
diff --git a/internal/db/sqlite3trackerdb.go b/internal/db/sqlite3trackerdb.go
new file mode 100644
index 00000000..2496fab3
--- /dev/null
+++ b/internal/db/sqlite3trackerdb.go
@@ -0,0 +1,90 @@
+//go:build cgo
+// +build cgo
+
+package db
+
+import (
+ "sync"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+)
+
+type SqliteTdb struct {
+ Db *sqlite.Conn
+ mu sync.Mutex
+}
+
+func (db *SqliteTdb) Open(fp string) {
+ var err error
+
+ db.Db, err = sqlite.OpenConn(fp, 0)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ err = sqlitex.ExecScript(db.Db, `create table if not exists trackerdb (url text primary key);`)
+
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteTdb) Close() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err := db.Db.Close()
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *SqliteTdb) Add(url string) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(db.Db, `insert into trackerdb (url) values (?);`, nil, url)
+}
+
+func (db *SqliteTdb) Delete(url string) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(db.Db, `delete from trackerdb where url=?;`, nil, url)
+}
+
+func (db *SqliteTdb) DeleteN(count int) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(db.Db, `delete from trackerdb where url in (select url from trackerdb limit ?);`, nil, count)
+}
+
+func (db *SqliteTdb) DeleteAll() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(db.Db, `delete from trackerdb;`, nil)
+}
+
+func (db *SqliteTdb) Count() (ret int64) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(
+ db.Db, `select count(*) from trackerdb;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = stmt.ColumnInt64(0)
+ return nil
+ })
+ return
+}
+
+func (db *SqliteTdb) Get() (ret []string) {
+ ret = make([]string, 0)
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(
+ db.Db, `select url from trackerdb;`,
+ func(stmt *sqlite.Stmt) error {
+ ret = append(ret, stmt.GetText("url"))
+ return nil
+ })
+
+ return
+}
diff --git a/internal/db/sqlite3userdb.go b/internal/db/sqlite3userdb.go
new file mode 100644
index 00000000..781d1de0
--- /dev/null
+++ b/internal/db/sqlite3userdb.go
@@ -0,0 +1,191 @@
+//go:build cgo
+// +build cgo
+
+package db
+
+import (
+ "fmt"
+ "sync"
+ "time"
+
+ "github.com/google/uuid"
+ "golang.org/x/crypto/bcrypt"
+
+ "crawshaw.io/sqlite"
+ "crawshaw.io/sqlite/sqlitex"
+)
+
+type Sqlite3UserDb struct {
+ Db *sqlite.Conn
+ mu sync.Mutex
+}
+
+func (db *Sqlite3UserDb) Open(fp string) {
+ var err error
+ db.Db, err = sqlite.OpenConn(fp, 0)
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+
+ err = sqlitex.ExecScript(db.Db, `create table if not exists userdb (username text unique,password text,token text unique,usertype integer,createdat text);`)
+
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *Sqlite3UserDb) Close() {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err := db.Db.Close()
+ if err != nil {
+ DbL.Fatalln(err)
+ }
+}
+
+func (db *Sqlite3UserDb) Add(Username string, Password string, UserType int) (err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ err = fmt.Errorf("uuid error") // uuid may panic
+ }
+ }()
+ if len(Username) < 5 || len(Password) < 5 {
+ return fmt.Errorf("username or password size too small")
+ }
+ bytes, err := bcrypt.GenerateFromPassword([]byte(Password), 10)
+ if err != nil {
+ return
+ }
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `insert into userdb (username,password,token,usertype,createdat) values (?,?,?,?,?);`, nil, Username, string(bytes), uuid.New().String(), UserType, time.Now().Format(time.RFC3339))
+ return
+}
+
+func (db *Sqlite3UserDb) Delete(Username string) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `delete from userdb where username=?;`, nil, Username)
+ return
+}
+
+func (db *Sqlite3UserDb) UpdatePw(Username string, Password string) (err error) {
+ if len(Password) < 5 {
+ return fmt.Errorf("username or password size too small")
+ }
+ bytes, err := bcrypt.GenerateFromPassword([]byte(Password), 10)
+ if err != nil {
+ return
+ }
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `update userdb set password=? where username=?;`, nil, string(bytes), Username)
+ return
+}
+
+func (db *Sqlite3UserDb) ChangeType(Username string, Type string) (err error) {
+ if len(Username) == 0 {
+ return fmt.Errorf("empty username")
+ }
+ var ut int
+ if Type == "admin" {
+ ut = 1
+ } else if Type == "user" {
+ ut = 0
+ } else if Type == "disabled" {
+ ut = -1
+ } else {
+ return fmt.Errorf("unknown type")
+ }
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `update userdb set usertype=? where username=?;`, nil, ut, Username)
+ return
+}
+
+func (db *Sqlite3UserDb) GetUsers() (ret []*User) {
+ ret = make([]*User, 0)
+ var terr error
+
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ _ = sqlitex.Exec(
+ db.Db, `select * from userdb;`,
+ func(stmt *sqlite.Stmt) error {
+ var user User
+ user.Username = stmt.GetText("username")
+ user.Password = stmt.GetText("password")
+ user.Token = stmt.GetText("token")
+ user.UserType = stmt.ColumnInt(3)
+ user.CreatedAt, terr = time.Parse(time.RFC3339, stmt.GetText("createdat"))
+ if terr != nil {
+ DbL.Println(terr)
+ return terr
+ }
+ ret = append(ret, &user)
+ return nil
+ })
+ return
+}
+
+func (db *Sqlite3UserDb) Validate(Username string, Password string) (ut int, ret bool) {
+ var pw string
+ var exists bool
+ var serr error
+
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ serr = sqlitex.Exec(
+ db.Db, `select usertype,password from userdb where username=?;`,
+ func(stmt *sqlite.Stmt) error {
+ exists = true
+ ut = stmt.ColumnInt(0)
+ pw = stmt.GetText("password")
+ return nil
+ }, Username)
+
+ if serr != nil {
+ return -1, false
+ }
+ if !exists {
+ return -1, false
+ }
+
+ serr = bcrypt.CompareHashAndPassword([]byte(pw), []byte(Password))
+ return ut, serr == nil
+}
+
+func (db *Sqlite3UserDb) ValidateToken(Token string) (user string, ut int, err error) {
+ if Token == "" {
+ return "", -1, fmt.Errorf("token is empty")
+ }
+ var exists bool
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(
+ db.Db, `select usertype,username from userdb where token=?;`,
+ func(stmt *sqlite.Stmt) error {
+ exists = true
+ ut = stmt.ColumnInt(0)
+ user = stmt.GetText("username")
+ return nil
+ }, Token)
+
+ if err != nil {
+ return "", -1, err
+ }
+ if !exists {
+ return "", -1, fmt.Errorf("token doesn't exist")
+ }
+ if user == "" {
+ return "", -1, fmt.Errorf("user doesn't exist")
+ }
+ return
+}
+
+func (db *Sqlite3UserDb) SetToken(Username string, Token string) (err error) {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ err = sqlitex.Exec(db.Db, `update userdb set token=? where username=?;`, nil, Token, Username)
+ return
+}
diff --git a/internal/web/.gitignore b/internal/web/.gitignore
new file mode 100644
index 00000000..dd87e2d7
--- /dev/null
+++ b/internal/web/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+build
diff --git a/internal/web/.npmrc b/internal/web/.npmrc
new file mode 100644
index 00000000..b6f27f13
--- /dev/null
+++ b/internal/web/.npmrc
@@ -0,0 +1 @@
+engine-strict=true
diff --git a/internal/web/.prettierignore b/internal/web/.prettierignore
new file mode 100644
index 00000000..84f37f60
--- /dev/null
+++ b/internal/web/.prettierignore
@@ -0,0 +1,3 @@
+static/**
+build/**
+node_modules/**
diff --git a/internal/web/.prettierrc b/internal/web/.prettierrc
new file mode 100644
index 00000000..8c71d267
--- /dev/null
+++ b/internal/web/.prettierrc
@@ -0,0 +1,6 @@
+{
+ "singleQuote": true,
+ "trailingComma": "none",
+ "printWidth": 300,
+ "jsxBracketSameLine": true
+}
diff --git a/internal/web/esbuild.config.js b/internal/web/esbuild.config.js
new file mode 100644
index 00000000..a51f9f47
--- /dev/null
+++ b/internal/web/esbuild.config.js
@@ -0,0 +1,46 @@
+import { existsSync, mkdirSync, copyFile } from 'fs';
+import { build } from 'esbuild';
+import sveltePlugin from 'esbuild-svelte';
+import sveltePreprocess from 'svelte-preprocess';
+import tailwindcss from 'tailwindcss';
+
+const WATCH = process.argv.includes('-w');
+
+//make sure the directoy exists before stuff gets put into it
+if (!existsSync('./build/')) {
+ mkdirSync('./build/');
+}
+
+copyFile('./src/index.html', './build/index.html', (err) => {
+ if (err) throw err;
+});
+
+//build the application
+build({
+ entryPoints: ['./src/index.js'],
+ outdir: './build',
+ format: 'esm',
+ minify: true,
+ bundle: true,
+ treeShaking: true,
+ splitting: true,
+ watch: WATCH,
+ incremental: WATCH,
+ plugins: [
+ sveltePlugin({
+ compileOptions: {
+ dev: WATCH
+ },
+ preprocess: sveltePreprocess({
+ aliases: ['ts', 'typescript'],
+ postcss: {
+ plugins: [tailwindcss()]
+ }
+ })
+ })
+ ],
+ tsconfig: 'tsconfig.json'
+}).catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/internal/web/package-lock.json b/internal/web/package-lock.json
new file mode 100644
index 00000000..f5469eb4
--- /dev/null
+++ b/internal/web/package-lock.json
@@ -0,0 +1,2732 @@
+{
+ "name": "exatorrent",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "exatorrent",
+ "license": "GPL-3.0-or-later",
+ "dependencies": {
+ "@tailwindcss/forms": "^0.3.3",
+ "autoprefixer": "^10.3.2",
+ "esbuild": "^0.12.22",
+ "esbuild-svelte": "^0.5.4",
+ "postcss": "^8.3.6",
+ "slocation": "latest",
+ "svelte": "latest",
+ "svelte-preprocess": "^4.8.0",
+ "tailwindcss": "^2.2.7"
+ },
+ "devDependencies": {
+ "@tsconfig/svelte": "^2.0.1",
+ "prettier": "^2.3.2",
+ "prettier-plugin-svelte": "^2.3.1",
+ "svelte-check": "^2.2.5",
+ "typescript": "^4.3.5"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz",
+ "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==",
+ "dependencies": {
+ "@babel/highlight": "^7.14.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.14.9",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz",
+ "integrity": "sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g==",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/highlight": {
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz",
+ "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.14.5",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ },
+ "node_modules/@babel/highlight/node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "dependencies": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "dependencies": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@tailwindcss/forms": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.3.3.tgz",
+ "integrity": "sha512-U8Fi/gq4mSuaLyLtFISwuDYzPB73YzgozjxOIHsK6NXgg/IWD1FLaHbFlWmurAMyy98O+ao74ksdQefsquBV1Q==",
+ "dependencies": {
+ "mini-svg-data-uri": "^1.2.3"
+ },
+ "peerDependencies": {
+ "tailwindcss": ">=2.0.0"
+ }
+ },
+ "node_modules/@tsconfig/svelte": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-2.0.1.tgz",
+ "integrity": "sha512-aqkICXbM1oX5FfgZd2qSSAGdyo/NRxjWCamxoyi3T8iVQnzGge19HhDYzZ6NrVOW7bhcWNSq9XexWFtMzbB24A==",
+ "dev": true
+ },
+ "node_modules/@types/node": {
+ "version": "16.7.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz",
+ "integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A=="
+ },
+ "node_modules/@types/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA=="
+ },
+ "node_modules/@types/pug": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.5.tgz",
+ "integrity": "sha512-LOnASQoeNZMkzexRuyqcBBDZ6rS+rQxUMkmj5A0PkhhiSZivLIuz6Hxyr1mkGoEZEkk66faROmpMi4fFkrKsBA=="
+ },
+ "node_modules/@types/sass": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.16.1.tgz",
+ "integrity": "sha512-iZUcRrGuz/Tbg3loODpW7vrQJkUtpY2fFSf4ELqqkApcS2TkZ1msk7ie8iZPB86lDOP8QOTTmuvWjc5S0R9OjQ==",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "7.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
+ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-node": {
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz",
+ "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==",
+ "dependencies": {
+ "acorn": "^7.0.0",
+ "acorn-walk": "^7.0.0",
+ "xtend": "^4.0.2"
+ }
+ },
+ "node_modules/acorn-walk": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz",
+ "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
+ "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/arg": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.1.tgz",
+ "integrity": "sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA=="
+ },
+ "node_modules/autoprefixer": {
+ "version": "10.3.2",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.2.tgz",
+ "integrity": "sha512-RHKq0YCvhxAn9987n0Gl6lkzLd39UKwCkUPMFE0cHhxU0SvcTjBxWG/CtkZ4/HvbqK9U5V8j03nAcGBlX3er/Q==",
+ "dependencies": {
+ "browserslist": "^4.16.8",
+ "caniuse-lite": "^1.0.30001251",
+ "colorette": "^1.3.0",
+ "fraction.js": "^4.1.1",
+ "normalize-range": "^0.1.2",
+ "postcss-value-parser": "^4.1.0"
+ },
+ "bin": {
+ "autoprefixer": "bin/autoprefixer"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ "peerDependencies": {
+ "postcss": "^8.1.0"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dependencies": {
+ "fill-range": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.16.8",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz",
+ "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==",
+ "dependencies": {
+ "caniuse-lite": "^1.0.30001251",
+ "colorette": "^1.3.0",
+ "electron-to-chromium": "^1.3.811",
+ "escalade": "^3.1.1",
+ "node-releases": "^1.1.75"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/camelcase-css": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz",
+ "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001251",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz",
+ "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ }
+ },
+ "node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz",
+ "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==",
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/color": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
+ "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
+ "dependencies": {
+ "color-convert": "^1.9.3",
+ "color-string": "^1.6.0"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ },
+ "node_modules/color-string": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.6.0.tgz",
+ "integrity": "sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA==",
+ "dependencies": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ }
+ },
+ "node_modules/color/node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/color/node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ },
+ "node_modules/colorette": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz",
+ "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w=="
+ },
+ "node_modules/commander": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
+ "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
+ },
+ "node_modules/cosmiconfig": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
+ "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
+ "dependencies": {
+ "@types/parse-json": "^4.0.0",
+ "import-fresh": "^3.2.1",
+ "parse-json": "^5.0.0",
+ "path-type": "^4.0.0",
+ "yaml": "^1.10.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/css-unit-converter": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz",
+ "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA=="
+ },
+ "node_modules/cssesc": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
+ "bin": {
+ "cssesc": "bin/cssesc"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/defined": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
+ "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM="
+ },
+ "node_modules/detect-indent": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
+ "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/detective": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz",
+ "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==",
+ "dependencies": {
+ "acorn-node": "^1.6.1",
+ "defined": "^1.0.0",
+ "minimist": "^1.1.1"
+ },
+ "bin": {
+ "detective": "bin/detective.js"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/didyoumean": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
+ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw=="
+ },
+ "node_modules/dlv": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
+ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.3.817",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.817.tgz",
+ "integrity": "sha512-Vw0Faepf2Id9Kf2e97M/c99qf168xg86JLKDxivvlpBQ9KDtjSeX0v+TiuSE25PqeQfTz+NJs375b64ca3XOIQ=="
+ },
+ "node_modules/error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dependencies": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.12.22",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.22.tgz",
+ "integrity": "sha512-yWCr9RoFehpqoe/+MwZXJpYOEIt7KOEvNnjIeMZpMSyQt+KCBASM3y7yViiN5dJRphf1wGdUz1+M4rTtWd/ulA==",
+ "hasInstallScript": true,
+ "bin": {
+ "esbuild": "bin/esbuild"
+ }
+ },
+ "node_modules/esbuild-svelte": {
+ "version": "0.5.4",
+ "resolved": "https://registry.npmjs.org/esbuild-svelte/-/esbuild-svelte-0.5.4.tgz",
+ "integrity": "sha512-7QgDYfnRW8U/oMo/eaVXr0Ptm/LRugziXMRvg3RGA2MB7dWyc/gYEdf2KThkHeYFFTFAmY7Ujg32gKrmHQE3qw==",
+ "dependencies": {
+ "svelte": "^3.42.1"
+ },
+ "peerDependencies": {
+ "esbuild": ">=0.9.6"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/fast-glob": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
+ "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
+ "dependencies": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.2",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/fastq": {
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz",
+ "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==",
+ "dependencies": {
+ "reusify": "^1.0.4"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/fraction.js": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.1.tgz",
+ "integrity": "sha512-MHOhvvxHTfRFpF1geTK9czMIZ6xclsEor2wkIGYYq+PxcQqT7vStJqjhe6S1TenZrMZzo+wlqOufBDVepUEgPg==",
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "type": "patreon",
+ "url": "https://www.patreon.com/infusion"
+ }
+ },
+ "node_modules/fs-extra": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
+ "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
+ "dependencies": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ },
+ "node_modules/glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/graceful-fs": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
+ },
+ "node_modules/has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dependencies": {
+ "function-bind": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/html-tags": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz",
+ "integrity": "sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/import-cwd": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz",
+ "integrity": "sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==",
+ "dependencies": {
+ "import-from": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/import-fresh": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+ "dependencies": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/import-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz",
+ "integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==",
+ "dependencies": {
+ "resolve-from": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/import-from/node_modules/resolve-from": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
+ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dependencies": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
+ "node_modules/is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz",
+ "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==",
+ "dependencies": {
+ "has": "^1.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
+ },
+ "node_modules/json-parse-even-better-errors": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="
+ },
+ "node_modules/jsonfile": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+ "dependencies": {
+ "universalify": "^2.0.0"
+ },
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/lilconfig": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.3.tgz",
+ "integrity": "sha512-EHKqr/+ZvdKCifpNrJCKxBTgk5XupZA3y/aCPY9mxfgBzmgh93Mt/WqjjQ38oMxXuvDokaKiM3lAgvSH2sjtHg==",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
+ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA="
+ },
+ "node_modules/lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
+ },
+ "node_modules/lodash.topath": {
+ "version": "4.5.2",
+ "resolved": "https://registry.npmjs.org/lodash.topath/-/lodash.topath-4.5.2.tgz",
+ "integrity": "sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak="
+ },
+ "node_modules/merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
+ "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
+ "dependencies": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.2.3"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/min-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
+ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/mini-svg-data-uri": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.3.3.tgz",
+ "integrity": "sha512-+fA2oRcR1dJI/7ITmeQJDrYWks0wodlOz0pAEhKYJ2IVc1z0AnwJUsKY2fzFmPAM3Jo9J0rBx8JAA9QQSJ5PuA==",
+ "bin": {
+ "mini-svg-data-uri": "cli.js"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+ },
+ "node_modules/modern-normalize": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/modern-normalize/-/modern-normalize-1.1.0.tgz",
+ "integrity": "sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA==",
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mri": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz",
+ "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.1.25",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
+ "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/node-emoji": {
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz",
+ "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==",
+ "dependencies": {
+ "lodash": "^4.17.21"
+ }
+ },
+ "node_modules/node-releases": {
+ "version": "1.1.75",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz",
+ "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw=="
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/normalize-range": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
+ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-hash": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
+ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/parse-json": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
+ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "dependencies": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
+ },
+ "node_modules/path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
+ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.3.6",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz",
+ "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==",
+ "dependencies": {
+ "colorette": "^1.2.2",
+ "nanoid": "^3.1.23",
+ "source-map-js": "^0.6.2"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ }
+ },
+ "node_modules/postcss-js": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-3.0.3.tgz",
+ "integrity": "sha512-gWnoWQXKFw65Hk/mi2+WTQTHdPD5UJdDXZmX073EY/B3BWnYjO4F4t0VneTCnCGQ5E5GsCdMkzPaTXwl3r5dJw==",
+ "dependencies": {
+ "camelcase-css": "^2.0.1",
+ "postcss": "^8.1.6"
+ },
+ "engines": {
+ "node": ">=10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ }
+ },
+ "node_modules/postcss-load-config": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.0.tgz",
+ "integrity": "sha512-ipM8Ds01ZUophjDTQYSVP70slFSYg3T0/zyfII5vzhN6V57YSxMgG5syXuwi5VtS8wSf3iL30v0uBdoIVx4Q0g==",
+ "dependencies": {
+ "import-cwd": "^3.0.0",
+ "lilconfig": "^2.0.3",
+ "yaml": "^1.10.2"
+ },
+ "engines": {
+ "node": ">= 10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ "peerDependencies": {
+ "ts-node": ">=9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ts-node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/postcss-nested": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-5.0.5.tgz",
+ "integrity": "sha512-GSRXYz5bccobpTzLQZXOnSOfKl6TwVr5CyAQJUPub4nuRJSOECK5AqurxVgmtxP48p0Kc/ndY/YyS1yqldX0Ew==",
+ "dependencies": {
+ "postcss-selector-parser": "^6.0.4"
+ },
+ "engines": {
+ "node": ">=10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ "peerDependencies": {
+ "postcss": "^8.1.13"
+ }
+ },
+ "node_modules/postcss-selector-parser": {
+ "version": "6.0.6",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz",
+ "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==",
+ "dependencies": {
+ "cssesc": "^3.0.0",
+ "util-deprecate": "^1.0.2"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/postcss-value-parser": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
+ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ=="
+ },
+ "node_modules/prettier": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
+ "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
+ "dev": true,
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/prettier-plugin-svelte": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.3.1.tgz",
+ "integrity": "sha512-F1/r6OYoBq8Zgurhs1MN25tdrhPw0JW5JjioPRqpxbYdmrZ3gY/DzHGs0B6zwd4DLyRsfGB2gqhxUCbHt/D1fw==",
+ "dev": true,
+ "peerDependencies": {
+ "prettier": "^1.16.4 || ^2.0.0",
+ "svelte": "^3.2.0"
+ }
+ },
+ "node_modules/pretty-hrtime": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
+ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/purgecss": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.0.3.tgz",
+ "integrity": "sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==",
+ "dependencies": {
+ "commander": "^6.0.0",
+ "glob": "^7.0.0",
+ "postcss": "^8.2.1",
+ "postcss-selector-parser": "^6.0.2"
+ },
+ "bin": {
+ "purgecss": "bin/purgecss.js"
+ }
+ },
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/quick-lru": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
+ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/reduce-css-calc": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.8.tgz",
+ "integrity": "sha512-8liAVezDmUcH+tdzoEGrhfbGcP7nOV4NkGE3a74+qqvE7nt9i4sKLGBuZNOnpI4WiGksiNPklZxva80061QiPg==",
+ "dependencies": {
+ "css-unit-converter": "^1.1.1",
+ "postcss-value-parser": "^3.3.0"
+ }
+ },
+ "node_modules/reduce-css-calc/node_modules/postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ=="
+ },
+ "node_modules/resolve": {
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
+ "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
+ "dependencies": {
+ "is-core-module": "^2.2.0",
+ "path-parse": "^1.0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/reusify": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+ "engines": {
+ "iojs": ">=1.0.0",
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dependencies": {
+ "glob": "^7.1.3"
+ },
+ "bin": {
+ "rimraf": "bin.js"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/run-parallel": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "dependencies": {
+ "queue-microtask": "^1.2.2"
+ }
+ },
+ "node_modules/sade": {
+ "version": "1.7.4",
+ "resolved": "https://registry.npmjs.org/sade/-/sade-1.7.4.tgz",
+ "integrity": "sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==",
+ "dev": true,
+ "dependencies": {
+ "mri": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/simple-swizzle": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
+ "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
+ "dependencies": {
+ "is-arrayish": "^0.3.1"
+ }
+ },
+ "node_modules/simple-swizzle/node_modules/is-arrayish": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
+ },
+ "node_modules/slocation": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/slocation/-/slocation-1.1.0.tgz",
+ "integrity": "sha512-UjdwQ90wNXOjzBXjbjXjwV8UCavFKIrh8YboMX3R/mhX418XzV5aKSBkNTMimxN30ZXJKXuYY2aUE2e0PT/ZjA==",
+ "dependencies": {
+ "svelte": "latest"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
+ "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz",
+ "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/strip-indent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
+ "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "dependencies": {
+ "min-indent": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/svelte": {
+ "version": "3.42.3",
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.42.3.tgz",
+ "integrity": "sha512-pbdtdNZEx2GBqSM6XEgPoHbwtvWBwFLt/1bRmzsyXZO+i424wFnPe7O5B3GOJDPFSxPRztumAW3mL5LPzecWUg==",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/svelte-check": {
+ "version": "2.2.5",
+ "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-2.2.5.tgz",
+ "integrity": "sha512-EstDoqxjqWStWELh7Z0qytqUDl/ikdNEr21dveNc4fUDnhnqO2F2jHEufqoNnC3GfBji3GIUHvoXsp/I5lMbCg==",
+ "dev": true,
+ "dependencies": {
+ "chalk": "^4.0.0",
+ "chokidar": "^3.4.1",
+ "glob": "^7.1.6",
+ "import-fresh": "^3.2.1",
+ "minimist": "^1.2.5",
+ "sade": "^1.7.4",
+ "source-map": "^0.7.3",
+ "svelte-preprocess": "^4.0.0",
+ "typescript": "*"
+ },
+ "bin": {
+ "svelte-check": "bin/svelte-check"
+ },
+ "peerDependencies": {
+ "svelte": "^3.24.0"
+ }
+ },
+ "node_modules/svelte-preprocess": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-4.8.0.tgz",
+ "integrity": "sha512-i9Z17cwGlp+kuSSv3kJWdAdAP2L26A5yMzHHdDj8YL+86sN64Yz5/gfjQp3Xb6fiaToo4sB+wTpid/23Gz0yvw==",
+ "hasInstallScript": true,
+ "dependencies": {
+ "@types/pug": "^2.0.4",
+ "@types/sass": "^1.16.0",
+ "detect-indent": "^6.0.0",
+ "strip-indent": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 9.11.2"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.10.2",
+ "coffeescript": "^2.5.1",
+ "less": "^3.11.3",
+ "postcss": "^7 || ^8",
+ "postcss-load-config": "^2.1.0 || ^3.0.0",
+ "pug": "^3.0.0",
+ "sass": "^1.26.8",
+ "stylus": "^0.54.7",
+ "sugarss": "^2.0.0",
+ "svelte": "^3.23.0",
+ "typescript": "^3.9.5 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@babel/core": {
+ "optional": true
+ },
+ "coffeescript": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "node-sass": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "postcss-load-config": {
+ "optional": true
+ },
+ "pug": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/tailwindcss": {
+ "version": "2.2.7",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.7.tgz",
+ "integrity": "sha512-jv35rugP5j8PpzbXnsria7ZAry7Evh0KtQ4MZqNd+PhF+oIKPwJTVwe/rmfRx9cZw3W7iPZyzBmeoAoNwfJ1yg==",
+ "dependencies": {
+ "arg": "^5.0.0",
+ "bytes": "^3.0.0",
+ "chalk": "^4.1.1",
+ "chokidar": "^3.5.2",
+ "color": "^3.2.0",
+ "cosmiconfig": "^7.0.0",
+ "detective": "^5.2.0",
+ "didyoumean": "^1.2.2",
+ "dlv": "^1.1.3",
+ "fast-glob": "^3.2.7",
+ "fs-extra": "^10.0.0",
+ "glob-parent": "^6.0.0",
+ "html-tags": "^3.1.0",
+ "is-glob": "^4.0.1",
+ "lodash": "^4.17.21",
+ "lodash.topath": "^4.5.2",
+ "modern-normalize": "^1.1.0",
+ "node-emoji": "^1.8.1",
+ "normalize-path": "^3.0.0",
+ "object-hash": "^2.2.0",
+ "postcss-js": "^3.0.3",
+ "postcss-load-config": "^3.1.0",
+ "postcss-nested": "5.0.5",
+ "postcss-selector-parser": "^6.0.6",
+ "postcss-value-parser": "^4.1.0",
+ "pretty-hrtime": "^1.0.3",
+ "purgecss": "^4.0.3",
+ "quick-lru": "^5.1.1",
+ "reduce-css-calc": "^2.1.8",
+ "resolve": "^1.20.0",
+ "tmp": "^0.2.1"
+ },
+ "bin": {
+ "tailwind": "lib/cli.js",
+ "tailwindcss": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=12.13.0"
+ },
+ "peerDependencies": {
+ "autoprefixer": "^10.0.2",
+ "postcss": "^8.0.9"
+ }
+ },
+ "node_modules/tailwindcss/node_modules/glob-parent": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.1.tgz",
+ "integrity": "sha512-kEVjS71mQazDBHKcsq4E9u/vUzaLcw1A8EtUeydawvIWQCJM0qQ08G1H7/XTjFUulla6XQiDOG6MXSaG0HDKog==",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/tmp": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
+ "dependencies": {
+ "rimraf": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8.17.0"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "4.3.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
+ "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
+ "devOptional": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
+ },
+ "node_modules/universalify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
+ "engines": {
+ "node": ">= 10.0.0"
+ }
+ },
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "node_modules/xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+ "engines": {
+ "node": ">=0.4"
+ }
+ },
+ "node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "engines": {
+ "node": ">= 6"
+ }
+ }
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz",
+ "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==",
+ "requires": {
+ "@babel/highlight": "^7.14.5"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.14.9",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz",
+ "integrity": "sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g=="
+ },
+ "@babel/highlight": {
+ "version": "7.14.5",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz",
+ "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.14.5",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "requires": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ }
+ },
+ "@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="
+ },
+ "@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "requires": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ }
+ },
+ "@tailwindcss/forms": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.3.3.tgz",
+ "integrity": "sha512-U8Fi/gq4mSuaLyLtFISwuDYzPB73YzgozjxOIHsK6NXgg/IWD1FLaHbFlWmurAMyy98O+ao74ksdQefsquBV1Q==",
+ "requires": {
+ "mini-svg-data-uri": "^1.2.3"
+ }
+ },
+ "@tsconfig/svelte": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-2.0.1.tgz",
+ "integrity": "sha512-aqkICXbM1oX5FfgZd2qSSAGdyo/NRxjWCamxoyi3T8iVQnzGge19HhDYzZ6NrVOW7bhcWNSq9XexWFtMzbB24A==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "16.7.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz",
+ "integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A=="
+ },
+ "@types/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA=="
+ },
+ "@types/pug": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.5.tgz",
+ "integrity": "sha512-LOnASQoeNZMkzexRuyqcBBDZ6rS+rQxUMkmj5A0PkhhiSZivLIuz6Hxyr1mkGoEZEkk66faROmpMi4fFkrKsBA=="
+ },
+ "@types/sass": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.16.1.tgz",
+ "integrity": "sha512-iZUcRrGuz/Tbg3loODpW7vrQJkUtpY2fFSf4ELqqkApcS2TkZ1msk7ie8iZPB86lDOP8QOTTmuvWjc5S0R9OjQ==",
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "acorn": {
+ "version": "7.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
+ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="
+ },
+ "acorn-node": {
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz",
+ "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==",
+ "requires": {
+ "acorn": "^7.0.0",
+ "acorn-walk": "^7.0.0",
+ "xtend": "^4.0.2"
+ }
+ },
+ "acorn-walk": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz",
+ "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA=="
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "anymatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
+ "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "arg": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.1.tgz",
+ "integrity": "sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA=="
+ },
+ "autoprefixer": {
+ "version": "10.3.2",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.2.tgz",
+ "integrity": "sha512-RHKq0YCvhxAn9987n0Gl6lkzLd39UKwCkUPMFE0cHhxU0SvcTjBxWG/CtkZ4/HvbqK9U5V8j03nAcGBlX3er/Q==",
+ "requires": {
+ "browserslist": "^4.16.8",
+ "caniuse-lite": "^1.0.30001251",
+ "colorette": "^1.3.0",
+ "fraction.js": "^4.1.1",
+ "normalize-range": "^0.1.2",
+ "postcss-value-parser": "^4.1.0"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
+ },
+ "binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "browserslist": {
+ "version": "4.16.8",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz",
+ "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==",
+ "requires": {
+ "caniuse-lite": "^1.0.30001251",
+ "colorette": "^1.3.0",
+ "electron-to-chromium": "^1.3.811",
+ "escalade": "^3.1.1",
+ "node-releases": "^1.1.75"
+ }
+ },
+ "bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
+ },
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
+ },
+ "camelcase-css": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz",
+ "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA=="
+ },
+ "caniuse-lite": {
+ "version": "1.0.30001251",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz",
+ "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A=="
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "chokidar": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz",
+ "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==",
+ "requires": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "fsevents": "~2.3.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ }
+ },
+ "color": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
+ "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
+ "requires": {
+ "color-convert": "^1.9.3",
+ "color-string": "^1.6.0"
+ },
+ "dependencies": {
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ }
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ },
+ "color-string": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.6.0.tgz",
+ "integrity": "sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA==",
+ "requires": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ }
+ },
+ "colorette": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz",
+ "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w=="
+ },
+ "commander": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
+ "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
+ },
+ "cosmiconfig": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
+ "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
+ "requires": {
+ "@types/parse-json": "^4.0.0",
+ "import-fresh": "^3.2.1",
+ "parse-json": "^5.0.0",
+ "path-type": "^4.0.0",
+ "yaml": "^1.10.0"
+ }
+ },
+ "css-unit-converter": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz",
+ "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA=="
+ },
+ "cssesc": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="
+ },
+ "defined": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
+ "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM="
+ },
+ "detect-indent": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
+ "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA=="
+ },
+ "detective": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz",
+ "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==",
+ "requires": {
+ "acorn-node": "^1.6.1",
+ "defined": "^1.0.0",
+ "minimist": "^1.1.1"
+ }
+ },
+ "didyoumean": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
+ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw=="
+ },
+ "dlv": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
+ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="
+ },
+ "electron-to-chromium": {
+ "version": "1.3.817",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.817.tgz",
+ "integrity": "sha512-Vw0Faepf2Id9Kf2e97M/c99qf168xg86JLKDxivvlpBQ9KDtjSeX0v+TiuSE25PqeQfTz+NJs375b64ca3XOIQ=="
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "esbuild": {
+ "version": "0.12.22",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.22.tgz",
+ "integrity": "sha512-yWCr9RoFehpqoe/+MwZXJpYOEIt7KOEvNnjIeMZpMSyQt+KCBASM3y7yViiN5dJRphf1wGdUz1+M4rTtWd/ulA=="
+ },
+ "esbuild-svelte": {
+ "version": "0.5.4",
+ "resolved": "https://registry.npmjs.org/esbuild-svelte/-/esbuild-svelte-0.5.4.tgz",
+ "integrity": "sha512-7QgDYfnRW8U/oMo/eaVXr0Ptm/LRugziXMRvg3RGA2MB7dWyc/gYEdf2KThkHeYFFTFAmY7Ujg32gKrmHQE3qw==",
+ "requires": {
+ "svelte": "^3.42.1"
+ }
+ },
+ "escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
+ },
+ "fast-glob": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
+ "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
+ "requires": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.2",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.4"
+ }
+ },
+ "fastq": {
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz",
+ "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==",
+ "requires": {
+ "reusify": "^1.0.4"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "fraction.js": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.1.tgz",
+ "integrity": "sha512-MHOhvvxHTfRFpF1geTK9czMIZ6xclsEor2wkIGYYq+PxcQqT7vStJqjhe6S1TenZrMZzo+wlqOufBDVepUEgPg=="
+ },
+ "fs-extra": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
+ "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
+ "requires": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ },
+ "fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "optional": true
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ },
+ "glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
+ },
+ "html-tags": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz",
+ "integrity": "sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg=="
+ },
+ "import-cwd": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz",
+ "integrity": "sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==",
+ "requires": {
+ "import-from": "^3.0.0"
+ }
+ },
+ "import-fresh": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+ "requires": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ }
+ },
+ "import-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz",
+ "integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==",
+ "requires": {
+ "resolve-from": "^5.0.0"
+ },
+ "dependencies": {
+ "resolve-from": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
+ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw=="
+ }
+ }
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-core-module": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz",
+ "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==",
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
+ },
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
+ },
+ "json-parse-even-better-errors": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="
+ },
+ "jsonfile": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+ "requires": {
+ "graceful-fs": "^4.1.6",
+ "universalify": "^2.0.0"
+ }
+ },
+ "lilconfig": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.3.tgz",
+ "integrity": "sha512-EHKqr/+ZvdKCifpNrJCKxBTgk5XupZA3y/aCPY9mxfgBzmgh93Mt/WqjjQ38oMxXuvDokaKiM3lAgvSH2sjtHg=="
+ },
+ "lines-and-columns": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
+ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA="
+ },
+ "lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
+ },
+ "lodash.topath": {
+ "version": "4.5.2",
+ "resolved": "https://registry.npmjs.org/lodash.topath/-/lodash.topath-4.5.2.tgz",
+ "integrity": "sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak="
+ },
+ "merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="
+ },
+ "micromatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
+ "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.2.3"
+ }
+ },
+ "min-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
+ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="
+ },
+ "mini-svg-data-uri": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.3.3.tgz",
+ "integrity": "sha512-+fA2oRcR1dJI/7ITmeQJDrYWks0wodlOz0pAEhKYJ2IVc1z0AnwJUsKY2fzFmPAM3Jo9J0rBx8JAA9QQSJ5PuA=="
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+ },
+ "modern-normalize": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/modern-normalize/-/modern-normalize-1.1.0.tgz",
+ "integrity": "sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA=="
+ },
+ "mri": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz",
+ "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==",
+ "dev": true
+ },
+ "nanoid": {
+ "version": "3.1.25",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
+ "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q=="
+ },
+ "node-emoji": {
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz",
+ "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==",
+ "requires": {
+ "lodash": "^4.17.21"
+ }
+ },
+ "node-releases": {
+ "version": "1.1.75",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz",
+ "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw=="
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
+ },
+ "normalize-range": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
+ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI="
+ },
+ "object-hash": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
+ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "requires": {
+ "callsites": "^3.0.0"
+ }
+ },
+ "parse-json": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
+ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
+ },
+ "path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
+ },
+ "path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="
+ },
+ "picomatch": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
+ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw=="
+ },
+ "postcss": {
+ "version": "8.3.6",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz",
+ "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==",
+ "requires": {
+ "colorette": "^1.2.2",
+ "nanoid": "^3.1.23",
+ "source-map-js": "^0.6.2"
+ }
+ },
+ "postcss-js": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-3.0.3.tgz",
+ "integrity": "sha512-gWnoWQXKFw65Hk/mi2+WTQTHdPD5UJdDXZmX073EY/B3BWnYjO4F4t0VneTCnCGQ5E5GsCdMkzPaTXwl3r5dJw==",
+ "requires": {
+ "camelcase-css": "^2.0.1",
+ "postcss": "^8.1.6"
+ }
+ },
+ "postcss-load-config": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.0.tgz",
+ "integrity": "sha512-ipM8Ds01ZUophjDTQYSVP70slFSYg3T0/zyfII5vzhN6V57YSxMgG5syXuwi5VtS8wSf3iL30v0uBdoIVx4Q0g==",
+ "requires": {
+ "import-cwd": "^3.0.0",
+ "lilconfig": "^2.0.3",
+ "yaml": "^1.10.2"
+ }
+ },
+ "postcss-nested": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-5.0.5.tgz",
+ "integrity": "sha512-GSRXYz5bccobpTzLQZXOnSOfKl6TwVr5CyAQJUPub4nuRJSOECK5AqurxVgmtxP48p0Kc/ndY/YyS1yqldX0Ew==",
+ "requires": {
+ "postcss-selector-parser": "^6.0.4"
+ }
+ },
+ "postcss-selector-parser": {
+ "version": "6.0.6",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz",
+ "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==",
+ "requires": {
+ "cssesc": "^3.0.0",
+ "util-deprecate": "^1.0.2"
+ }
+ },
+ "postcss-value-parser": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
+ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ=="
+ },
+ "prettier": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
+ "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
+ "dev": true
+ },
+ "prettier-plugin-svelte": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.3.1.tgz",
+ "integrity": "sha512-F1/r6OYoBq8Zgurhs1MN25tdrhPw0JW5JjioPRqpxbYdmrZ3gY/DzHGs0B6zwd4DLyRsfGB2gqhxUCbHt/D1fw==",
+ "dev": true,
+ "requires": {}
+ },
+ "pretty-hrtime": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
+ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE="
+ },
+ "purgecss": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.0.3.tgz",
+ "integrity": "sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==",
+ "requires": {
+ "commander": "^6.0.0",
+ "glob": "^7.0.0",
+ "postcss": "^8.2.1",
+ "postcss-selector-parser": "^6.0.2"
+ }
+ },
+ "queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="
+ },
+ "quick-lru": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
+ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="
+ },
+ "readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "requires": {
+ "picomatch": "^2.2.1"
+ }
+ },
+ "reduce-css-calc": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.8.tgz",
+ "integrity": "sha512-8liAVezDmUcH+tdzoEGrhfbGcP7nOV4NkGE3a74+qqvE7nt9i4sKLGBuZNOnpI4WiGksiNPklZxva80061QiPg==",
+ "requires": {
+ "css-unit-converter": "^1.1.1",
+ "postcss-value-parser": "^3.3.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ=="
+ }
+ }
+ },
+ "resolve": {
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
+ "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
+ "requires": {
+ "is-core-module": "^2.2.0",
+ "path-parse": "^1.0.6"
+ }
+ },
+ "resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
+ },
+ "reusify": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw=="
+ },
+ "rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "run-parallel": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "requires": {
+ "queue-microtask": "^1.2.2"
+ }
+ },
+ "sade": {
+ "version": "1.7.4",
+ "resolved": "https://registry.npmjs.org/sade/-/sade-1.7.4.tgz",
+ "integrity": "sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==",
+ "dev": true,
+ "requires": {
+ "mri": "^1.1.0"
+ }
+ },
+ "simple-swizzle": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
+ "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
+ "requires": {
+ "is-arrayish": "^0.3.1"
+ },
+ "dependencies": {
+ "is-arrayish": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
+ }
+ }
+ },
+ "slocation": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/slocation/-/slocation-1.1.0.tgz",
+ "integrity": "sha512-UjdwQ90wNXOjzBXjbjXjwV8UCavFKIrh8YboMX3R/mhX418XzV5aKSBkNTMimxN30ZXJKXuYY2aUE2e0PT/ZjA==",
+ "requires": {
+ "svelte": "latest"
+ }
+ },
+ "source-map": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
+ "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
+ "dev": true
+ },
+ "source-map-js": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz",
+ "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug=="
+ },
+ "strip-indent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
+ "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "requires": {
+ "min-indent": "^1.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "svelte": {
+ "version": "3.42.3",
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.42.3.tgz",
+ "integrity": "sha512-pbdtdNZEx2GBqSM6XEgPoHbwtvWBwFLt/1bRmzsyXZO+i424wFnPe7O5B3GOJDPFSxPRztumAW3mL5LPzecWUg=="
+ },
+ "svelte-check": {
+ "version": "2.2.5",
+ "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-2.2.5.tgz",
+ "integrity": "sha512-EstDoqxjqWStWELh7Z0qytqUDl/ikdNEr21dveNc4fUDnhnqO2F2jHEufqoNnC3GfBji3GIUHvoXsp/I5lMbCg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.0.0",
+ "chokidar": "^3.4.1",
+ "glob": "^7.1.6",
+ "import-fresh": "^3.2.1",
+ "minimist": "^1.2.5",
+ "sade": "^1.7.4",
+ "source-map": "^0.7.3",
+ "svelte-preprocess": "^4.0.0",
+ "typescript": "*"
+ }
+ },
+ "svelte-preprocess": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-4.8.0.tgz",
+ "integrity": "sha512-i9Z17cwGlp+kuSSv3kJWdAdAP2L26A5yMzHHdDj8YL+86sN64Yz5/gfjQp3Xb6fiaToo4sB+wTpid/23Gz0yvw==",
+ "requires": {
+ "@types/pug": "^2.0.4",
+ "@types/sass": "^1.16.0",
+ "detect-indent": "^6.0.0",
+ "strip-indent": "^3.0.0"
+ }
+ },
+ "tailwindcss": {
+ "version": "2.2.7",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.7.tgz",
+ "integrity": "sha512-jv35rugP5j8PpzbXnsria7ZAry7Evh0KtQ4MZqNd+PhF+oIKPwJTVwe/rmfRx9cZw3W7iPZyzBmeoAoNwfJ1yg==",
+ "requires": {
+ "arg": "^5.0.0",
+ "bytes": "^3.0.0",
+ "chalk": "^4.1.1",
+ "chokidar": "^3.5.2",
+ "color": "^3.2.0",
+ "cosmiconfig": "^7.0.0",
+ "detective": "^5.2.0",
+ "didyoumean": "^1.2.2",
+ "dlv": "^1.1.3",
+ "fast-glob": "^3.2.7",
+ "fs-extra": "^10.0.0",
+ "glob-parent": "^6.0.0",
+ "html-tags": "^3.1.0",
+ "is-glob": "^4.0.1",
+ "lodash": "^4.17.21",
+ "lodash.topath": "^4.5.2",
+ "modern-normalize": "^1.1.0",
+ "node-emoji": "^1.8.1",
+ "normalize-path": "^3.0.0",
+ "object-hash": "^2.2.0",
+ "postcss-js": "^3.0.3",
+ "postcss-load-config": "^3.1.0",
+ "postcss-nested": "5.0.5",
+ "postcss-selector-parser": "^6.0.6",
+ "postcss-value-parser": "^4.1.0",
+ "pretty-hrtime": "^1.0.3",
+ "purgecss": "^4.0.3",
+ "quick-lru": "^5.1.1",
+ "reduce-css-calc": "^2.1.8",
+ "resolve": "^1.20.0",
+ "tmp": "^0.2.1"
+ },
+ "dependencies": {
+ "glob-parent": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.1.tgz",
+ "integrity": "sha512-kEVjS71mQazDBHKcsq4E9u/vUzaLcw1A8EtUeydawvIWQCJM0qQ08G1H7/XTjFUulla6XQiDOG6MXSaG0HDKog==",
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ }
+ }
+ },
+ "tmp": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
+ "requires": {
+ "rimraf": "^3.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ },
+ "typescript": {
+ "version": "4.3.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
+ "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
+ "devOptional": true
+ },
+ "universalify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
+ },
+ "yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="
+ }
+ }
+}
diff --git a/internal/web/package.json b/internal/web/package.json
new file mode 100644
index 00000000..b2c51f65
--- /dev/null
+++ b/internal/web/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "exatorrent",
+ "scripts": {
+ "build": "node ./esbuild.config.js",
+ "watch": "node ./esbuild.config.js -w",
+ "format": "prettier --write --plugin-search-dir=. ."
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/varbhat/exatorrent.git"
+ },
+ "author": "varbhat",
+ "license": "GPL-3.0-or-later",
+ "bugs": {
+ "url": "https://github.com/varbhat/exatorrent/issues"
+ },
+ "homepage": "https://github.com/varbhat/exatorrent#readme",
+ "private": true,
+ "type": "module",
+ "devDependencies": {
+ "@tsconfig/svelte": "^2.0.1",
+ "prettier": "^2.3.2",
+ "prettier-plugin-svelte": "^2.3.1",
+ "svelte-check": "^2.2.5",
+ "typescript": "^4.3.5"
+ },
+ "dependencies": {
+ "slocation": "latest",
+ "esbuild": "^0.12.22",
+ "esbuild-svelte": "^0.5.4",
+ "autoprefixer": "^10.3.2",
+ "@tailwindcss/forms": "^0.3.3",
+ "postcss": "^8.3.6",
+ "tailwindcss": "^2.2.7",
+ "svelte-preprocess": "^4.8.0",
+ "svelte": "latest"
+ }
+}
diff --git a/internal/web/src/Index.svelte b/internal/web/src/Index.svelte
new file mode 100644
index 00000000..68786c02
--- /dev/null
+++ b/internal/web/src/Index.svelte
@@ -0,0 +1,69 @@
+
+
+
+ exatorrent
+
+
+
+{#if $isDisConnected === false && $slocation.pathname !== '/signin' && $slocation.pathname !== '/file'}
+
+{/if}
+
+{#if $isDisConnected === true && $slocation.pathname !== '/signin' && $slocation.pathname !== '/file'}
+
+{:else if $slocation.pathname === '/'}
+
+{:else if $slocation.pathname === '/signin'}
+
+{:else if $slocation.pathname === '/notifications'}
+
+{:else if $slocation.pathname === '/torrents'}
+
+{:else if $slocation.pathname === '/settings'}
+
+{:else if $slocation.pathname === '/file'}
+
+{:else if $slocation.pathname === '/stats' && $isAdmin === true}
+
+{:else if $slocation.pathname === '/users' && $isAdmin === true}
+
+{:else if $slocation.pathname.startsWith('/user/') && $isAdmin === true}
+
+{:else if $slocation.pathname.startsWith('/torrent/')}
+
+{:else if $slocation.pathname === '/about'}
+
+{:else}
+
+{/if}
+
+
diff --git a/internal/web/src/index.html b/internal/web/src/index.html
new file mode 100644
index 00000000..b1a0d614
--- /dev/null
+++ b/internal/web/src/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/internal/web/src/index.ts b/internal/web/src/index.ts
new file mode 100644
index 00000000..cf1283f6
--- /dev/null
+++ b/internal/web/src/index.ts
@@ -0,0 +1,5 @@
+import Index from './Index.svelte';
+
+new Index({
+ target: document.getElementById('app')
+});
diff --git a/internal/web/src/partials/About.svelte b/internal/web/src/partials/About.svelte
new file mode 100644
index 00000000..adf2fed5
--- /dev/null
+++ b/internal/web/src/partials/About.svelte
@@ -0,0 +1,23 @@
+
+
+
+
exatorrent is torrent client
+
License: GPLv3
+
Version: {$versionstr}
+
+
diff --git a/internal/web/src/partials/Disconnect.svelte b/internal/web/src/partials/Disconnect.svelte
new file mode 100644
index 00000000..60706152
--- /dev/null
+++ b/internal/web/src/partials/Disconnect.svelte
@@ -0,0 +1,45 @@
+
+
+
+
+
Disconnected
+
+
+
{
+ Connect();
+ }}
+ >
+
+
+
+ Reconnect
+
+
+
{
+ SignOut();
+ }}
+ >
+
+
+
+ Sign Out
+
+
+
diff --git a/internal/web/src/partials/File.svelte b/internal/web/src/partials/File.svelte
new file mode 100644
index 00000000..fae77e87
--- /dev/null
+++ b/internal/web/src/partials/File.svelte
@@ -0,0 +1,90 @@
+
+
+
+
+
{
+ history.length > 2 ? history.back() : slocation.goto('/');
+ }}
+ >
+
+
+
+
+
+
{
+ slocation.goto('/');
+ }}
+ >
+ exatorrent
+
+
+
+
+
+
+
+ {#if ft === 'video'}
+
+ {:else if ft === 'audio'}
+
+ {/if}
+
+
+
{$fsfileinfo?.name}
+
({fileSize($fsfileinfo?.size)})
+
+
+
+ {#if ft === 'video' || ft === 'audio'}
+
+ Play in VLC
+
+
+
+ Play in MPV
+
+ {/if}
+
+
+
+
+ Download
+
+
diff --git a/internal/web/src/partials/Index.svelte b/internal/web/src/partials/Index.svelte
new file mode 100644
index 00000000..f6486159
--- /dev/null
+++ b/internal/web/src/partials/Index.svelte
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+ {#if ismetainfo}
+
+ {:else}
+
+
+
+
+
+ Select a Torrent File
+
+ readtrnt(e)} id="torrentfile" name="torrentfile" type="file" class="hidden" />
+
+ {/if}
+
+
+ {#if ismetainfo}
+
+ {:else}
+
+ {/if}
+
+
+
+
+
Add
+
+
+
+
+
+
+
{
+ slocation.goto('/torrents');
+ }}
+ >
+
+
+
+ Torrents
+
+
{
+ slocation.goto('/settings');
+ }}
+ >
+
+
+
+
+ Settings
+
+
+ {#if $isAdmin}
+
+
{
+ slocation.goto('/users');
+ }}
+ >
+
+
+
+ Users
+
+
{
+ slocation.goto('/stats');
+ }}
+ >
+
+
+
+ Stats
+
+
+ {/if}
+
diff --git a/internal/web/src/partials/Notifications.svelte b/internal/web/src/partials/Notifications.svelte
new file mode 100644
index 00000000..dac3635e
--- /dev/null
+++ b/internal/web/src/partials/Notifications.svelte
@@ -0,0 +1,41 @@
+
+
+
+ {#if $resplist?.has === true}
+
{
+ resplist.set({ has: false, data: [] });
+ }}
+ >
+ Clear All
+
+ {#each $resplist?.data as resp}
+
{
+ if (typeof resp?.infohash === 'string' && resp?.infohash.length > 0) {
+ slocation.goto(`/torrent/${resp?.infohash}`);
+ }
+ }}
+ >
+
+ {resp?.message}
+
+
+
+ {resp?.type}
+ {resp?.state}
+ {resp?.infohash ? `( ${resp?.infohash} )` : ''}
+
+
+
+ {/each}
+ {:else}
+
No Notifications
+ {/if}
+
diff --git a/internal/web/src/partials/ProgStat.svelte b/internal/web/src/partials/ProgStat.svelte
new file mode 100644
index 00000000..cca5e5e6
--- /dev/null
+++ b/internal/web/src/partials/ProgStat.svelte
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ {fileSize(bytescompleted)} / {fileSize(length)} (Off. {offset})
+
+
+ {progress?.toLocaleString('en-US', {
+ maximumFractionDigits: 2,
+ minimumFractionDigits: 2
+ })} %
+
+
+
diff --git a/internal/web/src/partials/Settings.svelte b/internal/web/src/partials/Settings.svelte
new file mode 100644
index 00000000..ea517304
--- /dev/null
+++ b/internal/web/src/partials/Settings.svelte
@@ -0,0 +1,385 @@
+
+
+
+
+
+
+
+ User Settings {#if localStorage.getItem('exausertype') === 'admin'} admin {/if}
+
+
+
+
+
+
+ {#if editmode === false}
+
+
{
+ editmode = true;
+ }}
+ >
+
+
+
+
+ {:else if editmode === true}
+
+
{
+ editmode = false;
+ }}
+ >
+
+
+
+
+
+
+
+
+
+ {/if}
+
+
+
Don't Start Torrents on Add
+
+
+ {#if $isAdmin === true}
+
+ {/if}
+
+
+
+
+
+
+
+
+
+ {#if diskstatsOpen === true}
+
{
+ Send({
+ command: 'diskusage'
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if diskstatsOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if diskstatsOpen === true}
+
+ Total: {fileSize($diskstats?.total)}
+
+
+ Free: {fileSize($diskstats?.free)}
+
+
+ Used: {fileSize($diskstats?.used)} ({$diskstats?.usedPercent} %)
+
+ {/if}
+
+
+
+
+{#if $isAdmin === true}
+
+
+
+
+
+ {#if miscOpen === true}
+
{
+ Send({
+ command: 'nooftrackersintrackerdb',
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if miscOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if miscOpen === true}
+
+ Total Number of Trackers in TrackerDB: {$nooftrackersintrackerdb}
+
+
{
+ Send({
+ command: 'deletetrackersintrackerdb',
+ data1: 'all',
+ aop: 1
+ });
+ }}>Delete All Trackers in TrackerDB
+
{
+ Send({
+ command: 'trackerdbrefresh',
+ aop: 1
+ });
+ }}>Refresh TrackerDB
+
{
+ Send({
+ command: 'stoponseedratio',
+ aop: 1
+ });
+ }}>Seed Ratio Check
+
+
+ {
+ Send({
+ command: 'deletetrackersintrackerdb',
+ data1: trdelno,
+ aop: 1
+ });
+ }}
+ >
+ Delete Trackers
+
+
+
+
+ {
+ Send({
+ command: 'stoponseedratio',
+ data1: srno,
+ aop: 1
+ });
+ }}
+ >
+ Stop Torrents
+
+
+ {/if}
+
+
+
+
+
+
+
+
+
+ {#if engsettingsOpen === true}
+
{
+ if (engsettingsstring?.length === 0) {
+ alert('Empty Config!');
+ } else {
+ let b64config = window.btoa(engsettingsstring);
+ Send({
+ command: 'updateconfig',
+ data1: b64config,
+ aop: 1
+ });
+ }
+ }}>Update
+
{
+ Send({
+ command: 'getconfig',
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if engsettingsOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if engsettingsOpen === true && $engconfig != null}
+
+ {/if}
+
+
+
+{/if}
+
+
+ {
+ slocation.goto('/about');
+ }}>About exatorrent
+
diff --git a/internal/web/src/partials/Signin.svelte b/internal/web/src/partials/Signin.svelte
new file mode 100644
index 00000000..7696b316
--- /dev/null
+++ b/internal/web/src/partials/Signin.svelte
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
Sign in to your account
+
+
+
+
Username
+
+
+
+
Password
+
+
+
+
+
+ {#if pwvisible}
+
+ {:else}
+
+
+ {/if}
+
+
+
+
+
Sign in
+
+
+
diff --git a/internal/web/src/partials/Stats.svelte b/internal/web/src/partials/Stats.svelte
new file mode 100644
index 00000000..7d6fc9db
--- /dev/null
+++ b/internal/web/src/partials/Stats.svelte
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+ {#if deviceinfoOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if deviceinfoOpen === true}
+ {#if $hasMachinfo === true}
+
Arch: {$machinfo?.arch}
+
CPU Model: {$machinfo?.cpumodel}
+
Go Version: {$machinfo?.goversion}
+
Hostname: {$machinfo?.hostname}
+
CPU No: {$machinfo?.numbercpu}
+
OS: {$machinfo?.os}
+
Platform: {$machinfo?.platform}
+
Started at {new Date($machinfo?.startedat)?.toLocaleString()}
+
Total Mem: {fileSize($machinfo?.totalmem)}
+ {/if}
+ {/if}
+
+
+
+
+
+
+
+
+
+ {#if devicestatsOpen === true}
+
{
+ Send({ command: 'machstats', aop: 1 });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if devicestatsOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if devicestatsOpen === true}
+
CPU Cycles: {$machstats?.cpucycles}
+
Disk Free: {$machstats?.diskfree}
+
Disk Percent: {$machstats?.diskpercent} %
+
Memory Percent: {$machstats?.mempercent} %
+
Go Mem: {fileSize($machstats?.gomem)}
+
Go Mem(sys): {fileSize($machstats?.gomemsys)}
+
Goroutines: {$machstats?.goroutines}
+ {/if}
+
+
+
+
+
+
+
+
+
Torrent Client Status
+
+
+ {#if torcstatsOpen === true}
+
{
+ Send({ command: 'torcstatus', aop: 1 });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if torcstatsOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if torcstatsOpen === true}
+
{$torcstatus}
+ {/if}
+
+
+
diff --git a/internal/web/src/partials/Top.svelte b/internal/web/src/partials/Top.svelte
new file mode 100644
index 00000000..28dfb0bf
--- /dev/null
+++ b/internal/web/src/partials/Top.svelte
@@ -0,0 +1,67 @@
+
+
+
+
+ {#if $slocation.pathname !== '/'}
+
{
+ history.length > 2 ? history.back() : slocation.goto('/');
+ }}
+ >
+
+
+
+
+ {:else}
+
{
+ slocation.goto('/notifications');
+ }}
+ >
+
+
+
+
+ {/if}
+
+
{
+ if ($slocation.pathname === '/') {
+ slocation.goto('/about');
+ } else {
+ slocation.goto('/');
+ }
+ }}
+ >
+ exatorrent
+
+
+
+
+
+
+
+
+
diff --git a/internal/web/src/partials/Torrent.svelte b/internal/web/src/partials/Torrent.svelte
new file mode 100644
index 00000000..c18d859f
--- /dev/null
+++ b/internal/web/src/partials/Torrent.svelte
@@ -0,0 +1,684 @@
+
+
+
+ {$torrentinfo?.name} ({$torrentinfo?.infohash})
+
+
+
+
+
+
+ {#if $adminmode === false}
+
+
{
+ Send({
+ command: 'abandontorrent',
+ data1: infohash
+ });
+ slocation.goto('/');
+ }}
+ >
+
+
+
+ Abandon
+
+
+ {/if}
+
+
+
+
+
+
+ {#if $torrentinfo?.state === 'active' || $torrentinfo?.state === 'inactive'}
+
+
+
+
+ {#if fileProgressOpen === true}
+
{
+ Send({
+ command: 'gettorrentfiles',
+ data1: infohash
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if fileProgressOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if fileProgressOpen === true}
+ {#each $torrentfiles as file (file.path)}
+
+
+
{
+ fileviewpath.set(file?.path);
+ fileviewinfohash.set(infohash);
+ slocation.goto('/file');
+ }}
+ >
+
+ {file?.displaypath}
+
+
+
+ {#if file?.priority === 1}
+
{
+ Send({
+ command: 'stopfile',
+ data1: infohash,
+ data2: file?.path,
+ ...($adminmode === true && {
+ aop: 1
+ })
+ });
+ setTimeout(() => {
+ Send({
+ command: 'gettorrentfiles',
+ data1: infohash
+ });
+ }, 1000);
+ }}
+ >
+
+
+
+
+ {:else if file?.priority === 0}
+
{
+ Send({
+ command: 'startfile',
+ data1: infohash,
+ data2: file?.path,
+ ...($adminmode === true && {
+ aop: 1
+ })
+ });
+ setTimeout(() => {
+ Send({
+ command: 'gettorrentfiles',
+ data1: infohash
+ });
+ }, 1000);
+ }}
+ >
+
+
+
+
+
+ {/if}
+
+
+
+
+ {/each}
+ {/if}
+
+
+ {/if}
+
+
+
+
+
+ {#if browseFilesOpen === true}
+
{
+ Send({
+ command: 'getfsdirinfo',
+ data1: infohash
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if browseFilesOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if browseFilesOpen === true}
+ {#each $fsdirinfo as file (file.path)}
+
+
+
{
+ if (file?.isdir === true) {
+ Send({
+ command: 'getfsdirinfo',
+ data1: infohash,
+ data2: file?.path
+ });
+ } else if (file?.isdir === false) {
+ fileviewpath.set(file?.path);
+ fileviewinfohash.set(infohash);
+ slocation.goto('/file');
+ }
+ }}
+ >
+
+ {file?.name}
+
+
+
+
+
+
+
+ {#if file?.isdir === true}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/if}
+
+ {#if $torrentinfo?.state === 'removed'}
+
{
+ Send({
+ command: 'deletefilepath',
+ data1: infohash,
+ data2: file?.path,
+ ...($adminmode === true && {
+ aop: 1
+ })
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+
+
+ {/each}
+ {/if}
+
+
+
+ {#if $torrentinfo?.state === 'active' || $torrentinfo?.state === 'inactive' || $torrentinfo?.state === 'loading'}
+
+
+
+
+ {#if trntStatsOpen === true}
+
{
+ Send({
+ command: 'gettorrentstats',
+ data1: infohash
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if trntStatsOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if trntStatsOpen === true}
+
+ Total Peers: {$torrentstats?.TotalPeers}
+
+
+ Pending Peers: {$torrentstats?.PendingPeers}
+
+
+ Active Peers: {$torrentstats?.ActivePeers}
+
+
+ Connected Seeders: {$torrentstats?.ConnectedSeeders}
+
+
+ Half Open Peers: {$torrentstats?.HalfOpenPeers}
+
+
+ Written: {fileSize($torrentstats?.BytesWritten)}
+
+
+ WrittenData: {fileSize($torrentstats?.BytesWrittenData)}
+
+
+ Read: {fileSize($torrentstats?.BytesRead)}
+
+
+ ReadData: {fileSize($torrentstats?.BytesReadData)}
+
+
+ ReadUsefulData: {fileSize($torrentstats?.BytesReadUsefulData)}
+
+
+ Seed Ratio: {($torrentstats?.BytesWrittenData / $torrentstats.BytesReadData).toLocaleString('en-US', {
+ maximumFractionDigits: 5,
+ minimumFractionDigits: 5
+ })}
+
+
+
+ Chunks Written: {$torrentstats?.ChunksWritten}
+
+
+ Chunks Read: {$torrentstats?.ChunksRead}
+
+
+ Chunks Read Useful: {$torrentstats?.ChunksReadUseful}
+
+
+ Chunks Read Wasted: {$torrentstats?.ChunksReadWasted}
+
+
+ Metadata Chunks Read: {$torrentstats?.MetadataChunksRead}
+
+
+ Piece Dirtied Good: {$torrentstats?.PiecesDirtiedGood}
+
+
+ Piece Dirtied Bad: {$torrentstats?.PiecesDirtiedBad}
+
+ {/if}
+
+
+ {/if}
+
+ {#if $isAdmin === true}
+
+
+
+
Users who Own this Torrent
+
+
+ {#if trntUsersOpen === true}
+
{
+ Send({
+ command: 'listusersfortorrent',
+ data1: infohash,
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if trntUsersOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if trntUsersOpen === true}
+ {#each $usersfortorrent as eachuser (eachuser)}
+
+
+
+
+
{
+ Send({
+ command: 'abandontorrent',
+ data1: infohash,
+ data2: eachuser,
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+
+
+ {/each}
+ {/if}
+
+
+ {/if}
+
+
+
+
+
+ {#if miscOpen === true}
+
{
+ Send({
+ command: 'gettorrentinfostat',
+ data1: infohash
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if miscOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if miscOpen === true}
+ {#if $torrentinfo?.state === 'active' || $torrentinfo?.state === 'inactive' || $torrentinfo?.state === 'loading'}
+
+ Added at {$torctime.addedat}
+
+
+ {#if $torrentinfo?.state === 'active'}Started At {$torctime.startedat}{/if}
+
+
+
+
+
+
+ Add Trackers (List)
+
+ readtracker(e)} id="torrentfile" name="torrentfile" type="file" class="hidden" />
+
+
{
+ Send({
+ command: 'gettorrentmetainfo',
+ data1: infohash
+ });
+ }}>Download Torrent File
+ {/if}
+ {#if $isAdmin === true && $adminmode === true}
+
{
+ Send({
+ command: 'changedataload',
+ data1: infohash,
+ data2: 'upload',
+ data3: 'allow',
+ aop: 1
+ });
+ }}>Allow Data Upload
+
{
+ Send({
+ command: 'changedataload',
+ data1: infohash,
+ data2: 'upload',
+ data3: 'disallow',
+ aop: 1
+ });
+ }}>Disallow Data Upload
+
{
+ Send({
+ command: 'changedataload',
+ data1: infohash,
+ data2: 'download',
+ data3: 'allow',
+ aop: 1
+ });
+ }}>Allow Data Download
+
{
+ Send({
+ command: 'changedataload',
+ data1: infohash,
+ data2: 'download',
+ data3: 'disallow',
+ aop: 1
+ });
+ }}>Disallow Data Download
+ {/if}
+ {/if}
+
+
+
diff --git a/internal/web/src/partials/TorrentCard.svelte b/internal/web/src/partials/TorrentCard.svelte
new file mode 100644
index 00000000..9215882f
--- /dev/null
+++ b/internal/web/src/partials/TorrentCard.svelte
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
{infohash}
+
+ {#if state === 'active' || state === 'inactive'}{#if seeding === true}(Seeding)
+ {/if}{fileSize(bytesmissing == null ? 0 : bytesmissing)} R.{/if}
+
+
+ {#if state !== 'removed'}
+
{
+ if (isTorrentPage === false) {
+ slocation.goto(`/torrent/${infohash}`);
+ }
+ }}
+ >
+ {name}
+
+ {/if}
+
+
+
+ {#if state === 'active' || state === 'inactive'}
+
+
+
+
{fileSize(bytescompleted)} / {fileSize(length)}
+
+ {progpercentage?.toLocaleString('en-US', {
+ maximumFractionDigits: 2,
+ minimumFractionDigits: 2
+ })} %
+
+
+
+ {/if}
+
+
+
+ {#if state === 'active' || state === 'loading' || state === 'inactive'}
+
{
+ Send({
+ command: 'removetorrent',
+ data1: infohash,
+ ...($adminmode === true && { aop: 1 })
+ });
+ }}
+ >
+
+
+
+ Remove
+
+ {:else if state === 'removed'}
+
{
+ Send({
+ command: 'deletetorrent',
+ data1: infohash,
+ ...($adminmode === true && { aop: 1 })
+ });
+ if (isTorrentPage === true) {
+ slocation.goto('/');
+ } else if (isTorrentPage === false) {
+ refresh();
+ Send({ command: 'gettorrents' });
+ }
+ }}
+ >
+
+
+
+ Delete
+
+ {/if}
+
+ {#if state === 'loading'}
+
+
+
+
+
+ Loading
+
+ {:else if state === 'active'}
+
{
+ Send({
+ command: 'stoptorrent',
+ data1: infohash,
+ ...($adminmode === true && { aop: 1 })
+ });
+ refresh();
+ }}
+ >
+
+
+
+ Stop
+
+ {:else if state === 'removed'}
+
{
+ Send({
+ command: 'addinfohash',
+ data1: infohash
+ });
+ refresh();
+ }}
+ >
+
+
+
+ Add
+
+ {:else if state === 'inactive'}
+
{
+ Send({
+ command: 'starttorrent',
+ data1: infohash,
+ ...($adminmode === true && { aop: 1 })
+ });
+ refresh();
+ }}
+ >
+
+
+
+
+ Start
+
+ {/if}
+
+ {#if isTorrentPage === false}
+
{
+ slocation.goto(`/torrent/${infohash}`);
+ }}
+ >
+
+
+
+ View
+
+ {:else}
+
{
+ Send({
+ command: 'toggletorrentlock',
+ data1: infohash
+ });
+ setTimeout(() => {
+ Send({ command: 'istorrentlocked', data1: infohash });
+ }, 1000);
+ }}
+ >
+ {#if locked === true}
+
+
+
+ Locked
+ {:else}
+
+
+
+ Unlocked
+ {/if}
+
+ {/if}
+
+
diff --git a/internal/web/src/partials/Torrents.svelte b/internal/web/src/partials/Torrents.svelte
new file mode 100644
index 00000000..e81288ea
--- /dev/null
+++ b/internal/web/src/partials/Torrents.svelte
@@ -0,0 +1,49 @@
+
+
+
+ {#if $terrormsg?.has === false}
+ {#if $isAdmin === true && $adminmode === true}
+
+ {/if}
+
+ {#each $downloadslist?.data as dl (dl.infohash)}
+
+ {/each}
+ {:else}
+
{$terrormsg?.msg}
+ {/if}
+
diff --git a/internal/web/src/partials/User.svelte b/internal/web/src/partials/User.svelte
new file mode 100644
index 00000000..e2492424
--- /dev/null
+++ b/internal/web/src/partials/User.svelte
@@ -0,0 +1,37 @@
+
+
+
+ {#if Array.isArray($torrentsforuser) && $torrentsforuser?.length}
+ {#each $torrentsforuser as trnt (trnt)}
+
{
+ if (typeof trnt === 'string' && trnt?.length > 0) {
+ slocation.goto(`/torrent/${trnt}`);
+ }
+ }}
+ >
+
+ {trnt}
+
+
+ {/each}
+ {:else}
+
User owns no Torrents
+ {/if}
+
diff --git a/internal/web/src/partials/Useredit.svelte b/internal/web/src/partials/Useredit.svelte
new file mode 100644
index 00000000..f68fd79e
--- /dev/null
+++ b/internal/web/src/partials/Useredit.svelte
@@ -0,0 +1,120 @@
+
+
+
+
+
+
{username}
+
+
{
+ usereditmode = !usereditmode;
+ }}
+ >
+
+
+
+
+
+
{
+ Send({
+ command: 'removeuser',
+ data1: username,
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+
+
{
+ slocation.goto(`/user/${username}`);
+ }}
+ >
+
+
+
+
+
+
+
+
+ {#if usereditmode === true}
+
+
+
{
+ Send({
+ command: 'revoketoken',
+ data1: username,
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+
+ User
+ Disabled
+ Admin
+
+
Update
+
+ {/if}
+
diff --git a/internal/web/src/partials/Users.svelte b/internal/web/src/partials/Users.svelte
new file mode 100644
index 00000000..f03da8e5
--- /dev/null
+++ b/internal/web/src/partials/Users.svelte
@@ -0,0 +1,273 @@
+
+
+
+
+
+
+
+ {#if userconnlistOpen === true}
+
{
+ Send({
+ command: 'listuserconns',
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if userconnlistOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if userconnlistOpen === true}
+ {#each $userconnlist as eachuser (eachuser?.username)}
+
+
+
+
+
+ {eachuser?.username}
+ {#if eachuser?.isadmin === true}(admin){/if}
+
+
+
+
{
+ Send({
+ command: 'kickuser',
+ data1: eachuser?.username,
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+
+
+
+
+ {/each}
+ {/if}
+
+
+
+
+
+
+
+
+
+ {#if manageUsersOpen === true}
+
{
+ Send({
+ command: 'getusers',
+ aop: 1
+ });
+ }}
+ >
+
+
+
+
+ {/if}
+
+
+ {#if manageUsersOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if manageUsersOpen === true}
+ {#each $userlist as eachuser (eachuser?.Username)}
+
+ {/each}
+ {/if}
+
+
+
+
+
+
+
+
+
+
+ {#if addUserOpen === true}
+
+
+
+ {:else}
+
+
+
+ {/if}
+
+
+
+
+ {#if addUserOpen === true}
+
+
Username
+
+
+
+
Password
+
+
+
+
+
+ {#if pwvisible}
+
+ {:else}
+
+
+ {/if}
+
+
+
+
+
+ User
+ Disabled
+ Admin
+
+
+
Add User
+
+ {/if}
+
+
+
diff --git a/internal/web/src/partials/core.ts b/internal/web/src/partials/core.ts
new file mode 100644
index 00000000..5ec1e59d
--- /dev/null
+++ b/internal/web/src/partials/core.ts
@@ -0,0 +1,517 @@
+import { writable, get } from 'svelte/store';
+import type { Writable } from 'svelte/store';
+import { slocation } from 'slocation';
+
+export interface DlObject {
+ infohash: string;
+ name?: string;
+ bytescompleted?: number;
+ bytesmissing?: number;
+ length?: number;
+ state: string;
+ seeding?: boolean;
+}
+
+interface DlObject2 {
+ locked: boolean;
+ addedat: string;
+ startedat: string;
+}
+
+interface RespObject {
+ type: string;
+ state: string;
+ infohash?: string;
+ message: string;
+}
+
+interface FsFile {
+ name: string;
+ path: string;
+ size: number;
+ isdir: boolean;
+}
+
+interface TorrentFile {
+ bytescompleted: number;
+ displaypath: string;
+ length: number;
+ offset: number;
+ path: string;
+ priority: number;
+}
+
+interface DevInfo {
+ arch: string;
+ numbercpu: number;
+ cpumodel: string;
+ hostname: string;
+ platform: string;
+ os: string;
+ totalmem: number;
+ goversion: string;
+ startedat: string;
+}
+interface DevStats {
+ cpucycles: number;
+ diskfree: number;
+ diskpercent: number;
+ mempercent: number;
+ gomem: number;
+ gomemsys: number;
+ goroutines: number;
+}
+
+interface TorrentStats {
+ TotalPeers: number;
+ PendingPeers: number;
+ ActivePeers: number;
+ ConnectedSeeders: number;
+ HalfOpenPeers: number;
+ BytesWritten: number;
+ BytesWrittenData: number;
+ BytesRead: number;
+ BytesReadData: number;
+ BytesReadUsefulData: number;
+ ChunksWritten: number;
+ ChunksRead: number;
+ ChunksReadUseful: number;
+ ChunksReadWasted: number;
+ MetadataChunksRead: number;
+ PiecesDirtiedGood: number;
+ PiecesDirtiedBad: number;
+}
+
+interface UserConn {
+ username: string;
+ isadmin: boolean;
+ contime: string;
+}
+
+interface Userrepr {
+ Username: string;
+ Token: string;
+ UserType: number;
+ CreatedAt: string;
+}
+
+interface TorcSettings {
+ TUploadRateLimiter: number;
+ TDownloadRateLimiter: number;
+ DisableLocalCache: boolean;
+ OnlineCacheURL: string;
+ TrackerRefresh: number;
+ TrackerListURLs: string[];
+ DisAllowTrackersUser: boolean;
+ DisAllowTrackersCache: boolean;
+ GlobalSeedRatio: number;
+ SRRefresh: number;
+ DontRemoveCacheInfo: boolean;
+}
+
+interface DiskStats {
+ total: number;
+ free: number;
+ used: number;
+ usedPercent: number;
+}
+
+export let socket: WebSocket;
+export const isSignedIn = writable(false);
+export const isDisConnected = writable(false);
+export const filepagediscon = writable(false);
+
+export const dontstart = writable('false');
+export const isAdmin = writable(false);
+export const downloadslist: Writable<{ has: boolean; data: DlObject[] }> = writable({
+ has: false,
+ data: []
+});
+export const torrentinfo: Writable = writable({} as DlObject);
+export const torrentinfostat: Writable = writable({} as DlObject2);
+export const istrntlocked: Writable = writable(false);
+export const resplist: Writable<{ has: boolean; data: RespObject[] }> = writable({
+ has: false,
+ data: []
+});
+
+export const torrentstats: Writable = writable({} as TorrentStats);
+
+export const torcstatus: Writable = writable({});
+export const machinfo: Writable = writable({} as DevInfo);
+export const machstats: Writable = writable({} as DevStats);
+
+export const fsdirinfo: Writable = writable([]);
+export const torrentfiles: Writable = writable([]);
+
+export const fileviewpath: Writable = writable('');
+export const fileviewinfohash: Writable = writable('');
+
+export const fsfileinfo: Writable = writable({} as FsFile);
+export const torrentfileinfo: Writable = writable({} as TorrentFile);
+export const adminmode: Writable = writable(false);
+
+export const usersfortorrent: Writable = writable([] as string[]);
+export const torrentsforuser: Writable = writable([] as string[]);
+
+export const userconnlist: Writable = writable([] as UserConn[]);
+export const userlist: Writable = writable([] as Userrepr[]);
+export const engconfig: Writable = writable({} as TorcSettings);
+
+export const torctime: Writable<{ addedat: string; startedat: string }> = writable({ addedat: '', startedat: '' });
+
+export const diskstats: Writable = writable({} as DiskStats);
+
+export const nooftrackersintrackerdb: Writable = writable(0);
+
+export const hasMachinfo: Writable = writable(false);
+
+export const terrormsg: Writable<{ has: boolean; msg: string }> = writable({ has: true, msg: '' });
+export const versionstr: Writable = writable('');
+export const versionchecked: Writable = writable(false);
+
+let curobj: Location;
+let un = '';
+let pw = '';
+let firsttimecon = true;
+
+let wonopenfn = () => {
+ firsttimecon = false;
+ isDisConnected.set(false);
+ localStorage.getItem('exausertype') === 'admin' ? isAdmin.set(true) : isAdmin.set(false);
+ curobj = get(slocation);
+ if (curobj?.pathname === '/signin') {
+ slocation.goto('/');
+ }
+};
+
+let wonclosefn = () => {
+ isDisConnected.set(true);
+};
+
+let werrorfn = () => {
+ if (firsttimecon === false && location.pathname !== '/signin') {
+ alert('Error Connecting');
+ return;
+ }
+ try {
+ fetch('/api/auth', {
+ method: 'POST',
+ body: JSON.stringify({ data1: un, data2: pw })
+ })
+ .then((res) => {
+ if (res.status >= 200 && res.status <= 299) {
+ return res.json();
+ } else {
+ alert('Error Authenticating');
+ throw new Error('Error Authenticating');
+ }
+ })
+ .then((res) => {
+ localStorage.setItem('exasession', res?.session);
+ localStorage.setItem('exausertype', res?.usertype);
+
+ if (!(localStorage.getItem('dontstart') == undefined)) {
+ localStorage.setItem('dontstart', 'false');
+ } else {
+ dontstart.set(localStorage.getItem('dontstart'));
+ }
+
+ socket = new WebSocket((location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + '/api/socket');
+ socket.onopen = wonopenfn;
+ socket.onmessage = SocketHandler;
+ socket.onclose = wonclosefn;
+ socket.onerror = werrorfn;
+ isSignedIn.set(true);
+ });
+ } catch (err) {
+ console.log(err);
+ SignOut();
+ return;
+ }
+};
+
+export let Connect = () => {
+ un = localStorage.getItem('exausername');
+ pw = localStorage.getItem('exapassword');
+
+ if (un != '' && un != undefined && un != null) {
+ if (pw != '' && pw != undefined && pw != null) {
+ console.log('Signing In');
+ } else {
+ slocation.goto('/signin');
+ return;
+ }
+ } else {
+ slocation.goto('/signin');
+ return;
+ }
+
+ if (!(un.length > 5) || !(pw.length > 5)) {
+ alert('Invalid Credentials');
+ return;
+ }
+
+ if (socket != null || socket != undefined) {
+ socket?.close();
+ }
+
+ socket = new WebSocket((window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host + '/api/socket');
+
+ socket.onopen = wonopenfn;
+ socket.onmessage = SocketHandler;
+ socket.onclose = wonclosefn;
+ socket.onerror = werrorfn;
+};
+
+export let SocketHandler = (event: MessageEvent) => {
+ console.log('On Message:', event.data);
+ let msg = JSON.parse(event.data);
+ console.log(msg);
+
+ switch (msg.type) {
+ case 'resp':
+ if (!(msg == null)) {
+ if (msg?.state === 'error' || msg?.state === 'success') {
+ alert(msg?.message);
+ }
+ let rl = get(resplist);
+ resplist.set({ has: true, data: [msg, ...rl?.data] as RespObject[] });
+ } else {
+ resplist.set({ has: false, data: [] as RespObject[] });
+ }
+ break;
+ case 'nfn':
+ if (!(msg == null)) {
+ let rl = get(resplist);
+ resplist.set({ has: true, data: [msg, ...rl?.data] as RespObject[] });
+ } else {
+ resplist.set({ has: false, data: [] as RespObject[] });
+ }
+ break;
+ case 'torrentstream':
+ if (!(msg.data == null)) {
+ terrormsg.set({ has: false, msg: '' });
+ downloadslist.set({ has: true, data: msg.data as DlObject[] });
+ } else {
+ terrormsg.set({ has: true, msg: 'No Torrents' });
+ downloadslist.set({ has: true, data: [] as DlObject[] });
+ }
+ break;
+ case 'torrentinfo':
+ if (!(msg.data == null)) {
+ terrormsg.set({ has: false, msg: '' });
+ torrentinfo.set({
+ infohash: msg.data?.infohash,
+ name: msg.data?.name,
+ bytescompleted: msg.data?.bytescompleted,
+ bytesmissing: msg.data?.bytesmissing,
+ length: msg.data?.length,
+ state: msg.data?.state,
+ seeding: msg.data?.seeding
+ } as DlObject);
+ } else {
+ terrormsg.set({ has: true, msg: 'No Torrent Info' });
+ torrentinfo.set({} as DlObject);
+ }
+ break;
+ case 'torrentinfostat':
+ if (!(msg.data == null)) {
+ torctime.set({ addedat: new Date(msg.data?.AddedAt)?.toLocaleString(), startedat: new Date(msg.data?.StartedAt)?.toLocaleString() });
+ } else {
+ torctime.set({ addedat: '', startedat: '' });
+ }
+ break;
+ case 'torrentstats':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ torrentstats.set(msg.data as TorrentStats);
+ } else {
+ torrentstats.set({} as TorrentStats);
+ }
+ break;
+ case 'fsdirinfo':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ fsdirinfo.set(msg.data as FsFile[]);
+ } else {
+ fsdirinfo.set([]);
+ }
+ break;
+ case 'torrentfiles':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ torrentfiles.set(msg.data as TorrentFile[]);
+ } else {
+ torrentfiles.set([]);
+ }
+ break;
+ case 'torrentmetainfo':
+ const linkSource = `data:application/x-bittorrent;base64,${msg?.data}`;
+ const downloadLink = document.createElement('a');
+ downloadLink.href = linkSource;
+ downloadLink.download = `${msg?.infohash}.torrent`;
+ downloadLink.click();
+ break;
+ case 'torrentfileinfo':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ torrentfileinfo.set(msg.data as TorrentFile);
+ } else {
+ torrentfileinfo.set({} as TorrentFile);
+ }
+ break;
+ case 'fsfileinfo':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ fsfileinfo.set(msg.data as FsFile);
+ } else {
+ fsfileinfo.set({} as FsFile);
+ }
+ if (get(filepagediscon) === true) {
+ socket?.readyState === WebSocket.OPEN ? socket?.close() : console.log('socket already closed');
+ }
+ break;
+ case 'usersfortorrent':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ usersfortorrent.set(msg.data as string[]);
+ } else {
+ usersfortorrent.set([]);
+ }
+ break;
+ case 'torrentsforuser':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ torrentsforuser.set(msg.data as string[]);
+ } else {
+ torrentsforuser.set([]);
+ }
+ break;
+ case 'torcstatus':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ torcstatus.set(msg.data as TorrentStats);
+ } else {
+ torcstatus.set({});
+ }
+ break;
+ case 'torrentlockstate':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ istrntlocked.set(msg.data === true);
+ } else {
+ istrntlocked.set(false);
+ }
+ break;
+ case 'userconn':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ userconnlist.set(msg.data as UserConn[]);
+ } else {
+ userconnlist.set([] as UserConn[]);
+ }
+ break;
+ case 'users':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ userlist.set(msg.data as Userrepr[]);
+ } else {
+ userlist.set([] as Userrepr[]);
+ }
+ break;
+ case 'engconf':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ engconfig.set(msg.data as TorcSettings);
+ } else {
+ engconfig.set({} as TorcSettings);
+ }
+ break;
+ case 'machinfo':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ hasMachinfo.set(true);
+ machinfo.set(msg.data as DevInfo);
+ } else {
+ machinfo.set({} as DevInfo);
+ }
+ break;
+ case 'machstats':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ machstats.set(msg.data as DevStats);
+ } else {
+ machstats.set({} as DevStats);
+ }
+ break;
+ case 'diskusage':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ diskstats.set(msg.data as DiskStats);
+ } else {
+ diskstats.set({} as DiskStats);
+ }
+ break;
+ case 'version':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ versionchecked.set(true);
+ versionstr.set(msg.data as string);
+ } else {
+ versionstr.set('');
+ }
+ break;
+ case 'nooftrackersintrackerdb':
+ console.log(msg);
+ if (!(msg.data == null)) {
+ nooftrackersintrackerdb.set(msg.data as number);
+ } else {
+ nooftrackersintrackerdb.set(0);
+ }
+ break;
+ }
+};
+
+export let SignOut = () => {
+ localStorage.removeItem('exausername');
+ localStorage.removeItem('exapassword');
+ localStorage.removeItem('exasession');
+ localStorage.removeItem('exausertype');
+ localStorage.removeItem('dontstart');
+ // Remove Cookies
+ document.cookie.split(';').forEach((c) => {
+ document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/;SameSite=Lax;');
+ });
+ isDisConnected.set(false);
+ slocation.goto('/signin');
+};
+
+export let Send = (value: any) => {
+ console.log('sending ', value);
+ if (socket?.readyState === WebSocket.OPEN) {
+ socket.send(JSON.stringify(value));
+ }
+};
+
+export let fileSize = (b: number) => {
+ let u = 0,
+ s = 1024;
+ while (b >= s || -b >= s) {
+ b /= s;
+ u++;
+ }
+ return (u ? b.toFixed(3) + ' ' : b) + ' KMGTPEZY'[u] + 'B';
+};
+
+export let fileType = (filepath: string): string => {
+ let ext = filepath.split('.').pop();
+ let vidext = ['webm', 'mkv', 'flv', 'vob', 'ogv', 'ogg', 'rrc', 'gifv', 'mng', 'mov', 'avi', 'qt', 'wmv', 'yuv', 'rm', 'asf', 'amv', 'mp4', 'm4p', 'm4v', 'mpg', 'mp2', 'mpeg', 'mpe', 'mpv', 'm4v', 'svi', '3gp', '3g2', 'mxf', 'roq', 'nsv', 'flv', 'f4v', 'f4p', 'f4a', 'f4b'];
+ let audext = ['aac', 'aiff', 'ape', 'au', 'flac', 'gsm', 'it', 'm3u', 'm4a', 'mid', 'mod', 'mp3', 'mpa', 'pls', 'ra', 's3m', 'sid', 'wav', 'wma', 'xm'];
+ if (vidext.includes(ext)) {
+ return 'video';
+ } else if (audext.includes(ext)) {
+ return 'audio';
+ }
+ return 'unknown';
+};
diff --git a/internal/web/tailwind.config.cjs b/internal/web/tailwind.config.cjs
new file mode 100644
index 00000000..de1f806e
--- /dev/null
+++ b/internal/web/tailwind.config.cjs
@@ -0,0 +1,26 @@
+const colors = require('tailwindcss/colors');
+const { colors: defaultColors } = require('tailwindcss/defaultTheme');
+module.exports = {
+ mode: 'jit',
+ purge: {
+ enabled: true,
+ content: ['./src/*.{html,js,svelte,ts}', './src/**/*.{html,js,svelte,ts}']
+ },
+ darkMode: 'media',
+ theme: {
+ colors: {
+ ...defaultColors,
+ gray: colors.trueGray,
+ secGray: colors.gray
+ },
+ extend: {}
+ },
+ variants: {
+ extend: {}
+ },
+ plugins: [
+ require('@tailwindcss/forms')({
+ strategy: 'class'
+ })
+ ]
+};
diff --git a/internal/web/tsconfig.json b/internal/web/tsconfig.json
new file mode 100644
index 00000000..19c55ac4
--- /dev/null
+++ b/internal/web/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "@tsconfig/svelte/tsconfig.json",
+ "include": ["src/**/*", "src/node_modules", "src/**/*.d.ts", "src/*", "src/**/*.svelte"],
+ "compilerOptions": {
+ "outDir": "tscheck",
+ "target": "ESNext",
+ "types": ["svelte"]
+ }
+}
diff --git a/internal/web/web.go b/internal/web/web.go
new file mode 100644
index 00000000..5be50c09
--- /dev/null
+++ b/internal/web/web.go
@@ -0,0 +1,30 @@
+package web
+
+import (
+ "embed"
+ "io/fs"
+ "net/http"
+)
+
+//go:embed build/*
+var webUI embed.FS
+
+type webFS struct {
+ Fs http.FileSystem
+}
+
+func (fs *webFS) Open(name string) (http.File, error) {
+ f, err := fs.Fs.Open(name)
+ if err != nil {
+ return fs.Fs.Open("index.html")
+ }
+ return f, err
+}
+
+// FrontEndHandler Provides Handler to Serve Frontend
+var FrontEndHandler http.Handler
+
+func init() {
+ contentStatic, _ := fs.Sub(fs.FS(webUI), "build")
+ FrontEndHandler = http.FileServer(&webFS{Fs: http.FS(contentStatic)})
+}