~ghost08/libphoton

fda3f0592d483c43275bb4c3908e073163387018 — VladimĂ­r Magyar 3 years ago
init
A  => LICENSE +674 -0
@@ 1,674 @@
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 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.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 2021  Vlado Magyar

    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 <https://www.gnu.org/licenses/>.

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:

    <program>  Copyright (C) 2021  Vlado Magyar
    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
<https://www.gnu.org/licenses/>.

  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
<https://www.gnu.org/licenses/why-not-lgpl.html>.

A  => article.go +114 -0
@@ 1,114 @@
package libphoton

import (
	"fmt"
	"image"
	"log"
	"net/http"
	"net/url"
	"time"

	"gioui.org/font/gofont"
	"gioui.org/text"
	"gioui.org/widget"
	"github.com/cixtor/readability"
	"golang.org/x/exp/shiny/materialdesign/icons"
)

var (
	contentLink    *widget.Icon
	fontCollection = gofont.Collection()
	shaper         = text.NewCache(fontCollection)
)

func init() {
	var err error
	contentLink, err = widget.NewIcon(icons.ContentLink)
	if err != nil {
		log.Panic(err)
	}
}

type Article struct {
	*readability.Article
	Link     string
	TopImage image.Image
}

func NewArticle(link string, client *http.Client) (*readability.Article, error) {
	req, err := http.NewRequest("GET", link, nil)
	if err != nil {
		return nil, err
	}
	uri, err := url.Parse(link)
	if err != nil {
		return nil, err
	}

	if client == nil {
		client = &http.Client{
			Timeout: time.Second * 10,
		}
		req.Header.Set("cookie", "__cfduid=d73722d8bb11742b3676371f1c97f19d11517447820")
		req.Header.Set("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36")
	}
	req.Header.Set("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
	req.Header.Set("accept-language", "en-US,en;q=0.9")
	req.Header.Set("host", uri.Host)
	req.Header.Set("authority", uri.Host)
	req.Header.Set("pragma", "no-cache")
	req.Header.Set("connection", "keep-alive")
	req.Header.Set("cache-control", "no-cache")
	req.Header.Set("upgrade-insecure-requests", "1")

	resp, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	if mime := resp.Header.Get("Content-Type"); !isValidContentType(mime) {
		return nil, fmt.Errorf("invalid content-type `%s`", mime)
	}

	a, err := readability.New().Parse(resp.Body, link)
	if err != nil {
		return nil, err
	}
	return &a, nil
}

func isValidContentType(mime string) bool {
	switch mime {
	case "text/html":
		return true
	case "application/rss+xml":
		return true
	case "text/html;charset=utf-8":
		return true
	case "text/html;charset=UTF-8":
		return true
	case "text/html; charset=utf-8":
		return true
	case "text/html; charset=UTF-8":
		return true
	case "text/html; charset=iso-8859-1":
		return true
	case "text/html; charset=ISO-8859-1":
		return true
	case "text/html; charset=\"utf-8\"":
		return true
	case "text/html; charset=\"UTF-8\"":
		return true
	case "text/html;;charset=UTF-8":
		return true
	case "text/plain; charset=utf-8":
		return true
	case "text/plain; charset=UTF-8":
		return true
	case "application/rss+xml; charset=utf-8":
		return true
	default:
		return false
	}
}

A  => card.go +226 -0
@@ 1,226 @@
package libphoton

import (
	"image"
	"io"
	"log"
	"net/http"
	"os"
	"os/user"
	"path/filepath"
	"strings"

	"git.sr.ht/~ghost08/libphoton/events"
	"git.sr.ht/~ghost08/libphoton/media"
	"github.com/cixtor/readability"
	"github.com/kennygrant/sanitize"
	"github.com/mmcdole/gofeed"
	"github.com/pkg/browser"
)

type Card struct {
	photon    *Photon
	Item      *gofeed.Item
	ItemImage image.Image
	Feed      *gofeed.Feed
	FeedImage image.Image
	Article   *readability.Article
	Media     *media.Media
	Redraw    func()
}

type Cards []*Card

func (cards Cards) Len() int {
	return len(cards)
}

func (cards Cards) Less(i, k int) bool {
	return cards[i].Item.PublishedParsed.After(*cards[k].Item.PublishedParsed)
}

func (cards Cards) Swap(i, k int) {
	cards[i], cards[k] = cards[k], cards[i]
}

func (card *Card) saveImage() func(image.Image) {
	return func(img image.Image) {
		card.ItemImage = img
		/*
			TODO check if this is needed
			for _, vi := range onScreenCards {
				if vi == card {
					card.Redraw()
					break
				}
			}
		*/
		card.Redraw()
	}
}

func (card *Card) OpenArticle(articleChanged func(*readability.Article)) {
	if card == nil {
		return
	}
	if card.Article == nil {
		article, err := NewArticle(card.Item.Link, card.photon.httpClient)
		if err != nil {
			log.Println("ERROR: scraping link:", err)
			return
		}
		card.Article = article
		if len(card.Article.TextContent) < len(card.Item.Description) {
			card.Article.TextContent = card.Item.Description
		}
		articleChanged(article)
	}
	card.photon.OpenedArticle.Article = card.Article
	card.photon.OpenedArticle.Link = card.Item.Link
	if card.photon.OpenedArticle.Image != "" {
		card.photon.imgDownloader.Download(
			card.photon.OpenedArticle.Image,
			func(img image.Image) {
				card.photon.OpenedArticle.TopImage = img
				card.Redraw()
			},
		)
	}
	card.Redraw()
}

func (card *Card) GetMedia() (*media.Media, error) {
	if card == nil {
		return nil, nil
	}
	if card.Media == nil || len(card.Media.Links) == 0 {
		m, err := card.photon.mediaExtractor.NewMedia(card.Item.Link)
		if err != nil {
			return nil, err
		}
		card.Media = m
	}
	return card.Media, nil
}

func (card *Card) RunMedia() {
	if card == nil {
		return
	}
	events.Emit(&events.RunMediaStart{Link: card.Item.Link})
	card.Redraw()
	go func() {
		defer func() {
			events.Emit(&events.RunMediaEnd{Link: card.Item.Link})
			card.Redraw()
		}()
		if _, err := card.GetMedia(); err != nil {
			log.Println("ERROR: extracting media link:", err)
			return
		}
		card.Media.Run()
	}()
}

func (card *Card) DownloadMedia() {
	if card == nil {
		return
	}
	go func() {
		log.Println("INFO: downloading media for:", card.Item.Link)
		m, err := card.GetMedia()
		if err != nil {
			log.Println("ERROR: extracting media link:", err)
			return
		}
		if err := card.downloadLinks(card.Item.Title, m.Links); err != nil {
			log.Println("ERROR: downloading media:", err)
			return
		}
	}()
}

func (card *Card) DownloadLink() {
	if card == nil {
		return
	}
	go func() {
		if err := card.downloadLinks(card.Item.Title, []string{card.Item.Link}); err != nil {
			log.Println("ERROR: downloading link:", err)
			return
		}
	}()
}

func (card *Card) DownloadImage() {
	if card == nil || card.Item == nil || card.Item.Image == nil {
		return
	}
	go func() {
		if err := card.downloadLinks(card.Item.Title, []string{card.Item.Image.URL}); err != nil {
			log.Println("ERROR: downloading image:", err)
			return
		}
	}()
}

func (card *Card) downloadLinks(name string, links []string) error {
	//get download path
	downloadPath := card.photon.downloadPath
	if strings.Contains(downloadPath, "$HOME") {
		usr, err := user.Current()
		if err != nil {
			return err
		}
		downloadPath = strings.ReplaceAll(downloadPath, "$HOME", usr.HomeDir)
	}
	//create download path
	if _, err := os.Stat(downloadPath); os.IsNotExist(err) {
		if err := os.MkdirAll(downloadPath, 0x755); err != nil {
			return err
		}
	}
	for _, link := range links {
		//get response
		req, err := http.NewRequest("GET", link, nil)
		if err != nil {
			return err
		}
		client := card.photon.httpClient
		resp, err := client.Do(req)
		if err != nil {
			return err
		}
		defer resp.Body.Close()
		var bodyReader io.Reader = resp.Body
		contentType := resp.Header.Get("Content-Type")
		if contentType == "" {
			contentType, bodyReader, err = recycleReader(resp.Body)
		}
		exts := extensionByType(contentType)
		if len(exts) > 0 {
			name += "." + exts[0]
		}
		log.Println(contentType, name)
		//write data to file
		f, err := os.Create(filepath.Join(downloadPath, sanitize.Name(name)))
		if err != nil {
			return err
		}
		if _, err := io.Copy(f, bodyReader); err != nil {
			return err
		}
		if err := f.Close(); err != nil {
			return err
		}
		log.Printf("INFO: downloaded link %s to %s", link, filepath.Join(downloadPath, name))
	}
	return nil
}

func (card *Card) OpenBrowser() {
	if card == nil {
		return
	}
	browser.OpenURL(card.Item.Link)
}

A  => card_lua.go +192 -0
@@ 1,192 @@
package libphoton

import (
	"git.sr.ht/~ghost08/libphoton/media"
	lua "github.com/yuin/gopher-lua"
)

const (
	luaCardTypeName  = "photon.card"
	luaCardsTypeName = "photon.cards"
)

func cardsLoader(L *lua.LState) int {
	var cardMethods = map[string]lua.LGFunction{
		"link":        cardItemLink,
		"image":       cardItemImage,
		"title":       cardItemTitle,
		"content":     cardItemContent,
		"description": cardItemDescription,
		"published":   cardItemPublished,
		"feed":        cardFeed,
		"getMedia":    getMedia,
		"runMedia": func(L *lua.LState) int {
			card := checkCard(L, 1)
			card.RunMedia()
			return 0
		},
		"openBrowser": func(L *lua.LState) int {
			card := checkCard(L, 1)
			card.OpenBrowser()
			return 0
		},
		/*
			TODO
			"openArticle": func(L *lua.LState) int {
				card := checkCard(L, 1)
				someArticleOpener := checkArticleOpener(L, 1)
				card.OpenArticle(someArticleOpener)
				return 0
			},
		*/
	}
	mt := L.NewTypeMetatable(luaCardTypeName)
	L.SetField(mt, "__index", L.SetFuncs(L.NewTable(), cardMethods))

	var cardsMethods = map[string]lua.LGFunction{
		"len": cardsLength,
		"get": cardsGet,
		"set": cardsSet,
	}
	mt = L.NewTypeMetatable(luaCardsTypeName)
	L.SetField(mt, "__index", L.SetFuncs(L.NewTable(), cardsMethods))

	feedLoader(L)
	return 0
}

func checkCard(L *lua.LState, index int) *Card {
	ud := L.CheckUserData(index)
	if v, ok := ud.Value.(*Card); ok {
		return v
	}
	L.ArgError(1, luaCardTypeName+" expected")
	return nil
}

func newCard(card *Card, L *lua.LState) *lua.LUserData {
	ud := L.NewUserData()
	ud.Value = card
	L.SetMetatable(ud, L.GetTypeMetatable(luaCardTypeName))
	return ud
}

func cardItemLink(L *lua.LState) int {
	card := checkCard(L, 1)
	if L.GetTop() == 2 {
		card.Item.Link = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(card.Item.Link))
	return 1
}

func cardItemImage(L *lua.LState) int {
	card := checkCard(L, 1)
	if L.GetTop() == 2 {
		card.Item.Image.URL = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(card.Item.Image.URL))
	return 1
}

func cardItemPublished(L *lua.LState) int {
	card := checkCard(L, 1)
	if L.GetTop() == 2 {
		card.Item.Published = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(card.Item.Published))
	return 1
}

func cardItemTitle(L *lua.LState) int {
	card := checkCard(L, 1)
	if L.GetTop() == 2 {
		card.Item.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(card.Item.Title))
	return 1
}

func cardItemContent(L *lua.LState) int {
	card := checkCard(L, 1)
	if L.GetTop() == 2 {
		card.Item.Content = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(card.Item.Content))
	return 1
}

func cardItemDescription(L *lua.LState) int {
	card := checkCard(L, 1)
	if L.GetTop() == 2 {
		card.Item.Description = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(card.Item.Description))
	return 1
}

func getMedia(L *lua.LState) int {
	card := checkCard(L, 1)
	m, err := card.GetMedia()
	if err != nil {
		L.Push(lua.LNil)
		L.Push(lua.LString(err.Error()))
		return 2
	}
	ud := media.NewLuaMedia(m, L)
	L.Push(ud)
	L.Push(lua.LNil)
	return 2
}

func cardFeed(L *lua.LState) int {
	card := checkCard(L, 1)
	L.Push(newFeed(card.Feed, L))
	return 1
}

//Cards

func newCards(cards *Cards, L *lua.LState) *lua.LUserData {
	ud := L.NewUserData()
	ud.Value = cards
	L.SetMetatable(ud, L.GetTypeMetatable(luaCardsTypeName))
	return ud
}

func checkCards(L *lua.LState) *Cards {
	ud := L.CheckUserData(1)
	if v, ok := ud.Value.(*Cards); ok {
		return v
	}
	L.ArgError(1, luaCardsTypeName+" expected")
	return nil
}

func cardsLength(L *lua.LState) int {
	cards := checkCards(L)
	L.Push(lua.LNumber(len(*cards)))
	return 1
}

func cardsGet(L *lua.LState) int {
	cards := checkCards(L)
	index := L.ToInt(2)
	card := (*cards)[index-1]
	L.Push(newCard(card, L))
	return 1
}

func cardsSet(L *lua.LState) int {
	cards := checkCards(L)
	index := L.ToInt(2)
	card := checkCard(L, 3)
	(*cards)[index-1] = card
	return 0
}

A  => events/events.go +68 -0
@@ 1,68 @@
package events

var registry = make(EventCallbacks)

type EventCallback func(Event) error

type EventCallbacks map[EventType][]EventCallback

func (ec EventCallbacks) Subscribe(et EventType, c EventCallback) {
	ec[et] = append(ec[et], c)
}

func (ec EventCallbacks) Emit(e Event) {
	for _, c := range ec[e.Type()] {
		c(e)
	}
}

func Emit(e Event) {
	registry.Emit(e)
}

type Event interface {
	Type() EventType
}

func Subscribe(et EventType, c EventCallback) {
	registry.Subscribe(et, c)
}

type EventType string

const (
	EventTypeInit            = EventType("Init")
	EventTypeRunMediaStart   = EventType("RunMediaStart")
	EventTypeRunMediaEnd     = EventType("RunMediaEnd")
	EventTypeFeedsDownloaded = EventType("FeedsDownloaded")
)

var events = make(EventCallbacks)

type Init struct{}

func (e *Init) Type() EventType {
	return EventTypeInit
}

type RunMediaStart struct {
	Link string
}

func (e *RunMediaStart) Type() EventType {
	return EventTypeRunMediaStart
}

type RunMediaEnd struct {
	Link string
}

func (e *RunMediaEnd) Type() EventType {
	return EventTypeRunMediaEnd
}

type FeedsDownloaded struct{}

func (e *FeedsDownloaded) Type() EventType {
	return EventTypeFeedsDownloaded
}

A  => events/events_lua.go +70 -0
@@ 1,70 @@
package events

import (
	lua "github.com/yuin/gopher-lua"
)

func Loader(L *lua.LState) int {
	var exports = map[string]lua.LGFunction{
		"subscribe": eventsSubscribe,
	}
	mod := L.SetFuncs(L.NewTable(), exports)
	registerEventType(L)
	L.SetField(mod, "Init", lua.LString(EventTypeInit))
	L.SetField(mod, "RunMediaStart", lua.LString(EventTypeRunMediaStart))
	L.SetField(mod, "RunMediaEnd", lua.LString(EventTypeRunMediaEnd))
	L.SetField(mod, "FeedsDownloaded", lua.LString(EventTypeFeedsDownloaded))
	L.Push(mod)

	return 1
}

func eventsSubscribe(L *lua.LState) int {
	t := L.ToString(1)
	f := L.ToFunction(2)
	et := EventType(t)
	fn := func(e Event) error {
		L.Push(f)
		L.Push(eventToLuaValue(L, e))
		if err := L.PCall(1, lua.MultRet, nil); err != nil {
			L.Error(lua.LString(err.Error()), 0)
			return err
		}
		return nil
	}
	Subscribe(et, fn)
	return 0
}

const luaEventTypeName = "photon.event"

func eventToLuaValue(L *lua.LState, e Event) lua.LValue {
	ud := L.NewUserData()
	ud.Value = e
	L.SetMetatable(ud, L.GetTypeMetatable(luaEventTypeName))
	return ud
}

func registerEventType(L *lua.LState) {
	var eventMethods = map[string]lua.LGFunction{
		"type": eventType,
	}
	mt := L.NewTypeMetatable(luaEventTypeName)
	L.SetGlobal(luaEventTypeName, mt)
	L.SetField(mt, "__index", L.SetFuncs(L.NewTable(), eventMethods))
}

func checkEvent(L *lua.LState) Event {
	ud := L.CheckUserData(1)
	if v, ok := ud.Value.(Event); ok {
		return v
	}
	L.ArgError(1, "event expected")
	return nil
}

func eventType(L *lua.LState) int {
	e := checkEvent(L)
	L.Push(lua.LString(e.Type()))
	return 1
}

A  => feed_lua.go +255 -0
@@ 1,255 @@
package libphoton

import (
	"github.com/mmcdole/gofeed"
	lua "github.com/yuin/gopher-lua"
)

const (
	luaFeedTypeName   = "photon.feed"
	luaPersonTypeName = "photon.person"
)

func feedLoader(L *lua.LState) int {
	var feedMethods = map[string]lua.LGFunction{
		"title":       feedTitle,
		"description": feedDescription,
		"link":        feedLink,
		"feedLink":    feedFeedLink,
		"updated":     feedUpdated,
		"published":   feedPublished,
		"language":    feedLanguage,
		"image":       feedImage,
		"copyright":   feedCopyright,
		"generator":   feedGenerator,
		"version":     feedFeedVersion,
		"categories":  feedCategories,
		"custom":      feedCustom,
	}
	mt := L.NewTypeMetatable(luaFeedTypeName)
	L.SetField(mt, "__index", L.SetFuncs(L.NewTable(), feedMethods))

	var personMethods = map[string]lua.LGFunction{
		"name":  personName,
		"email": personEmail,
	}
	mt = L.NewTypeMetatable(luaPersonTypeName)
	L.SetField(mt, "__index", L.SetFuncs(L.NewTable(), personMethods))

	return 0
}

//Feed

func newFeed(feed *gofeed.Feed, L *lua.LState) *lua.LUserData {
	ud := L.NewUserData()
	ud.Value = feed
	L.SetMetatable(ud, L.GetTypeMetatable(luaFeedTypeName))
	return ud
}

func checkFeed(L *lua.LState) *gofeed.Feed {
	ud := L.CheckUserData(1)
	if v, ok := ud.Value.(*gofeed.Feed); ok {
		return v
	}
	L.ArgError(1, luaFeedTypeName+" expected")
	return nil
}

func feedTitle(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Title))
	return 1
}

