no message
This commit is contained in:
parent
df2334ae22
commit
e6a32f074e
1
just/bao
1
just/bao
@ -1 +0,0 @@
|
||||
Subproject commit 71c43ea1177f43244a5ad74df9615a5664daa9f8
|
||||
674
just/bao/LICENSE
Executable file
674
just/bao/LICENSE
Executable file
@ -0,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) <year> <name of author>
|
||||
|
||||
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) <year> <name of author>
|
||||
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>.
|
||||
44
just/bao/build.gradle
Executable file
44
just/bao/build.gradle
Executable file
@ -0,0 +1,44 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id "org.jetbrains.kotlin.jvm" version "2.1.0"
|
||||
id "com.diffplug.spotless" version "6.25.0"
|
||||
id "io.gitlab.arturbosch.detekt" version "1.23.6"
|
||||
}
|
||||
|
||||
group 'me.leon'
|
||||
version '1.3.0'
|
||||
|
||||
dependencies {
|
||||
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6"
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1'
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
//for yaml 1.1, 1.32 limit maxsize 3M
|
||||
implementation 'org.yaml:snakeyaml:2.2'
|
||||
//mmdb格式
|
||||
implementation 'com.maxmind.geoip2:geoip2:4.2.1'
|
||||
//dat格式
|
||||
// implementation 'com.maxmind.geoip:geoip-api:1.3.1'
|
||||
// implementation 'com.maxmind.db:maxmind-db:1.2.0'
|
||||
//for yaml 1.2
|
||||
// implementation "org.snakeyaml:snakeyaml-engine:2.3"
|
||||
|
||||
// https://mvnrepository.com/artifact/org.jsoup/jsoup
|
||||
implementation 'org.jsoup:jsoup:1.18.3'
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
apply from: "$rootProject.projectDir/config/codeQuality.gradle"
|
||||
def hook = new File("$rootProject.projectDir/.git/hooks/pre-commit")
|
||||
hook.parentFile.mkdirs()
|
||||
hook.text = """#!/bin/bash
|
||||
echo "run code format"
|
||||
./gradlew spotlessCheck
|
||||
echo "run code smell check"
|
||||
./gradlew detekt
|
||||
"""
|
||||
33
just/bao/config/codeQuality.gradle
Executable file
33
just/bao/config/codeQuality.gradle
Executable file
@ -0,0 +1,33 @@
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
apply plugin: 'io.gitlab.arturbosch.detekt'
|
||||
detekt {
|
||||
allRules = false // activate all available (even unstable) rules.
|
||||
// https://github.com/detekt/detekt/blob/main/config/detekt/detekt.yml
|
||||
config = files("$rootProject.projectDir/config/detekt.yml")
|
||||
// point to your custom config defining rules to run, overwriting default behavior
|
||||
parallel = true
|
||||
input = files(
|
||||
"$rootDir/buildSrc",
|
||||
"$rootDir/build.gradle.kts",
|
||||
"$rootDir/build.gradle",
|
||||
"$rootDir/settings.gradle.kts",
|
||||
"$rootDir/settings.gradle",
|
||||
"build.gradle.kts",
|
||||
"build.gradle",
|
||||
"src/main/kotlin",
|
||||
"src/test/kotlin"
|
||||
)
|
||||
}
|
||||
|
||||
spotless {
|
||||
java {
|
||||
target "src/**/*.java"
|
||||
// https://github.com/google/google-java-format/releases
|
||||
googleJavaFormat('1.15.0').aosp()
|
||||
}
|
||||
kotlin {
|
||||
target "src/**/*.kt"
|
||||
// https://github.com/facebookincubator/ktfmt/releases
|
||||
ktfmt('0.53').kotlinlangStyle()
|
||||
}
|
||||
}
|
||||
569
just/bao/config/detekt.yml
Executable file
569
just/bao/config/detekt.yml
Executable file
@ -0,0 +1,569 @@
|
||||
comments:
|
||||
active: true
|
||||
AbsentOrWrongFileLicense:
|
||||
active: false
|
||||
licenseTemplateFile: 'license.template'
|
||||
licenseTemplateIsRegex: false
|
||||
CommentOverPrivateFunction:
|
||||
active: false
|
||||
CommentOverPrivateProperty:
|
||||
active: false
|
||||
DeprecatedBlockTag:
|
||||
active: false
|
||||
EndOfSentenceFormat:
|
||||
active: false
|
||||
endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
|
||||
UndocumentedPublicClass:
|
||||
active: false
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
searchInNestedClass: true
|
||||
searchInInnerClass: true
|
||||
searchInInnerObject: true
|
||||
searchInInnerInterface: true
|
||||
UndocumentedPublicFunction:
|
||||
active: false
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
UndocumentedPublicProperty:
|
||||
active: false
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
|
||||
complexity:
|
||||
active: true
|
||||
ComplexCondition:
|
||||
active: true
|
||||
threshold: 4
|
||||
StringLiteralDuplication:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
threshold: 5
|
||||
ignoreAnnotation: true
|
||||
excludeStringsWithLessThan5Characters: true
|
||||
ignoreStringsRegex: '$^'
|
||||
|
||||
ComplexInterface:
|
||||
active: true
|
||||
threshold: 10
|
||||
includeStaticDeclarations: false
|
||||
includePrivateDeclarations: false
|
||||
CyclomaticComplexMethod:
|
||||
active: true
|
||||
threshold: 16
|
||||
ignoreSingleWhenExpression: true
|
||||
ignoreSimpleWhenEntries: true
|
||||
ignoreNestingFunctions: true
|
||||
nestingFunctions:
|
||||
- 'run'
|
||||
- 'let'
|
||||
- 'apply'
|
||||
- 'with'
|
||||
- 'also'
|
||||
- 'use'
|
||||
- 'forEach'
|
||||
- 'isNotNull'
|
||||
- 'ifNull'
|
||||
LargeClass:
|
||||
active: false
|
||||
threshold: 600
|
||||
excludes: ['**/test/**', '**/*.Test.kt', '**/*.Spec.kt']
|
||||
MethodOverloading:
|
||||
active: true
|
||||
TooManyFunctions:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
thresholdInFiles: 24
|
||||
thresholdInClasses: 24
|
||||
thresholdInInterfaces: 24
|
||||
thresholdInObjects: 22
|
||||
thresholdInEnums: 24
|
||||
ignoreDeprecated: true
|
||||
ignorePrivate: true
|
||||
ignoreOverridden: true
|
||||
|
||||
LongMethod:
|
||||
active: true
|
||||
threshold: 75
|
||||
ignoreAnnotated: [ ]
|
||||
LongParameterList:
|
||||
active: true
|
||||
functionThreshold: 10
|
||||
constructorThreshold: 8
|
||||
ignoreDefaultParameters: false
|
||||
ignoreDataClasses: true
|
||||
ignoreAnnotated: [ ]
|
||||
NamedArguments:
|
||||
active: false
|
||||
threshold: 3
|
||||
NestedBlockDepth:
|
||||
active: false
|
||||
threshold: 4
|
||||
ReplaceSafeCallChainWithRun:
|
||||
active: false
|
||||
|
||||
coroutines:
|
||||
active: true
|
||||
GlobalCoroutineUsage:
|
||||
active: true
|
||||
RedundantSuspendModifier:
|
||||
active: true
|
||||
SleepInsteadOfDelay:
|
||||
active: true
|
||||
SuspendFunWithFlowReturnType:
|
||||
active: true
|
||||
empty-blocks:
|
||||
active: true
|
||||
EmptyCatchBlock:
|
||||
active: true
|
||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
||||
EmptyClassBlock:
|
||||
active: true
|
||||
EmptyDefaultConstructor:
|
||||
active: true
|
||||
EmptyDoWhileBlock:
|
||||
active: true
|
||||
EmptyElseBlock:
|
||||
active: true
|
||||
EmptyFinallyBlock:
|
||||
active: true
|
||||
EmptyForBlock:
|
||||
active: true
|
||||
EmptyFunctionBlock:
|
||||
active: true
|
||||
ignoreOverridden: false
|
||||
EmptyIfBlock:
|
||||
active: true
|
||||
EmptyInitBlock:
|
||||
active: true
|
||||
EmptyKtFile:
|
||||
active: true
|
||||
EmptySecondaryConstructor:
|
||||
active: true
|
||||
EmptyTryBlock:
|
||||
active: true
|
||||
EmptyWhenBlock:
|
||||
active: true
|
||||
EmptyWhileBlock:
|
||||
active: true
|
||||
|
||||
exceptions:
|
||||
InstanceOfCheckForException:
|
||||
active: true
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
NotImplementedDeclaration:
|
||||
active: false
|
||||
ObjectExtendsThrowable:
|
||||
active: true
|
||||
RethrowCaughtException:
|
||||
active: true
|
||||
ReturnFromFinally:
|
||||
active: true
|
||||
ThrowingExceptionFromFinally:
|
||||
active: true
|
||||
ThrowingExceptionInMain:
|
||||
active: true
|
||||
ThrowingExceptionsWithoutMessageOrCause:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
exceptions:
|
||||
- 'ArrayIndexOutOfBoundsException'
|
||||
- 'Error'
|
||||
- 'Exception'
|
||||
- 'IllegalMonitorStateException'
|
||||
- 'NullPointerException'
|
||||
- 'IndexOutOfBoundsException'
|
||||
- 'RuntimeException'
|
||||
- 'Throwable'
|
||||
ThrowingNewInstanceOfSameException:
|
||||
active: true
|
||||
SwallowedException:
|
||||
active: true
|
||||
ignoredExceptionTypes:
|
||||
- 'NumberFormatException'
|
||||
- 'InterruptedException'
|
||||
- 'ParseException'
|
||||
- 'MalformedURLException'
|
||||
- 'UnknownHostException'
|
||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
||||
TooGenericExceptionCaught:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
exceptionNames:
|
||||
- 'ArrayIndexOutOfBoundsException'
|
||||
- 'Error'
|
||||
- 'Exception'
|
||||
- 'IllegalMonitorStateException'
|
||||
- 'NullPointerException'
|
||||
- 'IndexOutOfBoundsException'
|
||||
- 'RuntimeException'
|
||||
- 'Throwable'
|
||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
||||
TooGenericExceptionThrown:
|
||||
active: true
|
||||
exceptionNames:
|
||||
- 'Error'
|
||||
- 'Exception'
|
||||
- 'Throwable'
|
||||
- 'RuntimeException'
|
||||
|
||||
naming:
|
||||
ClassNaming:
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
classPattern: '[A-Z][a-zA-Z0-9]*'
|
||||
ConstructorParameterNaming:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
parameterPattern: '[a-z][A-Za-z0-9]*'
|
||||
privateParameterPattern: '[a-z][A-Za-z0-9]*'
|
||||
excludeClassPattern: '$^'
|
||||
ignoreOverridden: true
|
||||
EnumNaming:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
enumEntryPattern: '[A-Z][_a-zA-Z0-9]*|`.*`'
|
||||
ForbiddenClassName:
|
||||
active: false
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
|
||||
forbiddenName: [ ]
|
||||
FunctionNaming:
|
||||
active: true
|
||||
excludes:
|
||||
- '**/test/**'
|
||||
- '**/androidTest/**'
|
||||
- '**/commonTest/**'
|
||||
- '**/functionalTest/**'
|
||||
- '**/jvmTest/**'
|
||||
- '**/jsTest/**'
|
||||
- '**/iosTest/**'
|
||||
TopLevelPropertyNaming:
|
||||
constantPattern: '[a-z][_A-Za-z0-9]*|[A-Z][_A-Z0-9]*'
|
||||
InvalidPackageDeclaration:
|
||||
active: true
|
||||
excludes: ['**/build-logic/**/*.kt', '**/*.kts']
|
||||
NoNameShadowing:
|
||||
active: false
|
||||
NonBooleanPropertyPrefixedWithIs:
|
||||
active: true
|
||||
VariableMaxLength:
|
||||
active: true
|
||||
VariableMinLength:
|
||||
active: true
|
||||
|
||||
performance:
|
||||
active: true
|
||||
ArrayPrimitive:
|
||||
active: true
|
||||
ForEachOnRange:
|
||||
active: true
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
SpreadOperator:
|
||||
active: true
|
||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||
UnnecessaryTemporaryInstantiation:
|
||||
active: true
|
||||
|
||||
potential-bugs:
|
||||
active: true
|
||||
AvoidReferentialEquality:
|
||||
active: true
|
||||
DontDowncastCollectionTypes:
|
||||
active: true
|
||||
DoubleMutabilityForCollection:
|
||||
active: false
|
||||
ElseCaseInsteadOfExhaustiveWhen:
|
||||
active: true
|
||||
ExitOutsideMain:
|
||||
active: false
|
||||
HasPlatformType:
|
||||
active: true
|
||||
IgnoredReturnValue:
|
||||
active: true
|
||||
restrictToConfig: true
|
||||
returnValueAnnotations:
|
||||
- '*.CheckReturnValue'
|
||||
- '*.CheckResult'
|
||||
ImplicitUnitReturnType:
|
||||
active: true
|
||||
MapGetWithNotNullAssertionOperator:
|
||||
active: false
|
||||
UnconditionalJumpStatementInLoop:
|
||||
active: true
|
||||
UnsafeCast:
|
||||
active: true
|
||||
excludes: ['**/test/**', '**/*.Test.kt', '**/*.Spec.kt']
|
||||
UselessPostfixExpression:
|
||||
active: true
|
||||
CastToNullableType:
|
||||
active: false
|
||||
Deprecation:
|
||||
active: false
|
||||
style:
|
||||
CanBeNonNullable:
|
||||
active: false
|
||||
CascadingCallWrapping:
|
||||
active: true
|
||||
ClassOrdering:
|
||||
active: true
|
||||
CollapsibleIfStatements:
|
||||
active: true
|
||||
DestructuringDeclarationWithTooManyEntries:
|
||||
active: true
|
||||
EqualsOnSignatureLine:
|
||||
active: true
|
||||
ExplicitCollectionElementAccessMethod:
|
||||
active: true
|
||||
ExplicitItLambdaParameter:
|
||||
active: true
|
||||
ForbiddenComment:
|
||||
active: true
|
||||
values:
|
||||
- 'TODO:'
|
||||
- 'FIXME:'
|
||||
- 'STOPSHIP:'
|
||||
- '@author'
|
||||
- '@requiresTypeResolution'
|
||||
excludes: ['**/detekt-rules-style/**/ForbiddenComment.kt']
|
||||
ForbiddenImport:
|
||||
active: true
|
||||
imports:
|
||||
- value: 'org.assertj.core.api.Assertions'
|
||||
reason: 'Import Assertions.assertThat instead.'
|
||||
- value: 'org.junit.jupiter.api.Assertions*'
|
||||
reason: 'Use AssertJ assertions instead.'
|
||||
ForbiddenMethodCall:
|
||||
active: false
|
||||
methods:
|
||||
- 'kotlin.io.print'
|
||||
- 'kotlin.io.println'
|
||||
- 'java.net.URL.openStream'
|
||||
- 'java.lang.Class.getResourceAsStream'
|
||||
- 'java.lang.ClassLoader.getResourceAsStream'
|
||||
- 'org.jetbrains.kotlin.diagnostics.DiagnosticUtils.getLineAndColumnInPsiFile'
|
||||
|
||||
ForbiddenVoid:
|
||||
active: true
|
||||
MagicNumber:
|
||||
excludes: ['**/test/**', '**/*Test.kt', '**/*Spec.kt']
|
||||
ignorePropertyDeclaration: true
|
||||
ignoreAnnotation: true
|
||||
ignoreEnums: true
|
||||
ignoreNumbers:
|
||||
- '-1'
|
||||
- '0'
|
||||
- '1'
|
||||
- '2'
|
||||
- '100'
|
||||
- '1000'
|
||||
MandatoryBracesLoops:
|
||||
active: true
|
||||
MaxLineLength:
|
||||
active: true
|
||||
excludes: ['**/test/**', '**/*Test.kt', '**/*Spec.kt']
|
||||
excludeCommentStatements: true
|
||||
NestedClassesVisibility:
|
||||
active: true
|
||||
ObjectLiteralToLambda:
|
||||
active: true
|
||||
PreferToOverPairSyntax:
|
||||
active: true
|
||||
RedundantExplicitType:
|
||||
active: true
|
||||
RedundantHigherOrderMapUsage:
|
||||
active: true
|
||||
RedundantVisibilityModifierRule:
|
||||
active: true
|
||||
ReturnCount:
|
||||
active: true
|
||||
excludeGuardClauses: true
|
||||
SpacingBetweenPackageAndImports:
|
||||
active: true
|
||||
TrimMultilineRawString:
|
||||
active: true
|
||||
UnderscoresInNumericLiterals:
|
||||
active: true
|
||||
UnnecessaryAnnotationUseSiteTarget:
|
||||
active: true
|
||||
UnnecessaryFilter:
|
||||
active: true
|
||||
UnnecessaryLet:
|
||||
active: true
|
||||
UnnecessaryInnerClass:
|
||||
active: true
|
||||
ignoreAnnotated: ['Nested']
|
||||
UntilInsteadOfRangeTo:
|
||||
active: true
|
||||
UnusedImports:
|
||||
active: false # formatting already have this rule enabled
|
||||
UnusedPrivateMember:
|
||||
active: true
|
||||
allowedNames: '(_|ignored|expected)'
|
||||
UseAnyOrNoneInsteadOfFind:
|
||||
active: true
|
||||
UseCheckOrError:
|
||||
active: true
|
||||
UseEmptyCounterpart:
|
||||
active: true
|
||||
UseIfEmptyOrIfBlank:
|
||||
active: true
|
||||
UseIsNullOrEmpty:
|
||||
active: true
|
||||
UseOrEmpty:
|
||||
active: true
|
||||
UseRequire:
|
||||
active: true
|
||||
UseRequireNotNull:
|
||||
active: true
|
||||
VarCouldBeVal:
|
||||
active: true
|
||||
ignoreAnnotated: ['Parameter']
|
||||
formatting:
|
||||
active: true
|
||||
android: false
|
||||
autoCorrect: true
|
||||
AnnotationOnSeparateLine:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
AnnotationSpacing:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
ArgumentListWrapping:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
indentSize: 4
|
||||
maxLineLength: 120
|
||||
ChainWrapping:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
CommentSpacing:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
EnumEntryNameCase:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
Filename:
|
||||
active: false
|
||||
FunctionReturnTypeSpacing:
|
||||
active: true
|
||||
FunctionStartOfBodySpacing:
|
||||
active: true
|
||||
FinalNewline:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
insertFinalNewLine: true
|
||||
ImportOrdering:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
layout: '*,java.**,javax.**,kotlin.**,^'
|
||||
Indentation:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
indentSize: 4
|
||||
MaximumLineLength:
|
||||
active: true
|
||||
maxLineLength: 120
|
||||
ignoreBackTickedIdentifier: false
|
||||
NullableTypeSpacing:
|
||||
active: true
|
||||
ParameterListSpacing:
|
||||
active: true
|
||||
SpacingBetweenFunctionNameAndOpeningParenthesis:
|
||||
active: true
|
||||
TypeParameterListSpacing:
|
||||
active: true
|
||||
ModifierOrdering:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
MultiLineIfElse:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoBlankLineBeforeRbrace:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoConsecutiveBlankLines:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoEmptyClassBody:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoEmptyFirstLineInMethodBlock:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
NoLineBreakAfterElse:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoLineBreakBeforeAssignment:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoMultipleSpaces:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoSemicolons:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoTrailingSpaces:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoUnitReturn:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
NoUnusedImports:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
WildcardImport:
|
||||
active: true
|
||||
excludeImports: []
|
||||
PackageName:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
ParameterListWrapping:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
maxLineLength: 120
|
||||
SpacingAroundAngleBrackets:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
SpacingAroundColon:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundComma:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundCurly:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundDot:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundDoubleColon:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
SpacingAroundKeyword:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundOperators:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundParens:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundRangeOperator:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
SpacingAroundUnaryOperator:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
SpacingBetweenDeclarationsWithAnnotations:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
SpacingBetweenDeclarationsWithComments:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
StringTemplate:
|
||||
active: true
|
||||
autoCorrect: true
|
||||
TrailingCommaOnCallSite:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
useTrailingCommaOnCallSite: false
|
||||
TrailingCommaOnDeclarationSite:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
useTrailingCommaOnDeclarationSite: false
|
||||
1
just/bao/gradle.properties
Executable file
1
just/bao/gradle.properties
Executable file
@ -0,0 +1 @@
|
||||
kotlin.code.style=official
|
||||
BIN
just/bao/gradle/wrapper/gradle-wrapper.jar
vendored
Executable file
BIN
just/bao/gradle/wrapper/gradle-wrapper.jar
vendored
Executable file
Binary file not shown.
6
just/bao/gradle/wrapper/gradle-wrapper.properties
vendored
Executable file
6
just/bao/gradle/wrapper/gradle-wrapper.properties
vendored
Executable file
@ -0,0 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
245
just/bao/gradlew
vendored
Executable file
245
just/bao/gradlew
vendored
Executable file
@ -0,0 +1,245 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
92
just/bao/gradlew.bat
vendored
Executable file
92
just/bao/gradlew.bat
vendored
Executable file
@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
BIN
just/bao/litespeed/lite
Executable file
BIN
just/bao/litespeed/lite
Executable file
Binary file not shown.
BIN
just/bao/litespeed/lite.exe
Executable file
BIN
just/bao/litespeed/lite.exe
Executable file
Binary file not shown.
1
just/bao/localFilter
Executable file
1
just/bao/localFilter
Executable file
@ -0,0 +1 @@
|
||||
./gradlew :test --tests "me.leon.NodeCrawler.crawl"
|
||||
1
just/bao/localFilter.bat
Executable file
1
just/bao/localFilter.bat
Executable file
@ -0,0 +1 @@
|
||||
gradlew :test --tests "me.leon.NodeCrawler.crawl"
|
||||
24
just/bao/settings.gradle
Executable file
24
just/bao/settings.gradle
Executable file
@ -0,0 +1,24 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = uri("https://mirrors.tencent.com/nexus/repository/maven-public") }
|
||||
maven { url = uri("https://mirrors.huaweicloud.com/repository/maven") }
|
||||
// 新库同步较慢, 降低优先级
|
||||
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||
maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
|
||||
maven { url = uri("https://maven.aliyun.com/repository/google") }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = uri("https://mirrors.tencent.com/nexus/repository/maven-public") }
|
||||
maven { url = uri("https://mirrors.huaweicloud.com/repository/maven") }
|
||||
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||
maven { url = uri("https://maven.aliyun.com/repository/google") }
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'SubCrawler'
|
||||
118
just/bao/src/main/java/me/leon/Clash.kt
Executable file
118
just/bao/src/main/java/me/leon/Clash.kt
Executable file
@ -0,0 +1,118 @@
|
||||
package me.leon
|
||||
|
||||
/** Clash完整配置 https://github.com/Dreamacro/clash/wiki/configuration */
|
||||
@Suppress("ConstructorParameterNaming")
|
||||
data class Clash(
|
||||
var proxies: List<Node> = mutableListOf(),
|
||||
)
|
||||
|
||||
@Suppress("ConstructorParameterNaming")
|
||||
data class Node(
|
||||
var name: String = "",
|
||||
var type: String = "",
|
||||
var cipher: String = "",
|
||||
var country: String = "",
|
||||
var obfs: String = "",
|
||||
var password: String = "",
|
||||
var port: Int = 0,
|
||||
var protocol: String = "",
|
||||
var uuid: String = "",
|
||||
var alterId: String = "",
|
||||
var network: String = "",
|
||||
var `protocol-param`: String = "",
|
||||
var server: String = "",
|
||||
var servername: String = ""
|
||||
) {
|
||||
var `ws-headers`: LinkedHashMap<String, String> = linkedMapOf()
|
||||
var `ws-path`: String = ""
|
||||
var `ws-opts`: VmessWsOpts = VmessWsOpts()
|
||||
|
||||
var `obfs-param`: String = ""
|
||||
var obfs_param: String = ""
|
||||
var sni: String = ""
|
||||
var tls: Any = Any()
|
||||
|
||||
var `skip-cert-verify`: Boolean = false
|
||||
var `protocol_param`: String = ""
|
||||
var protocolparam: String = ""
|
||||
var protoparam: String = ""
|
||||
var obfsparam: String = ""
|
||||
|
||||
data class VmessWsOpts(
|
||||
var path: String = "",
|
||||
var headers: LinkedHashMap<String, String> = linkedMapOf()
|
||||
)
|
||||
|
||||
private fun properPath() = if (network == "ws") `ws-path`.ifEmpty { `ws-opts`.path } else ""
|
||||
|
||||
private fun properHost() =
|
||||
if (network == "ws") {
|
||||
`ws-headers`["Host"]
|
||||
?: `ws-headers`["host"] ?: `ws-opts`.headers["Host"]
|
||||
?: `ws-opts`.headers["host"].orEmpty()
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
fun toNode(): Sub {
|
||||
// 兼容某些异常节点池
|
||||
if (server == "NULL") return NoSub
|
||||
return when (type) {
|
||||
"ss" -> toSs()
|
||||
"ssr" -> toSsr()
|
||||
"vmess" -> if (network == "grpc") NoSub else toVmess()
|
||||
"trojan" -> toTrojan()
|
||||
else -> NoSub
|
||||
}
|
||||
}
|
||||
|
||||
private fun toTrojan() =
|
||||
Trojan(password, server, port.toString()).apply {
|
||||
this.remark = this@Node.name
|
||||
query = "allowInsecure=${if (`skip-cert-verify`) 1 else 0}&sni=$sni"
|
||||
nation = country
|
||||
}
|
||||
|
||||
private fun toVmess() =
|
||||
V2ray(
|
||||
aid = alterId,
|
||||
add = server,
|
||||
port = port.toString(),
|
||||
id = uuid,
|
||||
net = network,
|
||||
)
|
||||
.apply {
|
||||
tls =
|
||||
when (this@Node.tls) {
|
||||
is Boolean -> if (this@Node.tls as Boolean) "true" else ""
|
||||
is Int -> if (this@Node.tls as Int == 1) "true" else ""
|
||||
else -> ""
|
||||
}
|
||||
path = properPath()
|
||||
host = properHost()
|
||||
ps = this@Node.name
|
||||
nation = country
|
||||
}
|
||||
|
||||
private fun toSsr() =
|
||||
SSR(
|
||||
server,
|
||||
port.toString(),
|
||||
protocol,
|
||||
cipher,
|
||||
obfs,
|
||||
password,
|
||||
if (obfs == "plain") "" else `obfs-param` + obfs_param + obfsparam,
|
||||
`protocol-param` + `protocol_param` + protocolparam + protoparam
|
||||
)
|
||||
.apply {
|
||||
remarks = this@Node.name
|
||||
nation = country
|
||||
}
|
||||
|
||||
private fun toSs() =
|
||||
SS(cipher, password, server, port.toString()).apply {
|
||||
remark = this@Node.name
|
||||
nation = country
|
||||
}
|
||||
}
|
||||
21
just/bao/src/main/java/me/leon/Config.kt
Executable file
21
just/bao/src/main/java/me/leon/Config.kt
Executable file
@ -0,0 +1,21 @@
|
||||
package me.leon
|
||||
|
||||
import java.io.File
|
||||
|
||||
val ROOT: String = File("sub").absolutePath
|
||||
val SHARE = "$ROOT/share"
|
||||
val HOST = "$SHARE/host"
|
||||
|
||||
// 本地节点池
|
||||
val POOL = "$ROOT/pools"
|
||||
|
||||
val NODE_OK = "$SHARE/available"
|
||||
val NODE_SS = "$SHARE/ss"
|
||||
val NODE_SSR = "$SHARE/ssr"
|
||||
val NODE_V2 = "$SHARE/v2"
|
||||
val NODE_ALL = "$SHARE/a11"
|
||||
val NODE_TR = "$SHARE/tr"
|
||||
val NODE_VLESS = "$SHARE/vless"
|
||||
val NODE_HYS2 = "$SHARE/hysteria2"
|
||||
val FAIL_IPS = "$ROOT/socketfail"
|
||||
val IP_SCORE = "$ROOT/ipScore"
|
||||
66
just/bao/src/main/java/me/leon/GeoParser.kt
Executable file
66
just/bao/src/main/java/me/leon/GeoParser.kt
Executable file
@ -0,0 +1,66 @@
|
||||
package me.leon
|
||||
|
||||
import com.maxmind.db.CHMCache
|
||||
import com.maxmind.geoip2.DatabaseReader
|
||||
import java.net.InetAddress
|
||||
import me.leon.GeoParser.cityReader
|
||||
import me.leon.GeoParser.countryReader
|
||||
import me.leon.support.*
|
||||
|
||||
object GeoParser {
|
||||
// register at https://www.maxmind.com/, and download your file
|
||||
// https://download.maxmind.com/geoip/databases/GeoLite2-Country/download?suffix=tar.gz
|
||||
// todo change it to your own file
|
||||
private const val geoDir = "C:/Users/Leon/Desktop/geo"
|
||||
private val dbFile = "$geoDir/GeoLite2-City.mmdb".toFile()
|
||||
private val dbCountryFile = javaClass.getResource("/GeoLite2-Country.mmdb").file.toFile()
|
||||
|
||||
val cityReader: DatabaseReader by lazy {
|
||||
DatabaseReader.Builder(dbFile).withCache(CHMCache()).build()
|
||||
}
|
||||
val countryReader: DatabaseReader by lazy {
|
||||
DatabaseReader.Builder(dbCountryFile).withCache(CHMCache()).build()
|
||||
}
|
||||
}
|
||||
|
||||
private const val CN = "zh-CN"
|
||||
|
||||
fun String.ipCountryZh() =
|
||||
runCatching { countryReader.country(this.toInetAddress()).country.names[CN] }
|
||||
.getOrElse {
|
||||
println("ipCountryZh error ${it.message}")
|
||||
ipInfo()
|
||||
} ?: ipInfo()
|
||||
|
||||
fun InetAddress.ipCountryZh() =
|
||||
runCatching { countryReader.country(this).country.names[CN] }.getOrDefault("未知")
|
||||
|
||||
fun Sub.ipCountryZh(): String =
|
||||
runCatching { countryReader.country(SERVER.toInetAddress()).country.names[CN] }
|
||||
.getOrDefault(SERVER.ipInfo())
|
||||
?: SERVER.ipInfo()
|
||||
|
||||
private fun String.ipInfo() = runCatching { "CF中转".takeIf { ipCloudFlare() } ?: "未知" }.getOrElse { "未知" }
|
||||
|
||||
fun String.ipCountryEn(): String =
|
||||
runCatching { countryReader.country(this.toInetAddress()).country.isoCode }
|
||||
.getOrDefault("UNKNOWN")
|
||||
|
||||
fun InetAddress.ipCountryEn(): String =
|
||||
runCatching { countryReader.country(this).country.isoCode }.getOrDefault("UNKNOWN")
|
||||
|
||||
fun String.ipCityZh() =
|
||||
runCatching {
|
||||
cityReader.city(this.toInetAddress()).run {
|
||||
mostSpecificSubdivision.names[CN] ?: country.names[CN]
|
||||
}
|
||||
}
|
||||
.getOrDefault("未知")
|
||||
|
||||
fun String.ipCityEn() =
|
||||
runCatching {
|
||||
cityReader.city(this.toInetAddress()).run {
|
||||
mostSpecificSubdivision.names["en"] ?: country.names["en"]
|
||||
}
|
||||
}
|
||||
.getOrDefault("未知")
|
||||
281
just/bao/src/main/java/me/leon/Parser.kt
Executable file
281
just/bao/src/main/java/me/leon/Parser.kt
Executable file
@ -0,0 +1,281 @@
|
||||
package me.leon
|
||||
|
||||
import java.security.SecureRandom
|
||||
import java.security.cert.CertificateException
|
||||
import java.security.cert.X509Certificate
|
||||
import javax.net.ssl.*
|
||||
import me.leon.support.*
|
||||
|
||||
private const val UUID_LENGTH = 36
|
||||
|
||||
object Parser {
|
||||
private val REG_SCHEMA_HASH = "(\\w+)://([^ #]+)(?:#([^#]+)?)?".toRegex()
|
||||
private val REG_SS = "([^:]+):([^@]+)@([^:]+):(\\d{1,5})/?".toRegex()
|
||||
private val REG_SSR_PARAM = "([^/]+)/\\?(.+)".toRegex()
|
||||
private val REG_TROJAN = "([^@]+)@([^:]+):(\\d{1,5})/?(?:\\?(.+))?".toRegex()
|
||||
|
||||
init {
|
||||
// 信任过期证书
|
||||
val trustAllCerts: Array<TrustManager> =
|
||||
arrayOf(
|
||||
object : X509TrustManager {
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkClientTrusted(
|
||||
chain: Array<X509Certificate?>?,
|
||||
authType: String?
|
||||
) {
|
||||
// if needed
|
||||
}
|
||||
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkServerTrusted(
|
||||
chain: Array<X509Certificate?>?,
|
||||
authType: String?
|
||||
) {
|
||||
// if needed
|
||||
}
|
||||
|
||||
override fun getAcceptedIssuers(): Array<X509Certificate> {
|
||||
return emptyArray()
|
||||
}
|
||||
}
|
||||
)
|
||||
// Install the all-trusting trust manager
|
||||
runCatching {
|
||||
val sc = SSLContext.getInstance("SSL")
|
||||
sc.init(null, trustAllCerts, SecureRandom())
|
||||
val sslsc = sc.serverSessionContext
|
||||
sslsc.sessionTimeout = 0
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.socketFactory)
|
||||
HttpsURLConnection.setDefaultHostnameVerifier { _, _ -> true }
|
||||
}
|
||||
.getOrElse {
|
||||
// if needed
|
||||
}
|
||||
}
|
||||
|
||||
var debug = false
|
||||
|
||||
fun parse(uri: String) =
|
||||
runCatching {
|
||||
when (uri.substringBefore(':')) {
|
||||
"vmess" -> parseV2ray(uri.trim())
|
||||
"ss" -> parseSs(uri.trim())
|
||||
"ssr" -> parseSsr(uri.trim())
|
||||
"trojan" -> parseTrojan(uri.trim())
|
||||
"vless" -> parseVless(uri.trim())
|
||||
"hysteria2" -> parseHysteria2(uri.trim())
|
||||
else -> NoSub
|
||||
}
|
||||
}
|
||||
.getOrDefault(NoSub)
|
||||
|
||||
fun parseV2ray(uri: String): Sub =
|
||||
runCatching {
|
||||
"parseV2ray ".debug(uri)
|
||||
REG_SCHEMA_HASH.matchEntire(uri)?.run {
|
||||
groupValues[2]
|
||||
.b64SafeDecode()
|
||||
.also { "parseV2ray base64 decode: ".debug(it) }
|
||||
.fromJson<V2ray>()
|
||||
.takeIf { it.id.length == UUID_LENGTH && !it.add.contains("baidu.com") }
|
||||
}
|
||||
?: NoSub
|
||||
}
|
||||
.getOrElse {
|
||||
"parseV2ray err".debug(uri)
|
||||
println("parseV2ray error ${it.stackTrace}")
|
||||
NoSub
|
||||
}
|
||||
|
||||
fun parseSs(uri: String): Sub {
|
||||
"parseSs ".debug(uri)
|
||||
REG_SCHEMA_HASH.matchEntire(uri)?.run {
|
||||
val remark = groupValues[3].urlDecode()
|
||||
"parseSs match".debug(remark)
|
||||
"parseSs match".debug(groupValues[2])
|
||||
val decoded =
|
||||
groupValues[2].takeUnless { it.contains("@") }?.b64Decode()
|
||||
// 兼容异常
|
||||
?: with(groupValues[2]) {
|
||||
"${substringBefore('@').b64Decode()}${substring(indexOf('@'))}".also {
|
||||
"parseSs b64 format correct".debug("___$it")
|
||||
}
|
||||
}
|
||||
decoded.also {
|
||||
"parseSs b64 decode".debug(it)
|
||||
REG_SS.matchEntire(it)?.run {
|
||||
"parseSs ss match".debug(this.groupValues.toString())
|
||||
return SS(groupValues[1], groupValues[2], groupValues[3], groupValues[4])
|
||||
.apply { this.remark = remark }
|
||||
}
|
||||
}
|
||||
}
|
||||
"parseSs failed".debug(uri)
|
||||
return NoSub
|
||||
}
|
||||
|
||||
fun parseSsr(uri: String): Sub {
|
||||
"parseSsr ".debug(uri)
|
||||
return runCatching {
|
||||
REG_SCHEMA_HASH.matchEntire(uri)?.run {
|
||||
groupValues[2].b64SafeDecode().split(":").run {
|
||||
"parseSsr query".debug(this[5])
|
||||
REG_SSR_PARAM.matchEntire(this[5])?.let {
|
||||
"parseSsr query match".debug(it.groupValues[2])
|
||||
val q = it.groupValues[2].queryParamMapB64()
|
||||
"parseSsr query maps".debug(q.toString())
|
||||
return SSR(
|
||||
this[0],
|
||||
this[1],
|
||||
this[2],
|
||||
this[3],
|
||||
this[4],
|
||||
it.groupValues[1].b64SafeDecode(),
|
||||
q["obfsparam"].orEmpty(),
|
||||
q["protoparam"].orEmpty(),
|
||||
)
|
||||
.apply {
|
||||
remarks = q["remarks"].orEmpty()
|
||||
group = q["group"].orEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?: NoSub
|
||||
}
|
||||
.getOrElse {
|
||||
"parseSsr err not match".debug(uri)
|
||||
NoSub
|
||||
}
|
||||
}
|
||||
|
||||
fun parseTrojan(uri: String): Sub {
|
||||
"parseTrojan".debug(uri)
|
||||
REG_SCHEMA_HASH.matchEntire(uri)?.run {
|
||||
val remark = groupValues[3].urlDecode()
|
||||
"parseTrojan remark".debug(remark)
|
||||
groupValues[2].also {
|
||||
"parseTrojan data".debug(it)
|
||||
REG_TROJAN.matchEntire(it)?.run {
|
||||
return Trojan(groupValues[1], groupValues[2], groupValues[3]).apply {
|
||||
this.remark = remark
|
||||
query = groupValues[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"parseTrojan ".debug("failed")
|
||||
return NoSub
|
||||
}
|
||||
|
||||
fun parseVless(uri: String): Sub {
|
||||
"parseVless".debug(uri)
|
||||
REG_SCHEMA_HASH.matchEntire(uri)?.run {
|
||||
val remark = groupValues[3].urlDecode()
|
||||
"parseVless remark".debug(remark)
|
||||
groupValues[2].also {
|
||||
"parseVless data".debug(it)
|
||||
REG_TROJAN.matchEntire(it)?.run {
|
||||
return Vless(groupValues[1], groupValues[2], groupValues[3]).apply {
|
||||
this.remark = remark
|
||||
query = groupValues[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"parseVless ".debug("failed")
|
||||
return NoSub
|
||||
}
|
||||
|
||||
fun parseHysteria2(uri: String): Sub {
|
||||
"parseHysteria2".debug(uri)
|
||||
REG_SCHEMA_HASH.matchEntire(uri)?.run {
|
||||
val remark = groupValues[3].urlDecode()
|
||||
"parseHysteria2 remark".debug(remark)
|
||||
groupValues[2].also {
|
||||
"parseHysteria2 data".debug(it)
|
||||
REG_TROJAN.matchEntire(it)?.run {
|
||||
return Hysteria2(groupValues[1], groupValues[2], groupValues[3]).apply {
|
||||
this.remark = remark
|
||||
query = groupValues[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"parseHysteria2 ".debug("failed")
|
||||
return NoSub
|
||||
}
|
||||
|
||||
private fun parseFromFileSub(path: String): LinkedHashSet<Sub> {
|
||||
"parseFromSub Local".debug(path)
|
||||
val data = path.readText().b64SafeDecode()
|
||||
return if (data.contains("proxies:")) {
|
||||
data.parseYaml<Clash>().proxies.asSequence().map(Node::toNode).fold(linkedSetOf()) { acc,
|
||||
sub ->
|
||||
acc.also { acc.add(sub) }
|
||||
}
|
||||
} else {
|
||||
data
|
||||
// .also { println(it) }
|
||||
.split("\r\n|\n".toRegex())
|
||||
.asSequence()
|
||||
.filter { it.isNotEmpty() }
|
||||
.map { it to parse(it) }
|
||||
.filterNot { it.second is NoSub }
|
||||
.fold(linkedSetOf()) { acc, sub ->
|
||||
acc.add(sub.second)
|
||||
acc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseFromNetwork(url: String): LinkedHashSet<Sub> {
|
||||
"parseFromNetwork".debug(url)
|
||||
println(url)
|
||||
val data = url.readFromNet().b64SafeDecode()
|
||||
return runCatching {
|
||||
if (data.contains("proxies:"))
|
||||
// 移除yaml中的标签
|
||||
{
|
||||
data
|
||||
.replace("\\[[^\"]+?]".toRegex(), "")
|
||||
.parseYaml<Clash>()
|
||||
.proxies
|
||||
.asSequence()
|
||||
.map(Node::toNode)
|
||||
.filterNot { it is NoSub }
|
||||
.fold(linkedSetOf<Sub>()) { acc, sub -> acc.also { acc.add(sub) } }
|
||||
} else {
|
||||
data
|
||||
.also { "parseFromNetwork".debug(it) }
|
||||
.split("\r\n|\n".toRegex())
|
||||
.asSequence()
|
||||
.filter { it.isNotEmpty() && it.contains("://") }
|
||||
.map {
|
||||
println(it)
|
||||
parse(it.replace("/#", "#").trim())
|
||||
}
|
||||
.filterNot { it is NoSub }
|
||||
.fold(linkedSetOf()) { acc, sub -> acc.also { acc.add(sub) } }
|
||||
}
|
||||
}
|
||||
.getOrElse {
|
||||
it.printStackTrace()
|
||||
println("failed______ $url ${it.message}")
|
||||
linkedSetOf()
|
||||
}
|
||||
}
|
||||
|
||||
fun parseFromSub(uri: String) =
|
||||
when {
|
||||
uri.startsWith("http") -> parseFromNetwork(uri)
|
||||
uri.startsWith("/") -> parseFromFileSub(uri)
|
||||
"^[A-Za-z]:".toRegex().find(uri) != null -> parseFromFileSub(uri)
|
||||
else -> linkedSetOf()
|
||||
}
|
||||
|
||||
fun String.debug(extra: String = "") {
|
||||
if (debug) println("$this $extra")
|
||||
}
|
||||
}
|
||||
230
just/bao/src/main/java/me/leon/Subs.kt
Executable file
230
just/bao/src/main/java/me/leon/Subs.kt
Executable file
@ -0,0 +1,230 @@
|
||||
package me.leon
|
||||
|
||||
import me.leon.support.b64Encode
|
||||
import me.leon.support.b64EncodeNoEqual
|
||||
import me.leon.support.toJson
|
||||
import me.leon.support.urlEncode
|
||||
|
||||
interface Uri {
|
||||
|
||||
var name: String
|
||||
var nation: String
|
||||
val SERVER: String
|
||||
val serverPort: Int
|
||||
fun toUri(): String
|
||||
fun info(): String
|
||||
}
|
||||
|
||||
sealed class Sub : Uri
|
||||
|
||||
object NoSub : Sub() {
|
||||
override var name: String
|
||||
get() = "nosub"
|
||||
set(value) {}
|
||||
override var nation: String
|
||||
get() = "N/A"
|
||||
set(value) {}
|
||||
override var serverPort = 0
|
||||
override val SERVER = "nosub"
|
||||
|
||||
override fun toUri() = "nosub"
|
||||
override fun info() = "nosub"
|
||||
}
|
||||
|
||||
data class V2ray(
|
||||
/** address 服务器 */
|
||||
var add: String = "",
|
||||
var port: String = "",
|
||||
/** uuid */
|
||||
var id: String = "",
|
||||
/** alertId */
|
||||
var aid: String = "0",
|
||||
var scy: String = "auto",
|
||||
/** network */
|
||||
var net: String = "tcp",
|
||||
) : Sub() {
|
||||
var v: String = "2"
|
||||
var ps: String = ""
|
||||
|
||||
/** 伪装域名 */
|
||||
var host: String = ""
|
||||
|
||||
/** 伪装路径 */
|
||||
var path: String = ""
|
||||
|
||||
/** 默认false,空串即可 */
|
||||
var tls: String = ""
|
||||
get() = if (field == "tls") "true" else field
|
||||
var sni: String = ""
|
||||
|
||||
/** 伪装类型 tcp/kcp/QUIC 默认none */
|
||||
var type: String = "none"
|
||||
|
||||
override var name: String
|
||||
get() = ps.ifEmpty { "$SERVER:$serverPort-V2-${hashCode()}" }
|
||||
set(value) {
|
||||
ps = value
|
||||
}
|
||||
override var serverPort: Int = 0
|
||||
get() = runCatching { port.toInt() }.getOrDefault(-1)
|
||||
override val SERVER
|
||||
get() = add
|
||||
override var nation: String = ""
|
||||
|
||||
override fun toUri() = "vmess://${this.toJson().b64Encode()}"
|
||||
override fun info() = "$nation $name vmess $add:$port"
|
||||
}
|
||||
|
||||
data class SS(
|
||||
val method: String = "",
|
||||
val pwd: String = "",
|
||||
val server: String = "",
|
||||
val port: String = "",
|
||||
) : Sub() {
|
||||
var remark: String = ""
|
||||
override var nation: String = ""
|
||||
|
||||
override var name: String
|
||||
get() = remark.ifEmpty { "$SERVER:$serverPort-SS-${hashCode()}" }
|
||||
set(value) {
|
||||
remark = value
|
||||
}
|
||||
override val serverPort
|
||||
get() = runCatching { port.toInt() }.getOrDefault(-1)
|
||||
override val SERVER
|
||||
get() = server
|
||||
|
||||
override fun toUri() = "ss://${"$method:$pwd@$server:$port".b64Encode()}#${name.urlEncode()}"
|
||||
|
||||
override fun info() = "$nation $remark ss $server:$port"
|
||||
}
|
||||
|
||||
@Suppress("ConstructorParameterNaming")
|
||||
data class SSR(
|
||||
val server: String = "",
|
||||
val port: String = "",
|
||||
val protocol: String = "",
|
||||
val method: String = "",
|
||||
val obfs: String = "",
|
||||
val password: String = "",
|
||||
val obfs_param: String = "",
|
||||
val protocol_param: String = "",
|
||||
) : Sub() {
|
||||
var remarks: String = ""
|
||||
var group: String = ""
|
||||
|
||||
override var name: String
|
||||
get() = remarks.ifEmpty { "$SERVER:$serverPort-SSR-${hashCode()}" }
|
||||
set(value) {
|
||||
remarks = value
|
||||
}
|
||||
override val serverPort
|
||||
get() = runCatching { port.toInt() }.getOrDefault(-1)
|
||||
override val SERVER
|
||||
get() = server
|
||||
override var nation: String = ""
|
||||
|
||||
@Suppress("TrimMultilineRawString")
|
||||
override fun toUri() =
|
||||
"ssr://${
|
||||
("$server:$port:$protocol:$method:$obfs:${password.b64Encode()}" +
|
||||
"/?obfsparam=${obfs_param.b64EncodeNoEqual()}" +
|
||||
"&protoparam=${protocol_param.b64EncodeNoEqual()}" +
|
||||
"&remarks=${name.b64EncodeNoEqual()}" +
|
||||
"&group=${group.b64EncodeNoEqual()}")
|
||||
.b64Encode()
|
||||
}"
|
||||
|
||||
override fun info() = "$nation $remarks ssr $server:$port"
|
||||
}
|
||||
|
||||
data class Trojan(val password: String = "", val server: String = "", val port: String = "") :
|
||||
Sub() {
|
||||
var remark: String = ""
|
||||
var query: String = ""
|
||||
override var name: String
|
||||
get() = remark.ifEmpty { "$SERVER:$serverPort-TR-${hashCode()}" }
|
||||
set(value) {
|
||||
remark = value
|
||||
}
|
||||
private val params
|
||||
get() = if (query.isEmpty()) "" else "?$query"
|
||||
override val serverPort
|
||||
get() = runCatching { port.toInt() }.getOrDefault(-1)
|
||||
override val SERVER
|
||||
get() = server
|
||||
override var nation: String = ""
|
||||
|
||||
override fun toUri() = "trojan://${"$password@$server:$port$params"}#${name.urlEncode()}"
|
||||
override fun info() =
|
||||
if (query.isEmpty()) {
|
||||
"$nation $name trojan $server:$port"
|
||||
} else {
|
||||
"$nation $remark trojan $server:$port?$query"
|
||||
}
|
||||
}
|
||||
|
||||
/** refer https://github.com/XTLS/Xray-core/issues/91 */
|
||||
data class Vless(val uuid: String = "", val server: String = "", val port: String = "") : Sub() {
|
||||
var remark: String = ""
|
||||
var query: String = ""
|
||||
override var name: String
|
||||
get() = remark.ifEmpty { "$SERVER:$serverPort-VL-${hashCode()}" }
|
||||
set(value) {
|
||||
remark = value
|
||||
}
|
||||
private val params
|
||||
get() = if (query.isEmpty()) "" else "?$query"
|
||||
override val serverPort
|
||||
get() = runCatching { port.toInt() }.getOrDefault(-1)
|
||||
override val SERVER
|
||||
get() = server
|
||||
override var nation: String = ""
|
||||
|
||||
override fun toUri() =
|
||||
"vless://${"${uuid.urlEncode()}@$server:$port$params"}#${name.urlEncode()}"
|
||||
|
||||
override fun info() =
|
||||
if (query.isEmpty()) {
|
||||
"$nation $name vless $server:$port"
|
||||
} else {
|
||||
"$nation $remark vless $server:$port?$query"
|
||||
}
|
||||
}
|
||||
|
||||
data class Hysteria2(val uuid: String = "", val server: String = "", val port: String = "") : Sub() {
|
||||
var remark: String = ""
|
||||
var query: String = ""
|
||||
override var name: String
|
||||
get() = remark.ifEmpty { "$SERVER:$serverPort-hys2-${hashCode()}" }
|
||||
set(value) {
|
||||
remark = value
|
||||
}
|
||||
private val params
|
||||
get() = if (query.isEmpty()) "" else "?$query"
|
||||
override val serverPort
|
||||
get() = runCatching { port.toInt() }.getOrDefault(-1)
|
||||
override val SERVER
|
||||
get() = server
|
||||
override var nation: String = ""
|
||||
|
||||
override fun toUri() =
|
||||
"hysteria2://${"${uuid.urlEncode()}@$server:$port$params"}#${name.urlEncode()}"
|
||||
|
||||
override fun info() =
|
||||
if (query.isEmpty()) {
|
||||
"$nation $name vless $server:$port"
|
||||
} else {
|
||||
"$nation $remark vless $server:$port?$query"
|
||||
}
|
||||
}
|
||||
|
||||
fun Sub.methodUnSupported() =
|
||||
this is SSR && (method in SSR_unSupportMethod || protocol in SSR_unSupportProtocol) ||
|
||||
this is SS && method in SS_unSupportCipher ||
|
||||
this is V2ray && net in VMESS_unSupportProtocol
|
||||
|
||||
val SSR_unSupportMethod = arrayOf("none", "rc4", "rc4-md5")
|
||||
val SSR_unSupportProtocol = arrayOf("auth_chain_a")
|
||||
val SS_unSupportCipher = arrayOf("rc4-md5", "aes-128-cfb", "aes-256-cfb", "none")
|
||||
val VMESS_unSupportProtocol = arrayOf("none", "grpc", "h2", "auto")
|
||||
18
just/bao/src/main/java/me/leon/domain/DnsResolve.kt
Executable file
18
just/bao/src/main/java/me/leon/domain/DnsResolve.kt
Executable file
@ -0,0 +1,18 @@
|
||||
package me.leon.domain
|
||||
|
||||
@Suppress("ConstructorParameterNaming")
|
||||
data class DnsResolve(
|
||||
val Status: Int?,
|
||||
val TC: Boolean?,
|
||||
val RD: Boolean?,
|
||||
val RA: Boolean?,
|
||||
val AD: Boolean?,
|
||||
val CD: Boolean?,
|
||||
val Question: List<Question>?,
|
||||
val Answer: List<Answer>?
|
||||
)
|
||||
|
||||
data class Question(val name: String?, val type: Int?)
|
||||
|
||||
@Suppress("ConstructorParameterNaming")
|
||||
data class Answer(val name: String?, val type: Int?, val TTL: Int?, val `data`: String?)
|
||||
8
just/bao/src/main/java/me/leon/domain/Host.kt
Executable file
8
just/bao/src/main/java/me/leon/domain/Host.kt
Executable file
@ -0,0 +1,8 @@
|
||||
package me.leon.domain
|
||||
|
||||
data class Host(val domain: String) {
|
||||
var ip: String = ""
|
||||
override fun toString(): String {
|
||||
return "$ip $domain"
|
||||
}
|
||||
}
|
||||
3
just/bao/src/main/java/me/leon/domain/Lanzou.kt
Executable file
3
just/bao/src/main/java/me/leon/domain/Lanzou.kt
Executable file
@ -0,0 +1,3 @@
|
||||
package me.leon.domain
|
||||
|
||||
data class Lanzou(val dom: String = "", val inf: Int = 0, val url: String = "", val zt: Int = 0)
|
||||
56
just/bao/src/main/java/me/leon/domain/LiteSpeed.kt
Executable file
56
just/bao/src/main/java/me/leon/domain/LiteSpeed.kt
Executable file
@ -0,0 +1,56 @@
|
||||
package me.leon.domain
|
||||
|
||||
data class LiteSpeed(val id: Int, val info: String) {
|
||||
|
||||
var servers: List<Server>? = null
|
||||
|
||||
private var speed: String = ""
|
||||
private var ping: Int = -1
|
||||
|
||||
fun ping(): Int? {
|
||||
return if (info == GOT_PING && ping > 0) {
|
||||
ping
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun isEnd() = info == END_ONE
|
||||
|
||||
fun speed(): String? {
|
||||
return if (info == GOT_SPEED) {
|
||||
speed
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
data class Server(
|
||||
val id: Int,
|
||||
val link: String,
|
||||
)
|
||||
|
||||
companion object {
|
||||
const val GOT_SERVERS = "gotservers"
|
||||
const val GOT_PING = "gotping"
|
||||
const val GOT_SPEED = "gotspeed"
|
||||
const val END_ONE = "endone"
|
||||
const val NA = "N/A"
|
||||
}
|
||||
}
|
||||
|
||||
data class LiteSpeedConfig(
|
||||
val subscription: String = "",
|
||||
val group: String = "Default",
|
||||
val speedtestMode: String = "pingonly",
|
||||
val pingMethod: String = "googleping",
|
||||
val sortMethod: String = "pingonly",
|
||||
val concurrency: Int = 128,
|
||||
val testMode: Int = 2,
|
||||
val timeout: Int = 5,
|
||||
val fontSize: Int = 24,
|
||||
val generatePicMode: Int = 2,
|
||||
val unique: Boolean = true,
|
||||
val language: String = "en",
|
||||
val theme: String = "rainbow",
|
||||
)
|
||||
25
just/bao/src/main/java/me/leon/domain/Quark.kt
Executable file
25
just/bao/src/main/java/me/leon/domain/Quark.kt
Executable file
@ -0,0 +1,25 @@
|
||||
package me.leon.domain
|
||||
|
||||
@Suppress("ConstructorParameterNaming", "NonBooleanPropertyPrefixedWithIs")
|
||||
data class Quark(
|
||||
val area: String = "",
|
||||
val country: String = "",
|
||||
val `data`: List<Data> = emptyList(),
|
||||
val port: Port = Port(),
|
||||
val status: Int? = 0
|
||||
) {
|
||||
data class Data(
|
||||
val area: String = "",
|
||||
val country: String = "",
|
||||
val host: String = "",
|
||||
val id: String = "",
|
||||
val is_full: Int = 0,
|
||||
val is_proxy: String = "",
|
||||
val is_vip: Int = 0,
|
||||
val name: String = "",
|
||||
val rate: Double = 0.0,
|
||||
val weight: Int = 0
|
||||
)
|
||||
|
||||
data class Port(val method: String = "", val password: String = "", val port: String = "")
|
||||
}
|
||||
36
just/bao/src/main/java/me/leon/support/Encode.kt
Executable file
36
just/bao/src/main/java/me/leon/support/Encode.kt
Executable file
@ -0,0 +1,36 @@
|
||||
package me.leon.support
|
||||
|
||||
import java.net.URLDecoder
|
||||
import java.net.URLEncoder
|
||||
import java.util.*
|
||||
|
||||
fun String.b64Decode() = String(Base64.getDecoder().decode(this.filter { it.code < 128 }))
|
||||
|
||||
fun String.b64SafeDecode() =
|
||||
if (this.contains(":")) {
|
||||
this
|
||||
} else {
|
||||
runCatching {
|
||||
if (contains("=[^=]+.+".toRegex())) {
|
||||
split("=")
|
||||
.filter { it.isNotEmpty() }
|
||||
.joinToString(System.lineSeparator()) {
|
||||
it.replace("_", "/").replace("-", "+").b64Decode()
|
||||
}
|
||||
} else {
|
||||
trim().replace("_", "/").replace("-", "+").b64Decode()
|
||||
}
|
||||
}
|
||||
.getOrElse {
|
||||
println("failed: $this ${it.message}")
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
fun String.b64Encode(): String = Base64.getEncoder().encodeToString(toByteArray())
|
||||
|
||||
fun String.b64EncodeNoEqual() = Base64.getEncoder().encodeToString(toByteArray()).replace("=", "")
|
||||
|
||||
fun String.urlEncode() = URLEncoder.encode(this).orEmpty()
|
||||
|
||||
fun String.urlDecode() = URLDecoder.decode(this).orEmpty()
|
||||
78
just/bao/src/main/java/me/leon/support/Ext.kt
Executable file
78
just/bao/src/main/java/me/leon/support/Ext.kt
Executable file
@ -0,0 +1,78 @@
|
||||
package me.leon.support
|
||||
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.TimeZone
|
||||
|
||||
private const val DEFAULT_READ_TIME_OUT = 30_000
|
||||
private const val DEFAULT_CONNECT_TIME_OUT = 30_000
|
||||
|
||||
fun String.httpRequest(timeout:Int = DEFAULT_READ_TIME_OUT) = (URL(this).openConnection().apply {
|
||||
// setRequestProperty("Referer",
|
||||
// "https://pc.woozooo.com/mydisk.php")
|
||||
connectTimeout = DEFAULT_CONNECT_TIME_OUT
|
||||
readTimeout = timeout
|
||||
setRequestProperty("Accept-Language", ACCEPT_LANGUAGE)
|
||||
setRequestProperty("user-agent", UA)
|
||||
} as HttpURLConnection)
|
||||
|
||||
fun String.readFromNet() =
|
||||
runCatching {
|
||||
String(
|
||||
(URL(this).openConnection().apply {
|
||||
// setRequestProperty("Referer",
|
||||
// "https://pc.woozooo.com/mydisk.php")
|
||||
connectTimeout = DEFAULT_CONNECT_TIME_OUT
|
||||
readTimeout = DEFAULT_READ_TIME_OUT
|
||||
setRequestProperty("Accept-Language", ACCEPT_LANGUAGE)
|
||||
setRequestProperty("User-Agent", UA)
|
||||
} as HttpURLConnection)
|
||||
.takeIf {
|
||||
// println("$this __ ${it.responseCode}")
|
||||
it.responseCode == RESPONSE_OK
|
||||
}
|
||||
?.inputStream
|
||||
?.readBytes()
|
||||
?: "".toByteArray()
|
||||
)
|
||||
}
|
||||
.getOrElse {
|
||||
println("read err ${it.message}")
|
||||
""
|
||||
}
|
||||
|
||||
fun String.queryParamMap() =
|
||||
"(\\w+)=([^&]*)".toRegex().findAll(this).fold(mutableMapOf<String, String>()) { acc, matchResult
|
||||
->
|
||||
acc.apply { acc[matchResult.groupValues[1]] = matchResult.groupValues[2] }
|
||||
}
|
||||
|
||||
fun String.queryParamMapB64() =
|
||||
"(\\w+)=([^&]*)".toRegex().findAll(this).fold(mutableMapOf<String, String>()) { acc, matchResult
|
||||
->
|
||||
acc.apply {
|
||||
acc[matchResult.groupValues[1]] =
|
||||
matchResult.groupValues[2].urlDecode().replace(" ", "+").b64SafeDecode()
|
||||
}
|
||||
}
|
||||
|
||||
fun Int.slice(group: Int): MutableList<IntRange> {
|
||||
val slice = kotlin.math.ceil(this.toDouble() / group.toDouble()).toInt()
|
||||
return (0 until group).foldIndexed(mutableListOf()) { index, acc, i ->
|
||||
acc.apply {
|
||||
acc.add(
|
||||
slice * index until ((slice * (i + 1)).takeIf { group - 1 != index } ?: this@slice)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Any?.safeAs(): T? = this as? T?
|
||||
|
||||
fun timeStamp(timeZone: String = "Asia/Shanghai"): String {
|
||||
val instance = Calendar.getInstance()
|
||||
TimeZone.setDefault(TimeZone.getTimeZone(timeZone))
|
||||
return SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(instance.time)
|
||||
}
|
||||
16
just/bao/src/main/java/me/leon/support/File.kt
Executable file
16
just/bao/src/main/java/me/leon/support/File.kt
Executable file
@ -0,0 +1,16 @@
|
||||
package me.leon.support
|
||||
|
||||
import java.io.File
|
||||
import java.nio.charset.Charset
|
||||
|
||||
fun String.readText(charset: Charset = Charsets.UTF_8) =
|
||||
File(this).canonicalFile.takeIf { it.exists() }?.readText(charset).orEmpty()
|
||||
|
||||
fun String.writeLine(txt: String = "", isAppend: Boolean = true): Unit =
|
||||
if (txt.isEmpty() || !isAppend) {
|
||||
File(this).also { if (!it.parentFile.exists()) it.parentFile.mkdirs() }.writeText(txt)
|
||||
} else {
|
||||
File(this).appendText("$txt${System.lineSeparator()}")
|
||||
}
|
||||
|
||||
fun String.readLines() = File(this).takeIf { it.exists() }?.readLines() ?: mutableListOf()
|
||||
45
just/bao/src/main/java/me/leon/support/FlagRemover.kt
Executable file
45
just/bao/src/main/java/me/leon/support/FlagRemover.kt
Executable file
@ -0,0 +1,45 @@
|
||||
package me.leon.support
|
||||
|
||||
import me.leon.ROOT
|
||||
|
||||
object FlagRemover {
|
||||
private val flagMaps = linkedMapOf<String, String>()
|
||||
private val flagReg by lazy {
|
||||
"$ROOT/flags.txt"
|
||||
.readLines()
|
||||
.map {
|
||||
with(it.split("|")) {
|
||||
flagMaps[this[0]] = this[2]
|
||||
flagMaps[this[1]] = this[2]
|
||||
Triple(this[0], this[1], this[2])
|
||||
}
|
||||
}
|
||||
.joinToString("|") { "(${it.first}) *(?:${it.second})?" }
|
||||
// .also { println(it) }
|
||||
.toRegex()
|
||||
}
|
||||
|
||||
fun remove(s: String): String {
|
||||
var tmp = s
|
||||
flagReg
|
||||
.findAll(s)
|
||||
.map {
|
||||
it.groupValues
|
||||
.filterIndexed { i, item -> i != 0 && item.isNotEmpty() }
|
||||
.map { item ->
|
||||
// println("$item ${flagMaps[item]}")
|
||||
flagMaps[item]?.run {
|
||||
tmp =
|
||||
flagReg.replaceFirst(
|
||||
tmp,
|
||||
this.takeUnless { tmp.contains(this) }.orEmpty()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
.lastOrNull()
|
||||
return tmp.replace("美国离岛美国|美国离岛".toRegex(), "美国")
|
||||
}
|
||||
}
|
||||
|
||||
fun String.removeFlags() = FlagRemover.remove(this)
|
||||
31
just/bao/src/main/java/me/leon/support/GsonUtils.kt
Executable file
31
just/bao/src/main/java/me/leon/support/GsonUtils.kt
Executable file
@ -0,0 +1,31 @@
|
||||
package me.leon.support
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.reflect.TypeToken
|
||||
|
||||
object GsonUtils {
|
||||
private val gson: Gson = Gson()
|
||||
|
||||
fun toJson(obj: Any): String = gson.toJson(obj)
|
||||
|
||||
fun <D> fromJson(json: String?, clazz: Class<D>): D = gson.fromJson(json, clazz)
|
||||
|
||||
fun <D> jsonToList(json: String, clazz: Class<Array<D>>): List<D> =
|
||||
gson.fromJson(json, clazz).toList()
|
||||
|
||||
fun <D> jsonToArrayList(json: String, clazz: Class<D>): List<D> {
|
||||
return gson
|
||||
.fromJson<List<JsonObject>>(json, object : TypeToken<List<JsonObject>>() {}.type)
|
||||
.map { gson.fromJson(it, clazz) }
|
||||
.toList()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified D> String.fromJson() = GsonUtils.fromJson(this, D::class.java)
|
||||
|
||||
inline fun <reified D> String.fromJsonArray() = GsonUtils.jsonToList(this, Array<D>::class.java)
|
||||
|
||||
inline fun <reified D> String.fromJsonList() = GsonUtils.jsonToArrayList(this, D::class.java)
|
||||
|
||||
fun Any.toJson() = GsonUtils.toJson(this)
|
||||
82
just/bao/src/main/java/me/leon/support/IpExt.kt
Executable file
82
just/bao/src/main/java/me/leon/support/IpExt.kt
Executable file
@ -0,0 +1,82 @@
|
||||
package me.leon.support
|
||||
|
||||
import me.leon.IP_SCORE
|
||||
import org.jsoup.Jsoup
|
||||
import java.net.InetAddress
|
||||
import kotlin.math.pow
|
||||
|
||||
@Throws
|
||||
fun String.toInetAddress(): InetAddress = InetAddress.getByName(this)
|
||||
|
||||
|
||||
val cfCidrs =
|
||||
setOf(
|
||||
"103.21.244.0/22",
|
||||
"103.22.200.0/22",
|
||||
"103.31.4.0/22",
|
||||
"104.16.0.0/13",
|
||||
"104.24.0.0/14",
|
||||
"108.162.192.0/18",
|
||||
"131.0.72.0/22",
|
||||
"141.101.64.0/18",
|
||||
"162.158.0.0/15",
|
||||
"172.64.0.0/13",
|
||||
"173.245.48.0/20",
|
||||
"188.114.96.0/20",
|
||||
"190.93.240.0/20",
|
||||
"197.234.240.0/22",
|
||||
"198.41.128.0/17"
|
||||
)
|
||||
.map { it.cidrRange() }
|
||||
|
||||
fun String.ip2Uint() = split(".").fold(0U) { acc, s -> acc * 256U + s.toUInt() }
|
||||
|
||||
fun UInt.toIp() = "${shr(24)}.${shr(16) and 0xFFU}.${shr(8) and 0xFFU}.${this and 0xFFU}"
|
||||
|
||||
fun String.ip2Binary() =
|
||||
split(".")
|
||||
.fold(StringBuilder()) { acc, s -> acc.append(s.toUInt().toString(2).padStart(8, '0')) }
|
||||
.toString()
|
||||
|
||||
fun Int.ipMaskBinary() = "1".repeat(this) + "0".repeat(32 - this)
|
||||
|
||||
fun Int.ipMask() = ipMaskBinary().binary2Ip()
|
||||
|
||||
fun String.binary2Ip() = stripAllSpace().chunked(8).joinToString(".") { it.toUInt(2).toString() }
|
||||
|
||||
fun String.cidrRange(): UIntRange {
|
||||
val (ipStr, cidrStr) = split("/").takeIf { it.size > 1 } ?: listOf(this, "24")
|
||||
val cidr = cidrStr.takeIf { it.isNotEmpty() }?.toInt() ?: 24
|
||||
val ip = ipStr.ip2Uint()
|
||||
val sub = 32 - cidr
|
||||
val count = 2.0.pow(sub).toInt()
|
||||
val mask = cidr.ipMask().ip2Uint()
|
||||
val net = mask and ip
|
||||
return (net + 1U)..(net + (count - 2).toUInt())
|
||||
}
|
||||
|
||||
fun String.ipCloudFlare() = cfCidrs.any { it.contains(ip2Uint()) }
|
||||
|
||||
fun String.stripAllSpace() = replace("\\s+".toRegex(), "")
|
||||
|
||||
val map = IP_SCORE.readLines().filter { it.isNotEmpty() }.associate { with(it.split("\t")) { first() to last().toInt() } }.toMutableMap()
|
||||
.also { println("ip score size ${it.size}") }
|
||||
|
||||
fun String.ipScore() =
|
||||
map[this] ?: (Jsoup.connect("https://scamalytics.com/ip/$this")
|
||||
.get()
|
||||
.selectFirst(".score")
|
||||
?.text()?.substringAfter("Fraud Score: ")?.toIntOrNull() ?: 0)
|
||||
.also {
|
||||
map[this] = it
|
||||
IP_SCORE.writeLine("$this\t$it")
|
||||
}
|
||||
|
||||
val Int.lvl
|
||||
get() =
|
||||
when {
|
||||
this < 40 -> "L$this"
|
||||
this < 70 -> "M$this"
|
||||
this < 100 -> "H$this"
|
||||
else -> "H"
|
||||
}
|
||||
177
just/bao/src/main/java/me/leon/support/Net.kt
Executable file
177
just/bao/src/main/java/me/leon/support/Net.kt
Executable file
@ -0,0 +1,177 @@
|
||||
package me.leon.support
|
||||
|
||||
import java.io.DataOutputStream
|
||||
import java.io.File
|
||||
import java.net.*
|
||||
import kotlin.system.measureTimeMillis
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import me.leon.FAIL_IPS
|
||||
|
||||
val failIpPorts by lazy { FAIL_IPS.readLines().toHashSet() }
|
||||
val fails = mutableSetOf<String>()
|
||||
val passes = mutableSetOf<String>()
|
||||
const val UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||
"Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0"
|
||||
const val ACCEPT_LANGUAGE = "en-US"
|
||||
/** ip + port 测试 */
|
||||
val Nop = { _: String, _: Int -> false }
|
||||
|
||||
fun String.connect(
|
||||
port: Int = 80,
|
||||
timeout: Int = 1000,
|
||||
cache: (ip: String, port: Int) -> Boolean = Nop,
|
||||
exceptionHandler: (info: String) -> Unit = {}
|
||||
) =
|
||||
if (!contains(".") || port < 0 || cache.invoke(this, port)) {
|
||||
// println("quick fail from cache")
|
||||
-1
|
||||
} else if (passes.contains("$this:$port")) {
|
||||
1
|
||||
} else {
|
||||
runCatching {
|
||||
measureTimeMillis {
|
||||
Socket().connect(InetSocketAddress(this, port), timeout)
|
||||
passes.add("$this:$port")
|
||||
}
|
||||
}
|
||||
.getOrElse {
|
||||
exceptionHandler.invoke("$this:$port")
|
||||
-1
|
||||
}
|
||||
}
|
||||
|
||||
/** ping 测试 */
|
||||
fun String.ping(
|
||||
timeout: Int = 1000,
|
||||
cacheFailed: (ip: String, port: Int) -> Boolean = Nop,
|
||||
exceptionHandler: (info: String) -> Unit = {}
|
||||
) =
|
||||
if (!contains(".") || cacheFailed.invoke(this, -1)) {
|
||||
println("fast failed")
|
||||
-1
|
||||
} else if (passes.contains(this)) {
|
||||
1
|
||||
} else {
|
||||
runCatching {
|
||||
val start = System.currentTimeMillis()
|
||||
val reachable = InetAddress.getByName(this).isReachable(timeout)
|
||||
if (reachable) {
|
||||
(System.currentTimeMillis() - start).also { passes.add(this) }
|
||||
} else {
|
||||
exceptionHandler.invoke(this)
|
||||
-1
|
||||
}
|
||||
}
|
||||
.getOrElse {
|
||||
exceptionHandler.invoke(this)
|
||||
-1
|
||||
}
|
||||
}
|
||||
|
||||
fun String.toFile() = File(this)
|
||||
|
||||
const val RESPONSE_OK = 200
|
||||
|
||||
fun String.post(params: MutableMap<String, String>) =
|
||||
runCatching {
|
||||
val p =
|
||||
params.keys
|
||||
.foldIndexed(StringBuilder()) { index, acc, s ->
|
||||
acc.also {
|
||||
acc.append("${"&".takeUnless { index == 0 }.orEmpty()}$s=${params[s]}")
|
||||
}
|
||||
}
|
||||
.toString()
|
||||
String(
|
||||
URL(this)
|
||||
.openConnection()
|
||||
.safeAs<HttpURLConnection>()
|
||||
?.apply {
|
||||
requestMethod = "POST"
|
||||
setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
|
||||
setRequestProperty("Referer", "https://pc.woozooo.com/mydisk.php")
|
||||
setRequestProperty("Accept-Language","en-US")
|
||||
setRequestProperty("Content-Length", "${p.toByteArray().size}")
|
||||
setRequestProperty("user-agent",UA)
|
||||
useCaches = false
|
||||
doInput = true
|
||||
doOutput = true
|
||||
|
||||
DataOutputStream(outputStream).use { it.writeBytes(p) }
|
||||
}
|
||||
?.takeIf {
|
||||
// println("$this __ ${it.responseCode}")
|
||||
it.responseCode == RESPONSE_OK
|
||||
}
|
||||
?.inputStream
|
||||
?.readBytes()
|
||||
?: "".toByteArray()
|
||||
)
|
||||
}
|
||||
.getOrElse {
|
||||
println("$this read err ${it.message}")
|
||||
""
|
||||
}
|
||||
|
||||
fun String.readBytesFromNet(
|
||||
method: String = "GET",
|
||||
timeout: Int = 3000,
|
||||
data: String = "",
|
||||
headers: MutableMap<String, Any> = mutableMapOf()
|
||||
) =
|
||||
runCatching {
|
||||
(URL(this).openConnection() as HttpURLConnection)
|
||||
.apply {
|
||||
connectTimeout = timeout
|
||||
readTimeout = timeout
|
||||
setRequestProperty("Content-Type", "application/json; charset=utf-8")
|
||||
setRequestProperty("Accept-Language", ACCEPT_LANGUAGE)
|
||||
setRequestProperty("user-agent", UA)
|
||||
for ((k, v) in headers) setRequestProperty(k, v.toString())
|
||||
|
||||
requestMethod = method
|
||||
|
||||
if (method.equals("post", true)) {
|
||||
val dataBytes = data.toByteArray()
|
||||
if (dataBytes.isNotEmpty()) {
|
||||
addRequestProperty("Content-Length", dataBytes.size.toString())
|
||||
}
|
||||
doOutput = true
|
||||
connect()
|
||||
outputStream.write(dataBytes)
|
||||
outputStream.flush()
|
||||
outputStream.close()
|
||||
}
|
||||
}
|
||||
.takeIf { it.responseCode == RESPONSE_OK }
|
||||
?.inputStream
|
||||
?.readBytes()
|
||||
?: byteArrayOf()
|
||||
}
|
||||
.getOrElse {
|
||||
println("read bytes err ")
|
||||
byteArrayOf()
|
||||
}
|
||||
|
||||
fun String.quickConnect(port: Int = 80, timeout: Int = 1000) =
|
||||
this.connect(
|
||||
port,
|
||||
timeout,
|
||||
{ ip, p ->
|
||||
failIpPorts.contains(ip) || fails.contains("$ip:$p") || failIpPorts.contains("$ip:$p")
|
||||
}
|
||||
) {
|
||||
// println("error $it")
|
||||
fails.add(it)
|
||||
FAIL_IPS.writeLine(it)
|
||||
}
|
||||
|
||||
fun String.quickPing(timeout: Int = 1000) =
|
||||
this.ping(timeout, { ip, _ -> failIpPorts.contains(ip) || fails.contains(ip) }) {
|
||||
println("error $it")
|
||||
fails.add(it)
|
||||
FAIL_IPS.writeLine(it)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class) val DISPATCHER = Dispatchers.IO.limitedParallelism(256)
|
||||
16
just/bao/src/main/java/me/leon/support/Yamls.kt
Executable file
16
just/bao/src/main/java/me/leon/support/Yamls.kt
Executable file
@ -0,0 +1,16 @@
|
||||
package me.leon.support
|
||||
|
||||
import org.yaml.snakeyaml.DumperOptions
|
||||
import org.yaml.snakeyaml.LoaderOptions
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
import org.yaml.snakeyaml.constructor.Constructor
|
||||
import org.yaml.snakeyaml.representer.Representer
|
||||
|
||||
inline fun <reified T> String.parseYaml() = (Yaml(Constructor(T::class.java, LoaderOptions().apply {
|
||||
codePointLimit = Int.MAX_VALUE
|
||||
}), Representer(DumperOptions()).apply { propertyUtils.isSkipMissingProperties = true }).load(fixYaml()) as T)
|
||||
|
||||
fun String.fixYaml() =
|
||||
replace("!<[^>]+>".toRegex(), "")
|
||||
.replace(" password: \n", " password: xxxxx\n")
|
||||
.replace("server: $*@", "server: ")
|
||||
BIN
just/bao/src/main/resources/GeoLite2-Country.mmdb
Executable file
BIN
just/bao/src/main/resources/GeoLite2-Country.mmdb
Executable file
Binary file not shown.
58
just/bao/src/test/java/me/leon/ConnectTest.kt
Executable file
58
just/bao/src/test/java/me/leon/ConnectTest.kt
Executable file
@ -0,0 +1,58 @@
|
||||
package me.leon
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ConnectTest {
|
||||
|
||||
@Test
|
||||
fun connect() {
|
||||
println("www.baidu.com".connect())
|
||||
println("www.baidu.com".ping())
|
||||
println("www.baidu.com".connect(443))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun poolTest() {
|
||||
NODE_OK.writeLine()
|
||||
runBlocking {
|
||||
Parser.parseFromSub(POOL)
|
||||
.map { it to async(DISPATCHER) { it.SERVER.quickConnect(it.serverPort, 2000) } }
|
||||
.filter { it.second.await() > -1 }
|
||||
.forEach {
|
||||
println(it.first.info() + ":" + it.second)
|
||||
NODE_OK.writeLine(it.first.toUri())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun poolPingTest() {
|
||||
runBlocking {
|
||||
Parser.parseFromSub(POOL)
|
||||
.map { it to async(DISPATCHER) { it.SERVER.quickPing(2000) } }
|
||||
.filter { it.second.await() > -1 }
|
||||
.also { println(it.size) }
|
||||
.forEach { println(it.first.info() + ":" + it.second) }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun url404() {
|
||||
runBlocking {
|
||||
("$ROOT/pool/sublists".readLines() + "$ROOT/pool/subs".readLines())
|
||||
.filterNot { it.startsWith("#") }
|
||||
.map {
|
||||
async(DISPATCHER) {
|
||||
it to runCatching { it.httpRequest(10000).responseCode == 404 }.getOrDefault(false)
|
||||
}
|
||||
}
|
||||
.awaitAll()
|
||||
.filter { it.second }
|
||||
.forEach {
|
||||
println(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
159
just/bao/src/test/java/me/leon/ExtTest.kt
Executable file
159
just/bao/src/test/java/me/leon/ExtTest.kt
Executable file
@ -0,0 +1,159 @@
|
||||
package me.leon
|
||||
|
||||
import java.io.File
|
||||
import java.text.NumberFormat
|
||||
import java.util.*
|
||||
import me.leon.domain.Lanzou
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ExtTest {
|
||||
|
||||
@Test
|
||||
fun encode() {
|
||||
println("https://suo.yt/WtbjDPJ".readFromNet())
|
||||
println("你好Leon".b64Encode())
|
||||
|
||||
println("5L2g5aW9TGVvbg==".b64Decode())
|
||||
println("你好Leon".urlEncode())
|
||||
println("%E4%BD%A0%E5%A5%BDLeon".urlDecode())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun v2rayTest() {
|
||||
val url =
|
||||
"vmess://ew0KICAidiI6ICIyIiwNCiAgInBzIjogIvCfh7rwn4e4576O5Zu9IOKYhuKYhiAgMDEg4piGTlRU4piGICAgMS4y5YCN" +
|
||||
"546HIiwNCiAgImFkZCI6ICJiai5rZWFpeXVuLnh5eiIsDQogICJwb3J0IjogIjMxMTAzIiwNCiAgImlkIjogIjQ0MTg5Mz" +
|
||||
"QxLTJjYzktM2JlOS1iYjEwLWMxMzVlOThjZDhlYiIsDQogICJhaWQiOiAiMiIsDQogICJzY3kiOiAiYXV0byIsDQogICJu" +
|
||||
"ZXQiOiAid3MiLA0KICAidHlwZSI6ICJub25lIiwNCiAgImhvc3QiOiAid3d3LmJhaWR1LmNvbSIsDQogICJwYXRoIjogIi9" +
|
||||
"2MnJheSIsDQogICJ0bHMiOiAiIiwNCiAgInNuaSI6ICIiDQp9"
|
||||
println(Parser.parseV2ray(url).toUri())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ssTest() {
|
||||
val url =
|
||||
"ss://YWVzLTI1Ni1nY206bjh3NFN0bmJWRDlkbVhZbjRBanQ4N0VBQDE1NC4xMjcuNTAuMTM4OjMxNTcy#(%e5%b7%b2%e5%9d%9" +
|
||||
"a%e6%8c%ba5%e5%a4%a9)%e5%8d%97%e9%9d%9e%e3%80%90%e5%88%86%e4%ba%ab%e6%9d%a5%e8%87%aaYoutube%e" +
|
||||
"4%b8%8d%e8%89%af%e6%9e%97%e3%80%91"
|
||||
println(Parser.parseSs(url).toUri())
|
||||
|
||||
val url2 =
|
||||
"ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTpyNFRlRXQ1YkswVURAc3MuY2Euc3NobWF4Lm5ldDoxNDQz"
|
||||
println(Parser.parseSs(url2).toUri())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ssrTest() {
|
||||
val url =
|
||||
"ssr://bnRlbXAxNi5ib29tLnBhcnR5OjIxMDAwOmF1dGhfYWVzMTI4X3NoYTE6YWVzLTI1Ni1jZmI6aHR0cF9zaW1wbGU6VldzNU1" +
|
||||
"rTlQvP29iZnNwYXJhbT1aRzkzYm14dllXUXVkMmx1Wkc5M2MzVndaR0YwWlM1amIyMCZwcm90b3BhcmFtPU1UUXpNRGN6T" +
|
||||
"2tONk9HRlBhUSZyZW1hcmtzPTZhYVo1cml2TFVJJmdyb3VwPU1R"
|
||||
println(Parser.parseSsr(url).toUri())
|
||||
|
||||
val url2 =
|
||||
"ssr://bjU3LmJvb20ucGFydHk6MjUwMDA6YXV0aF9hZXMxMjhfc2hhMTphZXMtMjU2LWNmYjpodHRwX3NpbXBsZTpWV3M1TWtOVC" +
|
||||
"8_b2Jmc3BhcmFtPVpHOTNibXh2WVdRdWQybHVaRzkzYzNWd1pHRjBaUzVqYjIwJnByb3RvcGFyYW09TVRRek1EY3pPa042" +
|
||||
"T0dGUGFRJnJlbWFya3M9NmFhWjVyaXZMVVEmZ3JvdXA9TVE"
|
||||
println(Parser.parseSsr(url2).toUri())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun trojanTest() {
|
||||
val url3 = "trojan://N8l9RGMa@t2.ssrsub.one:8443?sni=t2.ssrsub.one"
|
||||
println(Parser.parse(url3).toUri())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParse() {
|
||||
val q =
|
||||
"obfsparam=ZG93bmxvYWQud2luZG93c3VwZGF0ZS5jb20&protoparam=" +
|
||||
"MTQzMDczOkN6OGFPaQ&remarks=6aaZ5rivLUI&group=MQ"
|
||||
println(q.queryParamMap())
|
||||
|
||||
val q2 =
|
||||
"obfsparam=&protoparam=" +
|
||||
"dC5tZS9TU1JTVUI&remarks=UmVsYXlf8J+HqPCfh6ZDQS3wn4eo8J+HpkNBXzQxOSB8IDMuNTNNYg&group="
|
||||
println(q2.queryParamMapB64())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fileTest() {
|
||||
println(File("./").canonicalPath)
|
||||
println(this.javaClass.getResource(""))
|
||||
println(this.javaClass.getResource("/"))
|
||||
println(this.javaClass.classLoader.getResource(""))
|
||||
println(this.javaClass.classLoader.getResource("/"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sliceTest() {
|
||||
println(7.slice(3))
|
||||
println(9.slice(3))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pingTest() {
|
||||
println("wwws.baidu.com".quickPing())
|
||||
println("wwws.baidu.com".quickPing())
|
||||
println("www.baidu.com".quickPing())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun socketTest() {
|
||||
println("wwws.baidu.com".quickConnect(50))
|
||||
println("www.baidu.com".quickConnect(80))
|
||||
println("www.baidu.com".quickConnect(443))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun lanzouDirectLink() {
|
||||
val url = "https://leon.lanzoub.com/icjqqmk38xg"
|
||||
|
||||
url.readFromNet()
|
||||
.run { "(/fn\\?\\w{6,})\" frameborder".toRegex().find(this)!!.groupValues[1] }
|
||||
.also {
|
||||
println(it)
|
||||
"https://www.lanzouw.com/$it".readFromNet().also {
|
||||
println(it)
|
||||
val sign = "(?:vsign = +|'sign':)'(\\w+)'".toRegex().find(it)!!.groupValues[1]
|
||||
"https://www.lanzouw.com/ajaxm.php"
|
||||
.post(
|
||||
mutableMapOf(
|
||||
"action" to "downprocess",
|
||||
"signs" to "?ctdf",
|
||||
"sign" to sign,
|
||||
"ves" to "1"
|
||||
)
|
||||
)
|
||||
.fromJson<Lanzou>()
|
||||
.run { println("$dom/file/${this.url}") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun timeZone() {
|
||||
System.setProperty("user.timezone", "GMT +04")
|
||||
println(timeStamp())
|
||||
println(timeStamp("GMT-3"))
|
||||
println(timeStamp("UTC"))
|
||||
println(timeStamp("America/New_York"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dd() {
|
||||
val d1 = 2.147483647E9
|
||||
val d = 2_147_483_647.toDouble()
|
||||
println(d.toString())
|
||||
val instance = NumberFormat.getInstance()
|
||||
instance.isGroupingUsed = false // 设置不使用科学计数器
|
||||
instance.maximumFractionDigits = 2 // 小数点最大位数
|
||||
println(instance.format(d1))
|
||||
"\uD83C\uDDFA\uD83C\uDDF8 美国(欢迎订阅YouTube:8度科技%"
|
||||
.replace("[【((].+[))%】]?".toRegex(), "")
|
||||
.also { println(it) }
|
||||
|
||||
"(欢迎订阅youtube:8度科技".replace("[【((].+[))%】]?".toRegex(), "").also { println(it) }
|
||||
}
|
||||
}
|
||||
19
just/bao/src/test/java/me/leon/FlagTest.kt
Executable file
19
just/bao/src/test/java/me/leon/FlagTest.kt
Executable file
@ -0,0 +1,19 @@
|
||||
package me.leon
|
||||
|
||||
import me.leon.support.FlagRemover
|
||||
import me.leon.support.removeFlags
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class FlagTest {
|
||||
@Test
|
||||
fun flagParse() {
|
||||
|
||||
FlagRemover.remove("Relay_\uD83C\uDDE8\uD83C\uDDF3CN-\uD83C\uDDF8\uD83C\uDDECSG_1927")
|
||||
.also { println(it) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pool() {
|
||||
Parser.parseFromSub(NODE_OK).map { println("${it.name} ${it.name.removeFlags()}") }
|
||||
}
|
||||
}
|
||||
64
just/bao/src/test/java/me/leon/LocalFileSubTest.kt
Executable file
64
just/bao/src/test/java/me/leon/LocalFileSubTest.kt
Executable file
@ -0,0 +1,64 @@
|
||||
package me.leon
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class LocalFileSubTest {
|
||||
@Test
|
||||
fun readLocal() {
|
||||
Parser.parseFromSub("$ROOT/V2RayN.txt")
|
||||
.joinToString("|") { it.toUri() }
|
||||
.also { println(it) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readLocal2() {
|
||||
Parser.parseFromSub("$ROOT/subs.txt").joinToString("|") { it.toUri() }.also { println(it) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readLocalDir() {
|
||||
runBlocking {
|
||||
"C:\\Users\\Leon\\Downloads\\Telegram Desktop"
|
||||
.toFile()
|
||||
.listFiles()
|
||||
.map { Parser.parseFromSub(it.absolutePath) }
|
||||
.flatten()
|
||||
.distinct()
|
||||
.map { it to async(DISPATCHER) { it.SERVER.quickConnect(it.serverPort, 2000) } }
|
||||
.filter { it.second.await() > -1 }
|
||||
.map { it.first }
|
||||
.also { println(it.size) }
|
||||
.also { println(it.joinToString("\n") { it.toUri() }) }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readLocal4() {
|
||||
Parser.parseFromSub(NODE_OK)
|
||||
.filterIsInstance<V2ray>()
|
||||
.filter { it.net == "grpc" }
|
||||
.filterNot { it.methodUnSupported().apply { if (this) println("____$it") } }
|
||||
.joinToString("\n") { it.info() + "${it.tls} ${it.path}" }
|
||||
.also { println(it) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readLocalSSR() {
|
||||
Parser.parseFromSub(NODE_SSR)
|
||||
.also { println(it.size) }
|
||||
.filterNot { it.methodUnSupported() }
|
||||
.filterIsInstance<SSR>()
|
||||
// .joinToString("\n") { it.name }
|
||||
.also { println(it.map { it.protocol }.groupBy { it }.keys) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseUri() {
|
||||
val uri =
|
||||
"trojan://413f2e36-0038-48e4-963a-a38c0007ef24@us-sp.okzdns.com:50001/#S2%E7%BE%8E%E5%9B%BD%7CNetFlix%7C04"
|
||||
Parser.parse(uri).also { println(it) }
|
||||
}
|
||||
}
|
||||
87
just/bao/src/test/java/me/leon/NetworkSubTest.kt
Executable file
87
just/bao/src/test/java/me/leon/NetworkSubTest.kt
Executable file
@ -0,0 +1,87 @@
|
||||
package me.leon
|
||||
|
||||
import me.leon.support.urlDecode
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class NetworkSubTest {
|
||||
@Test
|
||||
fun subParse() {
|
||||
|
||||
val e =
|
||||
"https://raw.githubusercontent.com/itsyebekhe/HiN-VPN/main/subscription/normal/mix"
|
||||
|
||||
listOf(
|
||||
e,
|
||||
)
|
||||
.forEach {
|
||||
kotlin
|
||||
.runCatching {
|
||||
Parser.parseFromSub(it)
|
||||
.also { println(it.size) }
|
||||
.joinToString(
|
||||
// "|",
|
||||
"\r\n",
|
||||
transform = Sub::toUri
|
||||
)
|
||||
.also {
|
||||
println("___________")
|
||||
println(it)
|
||||
}
|
||||
}
|
||||
.onFailure { it.printStackTrace() }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sub() {
|
||||
val l1 = Parser.parseFromSub("https://etproxypool.ga/clash/proxies")
|
||||
val l2 = Parser.parseFromSub("https://suo.yt/v9UsfNr")
|
||||
val combine = l1 + l2
|
||||
val l1Only = combine - l2
|
||||
val l2Only = combine - l1
|
||||
val share = l1 - l1Only
|
||||
println("共享 ${share.size}")
|
||||
println("l1 ${l1.size} 独有 ${l1Only.size}")
|
||||
println("l2 ${l2.size} 独有 ${l2Only.size}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseVless() {
|
||||
val uri =
|
||||
"vless://21f181f3-2f66-47a8-b4d5-7aef046cc087@104.19.146.137:443?encryption=none&security=tls&sni=ap.utopub.com&type=ws&host=ap.utopub.com&path=%2futopub-vless#NY%40vless"
|
||||
Parser.parseVless(uri).also {
|
||||
Assertions.assertEquals(uri, it.toUri())
|
||||
println(it.info())
|
||||
}
|
||||
}
|
||||
@Test
|
||||
fun parseHysteria2() {
|
||||
val uri =
|
||||
"hysteria2://HowdyHysteria2023w0W@hysteria.udpgw.com:8443?insecure=1&sni=sni-here.com&obfs=salamander&obfs-password=HysteriaHowdy#\uD83C\uDD94oneclickvpnkeys%20\uD83D\uDD12%20HY2-UDP-N/A%20\uD83C\uDDA5\uD83C\uDDA5%20%20117ms"
|
||||
println(Parser.parse(uri))
|
||||
Parser.parseHysteria2(uri).also {
|
||||
println(it.toUri().urlDecode())
|
||||
Assertions.assertEquals(uri.substringBefore("#"), it.toUri().substringBefore("#"))
|
||||
println(it.info())
|
||||
}
|
||||
}
|
||||
@Test
|
||||
fun parseSs() {
|
||||
val uri =
|
||||
"ss://YWVzLTI1Ni1jZmI6OWQ2Y2NlYWEzNzNiZjJjOGFjYjIyZTYwYjZhNThiZTZANDUuNzkuMTExLjIxNDo0NDM=#%E7%BE%8E%E5%9B%BD"
|
||||
Parser.parseSs(uri).also {
|
||||
Assertions.assertEquals(uri, it.toUri())
|
||||
println(it.info())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseText() {
|
||||
|
||||
Parser.parseFromSub(
|
||||
"https://raw.iqiq.io/caijh/FreeProxiesScraper/2951ca40e0b93dc37be07a46ecc528bf245b6be8/README.md"
|
||||
)
|
||||
.also { println(it.size) }
|
||||
}
|
||||
}
|
||||
197
just/bao/src/test/java/me/leon/NodeCrawler.kt
Executable file
197
just/bao/src/test/java/me/leon/NodeCrawler.kt
Executable file
@ -0,0 +1,197 @@
|
||||
package me.leon
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.text.replace
|
||||
|
||||
@Suppress("LongMethod")
|
||||
class NodeCrawler {
|
||||
|
||||
private val onlyGenerateAll = true
|
||||
|
||||
private val maps = linkedMapOf<String, LinkedHashSet<Sub>>()
|
||||
|
||||
private val typeMapper = mapOf(
|
||||
SS::class.java to (NODE_SS to "ss节点: "),
|
||||
SSR::class.java to (NODE_SSR to "ssr节点: "),
|
||||
V2ray::class.java to (NODE_V2 to "v2ray节点: "),
|
||||
Trojan::class.java to (NODE_TR to "trojan节点: "),
|
||||
Vless::class.java to (NODE_VLESS to "vless节点: "),
|
||||
Hysteria2::class.java to (NODE_HYS2 to "hysteria2节点: "),
|
||||
)
|
||||
|
||||
|
||||
/** 1.爬取配置文件对应链接的节点,并去重 2.同时进行可用性测试 tcping */
|
||||
@Test
|
||||
fun crawl() {
|
||||
// 1.爬取配置文件的订阅
|
||||
crawlNodes()
|
||||
SpeedTest().exec()
|
||||
nodeGroup()
|
||||
}
|
||||
|
||||
/** 爬取配置文件数据,并去重写入文件 */
|
||||
@Test
|
||||
@Disabled
|
||||
fun crawlNodes() {
|
||||
val format = SimpleDateFormat("YYYYMMddHH").apply {
|
||||
timeZone = TimeZone.getTimeZone("Asia/Shanghai")
|
||||
}.format(Date())
|
||||
val prefix = format.substring(4)
|
||||
val yyyy =format.substring(0,4)
|
||||
val mm = prefix.substring(0, 2)
|
||||
val m = mm.trimStart('0')
|
||||
val dd = prefix.substring(2, 4)
|
||||
val d = dd.trimStart('0')
|
||||
|
||||
val mergeSubs = mergeAllNodesUrl()
|
||||
println(mergeSubs.size)
|
||||
val countryMap = mutableMapOf<String, Int>()
|
||||
val errorList = mutableListOf<String>()
|
||||
POOL.writeLine()
|
||||
runBlocking {
|
||||
mergeSubs.map { sub ->
|
||||
sub to
|
||||
async(DISPATCHER) {
|
||||
runCatching {
|
||||
val uri = sub.replace(MONTH, mm)
|
||||
.replace(MONTH1, m)
|
||||
.replace(DAY, dd)
|
||||
.replace(DAY1, d)
|
||||
.replace(YEAR, yyyy)
|
||||
Parser.parseFromSub(uri).also {
|
||||
println("$uri ${it.size}")
|
||||
if (it.isEmpty()) {
|
||||
errorList.add(uri)
|
||||
}
|
||||
}
|
||||
}
|
||||
.getOrElse {
|
||||
println("___parse failed $sub ${it.message}")
|
||||
linkedSetOf()
|
||||
}
|
||||
}
|
||||
}
|
||||
.map { it.first to it.second.await() }
|
||||
.fold(linkedSetOf<Sub>()) { acc, linkedHashSet ->
|
||||
maps[linkedHashSet.first] = linkedHashSet.second
|
||||
acc.apply { acc.addAll(linkedHashSet.second) }
|
||||
}
|
||||
.also { nodeCount = it.size }
|
||||
.filterNot { it.methodUnSupported() }
|
||||
.map { it to async(DISPATCHER) { it.SERVER.quickConnect(it.serverPort, 2000) } }
|
||||
.filter { it.second.await() > -1 }
|
||||
.map {
|
||||
it.first.apply {
|
||||
with(this.ipCountryZh()) {
|
||||
countryMap[this] = countryMap.getOrDefault(this, 0) + 1
|
||||
name = "${this}_$prefix${"%03d".format(countryMap[this])}"
|
||||
}
|
||||
}
|
||||
}
|
||||
.sortedBy { it.name }
|
||||
.also {
|
||||
NODE_OK.writeLine(it.joinToString("\n") { it.toUri() }, false)
|
||||
// 2.筛选可用节点
|
||||
println("有效节点: ${it.size}")
|
||||
nodeInfo.writeLine("更新时间${timeStamp()}\r\n", false)
|
||||
nodeInfo.writeLine("${System.lineSeparator()}**总订阅: $subCount**")
|
||||
nodeInfo.writeLine("**总节点: $nodeCount**")
|
||||
|
||||
it.filterIsInstance<Vless>()
|
||||
.groupBy { it.javaClass }
|
||||
.forEach { (clazz, subList) ->
|
||||
subList.firstOrNull()?.run { name = CUSTOM_INFO + name }
|
||||
val data = subList.joinToString("\n") { it.toUri() }.b64Encode()
|
||||
NODE_VLESS.writeLine()
|
||||
writeData(clazz, data, subList)
|
||||
}
|
||||
it.filterIsInstance<Hysteria2>()
|
||||
.groupBy { it.javaClass }
|
||||
.forEach { (clazz, subList) ->
|
||||
subList.firstOrNull()?.run { name = CUSTOM_INFO + name }
|
||||
val data = subList.joinToString("\n") { it.toUri() }.b64Encode()
|
||||
NODE_HYS2.writeLine()
|
||||
writeData(clazz, data, subList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println("_________________ \n${errorList.joinToString(System.lineSeparator())}")
|
||||
}
|
||||
|
||||
private fun nodeGroup() {
|
||||
val nodes = Parser.parseFromSub(NODE_OK)
|
||||
val regex = "[a-zA-Z]".toRegex()
|
||||
nodes.filterNot { it.SERVER.contains(regex) }
|
||||
.forEach {
|
||||
kotlin.runCatching {
|
||||
it.name += " " + it.SERVER.ipScore().lvl
|
||||
}.onFailure {
|
||||
println("${it.message}")
|
||||
}
|
||||
}
|
||||
nodeInfo.writeLine("\n**google ping有效节点: ${nodes.size}**")
|
||||
NODE_ALL.writeLine(
|
||||
nodes.filterNot { it is Vless || it is Hysteria2 }.joinToString("\n") { it.toUri() }.b64Encode(),
|
||||
false
|
||||
)
|
||||
|
||||
nodes
|
||||
.groupBy { it.javaClass }
|
||||
.forEach { (clazz, subList) ->
|
||||
subList.firstOrNull()?.run { name = CUSTOM_INFO + name }
|
||||
val data = subList.joinToString("\n") { it.toUri() }.b64Encode()
|
||||
writeData(clazz, data, subList)
|
||||
}
|
||||
}
|
||||
|
||||
private fun writeData(clazz: Class<out Sub>, data: String, subList: List<Sub>) {
|
||||
if (onlyGenerateAll && clazz != Vless::class.java && clazz != Hysteria2::class.java) {
|
||||
return
|
||||
}
|
||||
typeMapper[clazz]?.run {
|
||||
first.writeLine(data, false).also {
|
||||
println("$second${subList.size}".also { nodeInfo.writeLine("- $it") })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun mergeAllNodesUrl(): HashSet<String> {
|
||||
val sub1 = "$ROOT/pool/subs".readLines()
|
||||
val sublist = "$ROOT/pool/sublists".readLines()
|
||||
val sub2 =
|
||||
sublist
|
||||
.map { it.readFromNet() }
|
||||
.flatMap { it.split("\r\n|\n".toRegex()) }
|
||||
.distinct()
|
||||
.filterNot { it.startsWith("#") || it.trim().isEmpty() }
|
||||
.also {
|
||||
println(it)
|
||||
println("after ${it.size}")
|
||||
}
|
||||
val mergeSubs = (sub1 + sub2)
|
||||
.filterNot { it.trim().startsWith("#") || it.trim().isEmpty() }
|
||||
.toHashSet()
|
||||
.also { println("共有订阅源:${it.size.also { subCount = it }}") }
|
||||
|
||||
return mergeSubs
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val nodeInfo = "$ROOT/info.md"
|
||||
const val CUSTOM_INFO = "防失效github SubCrawler"
|
||||
private var subCount = 0
|
||||
private var nodeCount = 0
|
||||
private const val YEAR = "{YYYY}"
|
||||
private const val MONTH = "{MM}"
|
||||
private const val DAY = "{DD}"
|
||||
private const val MONTH1 = "{M}"
|
||||
private const val DAY1 = "{D}"
|
||||
}
|
||||
}
|
||||
17
just/bao/src/test/java/me/leon/NodeProcess.kt
Executable file
17
just/bao/src/test/java/me/leon/NodeProcess.kt
Executable file
@ -0,0 +1,17 @@
|
||||
package me.leon
|
||||
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class NodeProcess {
|
||||
|
||||
@Test
|
||||
fun nodeNationGroup() {
|
||||
Parser.parseFromSub(NODE_OK)
|
||||
.filter { it.SERVER.contains("p3r.centaur.net") && it.SERVER.ipCountryZh() == "中国" }
|
||||
.groupBy { it.SERVER.ipCountryZh() }
|
||||
.forEach { (t, u) ->
|
||||
println("$t: ${u.size}")
|
||||
if (t == "UNKNOWN") println(u.map { it.SERVER })
|
||||
}
|
||||
}
|
||||
}
|
||||
55
just/bao/src/test/java/me/leon/SpeedTest.kt
Executable file
55
just/bao/src/test/java/me/leon/SpeedTest.kt
Executable file
@ -0,0 +1,55 @@
|
||||
package me.leon
|
||||
|
||||
import me.leon.domain.LiteSpeed
|
||||
import me.leon.domain.LiteSpeedConfig
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.nio.charset.Charset
|
||||
|
||||
class SpeedTest {
|
||||
@Test
|
||||
fun exec() {
|
||||
val config = "litespeed/config.json".toFile().absoluteFile
|
||||
if (!NODE_OK.toFile().exists()) {
|
||||
println("---------------------- error")
|
||||
return
|
||||
}
|
||||
config.writeBytes(LiteSpeedConfig(NODE_OK).toJson().toByteArray())
|
||||
val nodes = mutableMapOf<Int, String>()
|
||||
val oks = mutableListOf<Int>()
|
||||
|
||||
val process =
|
||||
Runtime.getRuntime().exec("litespeed/lite --config litespeed/config.json --test Leon")
|
||||
|
||||
process.errorStream.bufferedReader(Charset.defaultCharset()).use {
|
||||
it.forEachLine {
|
||||
if (it.length <=19) {
|
||||
return@forEachLine
|
||||
}
|
||||
val message = it.substring(19)
|
||||
if (message.contains("json options: ")) {
|
||||
return@forEachLine
|
||||
}
|
||||
runCatching {
|
||||
val liteSpeed = message.fromJson<LiteSpeed>()
|
||||
liteSpeed.servers?.forEach { nodes[it.id] = it.link }
|
||||
liteSpeed.ping()?.run { oks.add(liteSpeed.id) }
|
||||
}.getOrElse {
|
||||
println("$message ${it.stackTraceToString()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println("${oks.size} $oks ")
|
||||
NODE_OK.writeLine(nodes.filter { oks.contains(it.key) }.values.joinToString("\n"), false)
|
||||
}
|
||||
}
|
||||
|
||||
const val INCREMENT = "█"
|
||||
const val EMPTY = "*"
|
||||
|
||||
fun progress(cur: Int, max: Int, length: Int = 60, desc: String = "Progress") {
|
||||
require(max > 0)
|
||||
val p = cur * length / max
|
||||
print("\r$desc: [${INCREMENT.repeat(p)}${EMPTY.repeat(length - p)}]")
|
||||
}
|
||||
59
just/bao/src/test/java/me/leon/ThirdVpnCrack.kt
Executable file
59
just/bao/src/test/java/me/leon/ThirdVpnCrack.kt
Executable file
@ -0,0 +1,59 @@
|
||||
package me.leon
|
||||
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import me.leon.domain.Quark
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ThirdVpnCrack {
|
||||
|
||||
private val quarkVpnDir = "$ROOT/vpn/quark"
|
||||
|
||||
@Test
|
||||
fun parseNet() {
|
||||
val key = SimpleDateFormat("yyyyMMdd").format(Date()).repeat(4)
|
||||
"https://ghproxy.com/https://raw.githubusercontent.com/webdao/v2ray/master/nodes.txt"
|
||||
.readFromNet()
|
||||
.b64Decode()
|
||||
.foldIndexed(StringBuilder()) { index, acc, c ->
|
||||
acc.also { acc.append((c.code xor key[index % key.length].code).toChar()) }
|
||||
}
|
||||
.also { println(it) }
|
||||
.split("\n")
|
||||
.also { println(it.joinToString("|")) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseQuarkVpn() {
|
||||
runBlocking {
|
||||
File(quarkVpnDir)
|
||||
.listFiles()
|
||||
.map {
|
||||
String(
|
||||
it.readBytes()
|
||||
.mapIndexed { index, byte ->
|
||||
if (index % 2 == 0) (byte - 1).toByte() else (byte + 1).toByte()
|
||||
}
|
||||
.toByteArray()
|
||||
)
|
||||
.fromJson<Quark>()
|
||||
}
|
||||
.flatMap { it.data.map { it.host to it.name } }
|
||||
.distinctBy { it.first }
|
||||
.also { println("${it.size} $it") }
|
||||
.map { it to async(DISPATCHER) { it.first.ping(2000) } }
|
||||
.filter { it.second.await() > -1 }
|
||||
.also { println("ok ${it.size} ") }
|
||||
.map {
|
||||
SS("aes-256-cfb", "4415934295", it.first.first, "50004")
|
||||
.apply { remark = it.first.second }
|
||||
.toUri()
|
||||
}
|
||||
.also { println(it.joinToString("\n")) }
|
||||
}
|
||||
}
|
||||
}
|
||||
59
just/bao/src/test/java/me/leon/YamlTest.kt
Executable file
59
just/bao/src/test/java/me/leon/YamlTest.kt
Executable file
@ -0,0 +1,59 @@
|
||||
package me.leon
|
||||
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.yaml.snakeyaml.LoaderOptions
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
import org.yaml.snakeyaml.constructor.Constructor
|
||||
|
||||
class YamlTest {
|
||||
|
||||
@Test
|
||||
fun yaml() {
|
||||
val list =
|
||||
listOf(
|
||||
"https://ghproxy.com/https://raw.githubusercontent.com/clashconfig/online/main/SurfShark(34687).yml",
|
||||
//
|
||||
// "https://ghproxy.com/https://raw.githubusercontent.com/mahdibland/SSAggregator/master/sub/sub_merge_yaml.yml",
|
||||
"https://ghproxy.com/https://raw.githubusercontent.com/vveg26/get_proxy/main/dist/clash.config.yaml",
|
||||
)
|
||||
|
||||
for (url in list) {
|
||||
println(url)
|
||||
val data = url.readFromNet()
|
||||
if (data.isNotEmpty()) {
|
||||
with(Yaml(Constructor(Clash::class.java, LoaderOptions())).load(data.fixYaml()) as Clash) {
|
||||
println(
|
||||
this.proxies.map(Node::toNode).filterIsInstance<V2ray>().joinToString(
|
||||
"|"
|
||||
) { sub ->
|
||||
sub.also { println(it) }.toUri()
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
println("no content")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun str() {
|
||||
val raw =
|
||||
"""
|
||||
- cipher: aes-128-cfb
|
||||
name: '[10-12]-🇦🇶-本机地址-964-${'$'}*@14.29.124.174'
|
||||
password:
|
||||
server: ${'$'}*@14.29.124.174
|
||||
port: 11049
|
||||
type: ss
|
||||
"""
|
||||
.trimIndent()
|
||||
|
||||
println(raw)
|
||||
raw.replace("!<[^>]+>".toRegex(), "")
|
||||
.replace(" password: \n", "")
|
||||
.replace("server: $*@", "server: ")
|
||||
.also { println(it) }
|
||||
}
|
||||
}
|
||||
35
just/bao/src/test/java/me/leon/ip/GeoTest.kt
Executable file
35
just/bao/src/test/java/me/leon/ip/GeoTest.kt
Executable file
@ -0,0 +1,35 @@
|
||||
package me.leon.ip
|
||||
|
||||
import me.leon.FAIL_IPS
|
||||
import me.leon.GeoParser.cityReader
|
||||
import me.leon.ipCityZh
|
||||
import me.leon.ipCountryEn
|
||||
import me.leon.ipCountryZh
|
||||
import me.leon.support.readLines
|
||||
import me.leon.support.toInetAddress
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class GeoTest {
|
||||
|
||||
@Test
|
||||
fun geoParse() {
|
||||
|
||||
val ipAddress = "128.101.101.101"
|
||||
// val ipAddress = "104.19.45.161"
|
||||
|
||||
println(ipAddress.ipCountryZh())
|
||||
// println(ipAddress.ipCountryEn())
|
||||
// println(ipAddress.ipCityZh())
|
||||
// println(ipAddress.ipCountryEn())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ip_reader() {
|
||||
FAIL_IPS.readLines().forEach {
|
||||
"""^(\d+(?:.\d+){3})(:\d+)?$""".toRegex().matchEntire(it)?.run {
|
||||
println(this.groupValues[1] to this.groupValues[1].toInetAddress().ipCountryZh())
|
||||
}
|
||||
// println(reader2.country(InetAddress.getByName(it)).country.names["zh-CN"])
|
||||
}
|
||||
}
|
||||
}
|
||||
159
just/bao/src/test/java/me/leon/ip/HostsTest.kt
Executable file
159
just/bao/src/test/java/me/leon/ip/HostsTest.kt
Executable file
@ -0,0 +1,159 @@
|
||||
package me.leon.ip
|
||||
|
||||
import kotlin.streams.toList
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import me.leon.HOST
|
||||
import me.leon.SHARE
|
||||
import me.leon.domain.DnsResolve
|
||||
import me.leon.domain.Host
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class HostsTest {
|
||||
|
||||
private val reg = "https://www\\.ipaddress\\.com/ipv4/(\\d+.\\d+.\\d+.\\d+)".toRegex()
|
||||
|
||||
// https://raw.fastgit.org/VeleSila/yhosts/master/hosts
|
||||
// https://raw.fastgit.org/jdlingyu/ad-wars/master/hosts
|
||||
// https://raw.fastgit.org/Goooler/1024_hosts/master/hosts
|
||||
// https://winhelp2002.mvps.org/hosts.txt
|
||||
// https://raw.fastgit.org/StevenBlack/hosts/master/hosts
|
||||
// https://github.com/E7KMbb/AD-hosts
|
||||
@Test
|
||||
fun blacklist() {
|
||||
listOf(
|
||||
"https://raw.fastgit.org/VeleSila/yhosts/master/hosts",
|
||||
"https://raw.fastgit.org/jdlingyu/ad-wars/master/hosts",
|
||||
"https://raw.fastgit.org/Goooler/1024_hosts/master/hosts",
|
||||
"https://winhelp2002.mvps.org/hosts.txt",
|
||||
"https://raw.fastgit.org/StevenBlack/hosts/master/hosts",
|
||||
"https://raw.fastgit.org/E7KMbb/AD-hosts/master/system/etc/hosts",
|
||||
"https://raw.fastgit.org/ilpl/ad-hosts/master/hosts",
|
||||
"https://raw.fastgit.org/rentianyu/Ad-set-hosts/master/hosts"
|
||||
)
|
||||
.flatMap {
|
||||
it.readFromNet()
|
||||
.split("\n|\r\n".toRegex())
|
||||
.map(String::trim)
|
||||
.filterNot fn@{ it.isEmpty() || it.startsWith("#") }
|
||||
.map {
|
||||
it.split("\\s+".toRegex()).run {
|
||||
Host(this[1]).apply {
|
||||
ip =
|
||||
if (this@run[0] == "127.0.0.1" && domain != "localhost") {
|
||||
"0.0.0.0"
|
||||
} else {
|
||||
this@run[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.filterNot { it.domain.contains("#") || it.domain == "0.0.0.0" }
|
||||
.also { println(it.size) }
|
||||
}
|
||||
.distinct()
|
||||
.sortedBy(Host::domain)
|
||||
.also {
|
||||
println(it.size)
|
||||
"$SHARE/blackhosts".writeLine(it.joinToString("\n"), false)
|
||||
}
|
||||
}
|
||||
|
||||
// https://raw.fastgit.org/googlehosts/hosts/master/hosts-files/hosts
|
||||
// 需要单独走无污染 dns,获取最新的ip
|
||||
@Test
|
||||
fun whitelist() {
|
||||
runBlocking {
|
||||
listOf(
|
||||
"https://raw.fastgit.org/googlehosts/hosts/master/hosts-files/hosts",
|
||||
"https://raw.fastgit.org/Leon406/pyutil/master/github/hosts",
|
||||
"https://raw.fastgit.org/Leon406/jsdelivr/master/hosts/whitelist",
|
||||
)
|
||||
.flatMap {
|
||||
it.readFromNet()
|
||||
.split("\n|\r\n".toRegex())
|
||||
.map(String::trim)
|
||||
.filterNot { it.isEmpty() || it.startsWith("#") }
|
||||
.map {
|
||||
it.split("\\s+".toRegex()).run {
|
||||
Host(this[1]).apply { ip = this@run[0] }
|
||||
}
|
||||
}
|
||||
.filterNot { it.domain.contains("#") }
|
||||
.also { println(it.size) }
|
||||
}
|
||||
.distinct()
|
||||
// .sortedBy (Host::domain)
|
||||
.map { it to async(DISPATCHER) { it.ip.quickPing(1000) } }
|
||||
.map { it.second.await() to it.first }
|
||||
.forEach {
|
||||
if (it.first > -1) {
|
||||
println("ok ip ${it.second}")
|
||||
"$SHARE/whitehost".writeLine(it.second.toString(), true)
|
||||
} else {
|
||||
println("err ip ${it.second}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dns() {
|
||||
|
||||
val unReachableDomains = mutableListOf<String>()
|
||||
HostsTest::class
|
||||
.java
|
||||
.getResourceAsStream("/domains")!!
|
||||
.bufferedReader()
|
||||
.use { it.lines().toList() }
|
||||
.filterNot { it.isEmpty() || it.startsWith("#") }
|
||||
.map { dnsResolve(it) + "\t" + it }
|
||||
.filter {
|
||||
val isEmp = it.startsWith("\t")
|
||||
if (isEmp) unReachableDomains.add(it.substring(1))
|
||||
!isEmp
|
||||
}
|
||||
.also {
|
||||
HOST.toFile().writeText("##### 更新时间${timeStamp()} #####\n" + it.joinToString("\n"))
|
||||
}
|
||||
println(unReachableDomains)
|
||||
unReachableDomains
|
||||
.map { ipApiResolve(it) + "\t" + it }
|
||||
.filter {
|
||||
val isEmp = it.startsWith("\t") || it.contains(",")
|
||||
if (isEmp) println(it.substring(1))
|
||||
!isEmp
|
||||
}
|
||||
.also { HOST.toFile().appendText("\n" + it.joinToString("\n")) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ipAddress() {
|
||||
ipApiResolve("baidu.com").also { println(it) }
|
||||
}
|
||||
|
||||
private fun dnsResolve(url: String): String =
|
||||
runCatching {
|
||||
"https://1.1.1.1/dns-query?name=$url&type=1"
|
||||
.readBytesFromNet(headers = mutableMapOf("accept" to "application/dns-json"))
|
||||
.decodeToString()
|
||||
.fromJson<DnsResolve>()
|
||||
.Answer
|
||||
?.find { it.type == 1 && it.data!!.quickPing() > 0 }
|
||||
?.data
|
||||
.orEmpty()
|
||||
}
|
||||
.getOrDefault("")
|
||||
|
||||
private fun ipApiResolve(url: String): String =
|
||||
runCatching {
|
||||
"https://ipaddress.com/website/$url"
|
||||
.readBytesFromNet(
|
||||
headers = mutableMapOf("referer" to "https://www.ipaddress.com/")
|
||||
)
|
||||
.decodeToString()
|
||||
.run { reg.find(this)?.groupValues?.get(1).orEmpty() }
|
||||
}
|
||||
.getOrDefault("")
|
||||
}
|
||||
117
just/bao/src/test/java/me/leon/ip/IpFilterTest.kt
Executable file
117
just/bao/src/test/java/me/leon/ip/IpFilterTest.kt
Executable file
@ -0,0 +1,117 @@
|
||||
package me.leon.ip
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import me.leon.*
|
||||
import me.leon.support.*
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
class IpFilterTest {
|
||||
|
||||
@Test
|
||||
fun reTestFailIps() {
|
||||
repeat(5) {
|
||||
failIp()
|
||||
removeOkPorts()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun failIp() {
|
||||
val okIps = mutableSetOf<String>()
|
||||
val failIps = mutableSetOf<String>()
|
||||
val failPorts = mutableSetOf<String>()
|
||||
val total = mutableSetOf<String>()
|
||||
|
||||
runBlocking {
|
||||
measureTimeMillis {
|
||||
FAIL_IPS.readLines()
|
||||
.also { println("before ${it.size}") }
|
||||
.sorted()
|
||||
.also {
|
||||
total.addAll(it)
|
||||
println("after deduplicate and sort ${total.size}")
|
||||
FAIL_IPS.writeLine()
|
||||
FAIL_IPS.writeLine(total.joinToString("\n"))
|
||||
}
|
||||
.map { it to async(DISPATCHER) { it.substringBeforeLast(':').ping(1000) } }
|
||||
.map { it.second.await() to it.first }
|
||||
.forEach {
|
||||
if (it.first > -1) {
|
||||
okIps.add(it.second.substringBeforeLast(":"))
|
||||
println("reAlive ip ${it.second}")
|
||||
} else {
|
||||
failIps.add(it.second.substringBeforeLast(":"))
|
||||
if (it.second.contains(":")) failPorts.add(it.second)
|
||||
}
|
||||
}
|
||||
|
||||
println(failIps)
|
||||
println(failPorts)
|
||||
println("_______")
|
||||
println(okIps)
|
||||
total
|
||||
.also {
|
||||
println("before ${it.size}")
|
||||
it.removeAll(okIps)
|
||||
it.removeAll(failPorts)
|
||||
it.addAll(failIps)
|
||||
}
|
||||
.filterNot {
|
||||
it.contains(":") && failIps.contains(it.substringBeforeLast(":"))
|
||||
}
|
||||
.sorted()
|
||||
.also {
|
||||
FAIL_IPS.writeLine()
|
||||
FAIL_IPS.writeLine(it.joinToString("\n"))
|
||||
println("after ${it.size}")
|
||||
}
|
||||
}
|
||||
.also { println("time $it ms") }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removeOkPorts() {
|
||||
val total = mutableSetOf<String>()
|
||||
runBlocking {
|
||||
FAIL_IPS.readLines()
|
||||
.also {
|
||||
total.addAll(it)
|
||||
println("before ${total.size}")
|
||||
}
|
||||
.filter { it.contains(":") && !it.contains("/") && !it.contains(" ") }
|
||||
.map {
|
||||
it to
|
||||
async(DISPATCHER) {
|
||||
runCatching {
|
||||
it.substringBeforeLast(":").connect(it.substringAfterLast(":").toInt())
|
||||
}.getOrElse { -1 }
|
||||
}
|
||||
}
|
||||
.filter { it.second.await() > -1 }
|
||||
.forEach {
|
||||
println(it.first)
|
||||
total.remove(it.first)
|
||||
}
|
||||
}
|
||||
println("after ${total.size}")
|
||||
FAIL_IPS.writeLine()
|
||||
FAIL_IPS.writeLine(total.joinToString("\n"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun checkAbuseIp() {
|
||||
Parser.parseFromSub("C:\\Users\\Leon\\Desktop\\local.yaml").map { it.SERVER }
|
||||
.distinct()
|
||||
.also { println(it.size) }
|
||||
.filterNot { it.contains("[a-zA-Z]".toRegex()) }
|
||||
.also { println(it) }
|
||||
.forEach {
|
||||
println("$it ${it.ipScore().lvl}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
107
just/bao/src/test/resources/domains
Executable file
107
just/bao/src/test/resources/domains
Executable file
@ -0,0 +1,107 @@
|
||||
#stackoverflow
|
||||
stackoverflow.com
|
||||
stackexchange.com
|
||||
cdn.sstatic.net
|
||||
#js cdn
|
||||
cdn.jsdelivr.net
|
||||
unpkg.com
|
||||
code.jquery.com
|
||||
cdnjs.com
|
||||
cdnjs.cloudflare.com
|
||||
#oracle
|
||||
sdlc-esd.oracle.com
|
||||
download.oracle.com
|
||||
#hcaptcha
|
||||
hcaptcha.com
|
||||
www.hcaptcha.com
|
||||
assets.hcaptcha.com
|
||||
imgs.hcaptcha.com
|
||||
newassets.hcaptcha.com
|
||||
cf-assets.hcaptcha.com
|
||||
js.hcaptcha.com
|
||||
api.hcaptcha.com
|
||||
#recaptcha
|
||||
recaptcha.net
|
||||
api.recaptcha.net
|
||||
api-secure.recaptcha.net
|
||||
api-verify.recaptcha.net
|
||||
mailhide.recaptcha.net
|
||||
www.recaptcha.net
|
||||
#discord
|
||||
discord.com
|
||||
discordapp.com
|
||||
dl.discordapp.net
|
||||
gateway.discord.gg
|
||||
status.discordapp.com
|
||||
cdn.discordapp.com
|
||||
media.discordapp.net
|
||||
images-ext-2.discordapp.net
|
||||
images-ext-1.discordapp.net
|
||||
discordcdn.com
|
||||
#lastpass
|
||||
lastpass.com
|
||||
www.lastpass.com
|
||||
data.lastpass.com
|
||||
content.product.lastpass.com
|
||||
#microsoft
|
||||
logincdn.msauth.net
|
||||
acctcdn.msauth.net
|
||||
login.live.com
|
||||
storage.live.com
|
||||
public.bn.files.1drv.com
|
||||
storeedgefd.dsx.mp.microsoft.com
|
||||
store-images.s-microsoft.com
|
||||
#arkoselabs验证码
|
||||
client-api.arkoselabs.com
|
||||
cdn.arkoselabs.com
|
||||
prod-ireland.arkoselabs.com
|
||||
#github
|
||||
github-cloud.s3.amazonaws.com
|
||||
gist.github.com
|
||||
api.github.com
|
||||
live.github.com
|
||||
status.github.com
|
||||
github-production-release-asset-2e65be.s3.amazonaws.com
|
||||
github-production-user-asset-6210df.s3.amazonaws.com
|
||||
github.com
|
||||
www.github.com
|
||||
alive.github.com
|
||||
collector.githubapp.com
|
||||
github.githubassets.com
|
||||
help.github.com
|
||||
central.github.com
|
||||
pipelines.actions.githubusercontent.com
|
||||
collector.github.com
|
||||
github.community
|
||||
support.github.com
|
||||
assets-cdn.github.com
|
||||
pages.github.com
|
||||
training.github.com
|
||||
github.io
|
||||
githubstatus.com
|
||||
documentcloud.github.com
|
||||
customer-stories-feed.github.com
|
||||
docs.github.com
|
||||
githubapp.com
|
||||
codeload.github.com
|
||||
nodeload.github.com
|
||||
github-com.s3.amazonaws.com
|
||||
github-production-repository-file-5c1aeb.s3.amazonaws.com
|
||||
github.global.ssl.fastly.net
|
||||
github.blog
|
||||
avatars.githubusercontent.com
|
||||
favicons.githubusercontent.com
|
||||
camo.githubusercontent.com
|
||||
user-images.githubusercontent.com
|
||||
gist.githubusercontent.com
|
||||
raw.github.com
|
||||
raw.githubusercontent.com
|
||||
cloud.githubusercontent.com
|
||||
objects.githubusercontent.com
|
||||
media.githubusercontent.com
|
||||
github.map.fastly.net
|
||||
desktop.githubusercontent.com
|
||||
github.dev
|
||||
# 谷歌翻译
|
||||
translate.googleapis.com
|
||||
translate.google.com
|
||||
259
just/bao/sub/flags.txt
Executable file
259
just/bao/sub/flags.txt
Executable file
@ -0,0 +1,259 @@
|
||||
🇦🇨|AC|阿森松岛
|
||||
🇦🇩|AD|安道尔
|
||||
🇦🇪|AE|阿拉伯联合酋长国
|
||||
🇦🇫|AF|阿富汗
|
||||
🇦🇬|AG|安提瓜和巴布达
|
||||
🇦🇮|AI|安圭拉
|
||||
🇦🇱|AL|阿尔巴尼亚
|
||||
🇦🇲|AM|亚美尼亚
|
||||
🇦🇴|AO|安哥拉
|
||||
🇦🇶|AQ|南极洲
|
||||
🇦🇷|AR|阿根廷
|
||||
🇦🇸|AS|美属萨摩亚
|
||||
🇦🇹|AT|奥地利
|
||||
🇦🇺|AU|澳大利亚
|
||||
🇦🇼|AW|阿鲁巴
|
||||
🇦🇽|AX|奥兰群岛
|
||||
🇦🇿|AZ|阿塞拜疆
|
||||
🇧🇦|BA|波斯尼亚和黑塞哥维那
|
||||
🇧🇧|BB|巴巴多斯
|
||||
🇧🇩|BD|孟加拉国
|
||||
🇧🇪|BE|比利时
|
||||
🇧🇫|BF|布基纳法索
|
||||
🇧🇬|BG|保加利亚
|
||||
🇧🇭|BH|巴林
|
||||
🇧🇮|BI|布隆迪
|
||||
🇧🇯|BJ|贝宁
|
||||
🇧🇱|BL|圣巴泰勒米
|
||||
🇧🇲|BM|百慕大
|
||||
🇧🇳|BN|文莱
|
||||
🇧🇴|BO|玻利维亚
|
||||
🇧🇶|BQ|荷属加勒比区
|
||||
🇧🇷|BR|巴西
|
||||
🇧🇸|BS|巴哈马
|
||||
🇧🇹|BT|不丹
|
||||
🇧🇻|BV|布韦岛
|
||||
🇧🇼|BW|博茨瓦纳
|
||||
🇧🇾|BY|白俄罗斯
|
||||
🇧🇿|BZ|伯利兹
|
||||
🇨🇦|CA|加拿大
|
||||
🇨🇨|CC|科科斯(基林)群岛
|
||||
🇨🇩|CD|刚果(金)
|
||||
🇨🇫|CF|中非共和国
|
||||
🇨🇬|CG|刚果(布)
|
||||
🇨🇭|CH|瑞士
|
||||
🇨🇮|CI|科特迪瓦
|
||||
🇨🇰|CK|库克群岛
|
||||
🇨🇱|CL|智利
|
||||
🇨🇲|CM|喀麦隆
|
||||
🇨🇳|CN|中国
|
||||
🇨🇴|CO|哥伦比亚
|
||||
🇨🇵|CP|克利珀顿岛
|
||||
🇨🇷|CR|哥斯达黎加
|
||||
🇨🇺|CU|古巴
|
||||
🇨🇻|CV|佛得角
|
||||
🇨🇼|CW|库拉索
|
||||
🇨🇽|CX|圣诞岛
|
||||
🇨🇾|CY|塞浦路斯
|
||||
🇨🇿|CZ|捷克
|
||||
🇩🇪|DE|德国
|
||||
🇩🇬|DG|迪戈加西亚岛
|
||||
🇩🇯|DJ|吉布提
|
||||
🇩🇰|DK|丹麦
|
||||
🇩🇲|DM|多米尼克
|
||||
🇩🇴|DO|多米尼加共和国
|
||||
🇩🇿|DZ|阿尔及利亚
|
||||
🇪🇦|EA|休达及梅利利亚
|
||||
🇪🇨|EC|厄瓜多尔
|
||||
🇪🇪|EE|爱沙尼亚
|
||||
🇪🇬|EG|埃及
|
||||
🇪🇭|EH|西撒哈拉
|
||||
🇪🇷|ER|厄立特里亚
|
||||
🇪🇸|ES|西班牙
|
||||
🇪🇹|ET|埃塞俄比亚
|
||||
🇪🇺|EU|欧洲
|
||||
🇫🇮|FI|芬兰
|
||||
🇫🇯|FJ|斐济
|
||||
🇫🇰|FK|福克兰群岛
|
||||
🇫🇲|FM|密克罗尼西亚
|
||||
🇫🇴|FO|法罗群岛
|
||||
🇫🇷|FR|法国
|
||||
🇬🇦|GA|加蓬
|
||||
🇬🇧|GB|英国
|
||||
🇬🇩|GD|格林纳达
|
||||
🇬🇪|GE|格鲁吉亚
|
||||
🇬🇫|GF|法属圭亚那
|
||||
🇬🇬|GG|根西岛
|
||||
🇬🇭|GH|加纳
|
||||
🇬🇮|GI|直布罗陀
|
||||
🇬🇱|GL|格陵兰
|
||||
🇬🇲|GM|冈比亚
|
||||
🇬🇳|GN|几内亚
|
||||
🇬🇵|GP|瓜德罗普
|
||||
🇬🇶|GQ|赤道几内亚
|
||||
🇬🇷|GR|希腊
|
||||
🇬🇸|GS|南乔治亚和南桑威奇群岛
|
||||
🇬🇹|GT|危地马拉
|
||||
🇬🇺|GU|关岛
|
||||
🇬🇼|GW|几内亚比绍
|
||||
🇬🇾|GY|圭亚那
|
||||
🇭🇰|HK|香港
|
||||
🇭🇲|HM|赫德岛和麦克唐纳群岛
|
||||
🇭🇳|HN|洪都拉斯
|
||||
🇭🇷|HR|克罗地亚
|
||||
🇭🇹|HT|海地
|
||||
🇭🇺|HU|匈牙利
|
||||
🇮🇨|IC|加纳利群岛
|
||||
🇮🇩|ID|印度尼西亚
|
||||
🇮🇪|ED|爱尔兰
|
||||
🇮🇱|IL|以色列
|
||||
🇮🇲|IM|马恩岛
|
||||
🇮🇳|IN|印度
|
||||
🇮🇴|IO|英属印度洋领地
|
||||
🇮🇶|IQ|伊拉克
|
||||
🇮🇷|IR|伊朗
|
||||
🇮🇸|IS|冰岛
|
||||
🇮🇹|IT|意大利
|
||||
🇯🇪|JE|泽西岛
|
||||
🇯🇲|JM|牙买加
|
||||
🇯🇴|JO|约旦
|
||||
🇯🇵|JP|日本
|
||||
🇰🇪|KE|肯尼亚
|
||||
🇰🇬|KG|吉尔吉斯斯坦
|
||||
🇰🇭|KH|柬埔寨
|
||||
🇰🇮|KI|基里巴斯
|
||||
🇰🇲|KM|科摩罗
|
||||
🇰🇳|KN|圣基茨和尼维斯
|
||||
🇰🇵|KP|朝鲜
|
||||
🇰🇷|KR|韩国
|
||||
🇰🇼|KW|科威特
|
||||
🇰🇾|KY|开曼群岛
|
||||
🇰🇿|KZ|哈萨克斯坦
|
||||
🇱🇦|LA|老挝
|
||||
🇱🇧|LB|黎巴嫩
|
||||
🇱🇨|LC|圣卢西亚
|
||||
🇱🇮|LI|列支敦士登
|
||||
🇱🇰|LK|斯里兰卡
|
||||
🇱🇷|LR|利比里亚
|
||||
🇱🇸|LS|莱索托
|
||||
🇱🇹|LT|立陶宛
|
||||
🇱🇺|LU|卢森堡
|
||||
🇱🇻|LV|拉脱维亚
|
||||
🇱🇾|LY|利比亚
|
||||
🇲🇦|MA|摩洛哥
|
||||
🇲🇨|MC|摩纳哥
|
||||
🇲🇩|MD|摩尔多瓦
|
||||
🇲🇪|ME|黑山
|
||||
🇲🇫|MF|法属圣马丁
|
||||
🇲🇬|MG|马达加斯加
|
||||
🇲🇭|MH|马绍尔群岛
|
||||
🇲🇰|MK|北马其顿
|
||||
🇲🇱|ML|马里
|
||||
🇲🇲|MM|缅甸
|
||||
🇲🇳|MN|蒙古
|
||||
🇲🇴|MO|澳门
|
||||
🇲🇵|MP|北马里亚纳群岛
|
||||
🇲🇶|MQ|马提尼克
|
||||
🇲🇷|MR|毛里塔尼亚
|
||||
🇲🇸|MS|蒙特塞拉特
|
||||
🇲🇹|MT|马耳他
|
||||
🇲🇺|MU|毛里求斯
|
||||
🇲🇻|MV|马尔代夫
|
||||
🇲🇼|MW|马拉维
|
||||
🇲🇽|MX|墨西哥
|
||||
🇲🇾|MY|马来西亚
|
||||
🇲🇿|MZ|莫桑比克
|
||||
🇳🇦|NA|纳米比亚
|
||||
🇳🇨|NC|新喀里多尼亚
|
||||
🇳🇪|NE|尼日尔
|
||||
🇳🇫|NF|诺福克岛
|
||||
🇳🇬|NG|尼日利亚
|
||||
🇳🇮|NI|尼加拉瓜
|
||||
🇳🇱|NL|荷兰
|
||||
🇳🇴|NO|挪威
|
||||
🇳🇵|NP|尼泊尔
|
||||
🇳🇷|NR|瑙鲁
|
||||
🇳🇺|NU|纽埃
|
||||
🇳🇿|NZ|新西兰
|
||||
🇴🇲|OM|阿曼
|
||||
🇵🇦|PA|巴拿马
|
||||
🇵🇪|PE|秘鲁
|
||||
🇵🇫|PF|法属波利尼西亚
|
||||
🇵🇬|PG|巴布亚新几内亚
|
||||
🇵🇭|PH|菲律宾
|
||||
🇵🇰|PK|巴基斯坦
|
||||
🇵🇱|PL|波兰
|
||||
🇵🇲|PM|圣皮埃尔和密克隆群岛
|
||||
🇵🇳|PN|皮特凯恩群岛
|
||||
🇵🇷|PR|波多黎各
|
||||
🇵🇸|PS|巴勒斯坦领土
|
||||
🇵🇹|PT|葡萄牙
|
||||
🇵🇼|PW|帕劳
|
||||
🇵🇾|PY|巴拉圭
|
||||
🇶🇦|QA|卡塔尔
|
||||
🇷🇪|RE|留尼汪
|
||||
🇷🇴|RO|罗马尼亚
|
||||
🇷🇸|RS|塞尔维亚
|
||||
🇷🇺|RU|俄罗斯
|
||||
🇷🇼|RW|卢旺达
|
||||
🇸🇦|SA|沙特阿拉伯
|
||||
🇸🇧|SB|所罗门群岛
|
||||
🇸🇨|SC|塞舌尔
|
||||
🇸🇩|SD|苏丹
|
||||
🇸🇪|SE|瑞典
|
||||
🇸🇬|SG|新加坡
|
||||
🇸🇭|SH|圣赫勒拿
|
||||
🇸🇮|SI|斯洛文尼亚
|
||||
🇸🇯|SJ|斯瓦尔巴和扬马延
|
||||
🇸🇰|SK|斯洛伐克
|
||||
🇸🇱|SL|塞拉利昂
|
||||
🇸🇲|SM|圣马力诺
|
||||
🇸🇳|SN|塞内加尔
|
||||
🇸🇴|SO|索马里
|
||||
🇸🇷|SR|苏里南
|
||||
🇸🇸|SS|南苏丹
|
||||
🇸🇹|ST|圣多美和普林西比
|
||||
🇸🇻|SV|萨尔瓦多
|
||||
🇸🇽|SX|荷属圣马丁
|
||||
🇸🇾|SY|叙利亚
|
||||
🇸🇿|SZ|斯威士兰
|
||||
🇹🇦|TA|特里斯坦-达库尼亚群岛
|
||||
🇹🇨|TC|特克斯和凯科斯群岛
|
||||
🇹🇩|TD|乍得
|
||||
🇹🇫|TF|法属南部领地
|
||||
🇹🇬|TG|多哥
|
||||
🇹🇭|TH|泰国
|
||||
🇹🇯|TJ|塔吉克斯坦
|
||||
🇹🇰|TK|托克劳
|
||||
🇹🇱|TL|东帝汶
|
||||
🇹🇲|TM|土库曼斯坦
|
||||
🇹🇳|TN|突尼斯
|
||||
🇹🇴|TO|汤加
|
||||
🇹🇷|TR|土耳其
|
||||
🇹🇹|TT|特立尼达和多巴哥
|
||||
🇹🇻|TV|图瓦卢
|
||||
🇹🇼|TW|台湾
|
||||
🇹🇿|TZ|坦桑尼亚
|
||||
🇺🇦|UA|乌克兰
|
||||
🇺🇬|UG|乌干达
|
||||
🇺🇲|UM|美国
|
||||
🇺🇳|UN|联合国
|
||||
🇺🇸|US|美国
|
||||
🇺🇾|UY|乌拉圭
|
||||
🇺🇿|UZ|乌兹别克斯坦
|
||||
🇻🇦|VA|梵蒂冈
|
||||
🇻🇨|VC|圣文森特和格林纳丁斯
|
||||
🇻🇪|VE|委内瑞拉
|
||||
🇻🇬|VG|英属维尔京群岛
|
||||
🇻🇮|VI|美属维尔京群岛
|
||||
🇻🇳|VN|越南
|
||||
🇻🇺|VU|瓦努阿图
|
||||
🇼🇫|WF|瓦利斯和富图纳
|
||||
🇼🇸|WS|萨摩亚
|
||||
🇽🇰|XK|科索沃
|
||||
🇾🇪|YE|也门
|
||||
🇾🇹|YT|马约特
|
||||
🇿🇦|ZA|南非
|
||||
🇿🇲|ZM|赞比亚
|
||||
🇿🇼|ZW|津巴布韦
|
||||
🏁|ZZ|未知
|
||||
8
just/bao/sub/info.md
Executable file
8
just/bao/sub/info.md
Executable file
@ -0,0 +1,8 @@
|
||||
更新时间2025-07-23 13:24:34
|
||||
|
||||
**总订阅: 451**
|
||||
**总节点: 48265**
|
||||
- vless节点: 22812
|
||||
- hysteria2节点: 10
|
||||
|
||||
**google ping有效节点: 26**
|
||||
8178
just/bao/sub/ipScore
Executable file
8178
just/bao/sub/ipScore
Executable file
File diff suppressed because it is too large
Load Diff
2
just/bao/sub/pool/sublists
Executable file
2
just/bao/sub/pool/sublists
Executable file
@ -0,0 +1,2 @@
|
||||
https://raw.githubusercontent.com/Leon406/jsdelivr/master/subscribe/sub.txt
|
||||
https://raw.githubusercontent.com/Leon406/jsdelivr/master/subscribe/subpools
|
||||
14
just/bao/sub/pool/subs
Executable file
14
just/bao/sub/pool/subs
Executable file
@ -0,0 +1,14 @@
|
||||
https://raw.githubusercontent.com/adiwzx/freenode/main/adispeed.yml
|
||||
https://raw.githubusercontent.com/freefq/free/master/v2
|
||||
https://raw.githubusercontent.com/huaxinCLUB/NodeSpider/master/newYaml/mattkaydiary.yaml
|
||||
https://raw.githubusercontent.com/ssrsub/ssr/master/Clash.yml
|
||||
https://raw.githubusercontent.com/zyzmzyz/free-nodes/master/Clash.yml
|
||||
https://raw.githubusercontent.com/pojiezhiyuanjun/freev2/master/0727clash.yml
|
||||
https://raw.githubusercontent.com/xiyaowong/freeFQ/main/v2ray
|
||||
https://raw.githubusercontent.com/iwxf/free-v2ray/master/index.html
|
||||
https://raw.githubusercontent.com/ermaozi/get_subscribe/main/subscribe/v2ray.txt
|
||||
https://raw.githubusercontent.com/wrfree/free/main/v2
|
||||
https://raw.githubusercontent.com/ronghuaxueleng/get_v2/main/pub/changfengoss.yaml
|
||||
https://raw.githubusercontent.com/anaer/Sub/main/clash.yaml
|
||||
https://v2ray.neocities.org/v2ray.txt
|
||||
https://raw.githubusercontent.com/mahdibland/SSAggregator/master/sub/sub_merge_yaml.yml
|
||||
1
just/bao/sub/share/a11
Executable file
1
just/bao/sub/share/a11
Executable file
File diff suppressed because one or more lines are too long
253989
just/bao/sub/share/blackhosts
Executable file
253989
just/bao/sub/share/blackhosts
Executable file
File diff suppressed because it is too large
Load Diff
2
just/bao/sub/share/host
Executable file
2
just/bao/sub/share/host
Executable file
@ -0,0 +1,2 @@
|
||||
##### 更新时间2025-07-23 12:37:27 #####
|
||||
|
||||
1
just/bao/sub/share/hysteria2
Executable file
1
just/bao/sub/share/hysteria2
Executable file
@ -0,0 +1 @@
|
||||
aHlzdGVyaWEyOi8vNjY2ODQ5MzgtNmQ5OC00NWU0LThmNTktZjZjNWNlNGI2NTIyQEJHUDMuYWJ5c3N2cG4uY29tOjMxMTAyP2luc2VjdXJlPTEjJUU5JTk4JUIyJUU1JUE0JUIxJUU2JTk1JTg4Z2l0aHViK1N1YkNyYXdsZXIlRTUlOEElQTAlRTYlOEIlQkYlRTUlQTQlQTdfMDcyMzEzMjIyCmh5c3RlcmlhMjovLzg2MmU5MGUxLTJmMjYtNDUwNi1iOGI5LTBhZGYyMGRhMDVmY0A0MC4yMzMuMTAzLjUxOjQ3MjYyP2luc2VjdXJlPTEmc25pPXd3dy5iaW5nLmNvbSMlRTUlOEElQTAlRTYlOEIlQkYlRTUlQTQlQTdfMDcyMzEzMjI0Cmh5c3RlcmlhMjovL2RiZTE3Mjk3M2MyOTUzNDgzM2M2ZmFlM2Q3MDZkOWU3QDkxLjIxNy4xMTkuNTE6NDQzP3NuaT13d3cuZ29vZ2xlLmNvbSZvYmZzPXNhbGFtYW5kZXImb2Jmcy1wYXNzd29yZD1WcG5IdWJNYXJLZVQmaW5zZWN1cmU9MSMlRTUlOUMlOUYlRTglODAlQjMlRTUlODUlQjZfMDcyMzEzMDU3Cmh5c3RlcmlhMjovLzVkMTEwZjE4LTVhMzctNGRiMy04Y2Y2LWYwYmNlZDM4YTFhZUAxNTQuODUuMTguMjMzOjQ0Mz9pbnNlY3VyZT0xJnNuaT13d3cuYmluZy5jb20jJUU2JTk3JUE1JUU2JTlDJUFDXzA3MjMxMzEyNApoeXN0ZXJpYTI6Ly9iODY2ZDgzYS1kMzAxLTQyNzAtYjY5OS00MGYzMjJiZjUyZmJAMTU0Ljg1LjE5LjYzOjQ0Mz9pbnNlY3VyZT0xJnNuaT13d3cuYmluZy5jb20jJUU2JTk3JUE1JUU2JTlDJUFDXzA3MjMxMzEyNQpoeXN0ZXJpYTI6Ly82NjY4NDkzOC02ZDk4LTQ1ZTQtOGY1OS1mNmM1Y2U0YjY1MjJAQkdQMi5hYnlzc3Zwbi5jb206MzExMDI/aW5zZWN1cmU9MSMlRTYlOTclQTUlRTYlOUMlQUNfMDcyMzEzNTAzCmh5c3RlcmlhMjovL2Rvbmd0YWl3YW5nLmNvbUA1MS4xNTkuMTExLjMyOjMxMTgwP3NlY3VyaXR5PXRscyZpbnNlY3VyZT0xJnNuaT1hcHBsZS5jb20jJUU2JUIzJTk1JUU1JTlCJUJEXzA3MjMxMzEyNQpoeXN0ZXJpYTI6Ly8xMjM0NTZAMTkyLjMuODUuMjM3OjQ0Mz9zZWN1cml0eT10bHMmaW5zZWN1cmU9MSZzbmk9YmluZy5jb20jJUU3JUJFJThFJUU1JTlCJUJEXzA3MjMxMzE0NjUKaHlzdGVyaWEyOi8vbmZzbjY2NkA0NS4yMDcuMjIyLjEzODo4ODg4P2luc2VjdXJlPTEmc25pPWhrLm5mc242NjYuZ3EjJUU5JUE2JTk5JUU2JUI4JUFGXzA3MjMxMzU0OApoeXN0ZXJpYTI6Ly9uZnNuNjY2QGhrLm5mc242NjYuZ3E6ODg4OD9pbnNlY3VyZT0xJnNuaT1oay5uZnNuNjY2LmdxIyVFOSVBNiU5OSVFNiVCOCVBRl8wNzIzMTM1NDk=
|
||||
1
just/bao/sub/share/ss
Executable file
1
just/bao/sub/share/ss
Executable file
File diff suppressed because one or more lines are too long
1
just/bao/sub/share/ssr
Executable file
1
just/bao/sub/share/ssr
Executable file
@ -0,0 +1 @@
|
||||
c3NyOi8vTkRVdU5UVXVNaTR5TXpJNk1UUXlPVE02YjNKcFoybHVPbUZsY3kweU5UWXRZMlppT25Cc1lXbHVPazFxUlROTlIxazBMejl2WW1aemNHRnlZVzA5Sm5CeWIzUnZjR0Z5WVcwOUpuSmxiV0Z5YTNNOU5scHBlVFZoVTNnMWNGZEpXakpzTUdGSVZtbEpSazR4V1d0T2VWbFlaSE5hV0V4dWRtODNiRzAzTVdaTlZFbDRUWHBKZDAxNmF6UW1aM0p2ZFhBOQ==
|
||||
1
just/bao/sub/share/tr
Executable file
1
just/bao/sub/share/tr
Executable file
File diff suppressed because one or more lines are too long
1
just/bao/sub/share/v2
Executable file
1
just/bao/sub/share/v2
Executable file
File diff suppressed because one or more lines are too long
1
just/bao/sub/share/vless
Executable file
1
just/bao/sub/share/vless
Executable file
File diff suppressed because one or more lines are too long
3848
just/bao/sub/share/whitehost
Executable file
3848
just/bao/sub/share/whitehost
Executable file
File diff suppressed because it is too large
Load Diff
72536
just/bao/sub/socketfail
Executable file
72536
just/bao/sub/socketfail
Executable file
File diff suppressed because it is too large
Load Diff
8
just/bao/sub/subs.txt
Executable file
8
just/bao/sub/subs.txt
Executable file
@ -0,0 +1,8 @@
|
||||
ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTpHIXlCd1BXSDNWYW9AMzguNjQuMTM4LjIwNzo4MDI=#38.64.138.207%3A802-SS-2056452187
|
||||
ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTpHIXlCd1BXSDNWYW9AMzguNjQuMTM4LjIwNzo4MDM=#
|
||||
trojan://7c9b7560-b0f7-11eb-a397-1239d0255272@fr-trojan.bonds.id:443#Relay_+%7C26.25Mb
|
||||
trojan://7e6256a0-b4ab-11eb-bc8f-1239d0255272@nl-trojan.bonds.id:443
|
||||
ssr://bjc0LmJvb20ucGFydHk6MjYwMDA6YXV0aF9hZXMxMjhfc2hhMTphZXMtMjU2LWNmYjpodHRwX3NpbXBsZTpWV3M1TWtOVC8_b2Jmc3BhcmFtPVpHOTNibXh2WVdRdWQybHVaRzkzYzNWd1pHRjBaUzVqYjIwJnByb3RvcGFyYW09TVRRek1EY3pPa042T0dGUGFRJnJlbWFya3M9NmFhWjVyaXZMVTAmZ3JvdXA9TVE
|
||||
ssr://bjkzLmJvb20ucGFydHk6MjgwMDA6YXV0aF9hZXMxMjhfc2hhMTphZXMtMjU2LWNmYjpodHRwX3NpbXBsZTpWV3M1TWtOVC8_b2Jmc3BhcmFtPVpHOTNibXh2WVdRdWQybHVaRzkzYzNWd1pHRjBaUzVqYjIwJnByb3RvcGFyYW09TVRRek1EY3pPa042T0dGUGFRJnJlbWFya3M9NmFhWjVyaXZMVkUmZ3JvdXA9TVE
|
||||
vmess://ewogICJhZGQiOiAiMTMuMjQ1LjE2LjEyNiIsCiAgImFpZCI6ICI2NCIsCiAgImhvc3QiOiAiMTMuMjQ1LjE2LjEyNiIsCiAgImlkIjogIjU1OTYzNmM3LWI1YTItNDUwYy05YjVlLTBkYzhmYzE0ZjRmNSIsCiAgIm5ldCI6ICJ0Y3AiLAogICJwYXRoIjogIiIsCiAgInBvcnQiOiAiMjA0MDQiLAogICJwcyI6ICJub25lIiwKICAidGxzIjogIiIsCiAgInR5cGUiOiAibm9uZSIsCiAgInVybF9ncm91cCI6ICJ2MnJheSIsCiAgInYiOiAiMSIKfQ==
|
||||
vmess://ew0KICAidiI6ICIyIiwNCiAgInBzIjogIkhLIEVDMiAwMSIsDQogICJhZGQiOiAiMTguMTY3Ljk0LjExMyIsDQogICJwb3J0IjogIjg5MyIsDQogICJpZCI6ICJjYTc4NDA1ZS1lNTU0LTNjZDMtOWI2ZC0yZWM5OGUyMWM4ZjEiLA0KICAiYWlkIjogIjEiLA0KICAibmV0IjogIndzIiwNCiAgInR5cGUiOiAibm9uZSIsDQogICJob3N0IjogIiIsDQogICJwYXRoIjogIi9obHMvY2N0djVwaGQubTN1OCIsDQogICJ0bHMiOiAiIg0KfQ==
|
||||
1
just/bao/sub/vpn/quark/asia.txt
Executable file
1
just/bao/sub/vpn/quark/asia.txt
Executable file
File diff suppressed because one or more lines are too long
5
just/bao/up.bat
Executable file
5
just/bao/up.bat
Executable file
@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
git add .
|
||||
git commit -m "commit via auto upload shell"
|
||||
git push
|
||||
pause
|
||||
3
just/bao/up.sh
Executable file
3
just/bao/up.sh
Executable file
@ -0,0 +1,3 @@
|
||||
git add .
|
||||
git commit -m "ci: Auto update at $(date +"%m-%d %H:%M")"
|
||||
git push
|
||||
Loading…
Reference in New Issue
Block a user