func feedDescription(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Description))
	return 1
}

func feedLink(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Link))
	return 1
}

func feedFeedLink(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.FeedLink))
	return 1
}

func feedUpdated(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Updated))
	return 1
}

func feedPublished(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Published))
	return 1
}

func feedLanguage(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Language))
	return 1
}

func feedImage(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Image.URL))
	return 1
}

func feedCopyright(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Copyright))
	return 1
}

func feedGenerator(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.Generator))
	return 1
}

func feedFeedVersion(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		feed.Title = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(feed.FeedVersion))
	return 1
}

func feedAuthor(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		p := checkPerson(L, 2)
		feed.Author = p
		return 0
	}
	L.Push(newPerson(feed.Author, L))
	return 1
}

func feedCategories(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		cs := L.CheckTable(2)
		categories := make([]string, cs.Len())
		for i := 0; i < cs.Len(); i++ {
			v := cs.RawGetInt(i + 1)
			categories[i] = lua.LVAsString(v)
		}
		feed.Categories = categories
		return 0
	}
	cs := L.NewTable()
	for i, v := range feed.Categories {
		cs.RawSetInt(i+1, lua.LString(v))
	}
	L.Push(cs)
	return 1
}

func feedCustom(L *lua.LState) int {
	feed := checkFeed(L)
	if L.GetTop() == 2 {
		cs := L.CheckTable(2)
		custom := make(map[string]string)
		cs.ForEach(func(key, value lua.LValue) {
			custom[lua.LVAsString(key)] = lua.LVAsString(value)
		})
		feed.Custom = custom
		return 0
	}
	cs := L.NewTable()
	for k, v := range feed.Custom {
		cs.RawSetString(k, lua.LString(v))
	}
	L.Push(cs)
	return 1
}

//Person
func newPerson(p *gofeed.Person, L *lua.LState) *lua.LUserData {
	ud := L.NewUserData()
	ud.Value = p
	L.SetMetatable(ud, L.GetTypeMetatable(luaPersonTypeName))
	return ud
}

func checkPerson(L *lua.LState, index int) *gofeed.Person {
	ud := L.CheckUserData(index)
	if v, ok := ud.Value.(*gofeed.Person); ok {
		return v
	}
	L.ArgError(1, luaPersonTypeName+" expected")
	return nil
}

func personName(L *lua.LState) int {
	p := checkPerson(L, 1)
	if L.GetTop() == 2 {
		p.Name = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(p.Name))
	return 1
}

func personEmail(L *lua.LState) int {
	p := checkPerson(L, 1)
	if L.GetTop() == 2 {
		p.Email = L.CheckString(2)
		return 0
	}
	L.Push(lua.LString(p.Email))
	return 1
}

A  => go.mod +32 -0
@@ 1,32 @@
module git.sr.ht/~ghost08/libphoton

go 1.17

require (
	gioui.org v0.0.0-20211126213425-227c5a132be6
	gioui.org/x v0.0.0-20211102210401-cead9283b8ff
	git.sr.ht/~ghost08/photon v0.0.0-20211107062232-e06d9d50a412
	github.com/cixtor/readability v1.0.0
	github.com/gabriel-vasile/mimetype v1.4.0
	github.com/kennygrant/sanitize v1.2.4
	github.com/mmcdole/gofeed v1.1.3
	github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
	github.com/sbani/go-humanizer v0.3.2
	github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9
	golang.org/x/exp v0.0.0-20211029182501-9b944d235b9d
	golang.org/x/image v0.0.0-20211028202545-6944b10bf410
	golang.org/x/net v0.0.0-20211101193420-4a448f8816b3
)

require (
	gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 // indirect
	gioui.org/shader v1.0.6 // indirect
	github.com/PuerkitoBio/goquery v1.8.0 // indirect
	github.com/andybalholm/cascadia v1.3.1 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/mmcdole/goxpp v0.0.0-20200921145534-2f3784f67354 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.2 // indirect
	golang.org/x/sys v0.0.0-20211102061401-a2f17f7b995c // indirect
	golang.org/x/text v0.3.7 // indirect
)

A  => go.sum +474 -0
@@ 1,474 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20211026101311-1eab4b84a6d3/go.mod h1:yoWOxPng6WkDpsud+NRmkoftmyWn3rkKsYGEcWHpjTI=
gioui.org v0.0.0-20211126213425-227c5a132be6 h1:I/VXI7iHRGYHVqkhLBOxw43zvDH+uzANxKhCj2DNbms=
gioui.org v0.0.0-20211126213425-227c5a132be6/go.mod h1:yoWOxPng6WkDpsud+NRmkoftmyWn3rkKsYGEcWHpjTI=
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 h1:AGDDxsJE1RpcXTAxPG2B4jrwVUJGFDjINIPi1jtO6pc=
gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
gioui.org/shader v1.0.6 h1:cvZmU+eODFR2545X+/8XucgZdTtEjR3QWW6W65b0q5Y=
gioui.org/shader v1.0.6/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
gioui.org/x v0.0.0-20211102210401-cead9283b8ff h1:hAKQjgj7vEgfU57xwS2QEC0lcdRBpjK8egdlHI0QNbg=
gioui.org/x v0.0.0-20211102210401-cead9283b8ff/go.mod h1:2SCbAJkcrS1ZQ8OlpswBRbDwOfLhKRPlSgz/HCpCXJA=
git.sr.ht/~ghost08/photon v0.0.0-20211107062232-e06d9d50a412 h1:aQDy6d8uT0DZJKKdPZIB6lXfpyKzyPhHMtLuLer6zQU=
git.sr.ht/~ghost08/photon v0.0.0-20211107062232-e06d9d50a412/go.mod h1:F5Xf6QtHjCg8UPOmtznz6sypWgYJxmD5sYaw0is+A9o=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
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/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
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/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/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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cixtor/readability v1.0.0 h1:6YZo0JJsxt4Xor9lYpln3eSJeuQGukxIBois9wpQI6g=
github.com/cixtor/readability v1.0.0/go.mod h1:WDrZcthrR2RVDxfMu3q0q59UKhReo5mIZAM6w1+MgFo=
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/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-20190321100706-95778dfbb74e/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/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/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 v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
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/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gabriel-vasile/mimetype v1.4.0 h1:Cn9dkdYsMIu56tGho+fqzh7XmvY2YyGU0FnbhiOsEro=
github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
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-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
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/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/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
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/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
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/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/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/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.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/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/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/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/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.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/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/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
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/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/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
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-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/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/mmcdole/gofeed v1.1.3 h1:pdrvMb18jMSLidGp8j0pLvc9IGziX4vbmvVqmLH6z8o=
github.com/mmcdole/gofeed v1.1.3/go.mod h1:QQO3maftbOu+hiVOGOZDRLymqGQCos4zxbA4j89gMrE=
github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf h1:sWGE2v+hO0Nd4yFU/S/mDBM5plIU8v/Qhfz41hkDIAI=
github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf/go.mod h1:pasqhqstspkosTneA62Nc+2p9SOBBYAPbnmRRWPQ0V8=
github.com/mmcdole/goxpp v0.0.0-20200921145534-2f3784f67354 h1:Z6i7ND25ixRtXFBylIUggqpvLMV1I15yprcqMVB7WZA=
github.com/mmcdole/goxpp v0.0.0-20200921145534-2f3784f67354/go.mod h1:pasqhqstspkosTneA62Nc+2p9SOBBYAPbnmRRWPQ0V8=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/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/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/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/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/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/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
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/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.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_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/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/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/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/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.21.0/go.mod h1:ZPhntP/xmq1nnND05hhpAh2QMhSsA4UN3MGZ6O2J3hM=
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/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sbani/go-humanizer v0.3.2 h1:uw2Fncf7rrl+IjlMS1sPwNcpMq041xrnV7SbG1QZ4N0=
github.com/sbani/go-humanizer v0.3.2/go.mod h1:FKsFliG5Wldo/Qm59N3Mi7tsCM+7s0k55wMwOyAndWo=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
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/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
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/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
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/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 h1:k/gmLsJDWwWqbLCur2yWnJzwQEKRcAHXo6seXGuSwWw=
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
go.uber.org/atomic v1.3.2/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/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
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/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/exp v0.0.0-20210722180016-6781d3edade3/go.mod h1:DVyR6MI7P4kEQgvZJSj1fQGrWIi2RzIrfYWycwheUAc=
golang.org/x/exp v0.0.0-20211029182501-9b944d235b9d h1:MKwb3mzSy4CTpgAm10+7Ru8Hq8ZnHOGgWAjo9fNVK+o=
golang.org/x/exp v0.0.0-20211029182501-9b944d235b9d/go.mod h1:OyI624f2tQ/aU3IMa7GB16Hk54CHURAfHfj6tMqtyhA=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
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/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211101193420-4a448f8816b3 h1:VrJZAjbekhoRn7n5FBujY31gboH+iB3pdLxn3gE9FjU=
golang.org/x/net v0.0.0-20211101193420-4a448f8816b3/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/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-20201020160332-67f06af15bc9/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-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-20190204203706-41f3e6584952/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-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-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/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-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/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-20211102061401-a2f17f7b995c h1:QOfDMdrf/UwlVR0UBq2Mpr58UzNtvgJRXA4BgPfFACs=
golang.org/x/sys v0.0.0-20211102061401-a2f17f7b995c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/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.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/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-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-20190312151545-0bb0c0a6e846/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-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-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-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
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/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
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.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-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/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=
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/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/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.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
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=

A  => image_downloader.go +110 -0
@@ 1,110 @@
package libphoton

import (
	"image"
	_ "image/gif"
	_ "image/jpeg"
	_ "image/png"
	"log"
	"net/http"
	"runtime"
	"sync"

	_ "golang.org/x/image/webp"
)

type ImgDownloader struct {
	client    *http.Client
	receiveCh chan imgDownloadReq
	imgCache  sync.Map
}

type imgDownloadReq struct {
	URL      string
	Callback func(image.Image)
}

type ImgDownloaderOption func(d *ImgDownloader)

func NewImgDownloader(options ...ImgDownloaderOption) *ImgDownloader {
	d := &ImgDownloader{receiveCh: make(chan imgDownloadReq, 1024)}
	for _, o := range options {
		o(d)
	}
	reqCh := make(chan imgDownloadReq, 1024)
	//receiver
	go func() {
		for req := range d.receiveCh {
			if i, ok := d.imgCache.Load(req.URL); ok {
				if i != nil {
					if req.Callback != nil {
						req.Callback(i.(image.Image))
					}
				}
				continue
			}
			d.imgCache.Store(req.URL, nil)
			reqCh <- req
		}
	}()
	//download workers
	for i := 0; i < runtime.NumCPU(); i++ {
		go func() {
			client := d.client
			if client == nil {
				client = http.DefaultClient
			}
			for req := range reqCh {
				r, err := http.NewRequest("GET", req.URL, nil)
				if err != nil {
					log.Println("ERROR: creating request for image:", err)
					continue
				}
				resp, err := client.Do(r)
				if err != nil {
					log.Println("ERROR: downloading image:", err)
					continue
				}
				defer resp.Body.Close()
				i, _, err := image.Decode(resp.Body)
				if err != nil {
					log.Println("ERROR: decoding image:", err, req.URL)
					continue
				}
				d.imgCache.Store(req.URL, i)
				if req.Callback != nil {
					req.Callback(i)
				}
			}
		}()
	}
	return d
}

func WithClient(client *http.Client) ImgDownloaderOption {
	return func(d *ImgDownloader) {
		d.client = client
	}
}

func (d *ImgDownloader) Download(url string, callback func(image.Image)) {
	img, ok := d.imgCache.Load(url)
	if !ok || img == nil {
		d.receiveCh <- imgDownloadReq{
			URL:      url,
			Callback: callback,
		}
	} else {
		if callback != nil {
			callback(img.(image.Image))
		}
	}
}

func (d *ImgDownloader) GetImg(url string) (image.Image, bool) {
	i, ok := d.imgCache.Load(url)
	if !ok || i == nil {
		return nil, false
	}
	return i.(image.Image), true
}

A  => inputs/inputs.go +15 -0
@@ 1,15 @@
package inputs

type Inputs []string

func (ins Inputs) Len() int {
	return len(ins)
}

func (ins Inputs) Get(i int) string {
	return ins[i]
}

func (ins Inputs) Set(i int, v string) {
	ins[i] = v
}

A  => inputs/inputs_lua.go +43 -0
@@ 1,43 @@
package inputs

import (
	lua "github.com/yuin/gopher-lua"
)

func Loader(in *Inputs) lua.LGFunction {
	return func(L *lua.LState) int {
		var exports = map[string]lua.LGFunction{
			"len": inputsLen(in),
			"get": inputsGet(in),
			"set": inputsSet(in),
		}
		mod := L.SetFuncs(L.NewTable(), exports)
		L.Push(mod)

		return 1
	}
}

func inputsLen(in *Inputs) lua.LGFunction {
	return func(L *lua.LState) int {
		L.Push(lua.LNumber(in.Len()))
		return 1
	}
}

func inputsGet(in *Inputs) lua.LGFunction {
	return func(L *lua.LState) int {
		i := L.ToInt(1)
		L.Push(lua.LString(in.Get(i - 1)))
		return 1
	}
}

func inputsSet(in *Inputs) lua.LGFunction {
	return func(L *lua.LState) int {
		i := L.ToInt(1)
		v := L.ToString(2)
		in.Set(i-1, v)
		return 0
	}
}

A  => inputs/lexer.go +251 -0
@@ 1,251 @@
package inputs

import (
	"bufio"
	"fmt"
	"io"
	"strings"
	"unicode"
)

var (
	eof = rune(0)
)

type itemType int

const (
	itemError itemType = iota
	itemEOF
	itemURL
	itemCmd
	itemComment
)

type item struct {
	typ itemType
	val string
}

func (i item) String() string {
	switch i.typ {
	case itemEOF:
		return "EOF"
	case itemError:
		return i.val
	}
	if len(i.val) > 10 {
		return fmt.Sprintf("%.10q...", i.val)
	}
	return fmt.Sprintf("%q", i.val)
}

//stateFn represents the state of the scanner as a function that returns the next state.
type stateFn func(*lexer) stateFn

// lexer holds the state of the scanner.
type lexer struct {
	input                     *bufio.Reader   // the data being scanned.
	buf                       strings.Builder //the data already scanned
	line, start, pos, prevpos int
	items                     chan item // channel of scanned items.
}

func lex(input io.Reader) *lexer {
	l := &lexer{
		input: bufio.NewReader(input),
		items: make(chan item, 5),
	}
	go l.run() // Concurrently run state machine.
	return l
}

//run lexes the input by executing state functions until the state is nil.
func (l *lexer) run() {
	for state := lexStart; state != nil; {
		state = state(l)
	}
	close(l.items) // No more tokens will be delivered.
}

// emit passes an item back to the client.
func (l *lexer) emit(t itemType) {
	l.items <- item{t, l.buf.String()}
	l.buf.Reset()
}

// read reads the next rune from the bufferred reader.
// Returns the rune(0) if an error occurs (or io.EOF is returned).
func (l *lexer) read() rune {
	ch, _, err := l.input.ReadRune()
	if ch == '\n' {
		l.line++
		l.prevpos = l.pos
		l.pos = 0
	} else {
		l.pos++
		if err != nil {
			return eof
		}
	}
	l.buf.WriteRune(ch)
	return ch
}

// unread places the previously read rune back on the reader.
func (l *lexer) unread() {
	l.input.UnreadRune()
	if l.pos == 0 {
		l.pos = l.prevpos
		if l.line == 0 {
			panic("Cannot unread! No runes readed")
		}
		l.line--
	} else {
		l.pos--
	}
	buf := l.buf.String()
	l.buf.Reset()
	if len(buf) > 0 {
		l.buf.WriteString(buf[:len(buf)-1])
	}
}

//peek returns but does not consume the next rune in the input.
func (l *lexer) peek() rune {
	r := l.read()
	l.unread()
	return r
}

//acceptRun consumes a run of runes from the valid set.
func (l *lexer) accept(valid string) {
	for strings.ContainsRune(valid, l.read()) {
	}
	l.unread()
}

func (l *lexer) acceptWhitespace() {
	l.accept(" \t\n\r")
	l.buf.Reset()
}

func (l *lexer) ignoreWhitespace() {
	for {
		ch, _, err := l.input.ReadRune()
		if ch == '\n' {
			l.line++
			l.prevpos = l.pos
			l.pos = 0
		} else {
			if !unicode.IsSpace(ch) {
				l.input.UnreadRune()
				return
			}
			l.pos++
			if err != nil {
				return
			}
		}
	}
}

//acceptToLineBreak reads entire string to line break
func (l *lexer) acceptToLineBreak() {
	for {
		if ch := l.read(); ch == eof {
			break
		} else if ch == '\n' {
			l.unread()
			break
		}
	}
}

//readLetters reads all runes that are letters
func (l *lexer) readLetters() string {
	var buf strings.Builder
	for {
		ch := l.read()
		if ch == eof {
			break
		} else if !unicode.IsLetter(ch) {
			l.unread()
			break
		}
		buf.WriteRune(ch)
	}
	return buf.String()
}

func lexStart(l *lexer) stateFn {
	t := l.readLetters()
	switch t {
	case "cmd":
		return lexCommand
	case "http", "https":
		return lexURL
	default:
		r := l.peek()
		switch r {
		case '#':
			return lexComment
		case eof:
			l.emit(itemEOF)
			return nil
		case '\n', '\r':
			l.acceptWhitespace()
			l.buf.Reset()
			return lexStart
		}
		return l.errorf("unexpected characters (%s)", t)
	}
}

func lexCommand(l *lexer) stateFn {
	if r := l.read(); r != ':' {
		return l.errorf("unexpected character after cmd (%r) expected colon (:)", r)
	}
	if r := l.read(); r != '/' {
		return l.errorf("unexpected character after cmd: (%r) expected slash (/)", r)
	}
	if r := l.read(); r != '/' {
		return l.errorf("unexpected character after cmd:/ (%r) expected slash (/)", r)
	}
	l.acceptToLineBreak()
	l.emit(itemCmd)
	return lexStart
}

func lexURL(l *lexer) stateFn {
	if r := l.read(); r != ':' {
		return l.errorf("unexpected character after %s (%r) expected colon (:)", l.buf.String(), r)
	}
	if r := l.read(); r != '/' {
		return l.errorf("unexpected character after %s (%r) expected slash (/)", l.buf.String(), r)
	}
	if r := l.read(); r != '/' {
		return l.errorf("unexpected character after %s (%r) expected slash (/)", l.buf.String(), r)
	}
	l.acceptToLineBreak()
	l.emit(itemURL)
	return lexStart
}

func lexComment(l *lexer) stateFn {
	l.buf.Reset()
	l.acceptToLineBreak()
	l.emit(itemComment)
	return lexStart
}

//errorf returns an error token and terminates the scan
//by passing back a nil pointer that will be the next
//state, terminating l.run.
func (l *lexer) errorf(format string, args ...interface{}) stateFn {
	l.items <- item{
		itemError,
		fmt.Sprintf("%d:%d:"+format, append([]interface{}{l.line, l.pos}, args...)...),
	}
	return nil
}

A  => inputs/parser.go +52 -0
@@ 1,52 @@
package inputs

import (
	"fmt"
	"io"
)

//Parse parses the photon config input, and retunts the list of urls/commands
func Parse(r io.Reader) (Inputs, error) {
	s := &scanner{l: lex(r)}
	urls, err := parseConf(s)
	if err != nil {
		return nil, fmt.Errorf("error parsing config file: %s", err)
	}
	return urls, nil
}

type scanner struct {
	curItem  item
	prevItem *item
	l        *lexer
}

func (s *scanner) next() item {
	if s.prevItem == nil {
		s.curItem = <-s.l.items
		return s.curItem
	}
	i := *s.prevItem
	s.prevItem = nil
	return i
}

func (s *scanner) backup() {
	s.prevItem = &s.curItem
}

func parseConf(s *scanner) (Inputs, error) {
	var urls Inputs
	for i := s.next(); i.typ != itemEOF; i = s.next() {
		switch i.typ {
		case itemError:
			return nil, fmt.Errorf(i.val)
		case itemComment:
		case itemCmd, itemURL:
			urls = append(urls, i.val)
		default:
			return nil, fmt.Errorf("unexpected item (%s) in config file", i)
		}
	}
	return urls, nil
}

A  => libphoton.go +241 -0
@@ 1,241 @@
package libphoton

import (
	"bytes"
	"fmt"
	"log"
	"net/http"
	"os"
	"os/exec"
	"sort"
	"strings"

	"git.sr.ht/~ghost08/libphoton/events"
	"git.sr.ht/~ghost08/libphoton/inputs"
	"git.sr.ht/~ghost08/libphoton/media"
	"github.com/mmcdole/gofeed"
)

type Photon struct {
	feedInputs     inputs.Inputs
	imgDownloader  *ImgDownloader
	mediaExtractor *media.Extractor
	httpClient     *http.Client
	downloadPath   string
	redraw         func()

	cards         Cards
	visibleCards  Cards
	SelectedCard  *Card
	searchQuery   string
	OpenedArticle *Article
}

func New(redraw func(), paths []string, options ...Option) (*Photon, error) {
	p := &Photon{}
	feedInputs, err := p.loadFeeds(paths)
	if err != nil {
		return nil, err
	}
	if len(feedInputs) == 0 {
		return nil, fmt.Errorf("no feeds")
	}
	p.feedInputs = feedInputs
	p.mediaExtractor = &media.Extractor{}
	p.imgDownloader = NewImgDownloader()
	for _, o := range options {
		o(p)
	}
	if p.httpClient == nil {
		p.httpClient = http.DefaultClient
	}
	p.imgDownloader.client = p.httpClient
	p.mediaExtractor.Client = p.httpClient
	events.Emit(&events.Init{})
	return p, nil
}

type Option func(*Photon)

func WithHTTPClient(c *http.Client) Option {
	return func(p *Photon) {
		p.httpClient = c
	}
}

func WithMediaExtractor(extractor string) Option {
	return func(p *Photon) {
		p.mediaExtractor.ExtractorCmd = extractor
	}
}

func WithMediaVideoCmd(videoCmd string) Option {
	return func(p *Photon) {
		p.mediaExtractor.VideoCmd = videoCmd
	}
}

func WithMediaImageCmd(imageCmd string) Option {
	return func(p *Photon) {
		p.mediaExtractor.ImageCmd = imageCmd
	}
}

func WithMediaTorrentCmd(torrentCmd string) Option {
	return func(p *Photon) {
		p.mediaExtractor.TorrentCmd = torrentCmd
	}
}

func WithDownloadPath(downloadPath string) Option {
	return func(p *Photon) {
		p.downloadPath = downloadPath
	}
}

func (p *Photon) loadFeeds(paths []string) (inputs.Inputs, error) {
	var ret []string
	for _, path := range paths {
		switch {
		case path == "-":
			if len(paths) > 1 {
				log.Fatal("ERROR: cannot parse from args and stdin")
			}
			ret = append(ret, "-")
		case strings.HasPrefix(path, "http://"), strings.HasPrefix(path, "https://"), strings.HasPrefix(path, "cmd://"):
			ret = append(ret, path)
		default:
			f, err := os.Open(path)
			if err != nil {
				log.Fatal("ERROR: opening file:", err)
			}
			defer f.Close()
			feeds, err := inputs.Parse(f)
			if err != nil {
				log.Fatal("ERROR: parsing file:", err)
			}
			ret = append(ret, feeds...)
		}
	}
	return ret, nil
}

func (p *Photon) SearchQuery(q string) {
	p.searchQuery = q
}

func (p *Photon) RefreshFeed() {
	p.cards = nil
	feeds := make(chan *gofeed.Feed)
	for _, feedURL := range p.feedInputs {
		feedURL := feedURL
		go func() {
			fp := gofeed.NewParser()
			fp.Client = p.httpClient
			fp.AtomTranslator = NewCustomAtomTranslator()
			fp.RSSTranslator = NewCustomRSSTranslator()
			var err error
			var f *gofeed.Feed
			switch {
			case feedURL == "-":
				f, err = fp.Parse(os.Stdin)
			case strings.HasPrefix(feedURL, "cmd://"):
				var command []string
				for _, c := range strings.Split(feedURL[6:], " ") {
					c = strings.TrimSpace(c)
					if c != "" {
						command = append(command, c)
					}
				}
				cmd := exec.Command(command[0], command[1:]...)
				var stdout bytes.Buffer
				cmd.Stdout = &stdout
				if err := cmd.Run(); err != nil {
					log.Printf("ERROR: running command (%s): %s", feedURL, err)
					feeds <- nil
					return
				}
				f, err = fp.Parse(&stdout)
			case strings.HasPrefix(feedURL, "http://"), strings.HasPrefix(feedURL, "https://"):
				f, err = fp.ParseURL(feedURL)
			default:
				log.Fatalf("ERROR: not supported feed: %s", feedURL)
			}
			if err != nil {
				log.Printf("ERROR: downloading feed (%s): %s", feedURL, err)
				feeds <- nil
				return
			}
			if f.Image != nil && f.Image.URL != "" {
				p.imgDownloader.Download(f.Image.URL, nil)
			}
			feeds <- f
		}()
	}
	var feedsGot int
	for f := range feeds {
		feedsGot++
		if f == nil {
			if feedsGot == len(p.feedInputs) {
				break
			}
			continue
		}
		newCards := make(Cards, len(f.Items))
		for i, item := range f.Items {
			newCards[i] = &Card{
				Item:   item,
				Feed:   f,
				Redraw: p.redraw,
			}
		}
		p.cards = append(p.cards, newCards...)
		if feedsGot == len(p.feedInputs) {
			break
		}
	}
	sort.Sort(p.cards)
	p.filterCards()
	if len(p.visibleCards) > 0 {
		p.SelectedCard = p.visibleCards[0]
	}
	events.Emit(&events.FeedsDownloaded{})
}

func (p *Photon) filterCards() {
	/*
		TODO
		defer func() {
			p.SelectedCard.Pos.X, p.SelectedCard.Pos.Y = 0, 0
			if len(p.visibleCards) == 0 {
				p.SelectedCard.Card = nil
			}
		}()
	*/
	query := strings.ToLower(strings.TrimPrefix(p.searchQuery, "/"))
	if query == "" {
		p.visibleCards = p.cards
		return
	}
	p.visibleCards = nil
	for _, card := range p.cards {
		if strings.Contains(strings.ToLower(card.Item.Title), query) {
			p.visibleCards = append(p.visibleCards, card)
			continue
		}
		if strings.Contains(strings.ToLower(card.Item.Description), query) {
			p.visibleCards = append(p.visibleCards, card)
			continue
		}
		if strings.Contains(strings.ToLower(card.Feed.Title), query) {
			p.visibleCards = append(p.visibleCards, card)
			continue
		}
		if card.Item.Author != nil {
			if strings.Contains(strings.ToLower(card.Item.Author.Name), query) {
				p.visibleCards = append(p.visibleCards, card)
				continue
			}
		}
	}
}

A  => media/media.go +195 -0
@@ 1,195 @@
package media

import (
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
	"os"
	"os/exec"
	"strings"
)

type Extractor struct {
	ExtractorCmd string
	VideoCmd     string
	ImageCmd     string
	TorrentCmd   string
	Client       *http.Client
}

type Media struct {
	e            *Extractor
	OriginalLink string
	Links        []string
	ContentType  string
}

func (e *Extractor) NewMedia(link string) (*Media, error) {
	//if link is a magnet link, or the content type is a torrent file, don't run the extractor
	ct, err := e.getContentType(link)
	if err != nil {
		return nil, fmt.Errorf("media link - getting content-type: %w ", err)
	}
	if ct == "application/x-bittorrent" || ct == "magnet-link" {
		return &Media{e: e, OriginalLink: link, Links: []string{link}, ContentType: ct}, nil
	}
	cmd := strings.Split(
		strings.TrimSpace(strings.ReplaceAll(e.ExtractorCmd, "%", link)),
		" ",
	)
	output, err := exec.Command(cmd[0], cmd[1:]...).Output()
	if err != nil {
		return nil, fmt.Errorf("extracting media link: %w (%s)", err, string(output))
	}
	outputLines := strings.Split(strings.TrimSpace(string(output)), "\n")
	var links []string
	for _, line := range outputLines {
		l, err := url.ParseRequestURI(strings.TrimSpace(line))
		if err != nil {
			continue
		}
		links = append(links, l.String())
	}
	if len(links) == 0 {
		return nil, fmt.Errorf("extracting media link: no links extracted")
	}
	contentType, err := e.getContentType(links[0])
	if err != nil {
		return nil, fmt.Errorf("getting media link content-type: %w", err)
	}
	return &Media{e: e, OriginalLink: link, Links: links, ContentType: contentType}, nil
}

func (e *Extractor) getContentType(link string) (string, error) {
	if strings.HasPrefix(link, "magnet:") {
		return "magnet-link", nil
	}
	req, err := http.NewRequest("HEAD", link, nil)
	if err != nil {
		return "", fmt.Errorf("creating HEAD request for content-type detection: %w", err)
	}
	resp, err := e.Client.Do(req)
	if err != nil {
		return "", fmt.Errorf("sending HEAD request for content-type detection: %w", err)
	}
	contentType := resp.Header.Get("Content-Type")
	if contentType == "" {
		return "", fmt.Errorf("HEAD request doesn't contain content-type")
	}
	return contentType, nil
}

//determineCommand returns videoCmd or imgCmd by the content-type
func (e *Extractor) determineCommand(contentType string) string {
	switch {
	case strings.HasPrefix(contentType, "video/"), contentType == "image/gif", strings.HasSuffix(contentType, "mpegurl"):
		return e.VideoCmd
	case strings.HasPrefix(contentType, "image/"):
		return e.ImageCmd
	case contentType == "application/x-bittorrent", contentType == "magnet-link":
		return e.TorrentCmd
	}
	return ""
}

func (media *Media) Run() {
	command := strings.TrimSpace(media.e.determineCommand(media.ContentType))
	if command == "" {
		log.Println("ERROR: could not determine content-type:", media.ContentType)
		return
	}
	//run command with downloaded torrent file
	if media.ContentType == "application/x-bittorrent" {
		req, err := http.NewRequest("GET", media.Links[0], nil)
		if err != nil {
			log.Printf("ERROR: downloading torrent file - creating http request: %s", err)
			return
		}
		resp, err := media.e.Client.Do(req)
		if err != nil {
			log.Printf("ERROR: downloading torrent file: %s", err)
			return
		}
		defer resp.Body.Close()
		f, err := os.CreateTemp("", "*.torrent")
		if err != nil {
			log.Printf("ERROR: downloading torrent file - creating temp file: %s", err)
			return
		}
		if _, err := io.Copy(f, resp.Body); err != nil {
			log.Printf("ERROR: downloading torrent file - writing data to file: %s", err)
			return
		}
		if err := f.Close(); err != nil {
			log.Printf("ERROR: downloading torrent file - closing file: %s", err)
			return
		}
		cmd := strings.Split(
			strings.ReplaceAll(
				command,
				"%",
				f.Name(),
			),
			" ",
		)
		exec.Command(cmd[0], cmd[1:]...).Run()
		return
	}

	//run command with the media link
	if strings.Contains(command, "%") {
		args := media.Links[0]
		if len(media.Links) > 1 {
			args = fmt.Sprintf("%s --audio-file=%s", media.Links[0], media.Links[1])
		}
		cmd := strings.Split(
			strings.ReplaceAll(
				command,
				"%",
				args,
			),
			" ",
		)
		exec.Command(cmd[0], cmd[1:]...).Run()
		return
	}
	//run command with the direct item link
	if strings.Contains(command, "$") {
		cmd := strings.Split(
			strings.ReplaceAll(
				command,
				"$",
				media.OriginalLink,
			),
			" ",
		)
		exec.Command(cmd[0], cmd[1:]...).Run()
		return
	}
	//run command and pipe the media data to it's stdin
	req, err := http.NewRequest("GET", media.Links[0], nil)
	if err != nil {
		log.Println("ERROR: creating GET request for media link:", err)
		return
	}
	resp, err := media.e.Client.Do(req)
	if err != nil {
		log.Println("ERROR: sending GET request for media link:", err)
		return
	}
	cmd := strings.Split(command, " ")
	c := exec.Command(cmd[0], cmd[1:]...)
	stdin, err := c.StdinPipe()
	if err != nil {
		log.Println("ERROR: getting stdin of command:", err)
		return
	}
	go func() {
		defer stdin.Close()
		defer resp.Body.Close()
		io.Copy(stdin, resp.Body)
	}()
	c.Run()
}

A  => media/media_lua.go +62 -0
@@ 1,62 @@
package media

import lua "github.com/yuin/gopher-lua"

const luaMediaTypeName = "photon.media"

func Loader(L *lua.LState) {
	mt := L.NewTypeMetatable(luaMediaTypeName)
	L.SetField(mt, "__index", L.NewFunction(mediaIndex))
}

func checkMedia(L *lua.LState) *Media {
	ud := L.CheckUserData(1)
	if v, ok := ud.Value.(*Media); ok {
		return v
	}
	L.ArgError(1, luaMediaTypeName+" expected")
	return nil
}

func NewLuaMedia(media *Media, L *lua.LState) *lua.LUserData {
	ud := L.NewUserData()
	ud.Value = media
	L.SetMetatable(ud, L.GetTypeMetatable(luaMediaTypeName))
	return ud
}

func mediaIndex(L *lua.LState) int {
	media := checkMedia(L)

	switch L.CheckString(2) {
	case "originalLink":
		return mediaOriginalLink(media, L)
	case "links":
		return mediaLinks(media, L)
	case "contentType":
		return mediaContentType(media, L)
	case "run":
		media.Run()
	}

	return 0
}

func mediaOriginalLink(media *Media, L *lua.LState) int {
	L.Push(lua.LString(media.OriginalLink))
	return 1
}

func mediaLinks(media *Media, L *lua.LState) int {
	links := L.NewTable()
	for i, link := range media.Links {
		links.RawSetInt(i+1, lua.LString(link))
	}
	L.Push(links)
	return 1
}

func mediaContentType(media *Media, L *lua.LState) int {
	L.Push(lua.LString(media.ContentType))
	return 1
}

A  => mime.go +907 -0
@@ 1,907 @@
package libphoton

import (
	"bytes"
	"io"
	"strings"

	"github.com/gabriel-vasile/mimetype"
)

var mimeTypes = map[string][]string{
	"application/andrew-inset":                {"ez"},
	"application/applixware":                  {"aw"},
	"application/atom+xml":                    {"atom"},
	"application/atomcat+xml":                 {"atomcat"},
	"application/atomsvc+xml":                 {"atomsvc"},
	"application/ccxml+xml":                   {"ccxml"},
	"application/cdmi-capability":             {"cdmia"},
	"application/cdmi-container":              {"cdmic"},
	"application/cdmi-domain":                 {"cdmid"},
	"application/cdmi-object":                 {"cdmio"},
	"application/cdmi-queue":                  {"cdmiq"},
	"application/cu-seeme":                    {"cu"},
	"application/dash+xml":                    {"mpd"},
	"application/davmount+xml":                {"davmount"},
	"application/docbook+xml":                 {"dbk"},
	"application/dssc+der":                    {"dssc"},
	"application/dssc+xml":                    {"xdssc"},
	"application/ecmascript":                  {"ecma", "es"},
	"application/emma+xml":                    {"emma"},
	"application/epub+zip":                    {"epub"},
	"application/exi":                         {"exi"},
	"application/font-tdpfr":                  {"pfr"},
	"application/geo+json":                    {"geojson"},
	"application/gml+xml":                     {"gml"},
	"application/gpx+xml":                     {"gpx"},
	"application/gxf":                         {"gxf"},
	"application/gzip":                        {"gz"},
	"application/hjson":                       {"hjson"},
	"application/hyperstudio":                 {"stk"},
	"application/inkml+xml":                   {"ink", "inkml"},
	"application/ipfix":                       {"ipfix"},
	"application/java-archive":                {"ear", "jar", "war"},
	"application/java-serialized-object":      {"ser"},
	"application/java-vm":                     {"class"},
	"application/javascript":                  {"js", "mjs"},
	"application/json":                        {"json", "map"},
	"application/json5":                       {"json5"},
	"application/jsonml+json":                 {"jsonml"},
	"application/ld+json":                     {"jsonld"},
	"application/lost+xml":                    {"lostxml"},
	"application/mac-binhex40":                {"hqx"},
	"application/mac-compactpro":              {"cpt"},
	"application/mads+xml":                    {"mads"},
	"application/manifest+json":               {"webmanifest"},
	"application/marc":                        {"mrc"},
	"application/marcxml+xml":                 {"mrcx"},
	"application/mathematica":                 {"ma", "mb", "nb"},
	"application/mathml+xml":                  {"mathml"},
	"application/mbox":                        {"mbox"},
	"application/mediaservercontrol+xml":      {"mscml"},
	"application/metalink+xml":                {"metalink"},
	"application/metalink4+xml":               {"meta4"},
	"application/mets+xml":                    {"mets"},
	"application/mods+xml":                    {"mods"},
	"application/mp21":                        {"m21", "mp21"},
	"application/mp4":                         {"m4p", "mp4s"},
	"application/msword":                      {"doc", "dot"},
	"application/mxf":                         {"mxf"},
	"application/octet-stream":                {"bin", "dump", "elc", "img", "pkg", "lrf", "mar", "msm", "msp", "bpk", "buffer", "deploy", "dist", "distz", "dms", "so"},
	"application/oda":                         {"oda"},
	"application/oebps-package+xml":           {"opf"},
	"application/ogg":                         {"ogx"},
	"application/omdoc+xml":                   {"omdoc"},
	"application/onenote":                     {"onepkg", "onetmp", "onetoc", "onetoc2"},
	"application/oxps":                        {"oxps"},
	"application/patch-ops-error+xml":         {"xer"},
	"application/pdf":                         {"pdf"},
	"application/pgp-encrypted":               {"pgp"},
	"application/pgp-signature":               {"asc", "sig"},
	"application/pics-rules":                  {"prf"},
	"application/pkcs10":                      {"p10"},
	"application/pkcs7-mime":                  {"p7c", "p7m"},
	"application/pkcs7-signature":             {"p7s"},
	"application/pkcs8":                       {"p8"},
	"application/pkix-attr-cert":              {"ac"},
	"application/pkix-cert":                   {"cer"},
	"application/pkix-crl":                    {"crl"},
	"application/pkix-pkipath":                {"pkipath"},
	"application/pkixcmp":                     {"pki"},
	"application/pls+xml":                     {"pls"},
	"application/postscript":                  {"ps", "eps", "ai"},
	"application/prs.cww":                     {"cww"},
	"application/pskc+xml":                    {"pskcxml"},
	"application/raml+yaml":                   {"raml"},
	"application/rdf+xml":                     {"rdf", "owl"},
	"application/reginfo+xml":                 {"rif"},
	"application/relax-ng-compact-syntax":     {"rnc"},
	"application/resource-lists+xml":          {"rl"},
	"application/resource-lists-diff+xml":     {"rld"},
	"application/rls-services+xml":            {"rs"},
	"application/rpki-ghostbusters":           {"gbr"},
	"application/rpki-manifest":               {"mft"},
	"application/rpki-roa":                    {"roa"},
	"application/rsd+xml":                     {"rsd"},
	"application/rss+xml":                     {"rss"},
	"application/sbml+xml":                    {"sbml"},
	"application/scvp-cv-request":             {"scq"},
	"application/scvp-cv-response":            {"scs"},
	"application/scvp-vp-request":             {"spq"},
	"application/scvp-vp-response":            {"spp"},
	"application/sdp":                         {"sdp"},
	"application/set-payment-initiation":      {"setpay"},
	"application/set-registration-initiation": {"setreg"},
	"application/shf+xml":                     {"shf"},
	"application/smil+xml":                    {"smi", "smil"},
	"application/sparql-query":                {"rq"},
	"application/sparql-results+xml":          {"srx"},
	"application/srgs":                        {"gram"},
	"application/srgs+xml":                    {"grxml"},
	"application/sru+xml":                     {"sru"},
	"application/ssdl+xml":                    {"ssdl"},
	"application/ssml+xml":                    {"ssml"},
	"application/tei+xml":                     {"tei", "teicorpus"},
	"application/thraud+xml":                  {"tfi"},
	"application/timestamped-data":            {"tsd"},
	"application/vnd.3gpp.pic-bw-large":       {"plb"},
	"application/vnd.3gpp.pic-bw-small":       {"psb"},
	"application/vnd.3gpp.pic-bw-var":         {"pvb"},
	"application/vnd.3gpp2.tcap":              {"tcap"},
	"application/vnd.3m.post-it-notes":        {"pwn"},
	"application/vnd.accpac.simply.aso":       {"aso"},
	"application/vnd.accpac.simply.imp":       {"imp"},
	"application/vnd.acucobol":                {"acu"},
	"application/vnd.acucorp":                 {"atc", "acutc"},
	"application/vnd.adobe.air-application-installer-package+zip":               {"air"},
	"application/vnd.adobe.formscentral.fcdt":                                   {"fcdt"},
	"application/vnd.adobe.fxp":                                                 {"fxp", "fxpl"},
	"application/vnd.adobe.xdp+xml":                                             {"xdp"},
	"application/vnd.adobe.xfdf":                                                {"xfdf"},
	"application/vnd.ahead.space":                                               {"ahead"},
	"application/vnd.airzip.filesecure.azf":                                     {"azf"},
	"application/vnd.airzip.filesecure.azs":                                     {"azs"},
	"application/vnd.amazon.ebook":                                              {"azw"},
	"application/vnd.americandynamics.acc":                                      {"acc"},
	"application/vnd.amiga.ami":                                                 {"ami"},
	"application/vnd.android.package-archive":                                   {"apk"},
	"application/vnd.anser-web-certificate-issue-initiation":                    {"cii"},
	"application/vnd.anser-web-funds-transfer-initiation":                       {"fti"},
	"application/vnd.antix.game-component":                                      {"atx"},
	"application/vnd.apple.installer+xml":                                       {"mpkg"},
	"application/vnd.apple.keynote":                                             {"keynote"},
	"application/vnd.apple.mpegurl":                                             {"m3u8"},
	"application/vnd.apple.numbers":                                             {"numbers"},
	"application/vnd.apple.pages":                                               {"pages"},
	"application/vnd.apple.pkpass":                                              {"pkpass"},
	"application/vnd.aristanetworks.swi":                                        {"swi"},
	"application/vnd.astraea-software.iota":                                     {"iota"},
	"application/vnd.audiograph":                                                {"aep"},
	"application/vnd.blueice.multipass":                                         {"mpm"},
	"application/vnd.bmi":                                                       {"bmi"},
	"application/vnd.businessobjects":                                           {"rep"},
	"application/vnd.chemdraw+xml":                                              {"cdxml"},
	"application/vnd.chipnuts.karaoke-mmd":                                      {"mmd"},
	"application/vnd.cinderella":                                                {"cdy"},
	"application/vnd.citationstyles.style+xml":                                  {"csl"},
	"application/vnd.claymore":                                                  {"cla"},
	"application/vnd.cloanto.rp9":                                               {"rp9"},
	"application/vnd.clonk.c4group":                                             {"c4d", "c4f", "c4g", "c4p", "c4u"},
	"application/vnd.cluetrust.cartomobile-config":                              {"c11amc"},
	"application/vnd.cluetrust.cartomobile-config-pkg":                          {"c11amz"},
	"application/vnd.commonspace":                                               {"csp"},
	"application/vnd.contact.cmsg":                                              {"cdbcmsg"},
	"application/vnd.cosmocaller":                                               {"cmc"},
	"application/vnd.crick.clicker":                                             {"clkx"},
	"application/vnd.crick.clicker.keyboard":                                    {"clkk"},
	"application/vnd.crick.clicker.palette":                                     {"clkp"},
	"application/vnd.crick.clicker.template":                                    {"clkt"},
	"application/vnd.crick.clicker.wordbank":                                    {"clkw"},
	"application/vnd.criticaltools.wbs+xml":                                     {"wbs"},
	"application/vnd.ctc-posml":                                                 {"pml"},
	"application/vnd.cups-ppd":                                                  {"ppd"},
	"application/vnd.curl.car":                                                  {"car"},
	"application/vnd.curl.pcurl":                                                {"pcurl"},
	"application/vnd.dart":                                                      {"dart"},
	"application/vnd.data-vision.rdz":                                           {"rdz"},
	"application/vnd.dece.data":                                                 {"uvd", "uvf", "uvvd", "uvvf"},
	"application/vnd.dece.ttml+xml":                                             {"uvt", "uvvt"},
	"application/vnd.dece.unspecified":                                          {"uvvx", "uvx"},
	"application/vnd.dece.zip":                                                  {"uvvz", "uvz"},
	"application/vnd.denovo.fcselayout-link":                                    {"fe_launch"},
	"application/vnd.dna":                                                       {"dna"},
	"application/vnd.dolby.mlp":                                                 {"mlp"},
	"application/vnd.dpgraph":                                                   {"dpg"},
	"application/vnd.dreamfactory":                                              {"dfac"},
	"application/vnd.ds-keypoint":                                               {"kpxx"},
	"application/vnd.dvb.ait":                                                   {"ait"},
	"application/vnd.dvb.service":                                               {"svc"},
	"application/vnd.dynageo":                                                   {"geo"},
	"application/vnd.ecowin.chart":                                              {"mag"},
	"application/vnd.enliven":                                                   {"nml"},
	"application/vnd.epson.esf":                                                 {"esf"},
	"application/vnd.epson.msf":                                                 {"msf"},
	"application/vnd.epson.quickanime":                                          {"qam"},
	"application/vnd.epson.salt":                                                {"slt"},
	"application/vnd.epson.ssf":                                                 {"ssf"},
	"application/vnd.eszigno3+xml":                                              {"es3", "et3"},
	"application/vnd.ezpix-album":                                               {"ez2"},
	"application/vnd.ezpix-package":                                             {"ez3"},
	"application/vnd.fdf":                                                       {"fdf"},
	"application/vnd.fdsn.mseed":                                                {"mseed"},
	"application/vnd.fdsn.seed":                                                 {"seed", "dataless"},
	"application/vnd.flographit":                                                {"gph"},
	"application/vnd.fluxtime.clip":                                             {"ftc"},
	"application/vnd.framemaker":                                                {"fm", "frame", "maker", "book"},
	"application/vnd.frogans.fnc":                                               {"fnc"},
	"application/vnd.frogans.ltf":                                               {"ltf"},
	"application/vnd.fsc.weblaunch":                                             {"fsc"},
	"application/vnd.fujitsu.oasys":                                             {"oas"},
	"application/vnd.fujitsu.oasys2":                                            {"oa2"},
	"application/vnd.fujitsu.oasys3":                                            {"oa3"},
	"application/vnd.fujitsu.oasysgp":                                           {"fg5"},
	"application/vnd.fujitsu.oasysprs":                                          {"bh2"},
	"application/vnd.fujixerox.ddd":                                             {"ddd"},
	"application/vnd.fujixerox.docuworks":                                       {"xdw"},
	"application/vnd.fujixerox.docuworks.binder":                                {"xbd"},
	"application/vnd.fuzzysheet":                                                {"fzs"},
	"application/vnd.genomatix.tuxedo":                                          {"txd"},
	"application/vnd.geogebra.file":                                             {"ggb"},
	"application/vnd.geogebra.tool":                                             {"ggt"},
	"application/vnd.geometry-explorer":                                         {"gex", "gre"},
	"application/vnd.geonext":                                                   {"gxt"},
	"application/vnd.geoplan":                                                   {"g2w"},
	"application/vnd.geospace":                                                  {"g3w"},
	"application/vnd.gmx":                                                       {"gmx"},
	"application/vnd.google-apps.document":                                      {"gdoc"},
	"application/vnd.google-apps.presentation":                                  {"gslides"},
	"application/vnd.google-apps.spreadsheet":                                   {"gsheet"},
	"application/vnd.google-earth.kml+xml":                                      {"kml"},
	"application/vnd.google-earth.kmz":                                          {"kmz"},
	"application/vnd.grafeq":                                                    {"gqf", "gqs"},
	"application/vnd.groove-account":                                            {"gac"},
	"application/vnd.groove-help":                                               {"ghf"},
	"application/vnd.groove-identity-message":                                   {"gim"},
	"application/vnd.groove-injector":                                           {"grv"},
	"application/vnd.groove-tool-message":                                       {"gtm"},
	"application/vnd.groove-tool-template":                                      {"tpl"},
	"application/vnd.groove-vcard":                                              {"vcg"},
	"application/vnd.hal+xml":                                                   {"hal"},
	"application/vnd.handheld-entertainment+xml":                                {"zmm"},
	"application/vnd.hbci":                                                      {"hbci"},
	"application/vnd.hhe.lesson-player":                                         {"les"},
	"application/vnd.hp-hpgl":                                                   {"hpgl"},
	"application/vnd.hp-hpid":                                                   {"hpid"},
	"application/vnd.hp-hps":                                                    {"hps"},
	"application/vnd.hp-jlyt":                                                   {"jlt"},
	"application/vnd.hp-pcl":                                                    {"pcl"},
	"application/vnd.hp-pclxl":                                                  {"pclxl"},
	"application/vnd.hydrostatix.sof-data":                                      {"sfd-hdstx"},
	"application/vnd.ibm.minipay":                                               {"mpy"},
	"application/vnd.ibm.modcap":                                                {"list3820", "listafp", "afp"},
	"application/vnd.ibm.rights-management":                                     {"irm"},
	"application/vnd.ibm.secure-container":                                      {"sc"},
	"application/vnd.iccprofile":                                                {"icc", "icm"},
	"application/vnd.igloader":                                                  {"igl"},
	"application/vnd.immervision-ivp":                                           {"ivp"},
	"application/vnd.immervision-ivu":                                           {"ivu"},
	"application/vnd.insors.igm":                                                {"igm"},
	"application/vnd.intercon.formnet":                                          {"xpw", "xpx"},
	"application/vnd.intergeo":                                                  {"i2g"},
	"application/vnd.intu.qbo":                                                  {"qbo"},
	"application/vnd.intu.qfx":                                                  {"qfx"},
	"application/vnd.ipunplugged.rcprofile":                                     {"rcprofile"},
	"application/vnd.irepository.package+xml":                                   {"irp"},
	"application/vnd.is-xpr":                                                    {"xpr"},
	"application/vnd.isac.fcs":                                                  {"fcs"},
	"application/vnd.jam":                                                       {"jam"},
	"application/vnd.jcp.javame.midlet-rms":                                     {"rms"},
	"application/vnd.jisp":                                                      {"jisp"},
	"application/vnd.joost.joda-archive":                                        {"joda"},
	"application/vnd.kahootz":                                                   {"ktr", "ktz"},
	"application/vnd.kde.karbon":                                                {"karbon"},
	"application/vnd.kde.kchart":                                                {"chrt"},
	"application/vnd.kde.kformula":                                              {"kfo"},
	"application/vnd.kde.kivio":                                                 {"flw"},
	"application/vnd.kde.kontour":                                               {"kon"},
	"application/vnd.kde.kpresenter":                                            {"kpr", "kpt"},
	"application/vnd.kde.kspread":                                               {"ksp"},
	"application/vnd.kde.kword":                                                 {"kwd", "kwt"},
	"application/vnd.kenameaapp":                                                {"htke"},
	"application/vnd.kidspiration":                                              {"kia"},
	"application/vnd.kinar":                                                     {"kne", "knp"},
	"application/vnd.koan":                                                      {"skd", "skm", "skp", "skt"},
	"application/vnd.kodak-descriptor":                                          {"sse"},
	"application/vnd.las.las+xml":                                               {"lasxml"},
	"application/vnd.llamagraphics.life-balance.desktop":                        {"lbd"},
	"application/vnd.llamagraphics.life-balance.exchange+xml":                   {"lbe"},
	"application/vnd.lotus-1-2-3":                                               {"123"},
	"application/vnd.lotus-approach":                                            {"apr"},
	"application/vnd.lotus-freelance":                                           {"pre"},
	"application/vnd.lotus-notes":                                               {"nsf"},
	"application/vnd.lotus-screencam":                                           {"scm"},
	"application/vnd.lotus-wordpro":                                             {"lwp"},
	"application/vnd.macports.portpkg":                                          {"portpkg"},
	"application/vnd.mcd":                                                       {"mcd"},
	"application/vnd.medcalcdata":                                               {"mc1"},
	"application/vnd.mediastation.cdkey":                                        {"cdkey"},
	"application/vnd.mfer":                                                      {"mwf"},
	"application/vnd.mfmp":                                                      {"mfm"},
	"application/vnd.micrografx.flo":                                            {"flo"},
	"application/vnd.micrografx.igx":                                            {"igx"},
	"application/vnd.mif":                                                       {"mif"},
	"application/vnd.mobius.daf":                                                {"daf"},
	"application/vnd.mobius.dis":                                                {"dis"},
	"application/vnd.mobius.mbk":                                                {"mbk"},
	"application/vnd.mobius.mqy":                                                {"mqy"},
	"application/vnd.mobius.msl":                                                {"msl"},
	"application/vnd.mobius.plc":                                                {"plc"},
	"application/vnd.mobius.txf":                                                {"txf"},
	"application/vnd.mophun.application":                                        {"mpn"},
	"application/vnd.mophun.certificate":                                        {"mpc"},
	"application/vnd.mozilla.xul+xml":                                           {"xul"},
	"application/vnd.ms-artgalry":                                               {"cil"},
	"application/vnd.ms-cab-compressed":                                         {"cab"},
	"application/vnd.ms-excel":                                                  {"xls", "xlw", "xla", "xlc", "xlm", "xlt"},
	"application/vnd.ms-excel.addin.macroenabled.12":                            {"xlam"},
	"application/vnd.ms-excel.sheet.binary.macroenabled.12":                     {"xlsb"},
	"application/vnd.ms-excel.sheet.macroenabled.12":                            {"xlsm"},
	"application/vnd.ms-excel.template.macroenabled.12":                         {"xltm"},
	"application/vnd.ms-fontobject":                                             {"eot"},
	"application/vnd.ms-htmlhelp":                                               {"chm"},
	"application/vnd.ms-ims":                                                    {"ims"},
	"application/vnd.ms-lrm":                                                    {"lrm"},
	"application/vnd.ms-officetheme":                                            {"thmx"},
	"application/vnd.ms-outlook":                                                {"msg"},
	"application/vnd.ms-pki.seccat":                                             {"cat"},
	"application/vnd.ms-pki.stl":                                                {"stl"},
	"application/vnd.ms-powerpoint":                                             {"ppt", "pps", "pot"},
	"application/vnd.ms-powerpoint.addin.macroenabled.12":                       {"ppam"},
	"application/vnd.ms-powerpoint.presentation.macroenabled.12":                {"pptm"},
	"application/vnd.ms-powerpoint.slide.macroenabled.12":                       {"sldm"},
	"application/vnd.ms-powerpoint.slideshow.macroenabled.12":                   {"ppsm"},
	"application/vnd.ms-powerpoint.template.macroenabled.12":                    {"potm"},
	"application/vnd.ms-project":                                                {"mpp", "mpt"},
	"application/vnd.ms-word.document.macroenabled.12":                          {"docm"},
	"application/vnd.ms-word.template.macroenabled.12":                          {"dotm"},
	"application/vnd.ms-works":                                                  {"wcm", "wdb", "wks", "wps"},
	"application/vnd.ms-wpl":                                                    {"wpl"},
	"application/vnd.ms-xpsdocument":                                            {"xps"},
	"application/vnd.mseq":                                                      {"mseq"},
	"application/vnd.musician":                                                  {"mus"},
	"application/vnd.muvee.style":                                               {"msty"},
	"application/vnd.mynfc":                                                     {"taglet"},
	"application/vnd.neurolanguage.nlu":                                         {"nlu"},
	"application/vnd.nitf":                                                      {"nitf", "ntf"},
	"application/vnd.noblenet-directory":                                        {"nnd"},
	"application/vnd.noblenet-sealer":                                           {"nns"},
	"application/vnd.noblenet-web":                                              {"nnw"},
	"application/vnd.nokia.n-gage.data":                                         {"ngdat"},
	"application/vnd.nokia.n-gage.symbian.install":                              {"n-gage"},
	"application/vnd.nokia.radio-preset":                                        {"rpst"},
	"application/vnd.nokia.radio-presets":                                       {"rpss"},
	"application/vnd.novadigm.edm":                                              {"edm"},
	"application/vnd.novadigm.edx":                                              {"edx"},
	"application/vnd.novadigm.ext":                                              {"ext"},
	"application/vnd.oasis.opendocument.chart":                                  {"odc"},
	"application/vnd.oasis.opendocument.chart-template":                         {"otc"},
	"application/vnd.oasis.opendocument.database":                               {"odb"},
	"application/vnd.oasis.opendocument.formula":                                {"odf"},
	"application/vnd.oasis.opendocument.formula-template":                       {"odft"},
	"application/vnd.oasis.opendocument.graphics":                               {"odg"},
	"application/vnd.oasis.opendocument.graphics-template":                      {"otg"},
	"application/vnd.oasis.opendocument.image":                                  {"odi"},
	"application/vnd.oasis.opendocument.image-template":                         {"oti"},
	"application/vnd.oasis.opendocument.presentation":                           {"odp"},
	"application/vnd.oasis.opendocument.presentation-template":                  {"otp"},
	"application/vnd.oasis.opendocument.spreadsheet":                            {"ods"},
	"application/vnd.oasis.opendocument.spreadsheet-template":                   {"ots"},
	"application/vnd.oasis.opendocument.text":                                   {"odt"},
	"application/vnd.oasis.opendocument.text-master":                            {"odm"},
	"application/vnd.oasis.opendocument.text-template":                          {"ott"},
	"application/vnd.oasis.opendocument.text-web":                               {"oth"},
	"application/vnd.olpc-sugar":                                                {"xo"},
	"application/vnd.oma.dd2+xml":                                               {"dd2"},
	"application/vnd.openofficeorg.extension":                                   {"oxt"},
	"application/vnd.openxmlformats-officedocument.presentationml.presentation": {"pptx"},
	"application/vnd.openxmlformats-officedocument.presentationml.slide":        {"sldx"},
	"application/vnd.openxmlformats-officedocument.presentationml.slideshow":    {"ppsx"},
	"application/vnd.openxmlformats-officedocument.presentationml.template":     {"potx"},
	"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":         {"xlsx"},
	"application/vnd.openxmlformats-officedocument.spreadsheetml.template":      {"xltx"},
	"application/vnd.openxmlformats-officedocument.wordprocessingml.document":   {"docx"},
	"application/vnd.openxmlformats-officedocument.wordprocessingml.template":   {"dotx"},
	"application/vnd.osgeo.mapguide.package":                                    {"mgp"},
	"application/vnd.osgi.dp":                                                   {"dp"},
	"application/vnd.osgi.subsystem":                                            {"esa"},
	"application/vnd.palm":                                                      {"pqa", "oprc"},
	"application/vnd.pawaafile":                                                 {"paw"},
	"application/vnd.pg.format":                                                 {"str"},
	"application/vnd.pg.osasli":                                                 {"ei6"},
	"application/vnd.picsel":                                                    {"efif"},
	"application/vnd.pmi.widget":                                                {"wg"},
	"application/vnd.pocketlearn":                                               {"plf"},
	"application/vnd.powerbuilder6":                                             {"pbd"},
	"application/vnd.previewsystems.box":                                        {"box"},
	"application/vnd.proteus.magazine":                                          {"mgz"},
	"application/vnd.publishare-delta-tree":                                     {"qps"},
	"application/vnd.pvi.ptid1":                                                 {"ptid"},
	"application/vnd.quark.quarkxpress":                                         {"qwd", "qwt", "qxb", "qxd", "qxl", "qxt"},
	"application/vnd.realvnc.bed":                                               {"bed"},
	"application/vnd.recordare.musicxml":                                        {"mxl"},
	"application/vnd.recordare.musicxml+xml":                                    {"musicxml"},
	"application/vnd.rig.cryptonote":                                            {"cryptonote"},
	"application/vnd.rim.cod":                                                   {"cod"},
	"application/vnd.rn-realmedia":                                              {"rm"},
	"application/vnd.rn-realmedia-vbr":                                          {"rmvb"},
	"application/vnd.route66.link66+xml":                                        {"link66"},
	"application/vnd.sailingtracker.track":                                      {"st"},
	"application/vnd.seemail":                                                   {"see"},
	"application/vnd.sema":                                                      {"sema"},
	"application/vnd.semd":                                                      {"semd"},
	"application/vnd.semf":                                                      {"semf"},
	"application/vnd.shana.informed.formdata":                                   {"ifm"},
	"application/vnd.shana.informed.formtemplate":                               {"itp"},
	"application/vnd.shana.informed.interchange":                                {"iif"},
	"application/vnd.shana.informed.package":                                    {"ipk"},
	"application/vnd.simtech-mindmapper":                                        {"twd", "twds"},
	"application/vnd.smaf":                                                      {"mmf"},
	"application/vnd.smart.teacher":                                             {"teacher"},
	"application/vnd.solent.sdkm+xml":                                           {"sdkd", "sdkm"},
	"application/vnd.spotfire.dxp":                                              {"dxp"},
	"application/vnd.spotfire.sfs":                                              {"sfs"},
	"application/vnd.stardivision.calc":                                         {"sdc"},
	"application/vnd.stardivision.draw":                                         {"sda"},
	"application/vnd.stardivision.impress":                                      {"sdd"},
	"application/vnd.stardivision.math":                                         {"smf"},
	"application/vnd.stardivision.writer":                                       {"sdw", "vor"},
	"application/vnd.stardivision.writer-global":                                {"sgl"},
	"application/vnd.stepmania.package":                                         {"smzip"},
	"application/vnd.stepmania.stepchart":                                       {"sm"},
	"application/vnd.sun.wadl+xml":                                              {"wadl"},
	"application/vnd.sun.xml.calc":                                              {"sxc"},
	"application/vnd.sun.xml.calc.template":                                     {"stc"},
	"application/vnd.sun.xml.draw":                                              {"sxd"},
	"application/vnd.sun.xml.draw.template":                                     {"std"},
	"application/vnd.sun.xml.impress":                                           {"sxi"},
	"application/vnd.sun.xml.impress.template":                                  {"sti"},
	"application/vnd.sun.xml.math":                                              {"sxm"},
	"application/vnd.sun.xml.writer":                                            {"sxw"},
	"application/vnd.sun.xml.writer.global":                                     {"sxg"},
	"application/vnd.sun.xml.writer.template":                                   {"stw"},
	"application/vnd.sus-calendar":                                              {"sus", "susp"},
	"application/vnd.svd":                                                       {"svd"},
	"application/vnd.symbian.install":                                           {"sis", "sisx"},
	"application/vnd.syncml+xml":                                                {"xsm"},
	"application/vnd.syncml.dm+wbxml":                                           {"bdm"},
	"application/vnd.syncml.dm+xml":                                             {"xdm"},
	"application/vnd.tao.intent-module-archive":                                 {"tao"},
	"application/vnd.tcpdump.pcap":                                              {"pcap", "cap", "dmp"},
	"application/vnd.tmobile-livetv":                                            {"tmo"},
	"application/vnd.trid.tpt":                                                  {"tpt"},
	"application/vnd.triscape.mxs":                                              {"mxs"},
	"application/vnd.trueapp":                                                   {"tra"},
	"application/vnd.ufdl":                                                      {"ufd", "ufdl"},
	"application/vnd.uiq.theme":                                                 {"utz"},
	"application/vnd.umajin":                                                    {"umj"},
	"application/vnd.unity":                                                     {"unityweb"},
	"application/vnd.uoml+xml":                                                  {"uoml"},
	"application/vnd.vcx":                                                       {"vcx"},
	"application/vnd.visio":                                                     {"vsd", "vss", "vst", "vsw"},
	"application/vnd.visionary":                                                 {"vis"},
	"application/vnd.vsf":                                                       {"vsf"},
	"application/vnd.wap.wbxml":                                                 {"wbxml"},
	"application/vnd.wap.wmlc":                                                  {"wmlc"},
	"application/vnd.wap.wmlscriptc":                                            {"wmlsc"},
	"application/vnd.webturbo":                                                  {"wtb"},
	"application/vnd.wolfram.player":                                            {"nbp"},
	"application/vnd.wordperfect":                                               {"wpd"},
	"application/vnd.wqd":                                                       {"wqd"},
	"application/vnd.wt.stf":                                                    {"stf"},
	"application/vnd.xara":                                                      {"xar"},
	"application/vnd.xfdl":                                                      {"xfdl"},
	"application/vnd.yamaha.hv-dic":                                             {"hvd"},
	"application/vnd.yamaha.hv-script":                                          {"hvs"},
	"application/vnd.yamaha.hv-voice":                                           {"hvp"},
	"application/vnd.yamaha.openscoreformat":                                    {"osf"},
	"application/vnd.yamaha.openscoreformat.osfpvg+xml":                         {"osfpvg"},
	"application/vnd.yamaha.smaf-audio":                                         {"saf"},
	"application/vnd.yamaha.smaf-phrase":                                        {"spf"},
	"application/vnd.yellowriver-custom-menu":                                   {"cmp"},
	"application/vnd.zul":                                                       {"zir", "zirz"},
	"application/vnd.zzazz.deck+xml":                                            {"zaz"},
	"application/voicexml+xml":                                                  {"vxml"},
	"application/wasm":                                                          {"wasm"},
	"application/widget":                                                        {"wgt"},
	"application/winhlp":                                                        {"hlp"},
	"application/wsdl+xml":                                                      {"wsdl"},
	"application/wspolicy+xml":                                                  {"wspolicy"},
	"application/x-7z-compressed":                                               {"7z"},
	"application/x-abiword":                                                     {"abw"},
	"application/x-ace-compressed":                                              {"ace"},
	"application/x-apple-diskimage":                                             {"dmg"},
	"application/x-arj":                                                         {"arj"},
	"application/x-authorware-bin":                                              {"u32", "vox", "x32", "aab"},
	"application/x-authorware-map":                                              {"aam"},
	"application/x-authorware-seg":                                              {"aas"},
	"application/x-bcpio":                                                       {"bcpio"},
	"application/x-bdoc":                                                        {"bdoc"},
	"application/x-bittorrent":                                                  {"torrent"},
	"application/x-blorb":                                                       {"blb", "blorb"},
	"application/x-bzip":                                                        {"bz"},
	"application/x-bzip2":                                                       {"boz", "bz2"},
	"application/x-cbr":                                                         {"cb7", "cba", "cbr", "cbt", "cbz"},
	"application/x-cdlink":                                                      {"vcd"},
	"application/x-cfs-compressed":                                              {"cfs"},
	"application/x-chat":                                                        {"chat"},
	"application/x-chess-pgn":                                                   {"pgn"},
	"application/x-chrome-extension":                                            {"crx"},
	"application/x-cocoa":                                                       {"cco"},
	"application/x-conference":                                                  {"nsc"},
	"application/x-cpio":                                                        {"cpio"},
	"application/x-csh":                                                         {"csh"},
	"application/x-debian-package":                                              {"deb", "udeb"},
	"application/x-dgc-compressed":                                              {"dgc"},
	"application/x-director":                                                    {"dxr", "fgd", "cct", "cst", "cxt", "dcr", "dir", "swa", "w3d"},
	"application/x-doom":                                                        {"wad"},
	"application/x-dtbncx+xml":                                                  {"ncx"},
	"application/x-dtbook+xml":                                                  {"dtb"},
	"application/x-dtbresource+xml":                                             {"res"},
	"application/x-dvi":                                                         {"dvi"},
	"application/x-envoy":                                                       {"evy"},
	"application/x-eva":                                                         {"eva"},
	"application/x-font-bdf":                                                    {"bdf"},
	"application/x-font-ghostscript":                                            {"gsf"},
	"application/x-font-linux-psf":                                              {"psf"},
	"application/x-font-pcf":                                                    {"pcf"},
	"application/x-font-snf":                                                    {"snf"},
	"application/x-font-type1":                                                  {"pfa", "pfb", "pfm", "afm"},
	"application/x-freearc":                                                     {"arc"},
	"application/x-futuresplash":                                                {"spl"},
	"application/x-gca-compressed":                                              {"gca"},
	"application/x-glulx":                                                       {"ulx"},
	"application/x-gnumeric":                                                    {"gnumeric"},
	"application/x-gramps-xml":                                                  {"gramps"},
	"application/x-gtar":                                                        {"gtar"},
	"application/x-hdf":                                                         {"hdf"},
	"application/x-httpd-php":                                                   {"php"},
	"application/x-install-instructions":                                        {"install"},
	"application/x-iso9660-image":                                               {"iso"},
	"application/x-java-archive-diff":                                           {"jardiff"},
	"application/x-java-jnlp-file":                                              {"jnlp"},
	"application/x-latex":                                                       {"latex"},
	"application/x-lua-bytecode":                                                {"luac"},
	"application/x-lzh-compressed":                                              {"lha", "lzh"},
	"application/x-makeself":                                                    {"run"},
	"application/x-mie":                                                         {"mie"},
	"application/x-mobipocket-ebook":                                            {"mobi"},
	"application/x-mpegurl":                                                     {"m3u8"},
	"application/x-ms-application":                                              {"application"},
	"application/x-ms-shortcut":                                                 {"lnk"},
	"application/x-ms-wmd":                                                      {"wmd"},
	"application/x-ms-xbap":                                                     {"xbap"},
	"application/x-msaccess":                                                    {"mdb"},
	"application/x-msbinder":                                                    {"obd"},
	"application/x-mscardfile":                                                  {"crd"},
	"application/x-msclip":                                                      {"clp"},
	"application/x-msdownload":                                                  {"exe", "msi", "bat", "com", "dll"},
	"application/x-msmediaview":                                                 {"m13", "m14", "mvb"},
	"application/x-msmetafile":                                                  {"emz", "wmz"},
	"application/x-msmoney":                                                     {"mny"},
	"application/x-mspublisher":                                                 {"pub"},
	"application/x-msschedule":                                                  {"scd"},
	"application/x-msterminal":                                                  {"trm"},
	"application/x-mswrite":                                                     {"wri"},
	"application/x-netcdf":                                                      {"nc", "cdf"},
	"application/x-ns-proxy-autoconfig":                                         {"pac"},
	"application/x-nzb":                                                         {"nzb"},
	"application/x-perl":                                                        {"pl", "pm"},
	"application/x-pilot":                                                       {"prc", "pdb"},
	"application/x-pkcs12":                                                      {"p12", "pfx"},
	"application/x-pkcs7-certificates":                                          {"p7b", "spc"},
	"application/x-pkcs7-certreqresp":                                           {"p7r"},
	"application/x-rar-compressed":                                              {"rar"},
	"application/x-redhat-package-manager":                                      {"rpm"},
	"application/x-research-info-systems":                                       {"ris"},
	"application/x-sea":                                                         {"sea"},
	"application/x-sh":                                                          {"sh"},
	"application/x-shar":                                                        {"shar"},
	"application/x-shockwave-flash":                                             {"swf"},
	"application/x-silverlight-app":                                             {"xap"},
	"application/x-sql":                                                         {"sql"},
	"application/x-stuffit":                                                     {"sit"},
	"application/x-stuffitx":                                                    {"sitx"},
	"application/x-subrip":                                                      {"srt"},
	"application/x-sv4cpio":                                                     {"sv4cpio"},
	"application/x-sv4crc":                                                      {"sv4crc"},
	"application/x-t3vm-image":                                                  {"t3"},
	"application/x-tads":                                                        {"gam"},
	"application/x-tar":                                                         {"tar"},
	"application/x-tcl":                                                         {"tcl", "tk"},
	"application/x-tex":                                                         {"tex"},
	"application/x-tex-tfm":                                                     {"tfm"},
	"application/x-texinfo":                                                     {"texi", "texinfo"},
	"application/x-tgif":                                                        {"obj"},
	"application/x-ustar":                                                       {"ustar"},
	"application/x-virtualbox-hdd":                                              {"hdd"},
	"application/x-virtualbox-ova":                                              {"ova"},
	"application/x-virtualbox-ovf":                                              {"ovf"},
	"application/x-virtualbox-vbox":                                             {"vbox"},
	"application/x-virtualbox-vbox-extpack":                                     {"vbox-extpack"},
	"application/x-virtualbox-vdi":                                              {"vdi"},
	"application/x-virtualbox-vhd":                                              {"vhd"},
	"application/x-virtualbox-vmdk":                                             {"vmdk"},
	"application/x-wais-source":                                                 {"src"},
	"application/x-web-app-manifest+json":                                       {"webapp"},
	"application/x-x509-ca-cert":                                                {"pem", "crt", "der"},
	"application/x-xfig":                                                        {"fig"},
	"application/x-xliff+xml":                                                   {"xlf"},
	"application/x-xpinstall":                                                   {"xpi"},
	"application/x-xz":                                                          {"xz"},
	"application/x-zmachine":                                                    {"z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"},
	"application/xaml+xml":                                                      {"xaml"},
	"application/xcap-diff+xml":                                                 {"xdf"},
	"application/xenc+xml":                                                      {"xenc"},
	"application/xhtml+xml":                                                     {"xht", "xhtml"},
	"application/xml":                                                           {"xml", "rng", "xsd", "xsl"},
	"application/xml-dtd":                                                       {"dtd"},
	"application/xop+xml":                                                       {"xop"},
	"application/xproc+xml":                                                     {"xpl"},
	"application/xslt+xml":                                                      {"xslt"},
	"application/xspf+xml":                                                      {"xspf"},
	"application/xv+xml":                                                        {"xvm", "xvml", "mxml", "xhvml"},
	"application/yang":                                                          {"yang"},
	"application/yin+xml":                                                       {"yin"},
	"application/zip":                                                           {"zip"},
	"audio/adpcm":                                                               {"adp"},
	"audio/basic":                                                               {"au", "snd"},
	"audio/midi":                                                                {"rmi", "kar", "mid", "midi"},
	"audio/mp4":                                                                 {"mp4a"},
	"audio/mpeg":                                                                {"mp3", "m2a", "m3a", "mp2", "mp2a", "mpga"},
	"audio/ogg":                                                                 {"ogg", "oga", "spx"},
	"audio/s3m":                                                                 {"s3m"},
	"audio/silk":                                                                {"sil"},
	"audio/vnd.dece.audio":                                                      {"uva", "uvva"},
	"audio/vnd.digital-winds":                                                   {"eol"},
	"audio/vnd.dra":                                                             {"dra"},
	"audio/vnd.dts":                                                             {"dts"},
	"audio/vnd.dts.hd":                                                          {"dtshd"},
	"audio/vnd.lucent.voice":                                                    {"lvp"},
	"audio/vnd.ms-playready.media.pya":                                          {"pya"},
	"audio/vnd.nuera.ecelp4800":                                                 {"ecelp4800"},
	"audio/vnd.nuera.ecelp7470":                                                 {"ecelp7470"},
	"audio/vnd.nuera.ecelp9600":                                                 {"ecelp9600"},
	"audio/vnd.rip":                                                             {"rip"},
	"audio/webm":                                                                {"weba"},
	"audio/x-aac":                                                               {"aac"},
	"audio/x-aiff":                                                              {"aif", "aifc", "aiff"},
	"audio/x-caf":                                                               {"caf"},
	"audio/x-flac":                                                              {"flac"},
	"audio/x-m4a":                                                               {"m4a"},
	"audio/x-matroska":                                                          {"mka"},
	"audio/x-mpegurl":                                                           {"m3u"},
	"audio/x-ms-wax":                                                            {"wax"},
	"audio/x-ms-wma":                                                            {"wma"},
	"audio/x-pn-realaudio":                                                      {"ram"},
	"audio/x-pn-realaudio-plugin":                                               {"rmp"},
	"audio/x-realaudio":                                                         {"ra"},
	"audio/x-wav":                                                               {"wav"},
	"audio/xm":                                                                  {"xm"},
	"chemical/x-cdx":                                                            {"cdx"},
	"chemical/x-cif":                                                            {"cif"},
	"chemical/x-cmdf":                                                           {"cmdf"},
	"chemical/x-cml":                                                            {"cml"},
	"chemical/x-csml":                                                           {"csml"},
	"chemical/x-xyz":                                                            {"xyz"},
	"font/collection":                                                           {"ttc"},
	"font/otf":                                                                  {"otf"},
	"font/ttf":                                                                  {"ttf"},
	"font/woff":                                                                 {"woff"},
	"font/woff2":                                                                {"woff2"},
	"image/aces":                                                                {"exr"},
	"image/apng":                                                                {"apng"},
	"image/cgm":                                                                 {"cgm"},
	"image/dicom-rle":                                                           {"drle"},
	"image/emf":                                                                 {"emf"},
	"image/fits":                                                                {"fits"},
	"image/g3fax":                                                               {"g3"},
	"image/gif":                                                                 {"gif"},
	"image/heic":                                                                {"heic"},
	"image/heic-sequence":                                                       {"heics"},
	"image/heif":                                                                {"heif"},
	"image/heif-sequence":                                                       {"heifs"},
	"image/ief":                                                                 {"ief"},
	"image/jls":                                                                 {"jls"},
	"image/jp2":                                                                 {"jp2", "jpg2"},
	"image/jpeg":                                                                {"jpeg", "jpe", "jpg"},
	"image/jpx":                                                                 {"jpf", "jpx"},
	"image/ktx":                                                                 {"ktx"},
	"image/png":                                                                 {"png"},
	"image/prs.btif":                                                            {"btif"},
	"image/prs.pti":                                                             {"pti"},
	"image/sgi":                                                                 {"sgi"},
	"image/svg+xml":                                                             {"svg", "svgz"},
	"image/t38":                                                                 {"t38"},
	"image/tiff":                                                                {"tif", "tiff"},
	"image/tiff-fx":                                                             {"tfx"},
	"image/vnd.adobe.photoshop":                                                 {"psd"},
	"image/vnd.airzip.accelerator.azv":                                          {"azv"},
	"image/vnd.dece.graphic":                                                    {"uvg", "uvi", "uvvg", "uvvi"},
	"image/vnd.djvu":                                                            {"djv", "djvu"},
	"image/vnd.dwg":                                                             {"dwg"},
	"image/vnd.dxf":                                                             {"dxf"},
	"image/vnd.fastbidsheet":                                                    {"fbs"},
	"image/vnd.fpx":                                                             {"fpx"},
	"image/vnd.fst":                                                             {"fst"},
	"image/vnd.fujixerox.edmics-mmr":                                            {"mmr"},
	"image/vnd.fujixerox.edmics-rlc":                                            {"rlc"},
	"image/vnd.ms-modi":                                                         {"mdi"},
	"image/vnd.ms-photo":                                                        {"wdp"},
	"image/vnd.net-fpx":                                                         {"npx"},
	"image/vnd.tencent.tap":                                                     {"tap"},
	"image/vnd.valve.source.texture":                                            {"vtf"},
	"image/vnd.wap.wbmp":                                                        {"wbmp"},
	"image/vnd.xiff":                                                            {"xif"},
	"image/webp":                                                                {"webp"},
	"image/wmf":                                                                 {"wmf"},
	"image/x-3ds":                                                               {"3ds"},
	"image/x-adobe-dng":                                                         {"dng"},
	"image/x-canon-cr2":                                                         {"cr2"},
	"image/x-canon-crw":                                                         {"crw"},
	"image/x-cmu-raster":                                                        {"ras"},
	"image/x-cmx":                                                               {"cmx"},
	"image/x-epson-erf":                                                         {"erf"},
	"image/x-freehand":                                                          {"fh", "fh4", "fh5", "fh7", "fhc"},
	"image/x-fuji-raf":                                                          {"raf"},
	"image/x-icon":                                                              {"ico"},
	"image/x-jng":                                                               {"jng"},
	"image/x-kodak-k25":                                                         {"k25"},
	"image/x-kodak-kdc":                                                         {"kdc"},
	"image/x-minolta-mrw":                                                       {"mrw"},
	"image/x-mrsid-image":                                                       {"sid"},
	"image/x-ms-bmp":                                                            {"bmp"},
	"image/x-nikon-nef":                                                         {"nef"},
	"image/x-olympus-orf":                                                       {"orf"},
	"image/x-panasonic-raw":                                                     {"raw"},
	"image/x-pcx":                                                               {"pcx"},
	"image/x-pentax-pef":                                                        {"pef"},
	"image/x-pict":                                                              {"pct", "pic"},
	"image/x-portable-anymap":                                                   {"pnm"},
	"image/x-portable-bitmap":                                                   {"pbm"},
	"image/x-portable-graymap":                                                  {"pgm"},
	"image/x-portable-pixmap":                                                   {"ppm"},
	"image/x-rgb":                                                               {"rgb"},
	"image/x-sigma-x3f":                                                         {"x3f"},
	"image/x-sony-arw":                                                          {"arw"},
	"image/x-sony-sr2":                                                          {"sr2"},
	"image/x-sony-srf":                                                          {"srf"},
	"image/x-tga":                                                               {"tga"},
	"image/x-xbitmap":                                                           {"xbm"},
	"image/x-xpixmap":                                                           {"xpm"},
	"image/x-xwindowdump":                                                       {"xwd"},
	"message/disposition-notification":                                          {"disposition-notification"},
	"message/global":                                                            {"u8msg"},
	"message/global-delivery-status":                                            {"u8dsn"},
	"message/global-disposition-notification":                                   {"u8mdn"},
	"message/global-headers":                                                    {"u8hdr"},
	"message/rfc822":                                                            {"eml", "mime"},
	"message/vnd.wfa.wsc":                                                       {"wsc"},
	"model/gltf+json":                                                           {"gltf"},
	"model/gltf-binary":                                                         {"glb"},
	"model/iges":                                                                {"iges", "igs"},
	"model/mesh":                                                                {"silo", "mesh", "msh"},
	"model/vnd.collada+xml":                                                     {"dae"},
	"model/vnd.dwf":                                                             {"dwf"},
	"model/vnd.gdl":                                                             {"gdl"},
	"model/vnd.gtw":                                                             {"gtw"},
	"model/vnd.mts":                                                             {"mts"},
	"model/vnd.vtu":                                                             {"vtu"},
	"model/vrml":                                                                {"vrml", "wrl"},
	"model/x3d+binary":                                                          {"x3db", "x3dbz"},
	"model/x3d+vrml":                                                            {"x3dv", "x3dvz"},
	"model/x3d+xml":                                                             {"x3d", "x3dz"},
	"text/cache-manifest":                                                       {"manifest", "appcache"},
	"text/calendar":                                                             {"ics", "ifb"},
	"text/coffeescript":                                                         {"litcoffee", "coffee"},
	"text/css":                                                                  {"css"},
	"text/csv":                                                                  {"csv"},
	"text/html":                                                                 {"html", "htm", "shtml"},
	"text/jade":                                                                 {"jade"},
	"text/jsx":                                                                  {"jsx"},
	"text/less":                                                                 {"less"},
	"text/markdown":                                                             {"md", "markdown"},
	"text/mathml":                                                               {"mml"},
	"text/n3":                                                                   {"n3"},
	"text/plain":                                                                {"txt", "in", "ini", "list", "log", "conf", "def", "text"},
	"text/prs.lines.tag":                                                        {"dsc"},
	"text/richtext":                                                             {"rtx"},
	"text/rtf":                                                                  {"rtf"},
	"text/sgml":                                                                 {"sgm", "sgml"},
	"text/shex":                                                                 {"shex"},
	"text/slim":                                                                 {"slim", "slm"},
	"text/stylus":                                                               {"styl", "stylus"},
	"text/tab-separated-values":                                                 {"tsv"},
	"text/troff":                                                                {"roff", "man", "me", "ms", "t", "tr"},
	"text/turtle":                                                               {"ttl"},
	"text/uri-list":                                                             {"uri", "uris", "urls"},
	"text/vcard":                                                                {"vcard"},
	"text/vnd.curl":                                                             {"curl"},
	"text/vnd.curl.dcurl":                                                       {"dcurl"},
	"text/vnd.curl.mcurl":                                                       {"mcurl"},
	"text/vnd.curl.scurl":                                                       {"scurl"},
	"text/vnd.dvb.subtitle":                                                     {"sub"},
	"text/vnd.fly":                                                              {"fly"},
	"text/vnd.fmi.flexstor":                                                     {"flx"},
	"text/vnd.graphviz":                                                         {"gv"},
	"text/vnd.in3d.3dml":                                                        {"3dml"},
	"text/vnd.in3d.spot":                                                        {"spot"},
	"text/vnd.sun.j2me.app-descriptor":                                          {"jad"},
	"text/vnd.wap.wml":                                                          {"wml"},
	"text/vnd.wap.wmlscript":                                                    {"wmls"},
	"text/vtt":                                                                  {"vtt"},
	"text/x-asm":                                                                {"s", "asm"},
	"text/x-c":                                                                  {"h", "hh", "c", "cc", "cpp", "cxx", "dic"},
	"text/x-component":                                                          {"htc"},
	"text/x-fortran":                                                            {"f", "f77", "f90", "for"},
	"text/x-handlebars-template":                                                {"hbs"},
	"text/x-java-source":                                                        {"java"},
	"text/x-lua":                                                                {"lua"},
	"text/x-markdown":                                                           {"mkd"},
	"text/x-nfo":                                                                {"nfo"},
	"text/x-opml":                                                               {"opml"},
	"text/x-org":                                                                {"org"},
	"text/x-pascal":                                                             {"p", "pas"},
	"text/x-processing":                                                         {"pde"},
	"text/x-sass":                                                               {"sass"},
	"text/x-scss":                                                               {"scss"},
	"text/x-setext":                                                             {"etx"},
	"text/x-sfv":                                                                {"sfv"},
	"text/x-suse-ymp":                                                           {"ymp"},
	"text/x-uuencode":                                                           {"uu"},
	"text/x-vcalendar":                                                          {"vcs"},
	"text/x-vcard":                                                              {"vcf"},
	"text/xml":                                                                  {"xml"},
	"text/yaml":                                                                 {"yaml", "yml"},
	"video/3gpp":                                                                {"3gp", "3gpp"},
	"video/3gpp2":                                                               {"3g2"},
	"video/h261":                                                                {"h261"},
	"video/h263":                                                                {"h263"},
	"video/h264":                                                                {"h264"},
	"video/jpeg":                                                                {"jpgv"},
	"video/jpm":                                                                 {"jpgm", "jpm"},
	"video/mj2":                                                                 {"mj2", "mjp2"},
	"video/mp2t":                                                                {"ts"},
	"video/mp4":                                                                 {"mp4", "mp4v", "mpg4"},
	"video/mpeg":                                                                {"mpeg", "m1v", "m2v", "mpe", "mpeg"},
	"video/ogg":                                                                 {"ogv"},
	"video/quicktime":                                                           {"qt", "mov"},
	"video/vnd.dece.hd":                                                         {"uvh", "uvvh"},
	"video/vnd.dece.mobile":                                                     {"uvm", "uvvm"},
	"video/vnd.dece.pd":                                                         {"uvp", "uvvp"},
	"video/vnd.dece.sd":                                                         {"uvs", "uvvs"},
	"video/vnd.dece.video":                                                      {"uvv", "uvvv"},
	"video/vnd.dvb.file":                                                        {"dvb"},
	"video/vnd.fvt":                                                             {"fvt"},
	"video/vnd.mpegurl":                                                         {"m4u", "mxu"},
	"video/vnd.ms-playready.media.pyv":                                          {"pyv"},
	"video/vnd.uvvu.mp4":                                                        {"uvu", "uvvu"},
	"video/vnd.vivo":                                                            {"viv"},
	"video/webm":                                                                {"webm"},
	"video/x-f4v":                                                               {"f4v"},
	"video/x-fli":                                                               {"fli"},
	"video/x-flv":                                                               {"flv"},
	"video/x-m4v":                                                               {"m4v"},
	"video/x-matroska":                                                          {"mkv", "mk3d", "mks"},
	"video/x-mng":                                                               {"mng"},
	"video/x-ms-asf":                                                            {"asf", "asx"},
	"video/x-ms-vob":                                                            {"vob"},
	"video/x-ms-wm":                                                             {"wm"},
	"video/x-ms-wmv":                                                            {"wmv"},
	"video/x-ms-wmx":                                                            {"wmx"},
	"video/x-ms-wvx":                                                            {"wvx"},
	"video/x-msvideo":                                                           {"avi"},
	"video/x-sgi-movie":                                                         {"movie"},
	"video/x-smv":                                                               {"smv"},
	"x-conference/x-cooltalk":                                                   {"ice"},
}

// TypeByExtension returns the content type based on the extension of the file
func extensionByType(typ string) []string {
	return mimeTypes[strings.ToLower(typ)]
}

// recycleReader returns the MIME type of input and a new reader
// containing the whole data from input.
func recycleReader(input io.Reader) (mimeType string, recycled io.Reader, err error) {
	// header will store the bytes mimetype uses for detection.
	header := bytes.NewBuffer(nil)

	// After DetectReader, the data read from input is copied into header.
	mtype, err := mimetype.DetectReader(io.TeeReader(input, header))

	// Concatenate back the header to the rest of the file.
	// recycled now contains the complete, original data.
	recycled = io.MultiReader(header, input)

	return mtype.String(), recycled, err
}

A  => translators.go +190 -0
@@ 1,190 @@
package libphoton

import (
	"fmt"
	"strings"
	"time"

	"github.com/mmcdole/gofeed"
	"github.com/mmcdole/gofeed/atom"
	"github.com/mmcdole/gofeed/rss"
	"golang.org/x/net/html"
)

func getExt(f func() string) (val string, ok bool) {
	defer func() {
		if r := recover(); r != nil {
			val = ""
			ok = false
		}
	}()
	return f(), true
}

//find img html element and extract raw text in description and/or content
func scrapContent(item *gofeed.Item) {
	var simpleContent string
	z := html.NewTokenizer(
		strings.NewReader(
			html.UnescapeString(item.Description + "\n" + item.Content),
		),
	)
	previousStartTokenTest := z.Token()
loopDomTest:
	for {
		tt := z.Next()
		switch tt {
		case html.ErrorToken:
			break loopDomTest // End of the document,  done
		case html.SelfClosingTagToken:
			if item.Image != nil {
				continue
			}
			t := z.Token()
			if t.Data != "img" {
				continue
			}
			for _, attr := range t.Attr {
				if attr.Key == "src" {
					item.Image = &gofeed.Image{URL: attr.Val}
				}
			}
		case html.StartTagToken:
			previousStartTokenTest = z.Token()
		case html.TextToken:
			switch previousStartTokenTest.Data {
			case "script", "style":
				continue
			}
			TxtContent := strings.TrimSpace(html.UnescapeString(string(z.Text())))
			if len(TxtContent) > 0 {
				simpleContent += TxtContent + "\n"
			}
		}
	}
	item.Description = simpleContent
}

func findImage(item *gofeed.Item) {
	for _, e := range item.Enclosures {
		if strings.HasPrefix(e.Type, "image/") {
			item.Image = &gofeed.Image{URL: item.Enclosures[0].URL}
			return
		}
	}
	if url, ok := getExt(func() string { return item.Extensions["media"]["group"][0].Children["thumbnail"][0].Attrs["url"] }); ok {
		item.Image = &gofeed.Image{URL: url}
		return
	}
	if url, ok := getExt(func() string { return item.Extensions["media"]["preview"][0].Attrs["url"] }); ok {
		item.Image = &gofeed.Image{URL: url}
		return
	}
	if url, ok := item.Custom["thumb_large"]; ok {
		item.Image = &gofeed.Image{URL: url}
		return
	}
	if url, ok := item.Custom["thumb"]; ok {
		item.Image = &gofeed.Image{URL: url}
		return
	}
}

type CustomAtomTranslator struct {
	defaultTranslator *gofeed.DefaultAtomTranslator
}

func NewCustomAtomTranslator() *CustomAtomTranslator {
	t := &CustomAtomTranslator{}
	t.defaultTranslator = &gofeed.DefaultAtomTranslator{}
	return t
}

func (ct *CustomAtomTranslator) Translate(feed interface{}) (*gofeed.Feed, error) {
	atom, found := feed.(*atom.Feed)
	if !found {
		return nil, fmt.Errorf("Feed did not match expected type of *atom.Feed")
	}

	f, err := ct.defaultTranslator.Translate(atom)
	if err != nil {
		return nil, err
	}

	if atom.Icon != "" && f.Image == nil {
		f.Image = &gofeed.Image{URL: strings.TrimSuffix(atom.Icon, "/")}
	}

	for _, i := range f.Items {
		if i.Image == nil || i.Image.URL == "" {
			findImage(i)
		}
		if val, ok := getExt(func() string { return i.Extensions["media"]["group"][0].Children["description"][0].Value }); ok {
			i.Description = val
		}
		scrapContent(i)
		if i.PublishedParsed == nil {
			if i.UpdatedParsed == nil {
				pubdate, ok := i.Custom["pubdate"]
				if !ok {
					i.PublishedParsed = &time.Time{}
					continue
				}
				pd, err := time.Parse(time.RFC3339, pubdate)
				if err != nil {
					return nil, fmt.Errorf("parsing pubdate: %w", err)
				}
				i.PublishedParsed = &pd
			} else {
				i.PublishedParsed = i.UpdatedParsed
			}
		}
	}
	return f, nil
}

type CustomRSSTranslator struct {
	defaultTranslator *gofeed.DefaultRSSTranslator
}

func NewCustomRSSTranslator() *CustomRSSTranslator {
	t := &CustomRSSTranslator{}
	t.defaultTranslator = &gofeed.DefaultRSSTranslator{}
	return t
}

func (ct *CustomRSSTranslator) Translate(feed interface{}) (*gofeed.Feed, error) {
	rss, found := feed.(*rss.Feed)
	if !found {
		return nil, fmt.Errorf("Feed did not match expected type of *rss.Feed")
	}

	f, err := ct.defaultTranslator.Translate(rss)
	if err != nil {
		return nil, err
	}

	for _, i := range f.Items {
		if i.Image == nil || i.Image.URL == "" {
			findImage(i)
		}
		scrapContent(i)
		if i.PublishedParsed == nil {
			if i.UpdatedParsed == nil {
				pubdate, ok := i.Custom["pubdate"]
				if !ok {
					i.PublishedParsed = &time.Time{}
					continue
				}
				pd, err := time.Parse(time.RFC3339, pubdate)
				if err != nil {
					return nil, fmt.Errorf("parsing pubdate: %w", err)
				}
				i.PublishedParsed = &pd
			} else {
				i.PublishedParsed = i.UpdatedParsed
			}
		}
	}
	return f, nil
}