diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..516f5da8
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,4 @@
+[*.cs]
+
+# Default severity for all analyzer diagnostics
+dotnet_analyzer_diagnostic.severity = none
diff --git a/.gitignore b/.gitignore
index 2397d072..3739cc60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -198,3 +198,5 @@ FakesAssemblies/
# vs code
.vscode/*
+/ProxySU_Core/Data/Record.json
+/ProxySuper.WPF/bin
diff --git a/.idea/.idea.ProxySU/.idea/codeStyles/codeStyleConfig.xml b/.idea/.idea.ProxySU/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 00000000..7ad1bf11
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/contentModel.xml b/.idea/.idea.ProxySU/.idea/contentModel.xml
new file mode 100644
index 00000000..0f66ecb4
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/contentModel.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/encodings.xml b/.idea/.idea.ProxySU/.idea/encodings.xml
new file mode 100644
index 00000000..df87cf95
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/indexLayout.xml b/.idea/.idea.ProxySU/.idea/indexLayout.xml
new file mode 100644
index 00000000..27ba142e
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/modules.xml b/.idea/.idea.ProxySU/.idea/modules.xml
new file mode 100644
index 00000000..a7c012bc
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/projectSettingsUpdater.xml b/.idea/.idea.ProxySU/.idea/projectSettingsUpdater.xml
new file mode 100644
index 00000000..4bb9f4d2
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/projectSettingsUpdater.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/vcs.xml b/.idea/.idea.ProxySU/.idea/vcs.xml
new file mode 100644
index 00000000..94a25f7f
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/.idea/workspace.xml b/.idea/.idea.ProxySU/.idea/workspace.xml
new file mode 100644
index 00000000..cfb386b7
--- /dev/null
+++ b/.idea/.idea.ProxySU/.idea/workspace.xml
@@ -0,0 +1,121 @@
+
+
+
+ ProxySU/ProxySU.csproj
+ WpfApp1/WpfApp1.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1607572158648
+
+
+ 1607572158648
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ProxySU/riderModule.iml b/.idea/.idea.ProxySU/riderModule.iml
new file mode 100644
index 00000000..1a4e0d95
--- /dev/null
+++ b/.idea/.idea.ProxySU/riderModule.iml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/7z/7z.exe b/7z/7z.exe
deleted file mode 100644
index 3a8ee478..00000000
Binary files a/7z/7z.exe and /dev/null differ
diff --git a/7z/readme.md b/7z/readme.md
deleted file mode 100644
index 892f5001..00000000
--- a/7z/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-这个7z.exe文件,只是为了生成Release.zip方便。可有可无。ProxySU并不调用。
\ No newline at end of file
diff --git a/FodyWeavers.xml b/FodyWeavers.xml
new file mode 100644
index 00000000..5c3cf8c5
--- /dev/null
+++ b/FodyWeavers.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/LICENSE b/LICENSE
index f288702d..a535319b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,674 +1,21 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
- .
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
+MIT License
+
+Copyright (c) 2025 ProxySU
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/ProxySU.sln b/ProxySU.sln
index 89f5ff94..a38b7001 100644
--- a/ProxySU.sln
+++ b/ProxySU.sln
@@ -1,9 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28307.1022
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31606.5
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySU", "ProxySU\ProxySU.csproj", "{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{CE908112-DB46-4B91-8236-9139A19D66E9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySuper.WPF", "ProxySuper.WPF\ProxySuper.WPF.csproj", "{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySuper.Core", "ProxySuper.Core\ProxySuper.Core.csproj", "{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,14 +15,22 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {B083EBFD-2925-46C9-8B00-E2C1300CEBA1} = {CE908112-DB46-4B91-8236-9139A19D66E9}
+ {15779EE6-D8CA-44BF-BFE2-941E155EEF3F} = {CE908112-DB46-4B91-8236-9139A19D66E9}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A3F3B8D6-7FED-42D9-9994-E913BD32E025}
EndGlobalSection
diff --git a/ProxySU/App.xaml b/ProxySU/App.xaml
deleted file mode 100644
index 4a9db0e2..00000000
--- a/ProxySU/App.xaml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/App.xaml.cs b/ProxySU/App.xaml.cs
deleted file mode 100644
index 6ed51145..00000000
--- a/ProxySU/App.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace ProxySU
-{
- ///
- /// App.xaml 的交互逻辑
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/ProxySU/ClassModel.cs b/ProxySU/ClassModel.cs
deleted file mode 100644
index 4bea9a7a..00000000
--- a/ProxySU/ClassModel.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Net;
-using System.ComponentModel;
-using System.Net.Sockets;
-using System.Runtime.InteropServices;
-using System.Runtime;
-using System.Globalization;
-using Microsoft.Win32;
-using System.Security;
-
-namespace ProxySU
-{
- class ClassModel
- {
- //检测域名是否为空
- public static bool TestDomainIsEmpty(string domainStr)
- {
- domainStr = domainStr.Trim();
- if (string.IsNullOrEmpty(domainStr) == true)
- {
- //****** "域名不能为空,请检查相关参数设置!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- return false;
- }
- else
- {
- return true;
- }
- }
- //伪装网站预处理
- public static bool PreDomainMask(string uri)
- {
- uri = uri.Trim();
- if (String.IsNullOrEmpty(uri) == false)
- {
- if (uri.Contains("/") == true)
- {
- //MessageBox.Show("伪装网址输入格式错误!请重新输入!");
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_MaskSitesToolTip").ToString());
- return false;
- }
- }
- return true;
- }
- //伪装网址的处理
- public static string DisguiseURLprocessing(string fakeUrl)
- {
- fakeUrl = fakeUrl.Trim();
- return fakeUrl;
- //处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // var uri = new Uri(fakeUrl);
- // return uri.Host;
- // }
-
- //}
-
- }
- }
-}
diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml
deleted file mode 100644
index 22d98954..00000000
--- a/ProxySU/MainWindow.xaml
+++ /dev/null
@@ -1,842 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs
deleted file mode 100644
index 52bd3778..00000000
--- a/ProxySU/MainWindow.xaml.cs
+++ /dev/null
@@ -1,10515 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Net;
-using System.ComponentModel;
-using System.Net.Sockets;
-using System.Runtime.InteropServices;
-using System.Runtime;
-using System.Globalization;
-using Microsoft.Win32;
-using System.Security;
-
-namespace ProxySU
-{
- class NatDns64
- {
- private string ipaddr { set; get; } //Dns64网关地址
- private int avg { set; get; } //ping的平均值
-
- public NatDns64(string IpAddr, int Avg)
- {
- this.ipaddr = IpAddr;
- this.avg = Avg;
- }
-
- public string IpAddr
- {
- get { return ipaddr; }
- set { this.ipaddr = IpAddr; }
- }
-
- public int Avg
- {
- get { return avg; }
- set { this.avg = Avg; }
- }
- }
- ///
- /// MainWindow.xaml 的交互逻辑
- ///
- public partial class MainWindow : Window
- {
- //多语言参数
- public class LanguageInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
- public static string[] ReceiveConfigurationParameters { get; set; }
-
- //ReceiveConfigurationParameters[0]----模板类型
- //ReceiveConfigurationParameters[1]----服务端口
- //ReceiveConfigurationParameters[2]----V2Ray uuid/(naive/Trojan-go/Trojan/SSR/SS)' Password
- //ReceiveConfigurationParameters[3]----QUIC加密方式/SSR 加密方法/SS 加密方式/naive'user/VLESS ws Path/trojan-go mux concurrency
- //ReceiveConfigurationParameters[4]----Domain
- //ReceiveConfigurationParameters[5]----伪装类型/插件名称/trojan-go mux idle_timeout
- //ReceiveConfigurationParameters[6]----V2Ray&Trojan-go&SS--Websocket'Path/http2'Path/QUIC密钥/mKCP Seed/VMESS ws Path
- //ReceiveConfigurationParameters[7]----伪装网站
- //ReceiveConfigurationParameters[8]----方案名称
- //ReceiveConfigurationParameters[9]----插件参数选项/VMESS tcp Path/MTProto Parameters/trojan-go是否启用Mux(true)
- //public static ConnectionInfo ConnectionInfo;
-
- public static string proxyType = "V2Ray"; //代理类型标识: V2Ray\TrojanGo\Trojan\NaiveProxy
- public static readonly string pwdir = AppDomain.CurrentDomain.BaseDirectory; //执行文件所在目录
- public static bool mKCPvlessIsSet = false; //mKCP是否使用VLESS协议
- static bool testDomain = false; //设置标识--域名是否需要检测解析,初始化为不需要
- static string ipv4 = String.Empty; //保存获取的ipv4地址
- static string ipv6 = String.Empty; //保存获取的ipv6地址
- static bool onlyIpv6 = false; //主机是否基于纯ipv6地址
- static bool functionResult = true; //标示功能函数是否执行状态(true无错误发生/false有错误发生)
- static string sshShellCommand = String.Empty; //定义保存执行的命令
- static string currentStatus = String.Empty; //定议保存要显示的状态
- static string currentShellCommandResult = String.Empty; //定义Shell命令执行结果保存变量
- static bool getApt = false; //判断系统软件管理,下同
- static bool getDnf = false;
- static bool getYum = false;
- static string sshCmdUpdate = String.Empty; //保存软件安装所用更新软件库命令
- static string sshCmdInstall = String.Empty; //保存软件安装所用命令格式
- static int randomCaddyListenPort = 8800; //Caddy做伪装网站所监听的端口,随机10001-60000
- static int installationDegree = 0; //安装进度条显示的百分比
- static string saveShellScriptFileName = "install.sh"; //用来保存下载的脚本名称
-
- //****** ******
- // Application.Current.FindResource("").ToString()
- //
- // {DynamicResource }
- //SetUpProgressBarProcessing(0);
- public MainWindow()
- {
- InitializeComponent();
-
- #region 多语言选择设置 初始设置为auto
- List languageList = new List();
-
- languageList.Add(new LanguageInfo { Name = "auto", Value = "auto" });
- languageList.Add(new LanguageInfo { Name = "English", Value = "en-US" });
- languageList.Add(new LanguageInfo { Name = "简体中文", Value = "zh-CN" });
- languageList.Add(new LanguageInfo { Name = "正體中文", Value = "zh-TW" });
-
- ComboBoxLanguage.ItemsSource = languageList;
-
- ComboBoxLanguage.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxLanguage.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxLanguage.SelectedIndex = 0;
-
- DataContext = this;
- string Culture = System.Globalization.CultureInfo.InstalledUICulture.Name;
- //Culture = "en-US";
- ResourcesLoad(Culture);
- #endregion
-
- //初始化参数设置数组
- ReceiveConfigurationParameters = new string[10];
-
- //初始化选定密码登录
- RadioButtonPasswordLogin.IsChecked = true;
- //初始化选定无代理
- RadioButtonNoProxy.IsChecked = true;
- //初始化代理无需登录
- RadioButtonProxyNoLogin.IsChecked = true;
- //初始化隐藏Socks4代理,
- RadioButtonSocks4.Visibility = Visibility.Collapsed;
-
- //初始化Trojan的密码
- TextBoxTrojanPassword.Text = RandomUUID();
-
- //初始化NaiveProxy的用户名和密码
- TextBoxNaivePassword.Text = RandomUUID();
- TextBoxNaiveUser.Text = RandomUserName();
-
- //初始化SSR的密码
- TextBoxSSRPassword.Text = RandomUUID();
-
- //初始化V2Ray所选方案面板为不显示
- GridV2rayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- //初始化Xray所选方案面板为不显示
- GridXrayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- //自动检查ProxySU是否有新版本发布,有则显示更新提示
- Thread thread = new Thread(() => TestLatestVersionProxySU(TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- #region 检测新版本代码
-
- //检测ProxySU新版本
- private void TestLatestVersionProxySU(TextBlock TextBlockLastVersionProxySU, TextBlock TextBlockNewVersionReminder, Button ButtonUpgradeProxySU)
- {
- string strJson = GetLatestJson(@"https://api.github.com/repos/proxysu/windows/releases/latest");
- if (String.IsNullOrEmpty(strJson) == false)
- {
- JObject lastVerJsonObj = JObject.Parse(strJson);
- string lastVersion = (string)lastVerJsonObj["tag_name"];//得到远程版本信息
-
- string lastVersionNoV = lastVersion.Replace("v", String.Empty);
-
- Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
- //MessageBox.Show(version.ToString());
- string cerversion = version.ToString().Substring(0, 6); //获取本地版本信息
- //MessageBox.Show(cerversion);
- string[] lastVerComp = lastVersionNoV.Split('.');
- string[] localVerComp = cerversion.Split('.');
-
- //版本信息不相同,则认为新版本发布,显示出新版本信息及更新提醒,下载按钮
- if (int.Parse(lastVerComp[0]) > int.Parse(localVerComp[0]))
- {
- TextBlockLastVersionProxySU.Dispatcher.BeginInvoke(updateNewVersionProxySUAction, TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU, lastVersion);
- return;
- }
- else if (int.Parse(lastVerComp[0]) == int.Parse(localVerComp[0]))
- {
- if (int.Parse(lastVerComp[1]) > int.Parse(localVerComp[1]))
- {
- TextBlockLastVersionProxySU.Dispatcher.BeginInvoke(updateNewVersionProxySUAction, TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU, lastVersion);
- return;
- }
- else if (int.Parse(lastVerComp[1]) == int.Parse(localVerComp[1]))
- {
- if (int.Parse(lastVerComp[2]) > int.Parse(localVerComp[2]))
- {
- TextBlockLastVersionProxySU.Dispatcher.BeginInvoke(updateNewVersionProxySUAction, TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU, lastVersion);
- return;
- }
- }
- }
- }
- }
-
- //下载最新版ProxySU
- private void ButtonUpgradeProxySU_Click(object sender, RoutedEventArgs e)
- {
- TextBlockNewVersionReminder.Visibility = Visibility.Hidden;
- TextBlockNewVersionDown.Visibility = Visibility.Visible;
- //TextBlockNewVersionReminder.Text = Application.Current.FindResource("TextBlockNewVersionDown").ToString();
- try
- {
- string strJson = GetLatestJson(@"https://api.github.com/repos/proxysu/windows/releases/latest");
- if (String.IsNullOrEmpty(strJson) == false)
- {
- JObject lastVerJsonObj = JObject.Parse(strJson);
- string lastVersion = (string)lastVerJsonObj["tag_name"];//得到远程版本信息
- string latestVerDownUrl = (string)lastVerJsonObj["assets"][0]["browser_download_url"];//得到最新版文件下载地址
- string latestNewVerFileName = (string)lastVerJsonObj["assets"][0]["name"];//得到最新版文件名
- string latestNewVerExplanation = (string)lastVerJsonObj["body"];//得到更新说明
-
- WebClient webClientNewVer = new WebClient();
- webClientNewVer.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
- //webClientNewVer.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
- if (CheckDir(lastVersion))
- {
- Uri latestVerDownUri = new Uri(latestVerDownUrl);
- webClientNewVer.DownloadFileAsync(latestVerDownUri, lastVersion + @"\" + latestNewVerFileName);
- //webClientNewVer.DownloadFile(latestVerDownUrl, latestNewVerFileName);
-
- using (StreamWriter sw = new StreamWriter(lastVersion + @"\" + "readme.txt"))
- {
- sw.WriteLine(latestNewVerExplanation);
- }
- }
- }
- }
- catch (Exception ex1)
- {
- // MessageBox.Show(ex1.ToString());
-
- return;
- }
- }
- //文件下载完处理方法
- private void Completed(object sender, AsyncCompletedEventArgs e)
- {
- if (e.Cancelled == true)
- {
- MessageBox.Show(e.Error.ToString());
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDownProxyFail").ToString());
- //label1.Text = "Download cancelled!";
- }
- else
- {
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDownProxySuccess").ToString());
- }
- }
-
- //获取LatestJson
- private string GetLatestJson(string theLatestUrl)
- {
- try
- {
- //ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | (SecurityProtocolType)3072 | (SecurityProtocolType)768 | SecurityProtocolType.Tls;
- ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
- // ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00 | 0x30);
- //string url = "https://api.github.com/repos/proxysu/windows/releases/latest";
- Uri uri = new Uri(theLatestUrl);
- HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
- req.Accept = @"application/json";
- req.UserAgent = @"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0";
- HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
- Stream stream = resp.GetResponseStream();
- StreamReader sr = new StreamReader(stream);
- string strJson = sr.ReadToEnd();
- return strJson;
- }
- catch (Exception ex1)
- {
- return null;
- }
- }
-
-
- //更新新版本提醒显示
- Action updateNewVersionProxySUAction = new Action(UpdateNewVersionProxySU);
- private static void UpdateNewVersionProxySU(TextBlock TextBlockLastVersionProxySU, TextBlock TextBlockNewVersionReminder, Button ButtonUpgradeProxySU, string theLatestVersion)
- {
- TextBlockLastVersionProxySU.Text = theLatestVersion;
- TextBlockLastVersionProxySU.Visibility = Visibility.Visible;
- TextBlockNewVersionReminder.Visibility = Visibility.Visible;
- ButtonUpgradeProxySU.Visibility = Visibility.Visible;
- }
-
- #endregion
-
- #region 安装过程信息显示 端口数字防错代码,密钥选择代码
-
- //更新状态条显示
- Action updateAction = new Action(UpdateTextBlock);
- private static void UpdateTextBlock(TextBlock textBlockName, ProgressBar progressBar, string currentStatus)
- {
- textBlockName.Text = currentStatus;
-
- //if (currentStatus.Contains("成功") == true || currentStatus.ToLower().Contains("success") == true)
- //{
- // progressBar.IsIndeterminate = false;
- // progressBar.Value = 100;
- //}
- //else
- if (currentStatus.Contains("失败") == true || currentStatus.Contains("取消") == true || currentStatus.Contains("退出") == true || currentStatus.ToLower().Contains("fail") == true || currentStatus.ToLower().Contains("cancel") == true || currentStatus.ToLower().Contains("exit") == true)
- {
- progressBar.IsIndeterminate = false;
- progressBar.Value = 0;
- }
- //else
- //{
- // progressBar.IsIndeterminate = true;
- // //progressBar.Value = 0;
- //}
-
-
- }
-
- //进度条更新百分比
- private void SetUpProgressBarProcessing(int max)
- {
-
- for (int i = installationDegree; i <= max; i++)
- {
- Thread.Sleep(100);
- Dispatcher.Invoke(new Action(ProgressBarSetUpProcessing.SetValue), System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, Convert.ToDouble(i) });
- }
- installationDegree = max;
- }
-
-
- //更新监视窗内的显示
- //结尾自动添加一个换行符
- Action updateMonitorAction = new Action(UpdateTextBox);
- private static void UpdateTextBox(TextBox textBoxName, string currentResult)
- {
- textBoxName.Text = textBoxName.Text + currentResult + Environment.NewLine;
- textBoxName.ScrollToEnd();
- }
-
- //结尾不添加换行符
- Action updateMonitorActionNoWrap = new Action(UpdateTextBoxNoWrap);
- private static void UpdateTextBoxNoWrap(TextBox textBoxName, string currentResult)
- {
- textBoxName.Text = textBoxName.Text + currentResult;
- textBoxName.ScrollToEnd();
- }
-
- //退出主程序
- private void Button_canel_Click(object sender, RoutedEventArgs e)
- {
- Application.Current.Shutdown();
- }
-
- // private static readonly Regex _regex = new Regex("[^0-9]+");
-
- //检测数字输入
- private void TextBoxPort_PreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- Regex regex = new Regex("[^0-9]+");
- e.Handled = regex.IsMatch(e.Text);
- }
-
- //检测字符串是否只由数字组成
- private bool IsOnlyNumber(string value)
- {
- value = value.Trim();
- Regex r = new Regex(@"^[0-9]+$");
- return r.Match(value).Success;
- }
-
- //端口输入框是否可使用粘贴命令
- private void TextBoxPort_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
- {
- if (e.Command == ApplicationCommands.Paste)
- {
- e.Handled = false;//true为不能使用粘贴命令,false为可以使用粘贴命令
- }
- }
-
- //打开证书浏览
- private void ButtonOpenFileDialog_Click(object sender, RoutedEventArgs e)
- {
- var openFileDialog = new Microsoft.Win32.OpenFileDialog()
- {
- Filter = "Cert Files (*.*)|*.*"
- };
- var result = openFileDialog.ShowDialog();
- if (result == true)
- {
- TextBoxCertFilePath.Text = openFileDialog.FileName;
- }
- }
- #endregion
-
- #region 主界面控件的有效无效控制代码块及界面语言
-
- //加载语言资源文件
- private void ResourcesLoad(string Culture)
- {
- List dictionaryList = new List();
- foreach (ResourceDictionary dictionary in Application.Current.Resources.MergedDictionaries)
- {
- dictionaryList.Add(dictionary);
- }
- string requestedCulture = string.Format(@"Translations\ProxySU.{0}.xaml", Culture);
- //string requestedCulture = string.Format(@"Translations\ProxySU.{0}.xaml", "default");
- ResourceDictionary resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedCulture));
- if (resourceDictionary == null)
- {
- requestedCulture = @"Translations\ProxySU.en-US.xaml";
- resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedCulture));
- }
- if (resourceDictionary != null)
- {
- Application.Current.Resources.MergedDictionaries.Remove(resourceDictionary);
- Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
- }
- }
-
- //界面语言处理
- private void ComboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- string languageCulture;
- object languageSelected;
- languageSelected = ComboBoxLanguage.SelectedValue;
- languageCulture = languageSelected.ToString();
- if (languageCulture.Equals("auto"))
- {
- languageCulture = System.Globalization.CultureInfo.InstalledUICulture.Name;
- ResourcesLoad(languageCulture);
- }
- else
- {
- ResourcesLoad(languageCulture);
- }
- //display.Text = language;
- }
- private void RadioButtonNoProxy_Checked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyHost.IsEnabled = false;
- TextBlockProxyHost.Visibility = Visibility.Collapsed;
- TextBoxProxyHost.IsEnabled = false;
- TextBoxProxyHost.Visibility = Visibility.Collapsed;
- TextBlockProxyPort.IsEnabled = false;
- TextBlockProxyPort.Visibility = Visibility.Collapsed;
- TextBoxProxyPort.IsEnabled = false;
- TextBoxProxyPort.Visibility = Visibility.Collapsed;
- RadioButtonProxyNoLogin.IsEnabled = false;
- RadioButtonProxyNoLogin.Visibility = Visibility.Collapsed;
- RadiobuttonProxyYesLogin.IsEnabled = false;
- RadiobuttonProxyYesLogin.Visibility = Visibility.Collapsed;
- TextBlockProxyUser.IsEnabled = false;
- TextBlockProxyUser.Visibility = Visibility.Collapsed;
- TextBoxProxyUserName.IsEnabled = false;
- TextBoxProxyUserName.Visibility = Visibility.Collapsed;
- TextBlockProxyPassword.IsEnabled = false;
- TextBlockProxyPassword.Visibility = Visibility.Collapsed;
- PasswordBoxProxyPassword.IsEnabled = false;
- PasswordBoxProxyPassword.Visibility = Visibility.Collapsed;
- }
-
- private void RadioButtonNoProxy_Unchecked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyHost.IsEnabled = true;
- TextBlockProxyHost.Visibility = Visibility.Visible;
- TextBoxProxyHost.IsEnabled = true;
- TextBoxProxyHost.Visibility = Visibility.Visible;
- TextBlockProxyPort.IsEnabled = true;
- TextBlockProxyPort.Visibility = Visibility.Visible;
- TextBoxProxyPort.IsEnabled = true;
- TextBoxProxyPort.Visibility = Visibility.Visible;
- RadioButtonProxyNoLogin.IsEnabled = true;
- RadioButtonProxyNoLogin.Visibility = Visibility.Visible;
- RadiobuttonProxyYesLogin.IsEnabled = true;
- RadiobuttonProxyYesLogin.Visibility = Visibility.Visible;
- if (RadioButtonProxyNoLogin.IsChecked == true)
- {
- TextBlockProxyUser.IsEnabled = false;
- TextBlockProxyUser.Visibility = Visibility.Collapsed;
- TextBlockProxyPassword.IsEnabled = false;
- TextBlockProxyPassword.Visibility = Visibility.Collapsed;
- TextBoxProxyUserName.IsEnabled = false;
- TextBoxProxyUserName.Visibility = Visibility.Collapsed;
- PasswordBoxProxyPassword.IsEnabled = false;
- PasswordBoxProxyPassword.Visibility = Visibility.Collapsed;
- }
- else
- {
- TextBlockProxyUser.IsEnabled = true;
- TextBlockProxyUser.Visibility = Visibility.Visible;
- TextBoxProxyUserName.IsEnabled = true;
- TextBoxProxyUserName.Visibility = Visibility.Visible;
- TextBlockProxyPassword.IsEnabled = true;
- TextBlockProxyPassword.Visibility = Visibility.Visible;
- PasswordBoxProxyPassword.IsEnabled = true;
- PasswordBoxProxyPassword.Visibility = Visibility.Visible;
- }
- }
-
- private void RadioButtonPasswordLogin_Checked(object sender, RoutedEventArgs e)
- {
- ButtonOpenFileDialog.IsEnabled = false;
- ButtonOpenFileDialog.Visibility = Visibility.Collapsed;
- TextBoxCertFilePath.IsEnabled = false;
- TextBoxCertFilePath.Visibility = Visibility.Collapsed;
- TextBlockCert.Visibility = Visibility.Collapsed;
- TextBlockPassword.Visibility = Visibility.Visible;
- PasswordBoxHostPassword.IsEnabled = true;
- PasswordBoxHostPassword.Visibility = Visibility.Visible;
- }
-
- private void RadioButtonCertLogin_Checked(object sender, RoutedEventArgs e)
- {
- //TextBlockPassword.Text = "密钥:";
- TextBlockCert.Visibility = Visibility.Visible;
- TextBlockPassword.Visibility = Visibility.Collapsed;
- PasswordBoxHostPassword.IsEnabled = false;
- PasswordBoxHostPassword.Visibility = Visibility.Collapsed;
- ButtonOpenFileDialog.IsEnabled = true;
- ButtonOpenFileDialog.Visibility = Visibility.Visible;
- TextBoxCertFilePath.IsEnabled = true;
- TextBoxCertFilePath.Visibility = Visibility.Visible;
- }
-
- private void RadioButtonProxyNoLogin_Checked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyUser.IsEnabled = false;
- TextBlockProxyUser.Visibility = Visibility.Collapsed;
- TextBlockProxyPassword.IsEnabled = false;
- TextBlockProxyPassword.Visibility = Visibility.Collapsed;
- TextBoxProxyUserName.IsEnabled = false;
- TextBoxProxyUserName.Visibility = Visibility.Collapsed;
- PasswordBoxProxyPassword.IsEnabled = false;
- PasswordBoxProxyPassword.Visibility = Visibility.Collapsed;
- }
-
- private void RadiobuttonProxyYesLogin_Checked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyUser.IsEnabled = true;
- TextBlockProxyUser.Visibility = Visibility.Visible;
- TextBlockProxyPassword.IsEnabled = true;
- TextBlockProxyPassword.Visibility = Visibility.Visible;
- TextBoxProxyUserName.IsEnabled = true;
- TextBoxProxyUserName.Visibility = Visibility.Visible;
- PasswordBoxProxyPassword.IsEnabled = true;
- PasswordBoxProxyPassword.Visibility = Visibility.Visible;
- }
- #endregion
-
- //远程主机连接信息
- private ConnectionInfo GenerateConnectionInfo()
- {
- ConnectionInfo connectionInfo;
-
- #region 检测输入的内容是否有错,并读取内容
- if (string.IsNullOrEmpty(PreTrim(TextBoxHost.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxPort.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxUserName.Text)) == true)
- {
- //******"主机地址、主机端口、用户名为必填项,不能为空"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostPortUserNotEmpty").ToString());
-
- return connectionInfo = null;
- }
- string sshHostName = PreTrim(TextBoxHost.Text);
- int sshPort = 22;
-
- if (IsOnlyNumber(PreTrim(TextBoxPort.Text)) == true)
- {
- TextBoxPort.Text = PreTrim(TextBoxPort.Text);
- sshPort = int.Parse(TextBoxPort.Text);
- }
- else
- {
- //******"连接端口含有非数字字符!"******
- MessageBox.Show("Host Port" + Application.Current.FindResource("MessageBoxShow_ErrorHostPortErr").ToString());
- return connectionInfo = null;
- }
-
- string sshUser = PreTrim(TextBoxUserName.Text);
-
- if (RadioButtonPasswordLogin.IsChecked == true && string.IsNullOrEmpty(PasswordBoxHostPassword.Password) == true)
- {
- //****** "登录密码为必填项,不能为空!!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostPasswordNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshPassword = PasswordBoxHostPassword.Password.ToString();
- if (RadioButtonCertLogin.IsChecked == true && string.IsNullOrEmpty(TextBoxCertFilePath.Text) == true)
- {
- //****** "密钥文件为必填项,不能为空!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostKeyNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshPrivateKey = TextBoxCertFilePath.Text.ToString();
- ProxyTypes proxyTypes = new ProxyTypes();//默认为None
-
- //proxyTypes = ProxyTypes.Socks5;
- if (RadioButtonHttp.IsChecked == true)
- {
- proxyTypes = ProxyTypes.Http;
- }
- else if (RadioButtonSocks4.IsChecked == true)
- {
- proxyTypes = ProxyTypes.Socks4;
- }
- else if (RadioButtonSocks5.IsChecked == true)
- {
- proxyTypes = ProxyTypes.Socks5;
- }
- else
- {
- proxyTypes = ProxyTypes.None;
- }
-
- //MessageBox.Show(proxyTypes.ToString());
- if (RadioButtonNoProxy.IsChecked == false && (string.IsNullOrEmpty(PreTrim(TextBoxProxyHost.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxProxyPort.Text)) == true))
- {
- //****** "如果选择了代理,则代理地址与端口不能为空!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorProxyAddressPortNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshProxyHost = PreTrim(TextBoxProxyHost.Text);
-
- int sshProxyPort = 1080;
- if (IsOnlyNumber(PreTrim(TextBoxProxyPort.Text)) == true)
- {
- TextBoxProxyPort.Text = PreTrim(TextBoxProxyPort.Text);
- sshProxyPort = int.Parse(TextBoxProxyPort.Text);
- }
- else
- {
- //******"连接端口含有非数字字符!"******
- MessageBox.Show("Proxy Port" + Application.Current.FindResource("MessageBoxShow_ErrorHostPortErr").ToString());
- return connectionInfo = null;
- }
-
- if (RadioButtonNoProxy.IsChecked == false && RadiobuttonProxyYesLogin.IsChecked == true && (string.IsNullOrEmpty(PreTrim(TextBoxProxyUserName.Text)) == true || string.IsNullOrEmpty(PasswordBoxProxyPassword.Password) == true))
- {
- //****** "如果代理需要登录,则代理登录的用户名与密码不能为空!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorProxyUserPasswordNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshProxyUser = PreTrim(TextBoxProxyUserName.Text);
- string sshProxyPassword = PasswordBoxProxyPassword.Password;
-
- #endregion
-
-
- //var connectionInfo = new PasswordConnectionInfo(sshHostName, sshPort, sshUser, sshPassword);
-
- connectionInfo = new ConnectionInfo(
- sshHostName,
- sshPort,
- sshUser,
- proxyTypes,
- sshProxyHost,
- sshProxyPort,
- sshProxyUser,
- sshProxyPassword,
- new PasswordAuthenticationMethod(sshUser, sshPassword)
- //new PrivateKeyAuthenticationMethod(sshUser, new PrivateKeyFile(sshPrivateKey))
- );
-
- if (RadioButtonCertLogin.IsChecked == true)
- {
- connectionInfo = new ConnectionInfo(
- sshHostName,
- sshPort,
- sshUser,
- proxyTypes,
- sshProxyHost,
- sshProxyPort,
- sshProxyUser,
- sshProxyPassword,
- //new PasswordAuthenticationMethod(sshUser, sshPassword)
- new PrivateKeyAuthenticationMethod(sshUser, new PrivateKeyFile(sshPrivateKey))
- );
-
- }
- return connectionInfo;
- }
-
- //登录主机过程中出现的异常处理
- private void ProcessException(string exceptionMessage)
- {
- //下面代码需要保留,以备将来启用
- //if (exceptionMessage.Contains("连接尝试失败") == true)
- //{
- // //****** "请检查主机地址及端口是否正确,如果通过代理,请检查代理是否正常工作!" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginHostOrPort").ToString());
- //}
-
- //else if (exceptionMessage.Contains("denied (password)") == true)
- //{
- // //****** "密码错误或用户名错误" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginUserOrPassword").ToString());
- //}
- //else if (exceptionMessage.Contains("Invalid private key file") == true)
- //{
- // //****** "所选密钥文件错误或者格式不对!" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginKey").ToString());
- //}
- //else if (exceptionMessage.Contains("denied (publickey)") == true)
- //{
- // //****** "使用密钥登录,密钥文件错误或用户名错误" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginKeyOrUser").ToString());
- //}
- //else if (exceptionMessage.Contains("目标计算机积极拒绝") == true)
- //{
- // //****** "主机地址错误,如果使用了代理,也可能是连接代理的端口错误" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginHostOrProxyPort").ToString());
- //}
- //else
- //{
- //****** "发生错误" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorLoginOccurred").ToString());
- MessageBox.Show(exceptionMessage);
- //}
-
- }
-
-
- #region V2Ray相关
-
- //打开v2ray模板设置窗口
- private void ButtonTemplateConfiguration_Click(object sender, RoutedEventArgs e)
- {
- //清空初始化模板参数
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- WindowTemplateConfiguration windowTemplateConfiguration = new WindowTemplateConfiguration();
- windowTemplateConfiguration.Closed += windowTemplateConfigurationClosed;
- windowTemplateConfiguration.ShowDialog();
- }
-
- //V2Ray模板设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void windowTemplateConfigurationClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlan.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- GridV2rayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- return;
- }
- else
- {
- GridV2rayCurrentlyPlan.Visibility = Visibility.Visible;
- }
- TextBlockCurrentlySelectedPlan.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockCurrentlySelectedPlanPort.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockCurrentlySelectedPlanUUID.Text = ReceiveConfigurationParameters[2]; //UUID
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
- //MessageBox.Show(ReceiveConfigurationParameters[7]);
- TextBlockCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideV2RayPathSeedKey();
- HideVlessVmessXtlsTcpWs();
-
- //隐藏域名/Quic加密方式
- HideV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideV2RayPathSeedKey();
- HideVlessVmessXtlsTcpWs();
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //显示复合方案路径
- ShowVlessVmessXtlsTcpWs();
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- ShowV2RayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideV2RayPathSeedKey();
- HideVlessVmessXtlsTcpWs();
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- ShowV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- //显示Path
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- HideV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- //显示Path
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- ShowV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- //显示Path
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- //显示mKCP Seed
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "mKCP Seed:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- //显示QUIC Key
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "QUIC Key:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示Quic加密方式
- ShowV2RayDomainQuicEncrypt();
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockQuicEncryption").ToString();
- TextBlockCurrentlySelectedPlanDomain.Text = ReceiveConfigurationParameters[3]; //Quic加密方式
- if (String.Equals(TextBlockCurrentlySelectedPlanDomain.Text, "none") == true)
- {
- HideV2RayPathSeedKey();
- }
-
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- }
-
- #region 当前方案界面控制
- //显示端口与UUID
- private void ShowV2RayCurrentPortUUID()
- {
- TextBlockV2RayShowPort.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPort.Visibility = Visibility.Visible;
-
- TextBlockV2RayShowUUID.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUID.Visibility = Visibility.Visible;
- }
-
- //显示Path/mKCP Seed/Quic Key
- private void ShowV2RayPathSeedKey()
- {
- HideVlessVmessXtlsTcpWs();
- TextBlockV2RayShowPathSeedKey.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Visible;
- }
-
- //隐藏Path/mKCP Seed/Quic Key
- private void HideV2RayPathSeedKey()
- {
- TextBlockV2RayShowPathSeedKey.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Hidden;
- }
-
- //显示VLESS VMESS XTLS TCP WS 复合方案
- private void ShowVlessVmessXtlsTcpWs()
- {
- HideV2RayPathSeedKey();
- GridVlessVmessXtlsTcpWs.Visibility = Visibility.Visible;
- TextBlockBoxPathVlessWS.Text = ReceiveConfigurationParameters[3];
- TextBlockBoxPathVmessTcp.Text = ReceiveConfigurationParameters[9];
- TextBlockBoxPathVmessWS.Text = ReceiveConfigurationParameters[6];
- }
-
- //隐藏VLESS VMESS XTLS TCP WS 复合方案
- private void HideVlessVmessXtlsTcpWs()
- {
- GridVlessVmessXtlsTcpWs.Visibility = Visibility.Collapsed;
- }
-
- //显示域名/Quic加密方式
- private void ShowV2RayDomainQuicEncrypt()
- {
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockV2RayDomain").ToString();
- TextBlockCurrentlySelectedPlanDomain.Text = ReceiveConfigurationParameters[4]; //域名
-
- }
-
- //隐藏域名/Quic加密方式
- private void HideV2RayDomainQuicEncrypt()
- {
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- }
- //显示伪装网站
- private void ShowV2RayMaskSites()
- {
- TextBlockV2RayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Visible;
- }
-
- //隐藏伪装网站
- private void HideV2RayMaskSites()
- {
- TextBlockV2RayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- }
- #endregion
-
- //传送V2Ray模板参数,启动V2Ray安装进程
- private void Button_Login_Click(object sender, RoutedEventArgs e)
-
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
-
- //生成客户端配置时,连接的服务主机的IP或者域名
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);
- testDomain = false;
- }
- //选择模板
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || ReceiveConfigurationParameters[0].Contains("mKCP") == true
- || ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- testDomain = false;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- testDomain = true;
-
- }
-
-
- //Thread thread
- //SetUpProgressBarProcessing(0); //重置安装进度
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- //Thread thread = new Thread(() => StartSetUpV2ray(connectionInfo, TextBlockSetUpProcessing, ProgressBarSetUpProcessing));
- Thread thread = new Thread(() => StartSetUpV2ray(connectionInfo));
-
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
-
-
- }
-
- //登录远程主机布署V2ray程序
- private void StartSetUpV2ray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- //Thread.Sleep(3000);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "v2ray", @"/usr/local/bin/v2ray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测系统是否符合安装要求 11--30
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测校对时间 31--33
- functionResult = CheckProofreadingTime(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名解析是否正确 34---36
- if (testDomain == true)
- {
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
-
- //下载安装脚本安装 37--40
- functionResult = ProxySoftInstall(client, @"V2Ray", @"https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh");
- //functionResult = ProxySoftInstallV2ray(client, @"V2Ray", @"https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh");
-
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //functionResult = V2RayInstallScript(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //生成服务端配置 44--46
- functionResult = GenerateServerConfigurationV2Ray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传配置文件......" ****** 47--50
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
- string serverRemoteConfig = @"/usr/local/etc/v2ray/config.json";
- UploadConfig(connectionInfo, @"config.json", serverRemoteConfig);
- File.Delete(@"config.json");
- SetUpProgressBarProcessing(50);
-
- //如果使用http2/WebSocketTLS/tcpTLS/VlessTcpTlsWeb/VLESS+TCP+XTLS+Web模式,先要安装acme.sh,申请证书
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装acme.sh与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //安装证书到V2Ray 58--60
- functionResult = CertInstallToV2ray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
-
- #region Caddy安装 61--70
-
- //如果是VLESS+TCP+XTLS+Web/VLESS+TCP+TLS+Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web/WebSocket+TLS+Web/http2Web模式,需要安装Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装Caddy 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #region 上传Caddy配置文件 67--70
-
- //******"上传Caddy配置文件"******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string serverConfig = "";
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\v2ray\caddy\vlessTcpTlsWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\v2ray\caddy\WebSocketTLSWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\v2ray\caddy\Http2Web.caddyfile";
- }
-
- string upLoadPath = "/etc/caddy/Caddyfile";
- client.RunCommand("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak");
- UploadConfig(connectionInfo, serverConfig, upLoadPath);
-
- functionResult = FileCheckExists(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false)
- {
- //****** "Caddy配置文件上传失败!" ******32
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- FunctionResultErr();
- client.Disconnect();
- return;
- }
-
- //****** "Caddy配置文件上传成功,OK!" ******32
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #endregion
-
- //启动Caddy服务
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
- #endregion
-
- //****** "正在启动V2ray......" ******35
- functionResult = SoftStartDetect(client, "v2ray", @"/usr/local/bin/v2ray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //测试BBR条件,若满足提示是否启用
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //生成客户端配置 96--98
- functionResult = GenerateClientConfigurationV2Ray();
-
- //****** "V2Ray安装成功,祝你玩的愉快!!" ******40
- SetUpProgressBarProcessing(100);
- currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(1000);
-
- //显示服务端连接参数
- proxyType = "V2Ray";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
-
- return;
-
- }
- }
- catch (Exception ex1)//例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
-
- #region V2Ray专用调用函数
- //安装代理程序 37--40
- //functionResult = ProxySoftInstall(client,@"",@"");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool ProxySoftInstallV2ray(SshClient client, string proxyName, string downloadUrl)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "正在安装{proxyName}......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} {downloadUrl}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
-
- }
- sshShellCommand = $"yes | bash {saveShellScriptFileName} --version v4.32.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- }
-
-
- //生成V2Ray服务端配置 44--46
- //functionResult = GenerateServerConfiguration(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateServerConfigurationV2Ray(SshClient client)
- {
- SetUpProgressBarProcessing(44);
- //修改v2ray.service
-
- sshShellCommand = $"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/v2ray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/v2ray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/v2ray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl daemon-reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备用下载地址:https://raw.githubusercontent.com/proxysu/Resources/master/v2ray/v2ray.service
-
- //sshShellCommand = $"yes | curl -o /etc/systemd/system/v2ray.service https://raw.githubusercontent.com/proxysu/Resources/master/v2ray/v2ray.service";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备份原来的文件
- functionResult = FileCheckExists(client, @"/usr/local/etc/v2ray/config.json");
- if (functionResult == true)
- {
-
- sshShellCommand = @"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- //读取配置文件各个模块
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\base.json";
-
- //配置文件模块合成
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["reverse"] = jObjectJson["reverse"];
- }
-
- //依据安装模式读取相应模板
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcp_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcp_http_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcp_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcpTLSselfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_tcp_xtls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_tcp_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_ws_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_http2_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_vmess_xtls_tcp_websocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\webSocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\WebSocket_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\WebSocketTLS_selfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\WebSocketTLSWeb_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\http2_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\Http2Web_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\Http2selfSigned_server_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_mkcp_server_config.json";
- }
- else
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\mkcp_server_config.json";
- }
-
- }
-
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\quic_server_config.json";
- }
-
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJsonTmp = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- var jObjectJson = (dynamic)jObjectJsonTmp;
-
- //Padavan路由固件服务端设置(因为客户端分流有问题所以在服务端弥补)加上后会影响一定的速度
-
- //string sniffingAddServer = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\00_padavan_router.json";
- //using (StreamReader readerSniffingJson = File.OpenText(sniffingAddServer))
- //{
- // JObject jObjectSniffingJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerSniffingJson));
- // jObjectJson["inbounds"][0]["sniffing"] = jObjectSniffingJson["sniffing"];
- //}
-
- //设置uuid
- jObjectJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //除WebSocketTLSWeb/http2Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web模式外设置监听端口
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "http2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == false)
- {
- jObjectJson["inbounds"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- }
-
- //设置VLESS协议的回落端口,指向Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- }
- //设置VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web协议
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][1]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- //设置其他模式的UUID
- jObjectJson["inbounds"][1]["settings"]["clients"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][2]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][3]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][4]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //设置Vless回落与分流的Path
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][1]["path"] = ReceiveConfigurationParameters[3];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][2]["path"] = ReceiveConfigurationParameters[9];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][3]["path"] = ReceiveConfigurationParameters[6];
-
- //设置Vless ws Path
- jObjectJson["inbounds"][2]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
- //设置Vmess tcp Path
- jObjectJson["inbounds"][3]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
- //设置Vmess ws Path
- jObjectJson["inbounds"][4]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- }
-
- //TLS自签证书/WebSocketTLS(自签证书)/http2自签证书模式下,使用v2ctl 生成自签证书
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- string selfSignedCa = client.RunCommand("/usr/local/bin/v2ctl cert --ca").Result;
- JObject selfSignedCaJObject = JObject.Parse(selfSignedCa);
- jObjectJson["inbounds"][0]["streamSettings"]["tlsSettings"]["certificates"][0] = selfSignedCaJObject;
- }
-
- //如果是WebSocketTLSWeb/WebSocketTLS/WebSocketTLS(自签证书)/VLESS+WebSocket+TLS+Web模式,则设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2/http2Web/http2自签/VLESS+http2+TLS+Web模式下,设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2+Web/VLESS+http2+TLS+Web模式下,设置host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //mkcp模式下,设置伪装类型
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //quic模式下设置伪装类型及密钥
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
-
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
- SetUpProgressBarProcessing(46);
- return true;
- }
-
- //安装证书到V2Ray 58--60
- //functionResult = CertInstallToV2ray(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CertInstallToV2ray(SshClient client)
- {
- //****** "安装证书到V2ray......" ******26
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "V2ray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mkdir -p /usr/local/etc/v2ray/ssl";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/v2ray/ssl/v2ray_ssl.crt --keypath /usr/local/etc/v2ray/ssl/v2ray_ssl.key --capath /usr/local/etc/v2ray/ssl/v2ray_ssl.crt --reloadcmd \"systemctl restart v2ray\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/v2ray/ssl/v2ray_ssl.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到V2ray!" ******27
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "V2Ray!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到V2ray失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "V2Ray" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- //设置私钥权限
- sshShellCommand = @"chmod 644 /usr/local/etc/v2ray/ssl/v2ray_ssl.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- return true;
- }
-
- //生成V2Ray客户端配置 96--98
- //functionResult = GenerateClientConfiguration();
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateClientConfigurationV2Ray()
- {
- //****** "生成客户端配置......" ******39
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\base.json";
- //Thread.Sleep(1000);
- if (!Directory.Exists("v2ray_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("v2ray_config");//创建该文件夹
- }
-
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["reverse"] = jObjectJson["reverse"];
- }
-
- //根据不同的安装方案,选择相应的客户端模板
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- //根据选择的不同模式,选择相应的配置文件
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcp_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcp_http_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcp_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcpTLSselfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_ws_tls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_http2_tls_server_config.json";
- }
-
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\webSocket_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocket_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocketTLS_selfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\http2_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\Http2Web_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\Http2selfSigned_client_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_mkcp_client_config.json";
- }
- else
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\mkcp_client_config.json";
- }
-
- }
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\quic_client_config.json";
- }
-
-
- //读取"相应模板的outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
-
- //设置WebSocket模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2+TLS+Web/VLESS+http2+TLS+Web模式下的host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //设置VLESS+TCP+XTLS+Web模式下的serverName
- //if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- //{
- // jObjectJson["outbounds"][0]["streamSettings"]["xtlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
- //}
-
- //设置mkcp
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //设置QUIC
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
-
- }
-
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
-
- #endregion
-
- }
- else
- {
- //复合方案所需要的配置文件
- //VLESS over TCP with XTLS模式
- //string outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- //using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- //{
- // JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- // //设置客户端的地址/端口/id
- // jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- // jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- // jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- // clientJson["outbounds"] = jObjectJson["outbounds"];
- // if (!Directory.Exists(@"v2ray_config\vless_tcp_xtls_client_config"))//如果不存在就创建file文件夹
- // {
- // Directory.CreateDirectory(@"v2ray_config\vless_tcp_xtls_client_config");//创建该文件夹
- // }
- // using (StreamWriter sw = new StreamWriter(@"v2ray_config\vless_tcp_xtls_client_config\config.json"))
- // {
- // sw.Write(clientJson.ToString());
- // }
- //}
-
- //VLESS over TCP with TLS模式
- string outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vless_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vless_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vless_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VLESS over WS with TLS 模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_ws_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vless_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vless_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vless_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vmess_tcp_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vmess_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vmess_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vmess_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over WS with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vmess_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vmess_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vmess_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //Trojan over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\trojan_tcp_tls.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\trojan_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\trojan_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\trojan_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- }
- }
- SetUpProgressBarProcessing(98);
- return true;
- }
-
-
- #endregion
-
- //检测升级远程主机端的V2Ray版本
- private void ButtonUpdateV2ray_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => UpdateV2ray(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级V2ray主程序
- private void UpdateV2ray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装V2ray......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......";
- MainWindowsShowInfo(currentStatus);
-
- //Thread.Sleep(1000);
- //检测是否安装V2Ray
- //sshShellCommand = @"find / -name v2ray";
- //sshShellCommand = @"if [[ -f /usr/local/bin/v2ray ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装V2ray"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "V2Ray!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
-
- }
-
- //sshcmd = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string v2rayCurrentVersion = currentShellCommandResult;//不含字母v
-
- //sshcmd = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -s ""https://api.github.com/repos/v2fly/v2ray-core/releases/latest"" --connect-timeout 10| grep 'tag_name' | cut -d\"" -f4";
- sshShellCommand = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -s ""https://api.github.com/repos/v2fly/v2ray-core/releases/latest"" --connect-timeout 10 | grep 'tag_name' | cut -d\"" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string v2rayNewVersion = currentShellCommandResult;//包含字母v
-
- if (v2rayNewVersion.Contains(v2rayCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{v2rayCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{v2rayNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.RunCommand(@"bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
- sshShellCommand = $"bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- //sshcmd = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- v2rayCurrentVersion = currentShellCommandResult;//不含字母v
- if (v2rayNewVersion.Contains(v2rayCurrentVersion) == true)
- {
- //****** "升级成功!当前已是最新版本!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString());
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString());
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{v2rayNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
- #endregion
-
- #region Xray相关
- //打开Xray模板设置窗口
- private void ButtonTemplateConfigurationXray_Click(object sender, RoutedEventArgs e)
- {
- //清空初始化模板参数
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- XrayWindowTemplateConfiguration XraywindowTemplateConfiguration = new XrayWindowTemplateConfiguration();
- XraywindowTemplateConfiguration.Closed += XraywindowTemplateConfigurationClosed;
- XraywindowTemplateConfiguration.ShowDialog();
- }
-
- //Xay模板设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void XraywindowTemplateConfigurationClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlanXray.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- GridXrayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- return;
- }
- else
- {
- GridXrayCurrentlyPlan.Visibility = Visibility.Visible;
- }
- TextBlockCurrentlySelectedPlanXray.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockCurrentlySelectedPlanPortXray.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockCurrentlySelectedPlanUUIDXray.Text = ReceiveConfigurationParameters[2]; //UUID
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
- //MessageBox.Show(ReceiveConfigurationParameters[7]);
- TextBlockCurrentlySelectedPlanFakeWebsiteXray.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideXayPathSeedKey();
- HideVlessVmessXtlsTcpWsXray();
-
- //隐藏域名/Quic加密方式
- HideXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideXayPathSeedKey();
- HideVlessVmessXtlsTcpWsXray();
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //显示复合方案路径
- ShowVlessVmessXtlsTcpWsXray();
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站
- ShowXayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideXayPathSeedKey();
- HideVlessVmessXtlsTcpWsXray();
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站
- ShowXayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- //显示Path
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- HideXrayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- //显示Path
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站
- ShowXayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- //显示Path
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- //显示mKCP Seed
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "mKCP Seed:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- //显示QUIC Key
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "QUIC Key:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示Quic加密方式
- ShowXrayDomainQuicEncrypt();
- TextBlockXrayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockQuicEncryption").ToString();
- TextBlockCurrentlySelectedPlanDomainXray.Text = ReceiveConfigurationParameters[3]; //Quic加密方式
- if (String.Equals(TextBlockCurrentlySelectedPlanDomain.Text, "none") == true)
- {
- HideXayPathSeedKey();
- }
-
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- }
-
- #region 当前方案界面控制
- //显示端口与UUID
- private void ShowXrayCurrentPortUUID()
- {
- TextBlockXrayShowPort.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortXray.Visibility = Visibility.Visible;
-
- TextBlockXrayShowUUID.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDXray.Visibility = Visibility.Visible;
- }
-
- //显示Path/mKCP Seed/Quic Key
- private void ShowXayPathSeedKey()
- {
- HideVlessVmessXtlsTcpWsXray();
- TextBlockXrayShowPathSeedKey.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Visibility = Visibility.Visible;
- }
-
- //隐藏Path/mKCP Seed/Quic Key
- private void HideXayPathSeedKey()
- {
- TextBlockXrayShowPathSeedKey.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Visibility = Visibility.Hidden;
- }
-
- //显示VLESS VMESS XTLS TCP WS 复合方案
- private void ShowVlessVmessXtlsTcpWsXray()
- {
- HideXayPathSeedKey();
- GridVlessVmessXtlsTcpWsXray.Visibility = Visibility.Visible;
- TextBlockBoxPathVlessWSXray.Text = ReceiveConfigurationParameters[3];
- TextBlockBoxPathVmessTcpXray.Text = ReceiveConfigurationParameters[9];
- TextBlockBoxPathVmessWSXray.Text = ReceiveConfigurationParameters[6];
- }
-
- //隐藏VLESS VMESS XTLS TCP WS 复合方案
- private void HideVlessVmessXtlsTcpWsXray()
- {
- GridVlessVmessXtlsTcpWsXray.Visibility = Visibility.Collapsed;
- }
-
- //显示域名/Quic加密方式
- private void ShowXrayDomainQuicEncrypt()
- {
- TextBlockXrayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomainXray.Visibility = Visibility.Visible;
- TextBlockXrayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockV2RayDomain").ToString();
- TextBlockCurrentlySelectedPlanDomainXray.Text = ReceiveConfigurationParameters[4]; //域名
-
- }
-
- //隐藏域名/Quic加密方式
- private void HideXrayDomainQuicEncrypt()
- {
- TextBlockXrayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomainXray.Visibility = Visibility.Hidden;
- }
- //显示伪装网站
- private void ShowXayMaskSites()
- {
- TextBlockXrayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsiteXray.Visibility = Visibility.Visible;
- }
-
- //隐藏伪装网站
- private void HideXrayMaskSites()
- {
- TextBlockXrayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsiteXray.Visibility = Visibility.Hidden;
- }
- #endregion
-
- //传送Xray模板参数,启动Xray安装进程
- private void ButtonXraySetUP_Click(object sender, RoutedEventArgs e)
-
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
-
- //生成客户端配置时,连接的服务主机的IP或者域名
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);
- testDomain = false;
- }
- //选择模板
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || ReceiveConfigurationParameters[0].Contains("mKCP") == true
- || ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- testDomain = false;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- testDomain = true;
-
- }
-
-
- //Thread thread
- //SetUpProgressBarProcessing(0); //重置安装进度
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- //Thread thread = new Thread(() => StartSetUpXray(connectionInfo, TextBlockSetUpProcessing, ProgressBarSetUpProcessing));
- Thread thread = new Thread(() => StartSetUpXray(connectionInfo));
-
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
-
-
- }
-
- //登录远程主机布署Xray程序
- private void StartSetUpXray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- //Thread.Sleep(3000);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "xray", @"/usr/local/bin/xray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测系统是否符合安装要求 11--30
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测校对时间 31--33
- functionResult = CheckProofreadingTime(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名解析是否正确 34---36
- if (testDomain == true)
- {
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
-
- //下载安装脚本安装 37--40
- //functionResult = ProxySoftInstall(client, @"Xray", @"https://raw.githubusercontent.com/v2fly/fhs-install-Xray/master/install-release.sh");
- functionResult = ProxySoftInstall(client, @"Xray", @"https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh");
-
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //functionResult = XrayInstallScript(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "xray", @"/usr/local/bin/xray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //生成服务端配置 44--46
- functionResult = GenerateServerConfigurationXray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传配置文件......" ****** 47--50
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
- string serverRemoteConfig = @"/usr/local/etc/xray/config.json";
- UploadConfig(connectionInfo, @"config.json", serverRemoteConfig);
- File.Delete(@"config.json");
- SetUpProgressBarProcessing(50);
-
- //如果使用http2/WebSocketTLS/tcpTLS/VlessTcpTlsWeb/VLESS+TCP+XTLS+Web模式,先要安装acme.sh,申请证书
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装acme.sh与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //安装证书到Xray 58--60
- functionResult = CertInstallToXray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
-
- #region Caddy安装 61--70
-
- //如果是VLESS+TCP+XTLS+Web/VLESS+TCP+TLS+Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web/WebSocket+TLS+Web/http2Web模式,需要安装Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装Caddy 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #region 上传Caddy配置文件 67--70
-
- //******"上传Caddy配置文件"******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string serverConfig = "";
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\xray\caddy\vlessTcpTlsWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\xray\caddy\WebSocketTLSWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\xray\caddy\Http2Web.caddyfile";
- }
-
- string upLoadPath = "/etc/caddy/Caddyfile";
- client.RunCommand("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak");
- UploadConfig(connectionInfo, serverConfig, upLoadPath);
-
- functionResult = FileCheckExists(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false)
- {
- //****** "Caddy配置文件上传失败!" ******32
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- FunctionResultErr();
- client.Disconnect();
- return;
- }
-
- //****** "Caddy配置文件上传成功,OK!" ******32
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #endregion
-
- //启动Caddy服务
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
- #endregion
-
- //****** "正在启动Xray......" ******35
- functionResult = SoftStartDetect(client, "xray", @"/usr/local/bin/xray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //测试BBR条件,若满足提示是否启用
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //生成客户端配置 96--98
- functionResult = GenerateClientConfigurationXray();
-
- //****** "Xray安装成功,祝你玩的愉快!!" ******40
- SetUpProgressBarProcessing(100);
- currentStatus = "Xray" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(1000);
-
- //显示服务端连接参数
- proxyType = "Xray";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
-
- return;
-
- }
- }
- catch (Exception ex1)//例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
-
- #region Xray专用调用函数
- //安装代理程序 37--40
- //functionResult = ProxySoftInstall(client,@"",@"");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- /* private bool ProxySoftInstallV2ray(SshClient client, string proxyName, string downloadUrl)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "正在安装{proxyName}......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} {downloadUrl}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
-
- }
- sshShellCommand = $"yes | bash {saveShellScriptFileName} --version v4.32.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- } */
-
-
- //生成Xray服务端配置 44--46
- //functionResult = GenerateServerConfiguration(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateServerConfigurationXray(SshClient client)
- {
- SetUpProgressBarProcessing(44);
- //修改xray.service
-
- sshShellCommand = $"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/xray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/xray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/xray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl daemon-reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备用下载地址:https://raw.githubusercontent.com/proxysu/Resources/master/xray/xray.service
-
- //sshShellCommand = $"yes | curl -o /etc/systemd/system/xray.service https://raw.githubusercontent.com/proxysu/Resources/master/xray/xray.service";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备份原来的文件
- functionResult = FileCheckExists(client, @"/usr/local/etc/xray/config.json");
- if (functionResult == true)
- {
-
- sshShellCommand = @"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- //读取配置文件各个模块
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\base.json";
-
- //配置文件模块合成
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["reverse"] = jObjectJson["reverse"];
- }
-
- //依据安装模式读取相应模板
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcp_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcp_http_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcp_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcpTLSselfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_tcp_xtls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_tcp_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_ws_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_http2_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_vmess_xtls_tcp_websocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\webSocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\WebSocket_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\WebSocketTLS_selfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\WebSocketTLSWeb_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\http2_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\Http2Web_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\Http2selfSigned_server_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_mkcp_server_config.json";
- }
- else
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\mkcp_server_config.json";
- }
-
- }
-
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\quic_server_config.json";
- }
-
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJsonTmp = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- var jObjectJson = (dynamic)jObjectJsonTmp;
-
- //Padavan路由固件服务端设置(因为客户端分流有问题所以在服务端弥补)加上后会影响一定的速度
-
- //string sniffingAddServer = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\00_padavan_router.json";
- //using (StreamReader readerSniffingJson = File.OpenText(sniffingAddServer))
- //{
- // JObject jObjectSniffingJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerSniffingJson));
- // jObjectJson["inbounds"][0]["sniffing"] = jObjectSniffingJson["sniffing"];
- //}
-
- //设置uuid
- jObjectJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //除WebSocketTLSWeb/http2Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web模式外设置监听端口
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "http2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == false)
- {
- jObjectJson["inbounds"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- }
-
- //设置VLESS协议的回落端口,指向Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- }
- //设置VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web协议
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][1]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- //设置其他模式的UUID
- jObjectJson["inbounds"][1]["settings"]["clients"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][2]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][3]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][4]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //设置Vless回落与分流的Path
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][1]["path"] = ReceiveConfigurationParameters[3];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][2]["path"] = ReceiveConfigurationParameters[9];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][3]["path"] = ReceiveConfigurationParameters[6];
-
- //设置Vless ws Path
- jObjectJson["inbounds"][2]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
- //设置Vmess tcp Path
- jObjectJson["inbounds"][3]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
- //设置Vmess ws Path
- jObjectJson["inbounds"][4]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- }
-
- //TLS自签证书/WebSocketTLS(自签证书)/http2自签证书模式下,使用v2ctl 生成自签证书
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- string selfSignedCa = client.RunCommand("/usr/local/bin/xray tls cert --ca").Result;
- JObject selfSignedCaJObject = JObject.Parse(selfSignedCa);
- jObjectJson["inbounds"][0]["streamSettings"]["tlsSettings"]["certificates"][0] = selfSignedCaJObject;
- }
-
- //如果是WebSocketTLSWeb/WebSocketTLS/WebSocketTLS(自签证书)/VLESS+WebSocket+TLS+Web模式,则设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2/http2Web/http2自签/VLESS+http2+TLS+Web模式下,设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2+Web/VLESS+http2+TLS+Web模式下,设置host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //mkcp模式下,设置伪装类型
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //quic模式下设置伪装类型及密钥
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
-
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
- SetUpProgressBarProcessing(46);
- return true;
- }
-
- //安装证书到Xray 58--60
- //functionResult = CertInstallToXray(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CertInstallToXray(SshClient client)
- {
- //****** "安装证书到Xray......" ******26
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mkdir -p /usr/local/etc/xray/ssl";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/xray/ssl/xray_ssl.crt --keypath /usr/local/etc/xray/ssl/xray_ssl.key --capath /usr/local/etc/xray/ssl/xray_ssl.crt --reloadcmd \"systemctl restart xray\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/xray/ssl/xray_ssl.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到Xray!" ******27
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "Xray!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到Xray失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "Xray" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- //设置私钥权限
- sshShellCommand = @"chmod 644 /usr/local/etc/xray/ssl/xray_ssl.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- return true;
- }
-
- //生成Xray客户端配置 96--98
- //functionResult = GenerateClientConfiguration();
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateClientConfigurationXray()
- {
- //****** "生成客户端配置......" ******39
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\base.json";
- //Thread.Sleep(1000);
- if (!Directory.Exists("xray_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("xray_config");//创建该文件夹
- }
-
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["reverse"] = jObjectJson["reverse"];
- }
-
- //根据不同的安装方案,选择相应的客户端模板
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- //根据选择的不同模式,选择相应的配置文件
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcp_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcp_http_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcp_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcpTLSselfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_ws_tls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_http2_tls_server_config.json";
- }
-
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\webSocket_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocket_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocketTLS_selfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\http2_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\Http2Web_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\Http2selfSigned_client_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_mkcp_client_config.json";
- }
- else
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\mkcp_client_config.json";
- }
-
- }
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\quic_client_config.json";
- }
-
-
- //读取"相应模板的outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
-
- //设置WebSocket模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2+TLS+Web/VLESS+http2+TLS+Web模式下的host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //设置VLESS+TCP+XTLS+Web模式下的serverName
- //if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- //{
- // jObjectJson["outbounds"][0]["streamSettings"]["xtlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
- //}
-
- //设置mkcp
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //设置QUIC
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
-
- }
-
- using (StreamWriter sw = new StreamWriter(@"xray_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
-
- #endregion
-
- }
- else
- {
- //复合方案所需要的配置文件
- //VLESS over TCP with XTLS模式
- string outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vless_tcp_xtls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vless_tcp_xtls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vless_tcp_xtls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VLESS over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vless_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vless_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vless_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VLESS over WS with TLS 模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_ws_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vless_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vless_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vless_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vmess_tcp_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vmess_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vmess_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vmess_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over WS with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vmess_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vmess_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vmess_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //Trojan over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\trojan_tcp_tls.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\trojan_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\trojan_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\trojan_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- }
- }
- SetUpProgressBarProcessing(98);
- return true;
- }
-
-
- #endregion
-
- //检测升级远程主机端的Xray版本
- private void ButtonUpdateXray_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => UpdateXray(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级Xray主程序
- private void UpdateXray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装Xray......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- //Thread.Sleep(1000);
- //检测是否安装Xray
- //sshShellCommand = @"find / -name xray";
- //sshShellCommand = @"if [[ -f /usr/local/bin/xray ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/xray") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/xray");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装Xray"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Xray!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
-
- client.Disconnect();
- return;
-
- }
-
- //sshcmd = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string xrayCurrentVersion = currentShellCommandResult;//不含字母v
-
- //sshcmd = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -s ""https://api.github.com/repos/v2fly/xray-core/releases/latest"" --connect-timeout 10| grep 'tag_name' | cut -d\"" -f4";
- sshShellCommand = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -sS ""https://api.github.com/repos/XTLS/Xray-core/releases/latest"" --connect-timeout 10 | grep 'tag_name' | cut -d\"" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string xrayNewVersion = currentShellCommandResult;//包含字母v
-
- if (xrayNewVersion.Contains(xrayCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{xrayCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{xrayNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.RunCommand(@"bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-xray/master/install-release.sh)");
- sshShellCommand = $"bash <(curl -L -s https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh)";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- //sshcmd = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- xrayCurrentVersion = currentShellCommandResult;//不含字母v
- if (xrayNewVersion.Contains(xrayCurrentVersion) == true)
- {
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- }
- }
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{xrayNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- #endregion
-
- #region Trojan-go相关
-
- //打开设置TrojanGo参数窗口
- private void ButtonTrojanGoTemplate_Click(object sender, RoutedEventArgs e)
- {
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- TrojanGoTemplateWindow windowTrojanGoTemplateConfiguration = new TrojanGoTemplateWindow();
- windowTrojanGoTemplateConfiguration.Closed += windowTrojanGoTemplateConfigurationClosed;
- windowTrojanGoTemplateConfiguration.ShowDialog();
- }
- //TrojanGo模板设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void windowTrojanGoTemplateConfigurationClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlan.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- TextBlockTrojanGoShowPort.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPort.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowPassword.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- return;
- }
- TextBlockTrojanGoCurrentlySelectedPlan.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockTrojanGoCurrentlySelectedPlanPort.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Text = ReceiveConfigurationParameters[2]; //UUID
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Text = ReceiveConfigurationParameters[4]; //域名
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoTLS2Web"))
- {
- TextBlockTrojanGoShowPort.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPort.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPassword.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoWebSocketTLS2Web"))
- {
- TextBlockTrojanGoShowPort.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPort.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPassword.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPath.Text = "WebSocket Path:";
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
-
- TextBlockTrojanGoShowPath.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- }
-
- }
-
- //传递TrojanGo参数
- private void ButtonTrojanGoSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- //****** "域名不能为空,请检查相关参数设置!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpTrojanGo(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署Trojan-Go程序
- private void StartSetUpTrojanGo(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "trojan-go", @"/usr/local/bin/trojan-go");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //下载脚本安装Trojan-go 37--40
- functionResult = ProxySoftInstall(client, @"Trojan-go", @"https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //functionResult = TrojanGoInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "trojan-go", @"/usr/local/bin/trojan-go");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //生成Trojan-go服务端配置 44--46
- functionResult = GenerateServerConfigurationTrojanGo(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //上传配置文件
- string upLoadPath = "/usr/local/etc/trojan-go/config.json";
- UploadConfig(connectionInfo, @"config.json", upLoadPath);
- File.Delete(@"config.json");
-
- //acme.sh安装与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "安装证书到Trojan-go......" ******
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/trojan-go/trojan-go.crt --keypath /usr/local/etc/trojan-go/trojan-go.key --capath /usr/local/etc/trojan-go/trojan-go.crt --reloadcmd \"systemctl restart trojan-go\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/trojan-go/trojan-go.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到Trojan-go!" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "Trojan-go!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到Trojan-go失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "Trojan-go" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- client.Disconnect();
- return;
- }
-
- //设置证书权限
- sshShellCommand = @"chmod 644 /usr/local/etc/trojan-go/trojan-go.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //Caddy安装与检测安装是否成功 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\trojan-go\trojan-go.caddyfile";
-
- upLoadPath = "/etc/caddy/Caddyfile";
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序启动检测Trojan-go
- functionResult = SoftStartDetect(client, "trojan-go", @"/usr/local/bin/trojan-go");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (!Directory.Exists("trojan-go_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("trojan-go_config");//创建该文件夹
- }
-
- string clientConfig = $"{pwdir}" + @"TemplateConfg\trojan-go\trojan-go_all_config.json"; //生成的客户端配置文件
-
- using (StreamReader reader = File.OpenText(clientConfig))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- clientJson["run_type"] = "client";
- clientJson["local_addr"] = "127.0.0.1";
- clientJson["local_port"] = 1080;
- clientJson["remote_addr"] = ReceiveConfigurationParameters[4];
- clientJson["remote_port"] = 443;
- //设置密码
- clientJson["password"][0] = ReceiveConfigurationParameters[2];
- clientJson["ssl"]["sni"] = ReceiveConfigurationParameters[4];
- //如果是WebSocket协议则设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoWebSocketTLS2Web"))
- {
- clientJson["websocket"]["enabled"] = true;
- clientJson["websocket"]["path"] = ReceiveConfigurationParameters[6];
- clientJson["websocket"]["host"] = ReceiveConfigurationParameters[4];
- }
- //如果开启了mux,设置客户端配置文件参数
- if (String.Equals(ReceiveConfigurationParameters[9], "true") == true)
- {
- clientJson["mux"]["enabled"] = true;
- clientJson["mux"]["concurrency"] = int.Parse(ReceiveConfigurationParameters[3]);
- clientJson["mux"]["idle_timeout"] = int.Parse(ReceiveConfigurationParameters[5]);
- //if(int.TryParse(ReceiveConfigurationParameters[3],out int value) == true)
- //{
- // clientJson["mux"]["concurrency"] = value;
- //}
- //if (int.TryParse(ReceiveConfigurationParameters[5], out int value2) == true)
- //{
- // clientJson["mux"]["idle_timeout"] = value2;
- //}
- //clientJson["mux"]["idle_timeout"] = int.TryParse(ReceiveConfigurationParameters[5], out int value2);
- //clientJson["mux"]["idle_timeout"] = value2;
- }
-
- using (StreamWriter sw = new StreamWriter(@"trojan-go_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //****** "Trojan-go安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "TrojanGo";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //下载脚本安装Trojan-go 37--40
- //functionResult = TrojanGoInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //private bool TrojanGoInstall(SshClient client)
- //{
- // //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- // SetUpProgressBarProcessing(37);
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- // MainWindowsShowInfo(currentStatus);
-
- // //****** "正在安装Trojan-go......" ******
- // SetUpProgressBarProcessing(38);
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan-go......";
- // MainWindowsShowInfo(currentStatus);
-
- // sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- // functionResult = FileCheckExists(client, @"/tmp/trojan-go.sh");
- // if (functionResult == true)
- // {
- // sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- // sshShellCommand = @"rm -f /tmp/trojan-go.sh";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- // }
- // else
- // {
- // //***安装脚本下载失败!***
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- // MainWindowsShowInfo(currentStatus);
- // return false;
- // }
-
-
- // SetUpProgressBarProcessing(40);
- // return true;
- //}
-
- //生成Trojan-go服务端配置 44--46
- //functionResult = GenerateServerConfigurationTrojanGo(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateServerConfigurationTrojanGo(SshClient client)
- {
- //备份原配置文件
- sshShellCommand = @"mv /etc/trojan-go/config.json /etc/trojan-go/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "安装完毕,上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string serverConfig = $"{pwdir}" + @"TemplateConfg\trojan-go\trojan-go_all_config.json"; //服务端配置文件
- //string upLoadPath = @"/usr/local/etc/trojan-go/config.json"; //服务端文件位置
-
- //生成服务端配置
- using (StreamReader reader = File.OpenText(serverConfig))
- {
- //设置Caddy随机监听的端口,用于Trojan-go,Trojan,V2Ray vless TLS
- //Random random = new Random();
- randomCaddyListenPort = GetRandomPort();
-
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- serverJson["run_type"] = "server";
- serverJson["local_addr"] = "0.0.0.0";
- serverJson["local_port"] = 443;
- serverJson["remote_addr"] = "127.0.0.1";
- serverJson["remote_port"] = randomCaddyListenPort;
- //设置密码
- serverJson["password"][0] = ReceiveConfigurationParameters[2];
- //设置证书
- serverJson["ssl"]["cert"] = "/usr/local/etc/trojan-go/trojan-go.crt";
- serverJson["ssl"]["key"] = "/usr/local/etc/trojan-go/trojan-go.key";
- serverJson["ssl"]["sni"] = ReceiveConfigurationParameters[4];
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoWebSocketTLS2Web"))
- {
- serverJson["websocket"]["enabled"] = true;
- serverJson["websocket"]["path"] = ReceiveConfigurationParameters[6];
- serverJson["websocket"]["host"] = ReceiveConfigurationParameters[4];
- }
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
-
-
- SetUpProgressBarProcessing(46);
- return true;
- }
-
-
- //检测升级Trojan-Go版本传递参数
- private void ButtonUpdateTrojanGo_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- Thread thread = new Thread(() => UpdateTojanGo(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级Trojan-go主程序
- private void UpdateTojanGo(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装Trojan-go......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- //string cmdTestTrojanInstalled = @"find / -name trojan-go";
-
- //sshShellCommand = @"find / -name trojan-go";
- //sshShellCommand = @"if [[ -f /usr/local/bin/trojan-go ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装Trojan-go"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Trojan-go!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
-
- }
- SetUpProgressBarProcessing(40);
- //获取当前安装的版本
- //string sshcmd = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string trojanCurrentVersion = currentShellCommandResult;//含字母v
-
- //获取最新版本
- //sshcmd = @"curl -s https://api.github.com/repos/p4gefau1t/trojan-go/tags | grep 'name' | cut -d\"" -f4 | head -1";
- sshShellCommand = @"curl -s https://api.github.com/repos/p4gefau1t/trojan-go/tags | grep 'name' | cut -d\"" -f4 | head -1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string trojanNewVersion = currentShellCommandResult;//含字母v
-
- if (trojanNewVersion.Equals(trojanCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{trojanCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //备份配置文件
- //sshcmd = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.bak";
- //client.RunCommand(sshcmd);
- //升级Trojan-Go主程序
- //client.RunCommand("curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh");
- //client.RunCommand("yes | bash /tmp/trojan-go.sh -f");
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
-
- //获取升级后的版本
- //sshcmd = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- trojanCurrentVersion = currentShellCommandResult;//含字母v
- if (trojanNewVersion.Equals(trojanCurrentVersion) == true)
- {
- //恢复原来的配置文件备份
- //sshcmd = @"rm -f /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
- //sshcmd = @"mv /usr/local/etc/trojan/config.json.bak /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
-
- //****** "升级成功!当前已是最新版本!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString());
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString());
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
-
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
- #endregion
-
- #region Trojan相关
-
- //Trojan参数传递
- private void ButtonTrojanSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxTrojanSites.Text);
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxTrojanHostDomain.Text);
- //if (string.IsNullOrEmpty(PreTrim(TextBoxTrojanHostDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
- if (domainNotEmpty == false || preDomainMask == false)
- {
- return;
- }
- //传递模板类型
- ReceiveConfigurationParameters[0] = "TrojanTLS2Web";
-
- //传递域名
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxTrojanHostDomain.Text);
- //传递伪装网站
- ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxTrojanSites.Text));
-
- //传递服务端口
- ReceiveConfigurationParameters[1] = "443";
- //传递密码(uuid)
- ReceiveConfigurationParameters[2] = TextBoxTrojanPassword.Text.ToString();
-
- //启动布署进程
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpTrojan(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署Trojan程序
- private void StartSetUpTrojan(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "trojan", @"/usr/local/bin/trojan");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //检测是否为64位系统
- sshShellCommand = @"uname -m";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string resultCmd = currentShellCommandResult;
- if (resultCmd.Contains("x86_64") == false)
- {
- //******"请在x86_64系统中安装Trojan" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_PleaseInstallSoftAtX64").ToString() + "NaiveProxy......");
- //****** "系统环境不满足要求,安装失败!!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_MissingSystemComponents").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //下载安装脚本安装 37-40
- functionResult = ProxySoftInstall(client, @"Trojan", @"https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////****** "正在安装Trojan......" ******
- //SetUpProgressBarProcessing(37);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan......";
- //MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"rm -f /tmp/trojan-quickstart.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "trojan", @"/usr/local/bin/trojan");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "安装完毕,上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string serverConfig = $"{pwdir}" + @"TemplateConfg\trojan\trojan_server_config.json"; //服务端配置文件
- string upLoadPath = @"/usr/local/etc/trojan/config.json"; //服务端文件位置
-
- //生成服务端配置
- using (StreamReader reader = File.OpenText(serverConfig))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //设置密码
- serverJson["password"][0] = ReceiveConfigurationParameters[2];
-
- //设置Caddy随机监听的端口,用于Trojan-go,Trojan,V2Ray vless TLS
- //Random random = new Random();
- randomCaddyListenPort = GetRandomPort();
-
- //设置转发到Caddy的随机监听端口
- serverJson["remote_port"] = randomCaddyListenPort;
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
- UploadConfig(connectionInfo, @"config.json", upLoadPath);
-
- File.Delete(@"config.json");
-
- //acme.sh安装与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "安装证书到Trojan......" ******
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/trojan/trojan_ssl.crt --keypath /usr/local/etc/trojan/trojan_ssl.key --capath /usr/local/etc/trojan/trojan_ssl.crt --reloadcmd \"systemctl restart trojan\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/trojan/trojan_ssl.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到Trojan!" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "Trojan!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到Trojan失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "Trojan" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- //设置证书权限
- sshShellCommand = @"chmod 644 /usr/local/etc/trojan/trojan_ssl.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //Caddy安装 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\trojan\trojan.caddyfile";
- upLoadPath = @"/etc/caddy/Caddyfile";
-
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序启动检测Trojan
- functionResult = SoftStartDetect(client, "trojan", @"/usr/local/bin/trojan");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
- if (!Directory.Exists("trojan_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("trojan_config");//创建该文件夹
- }
-
- string clientConfig = $"{pwdir}" + @"TemplateConfg\trojan\trojan_client_config.json"; //生成的客户端配置文件
- using (StreamReader reader = File.OpenText(clientConfig))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
-
- clientJson["remote_addr"] = ReceiveConfigurationParameters[4];
- clientJson["remote_port"] = int.Parse(ReceiveConfigurationParameters[1]);
- clientJson["password"][0] = ReceiveConfigurationParameters[2];
-
- using (StreamWriter sw = new StreamWriter(@"trojan_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //****** "Trojan安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "Trojan";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //检测升级远程主机Trojan版本传递参数
- private void ButtonUpdateTrojan_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => UpdateTojan(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级Trojan主程序
- private void UpdateTojan(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装Trojan......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
-
- //string cmdTestTrojanInstalled = @"find / -name trojan";
- //string resultCmdTestTrojanInstalled = client.RunCommand(cmdTestTrojanInstalled).Result;
- //sshShellCommand = @"find / -name trojan";
- //sshShellCommand = @"if [[ -f /usr/local/bin/trojan ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装Trojan"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Trojan!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
-
- }
-
- SetUpProgressBarProcessing(40);
-
- //获取当前安装的版本
- //string sshcmd = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- //string trojanCurrentVersion = client.RunCommand(sshcmd).Result;//不含字母v
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string trojanCurrentVersion = currentShellCommandResult;//不含字母v
-
-
- //sshcmd = @"curl -fsSL https://api.github.com/repos/trojan-gfw/trojan/releases/latest | grep tag_name | sed -E 's/.*""v(.*)"".*/\1/'";
- //获取最新版本
-
- sshShellCommand = @"curl -fsSL https://api.github.com/repos/trojan-gfw/trojan/releases/latest | grep tag_name | sed -E 's/.*""v(.*)"".*/\1/'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string trojanNewVersion = currentShellCommandResult;//不含字母v
-
- if (trojanNewVersion.Equals(trojanCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{trojanCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "备份Trojan配置文件......" ******
- SetUpProgressBarProcessing(80);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BackTrojanConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //string sshcmd = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.bak";
- //client.RunCommand(sshcmd);
- sshShellCommand = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //升级Trojan主程序
- //client.RunCommand("curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh");
- //client.RunCommand("yes | bash /tmp/trojan-quickstart.sh");
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshcmd = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- trojanCurrentVersion = currentShellCommandResult;//不含字母v
- //trojanCurrentVersion = client.RunCommand(sshcmd).Result;//不含字母v
- if (trojanNewVersion.Equals(trojanCurrentVersion) == true)
- {
- //****** "恢复Trojan配置文件......" ******
- SetUpProgressBarProcessing(90);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_RestoreTrojanConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //sshcmd = @"rm -f /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
- sshShellCommand = @"rm -f /usr/local/etc/trojan/config.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshcmd = @"mv /usr/local/etc/trojan/config.json.bak /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
- sshShellCommand = @"mv /usr/local/etc/trojan/config.json.bak /usr/local/etc/trojan/config.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString());
- //****** "升级成功!当前已是最新版本!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString());
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
-
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //更新Trojan的密码
- private void ButtonTrojanPassword_Click(object sender, RoutedEventArgs e)
- {
- TextBoxTrojanPassword.Text = RandomUUID();
- }
- #endregion
-
- #region NaiveProxy相关
-
- //NaiveProxy一键安装开始传递参数
- private void ButtonNavieSetUp_Click(object sender, RoutedEventArgs e)
- {
- //if (string.IsNullOrEmpty(PreTrim(TextBoxNaiveHostDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
-
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
-
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxNaiveSites.Text);
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxNaiveHostDomain.Text);
- if (domainNotEmpty == false || preDomainMask == false)
- {
- return;
- }
- //传递参数
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxNaiveHostDomain.Text);//传递域名
- ReceiveConfigurationParameters[1] = "443";//传递端口
- ReceiveConfigurationParameters[3] = TextBoxNaiveUser.Text;//传递用户名
- ReceiveConfigurationParameters[2] = TextBoxNaivePassword.Text;//传递密码
- ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxNaiveSites.Text));//传递伪装网站
-
- //启动布署进程
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpNaive(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署NaiveProxy程序
- private void StartSetUpNaive(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //安装代理程序 37--40
- functionResult = ProxySoftInstall(client,@"NaiveProxy", @"https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- //SetUpProgressBarProcessing(60);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- ////Caddy安装与检测安装是否成功 61--66
- //functionResult = CaddyInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- ////使用带插件的Caddy替换
- ////****** "正在为NaiveProxy升级服务端!" ******
- ////SetUpProgressBarProcessing(76);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNaiveProxy").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = $"curl -o /tmp/caddy.zip https://raw.githubusercontent.com/proxysu/Resources/master/Caddy2/caddy2.zip";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //functionResult = FileCheckExists(client, @"/tmp/caddy.zip");
- //if (functionResult == false)
- //{
- // //***文件下载失败!***
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- // MainWindowsShowInfo(currentStatus);
- // return;
- //}
- //sshShellCommand = @"yes | unzip -o /tmp/caddy.zip";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"chmod +x ./caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"systemctl stop caddy;rm -f /usr/bin/caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"cp caddy /usr/bin/";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"rm -f /tmp/caddy.zip caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- ////****** "升级完毕,OK!" ******
- ////SetUpProgressBarProcessing(79);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNaiveProxyOK").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //生成服务端配置
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\naive\naive_server.caddyfile";
- string upLoadPath = @"/etc/caddy/Caddyfile";
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
- //$"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"
- //$"sed -i 's/##basicauth##/basicauth {ReceiveConfigurationParameters[3]} {ReceiveConfigurationParameters[2]}/' {upLoadPath}"
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- sshShellCommand = $"sed -i 's/##basicauth##/basic_auth {ReceiveConfigurationParameters[3]} {ReceiveConfigurationParameters[2]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/file_server/#file_server/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //string caddyConfig = $"{pwdir}" + @"TemplateConfg\naive\naive_server_config.json";
- //using (StreamReader reader = File.OpenText(caddyConfig))
- //{
- // JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- // serverJson["apps"]["http"]["servers"]["srv0"]["routes"][0]["handle"][0]["auth_user"] = ReceiveConfigurationParameters[3];//----用户名
- // serverJson["apps"]["http"]["servers"]["srv0"]["routes"][0]["handle"][0]["auth_pass"] = ReceiveConfigurationParameters[2]; //----密码
-
- // serverJson["apps"]["http"]["servers"]["srv0"]["routes"][1]["match"][0]["host"][0] = ReceiveConfigurationParameters[4]; //----域名
-
- // serverJson["apps"]["http"]["servers"]["srv0"]["tls_connection_policies"][0]["match"]["sni"][0] = ReceiveConfigurationParameters[4]; //----域名
-
- // serverJson["apps"]["tls"]["automation"]["policies"][0]["subjects"][0] = ReceiveConfigurationParameters[4]; //-----域名
- // serverJson["apps"]["tls"]["automation"]["policies"][0]["issuer"]["email"] = $"user@{ReceiveConfigurationParameters[4]}"; //-----邮箱
- // //保存配置文件
- // using (StreamWriter sw = new StreamWriter(@"config.json"))
- // {
- // sw.Write(serverJson.ToString());
- // }
- //}
- //string upLoadPath = @"/etc/caddy/config.json";
- //UploadConfig(connectionInfo, @"config.json", upLoadPath);
-
- //File.Delete(@"config.json");
-
- //****** Caddy配置文件上传成功,OK! ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"sed -i 's/Caddyfile/config.json/' /lib/systemd/system/caddy.service";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"systemctl daemon-reload";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////设置伪装网站
- //if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false)
- //{
- // sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}";
- // //MessageBox.Show(sshCmd);
- // client.RunCommand(sshCmd);
- //}
- //Thread.Sleep(2000);
-
- //****** "正在优化网络参数......" ******
- SetUpProgressBarProcessing(80);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OptimizeNetwork").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //优化网络参数
- sshShellCommand = @"bash -c 'echo ""fs.file-max = 51200"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.rmem_max = 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.wmem_max = 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.rmem_default = 65536"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.wmem_default = 65536"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.netdev_max_backlog = 4096"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.somaxconn = 4096"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_syncookies = 1"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_tw_reuse = 1"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_tw_recycle = 0"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_fin_timeout = 30"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_keepalive_time = 1200"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.ip_local_port_range = 10000 65000"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_max_syn_backlog = 4096"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_max_tw_buckets = 5000"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_rmem = 4096 87380 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_wmem = 4096 65536 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_mtu_probing = 1"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl -p";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "优化网络参数,OK!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OptimizeNetworkOK").ToString(); ;
- MainWindowsShowInfo(currentStatus);
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (!Directory.Exists("naive_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("naive_config");//创建该文件夹
- }
-
- string clientConfig = $"{pwdir}" + @"TemplateConfg\naive\naive_client_config.json"; //生成的客户端配置文件
- using (StreamReader reader = File.OpenText(clientConfig))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
-
- clientJson["proxy"] = $"https://{ReceiveConfigurationParameters[3]}:{ReceiveConfigurationParameters[2]}@{ReceiveConfigurationParameters[4]}";
- using (StreamWriter sw = new StreamWriter(@"naive_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
-
- //****** "NaiveProxy安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "NaiveProxy";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //更新NaiveProxy的密码
- private void ButtonNaivePassword_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNaivePassword.Text = RandomUUID();
- }
-
- //生成随机UUID
- private string RandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- //TextBoxNaivePassword.Text = uuid.ToString();
- return uuid.ToString();
- }
-
- //NaiveProxy产生随机用户名
- private string RandomUserName()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- Guid uuid = Guid.NewGuid();
- string[] pathArray = uuid.ToString().Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- // TextBoxPath.Text = $"/{path}";
- //MessageBox.Show(path);
- }
-
- //NaiveProxy更改用户名,随机方式
- private void ButtonNaiveUser_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNaiveUser.Text = RandomUserName();
- }
-
- #endregion
-
- #region SSR+TLS+Caddy相关
-
- //SSR参数传递
- private void ButtonSSRSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
-
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxSSRHostDomain.Text);
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxSSRSites.Text);
- if (domainNotEmpty == false || preDomainMask == false)
- {
- return;
- }
- //if (string.IsNullOrEmpty(PreTrim(TextBoxSSRHostDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
-
- //传递域名
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxSSRHostDomain.Text);
- //传递伪装网站
- ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxSSRSites.Text));
-
- //传递服务端口
- ReceiveConfigurationParameters[1] = "443";
- //传递密码(uuid)
- ReceiveConfigurationParameters[2] = TextBoxSSRPassword.Text.ToString();
-
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpSSR(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署SSR+TLS+Caddy程序
- private void StartSetUpSSR(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "server.py", @"/usr/local/shadowsocks/server.py");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //下载脚本安装SSR 37--40
- functionResult = ProxySoftInstall(client, @"SSR", @"https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- //SetUpProgressBarProcessing(37);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- ////下载安装脚本安装
- ////****** "正在安装SSR......" ******
- //SetUpProgressBarProcessing(38);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SSR......";
- //MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = $"curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"yes | bash /tmp/ssr.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"rm -f /tmp/ssr.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "server.py", @"/usr/local/shadowsocks/server.py");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "安装完毕,上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //生成服务端配置
- string upLoadPath = @"/etc/shadowsocks.json";
-
- //设置指向Caddy监听的随机端口
- randomCaddyListenPort = GetRandomPort();
- string randomSSRListenPortStr = randomCaddyListenPort.ToString();
-
- sshShellCommand = $"sed -i 's/8800/{randomSSRListenPortStr}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置密码
- sshShellCommand = $"sed -i 's/##password##/{ReceiveConfigurationParameters[2]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //Caddy安装与检测安装是否成功 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\ssr\ssr_tls.caddyfile";
- upLoadPath = @"/etc/caddy/Caddyfile";
-
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
-
- functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序启动检测SSR
- functionResult = SoftStartDetect(client, "ssr", @"/usr/bin/ssr");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (!Directory.Exists("ssr_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("ssr_config");//创建该文件夹
- }
-
-
- //****** "SSR+TLS+Caddy安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "SSR+TLS+Caddy" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "SSR";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //更新SSR的密码
- private void ButtonSSRPassword_Click(object sender, RoutedEventArgs e)
- {
- TextBoxSSRPassword.Text = RandomUUID();
- }
-
-
- #endregion
-
- #region SS相关
-
- //打开SS Plugin设置窗口
- private void ButtonTemplateConfigurationSS_Click(object sender, RoutedEventArgs e)
- {
- //清空初始化模板参数
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- SSpluginWindow windowTemplateConfigurationSS = new SSpluginWindow();
- windowTemplateConfigurationSS.Closed += windowTemplateConfigurationSSClosed;
- windowTemplateConfigurationSS.ShowDialog();
- }
- //SS Plugin设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void windowTemplateConfigurationSSClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlanSS.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- TextBlockShowPortSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Hidden;
-
- TextBlockShowUUIDSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Hidden;
-
- TextBlockShowMethodSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Hidden;
-
- TextBlockShowDomainSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Hidden;
-
- TextBlockShowPathSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Hidden;
-
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- return;
- }
- TextBlockCurrentlySelectedPlanSS.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockCurrentlySelectedPlanPortSS.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockCurrentlySelectedPlanUUIDSS.Text = ReceiveConfigurationParameters[2]; //密码
- TextBlockCurrentlySelectedPlanMethodSS.Text = ReceiveConfigurationParameters[3]; //加密方法
- TextBlockCurrentlySelectedPlanDomainSS.Text = ReceiveConfigurationParameters[4]; //域名
- TextBlockCurrentlySelectedPlanPathSS.Text = ReceiveConfigurationParameters[6]; //WebSocket Path
- TextBlockCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "NonePluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS")
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketSS")
- || String.Equals(ReceiveConfigurationParameters[0], "KcptunPluginSS")
- )
- {
- //显示端口
- TextBlockShowPortSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Visible;
- //显示密码
- TextBlockShowUUIDSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Visible;
- //显示加密方式
- TextBlockShowMethodSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Visible;
- //隐藏域名
- TextBlockShowDomainSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Hidden;
- //隐藏WebSocket路径
- TextBlockShowPathSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Hidden;
- //隐藏伪装网站
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsiteSS.Visibility = Visibility.Hidden;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS")
- || String.Equals(ReceiveConfigurationParameters[0], "QuicSS")
- || String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS")
- )
- {
- //显示端口
- TextBlockShowPortSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Visible;
- //显示密码
- TextBlockShowUUIDSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Visible;
- //显示加密方式
- TextBlockShowMethodSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Visible;
- //显示域名
- TextBlockShowDomainSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Visible;
- //隐藏WebSocket路径
- TextBlockShowPathSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Hidden;
- //显示伪装网站
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsiteSS.Visibility = Visibility.Visible;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS"))
- {
- //显示端口
- TextBlockShowPortSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Visible;
- //显示密码
- TextBlockShowUUIDSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Visible;
- //显示加密方式
- TextBlockShowMethodSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Visible;
- //显示域名
- TextBlockShowDomainSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Visible;
- //隐藏WebSocket路径
- TextBlockShowPathSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Visible;
- //显示伪装网站
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsiteSS.Visibility = Visibility.Visible;
- }
-
- }
-
- //传送SS参数,启动SS安装进程
- private void Button_LoginSS_Click(object sender, RoutedEventArgs e)
-
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- //读取模板配置
-
- //生成客户端配置时,连接的服务主机的IP或者域名
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);
- testDomain = false;
- }
- //选择模板
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "NonePluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS")
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketSS")
- || String.Equals(ReceiveConfigurationParameters[0], "KcptunPluginSS")
- )
- {
- testDomain = false;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "QuicSS")
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS")
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS")
- )
- {
- testDomain = true;
- }
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpSS(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
-
- }
-
- //登录远程主机布署SS程序
- private void StartSetUpSS(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "ss-server", @"/usr/local/bin/ss-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //如果使用是TLS模式,需要检测域名解析是否正确
- if (testDomain == true)
- {
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //下载安装脚本安装
- //****** "正在安装SS,使用编译方式,时间稍长,请耐心等待............" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SS," + Application.Current.FindResource("DisplayInstallInfo_ExplainBuildSS").ToString();
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, sshShellCommand);//显示执行的命令
-
- //****** "编译中,请耐心等待............" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_CompilingSS").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread threadWaitSScompile = new Thread(() => MonitorCompileSSprocess());
- threadWaitSScompile.SetApartmentState(ApartmentState.STA);
- threadWaitSScompile.Start();
-
- //开始编译。。。
- currentShellCommandResult = client.RunCommand(sshShellCommand).Result;
- compileSSend = true; //中止显示"**"的线程
- threadWaitSScompile.Abort();
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "ss-server", @"/usr/local/bin/ss-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/shadowsocks-libev/config.json /etc/shadowsocks-libev/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //string getIpv4 = client.RunCommand(@"curl -4 ip.sb").Result;
- //string getIpv6 = client.RunCommand(@"wget -qO- -t1 -T2 ipv6.icanhazip.com").Result;
-
- //生成服务端配置
-
- string serverConfig = $"{pwdir}" + @"TemplateConfg\ss\ss_server_config.json";
- string ssPluginType = "";
- using (StreamReader reader = File.OpenText(serverConfig))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
-
- //设置服务器监听地址
- //if (String.IsNullOrEmpty(getIpv6) == true)
- //{
- serverJson["server"] = "0.0.0.0";
- //}
- //else
- //{
- // JArray serverIp = JArray.Parse(@"[""[::0]"", ""0.0.0.0""]");
- // serverJson["server"] = serverIp;
- //}
-
- //设置密码
- serverJson["password"] = ReceiveConfigurationParameters[2];
- //设置监听端口
- serverJson["server_port"] = int.Parse(ReceiveConfigurationParameters[1]);
- //设置加密方式
- serverJson["method"] = ReceiveConfigurationParameters[3];
- //产生伪装Web的监听端口
- randomCaddyListenPort = GetRandomPort();
-
- string failoverPort = randomCaddyListenPort.ToString();
- //obfs http模式
- if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS") == true)
- {
- serverJson["plugin"] = @"obfs-server";
- serverJson["plugin_opts"] = $"obfs=http;failover=127.0.0.1:{failoverPort}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"obfs-local";
- ReceiveConfigurationParameters[9] = "obfs=http;obfs-host=www.bing.com";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS") == true)
- {
- serverJson["plugin"] = @"obfs-server";
- serverJson["plugin_opts"] = $"obfs=tls;failover=127.0.0.1:{failoverPort}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"obfs-local";
- ReceiveConfigurationParameters[9] = $"obfs=tls;obfs-host={ReceiveConfigurationParameters[4]}";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketSS") == true)
- {
- serverJson["plugin"] = @"v2ray-plugin";
- serverJson["plugin_opts"] = $"server";
- //客户端项
- ReceiveConfigurationParameters[5] = @"v2ray-plugin";
- ReceiveConfigurationParameters[9] = "";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS") == true)
- {
- serverJson["server_port"] = 10000;
- serverJson["plugin"] = @"v2ray-plugin";
- serverJson["plugin_opts"] = $"server;host={ReceiveConfigurationParameters[4]};path={ReceiveConfigurationParameters[6]}";
-
- //客户端项
- ReceiveConfigurationParameters[5] = @"v2ray-plugin";
- ReceiveConfigurationParameters[9] = $"tls;host={ReceiveConfigurationParameters[4]};path={ReceiveConfigurationParameters[6]}";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "QuicSS") == true)
- {
- serverJson["mode"] = "tcp";
- serverJson["plugin"] = @"v2ray-plugin";
- serverJson["plugin_opts"] = $"server;mode=quic;host={ReceiveConfigurationParameters[4]}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"v2ray-plugin";
- ReceiveConfigurationParameters[9] = $"mode=quic;host={ReceiveConfigurationParameters[4]}";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "KcptunPluginSS") == true)
- {
- serverJson["mode"] = "tcp";
- serverJson["plugin"] = @"kcptun-plugin-server";
- serverJson["plugin_opts"] = $"key={ReceiveConfigurationParameters[2]}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"kcptun";
- ReceiveConfigurationParameters[9] = $"key={ReceiveConfigurationParameters[2]}";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS") == true)
- {
- serverJson["plugin"] = @"goquiet-plugin-server";
- serverJson["plugin_opts"] = $"WebServerAddr=127.0.0.1:{failoverPort};Key={ReceiveConfigurationParameters[2]}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"goquiet";
- ReceiveConfigurationParameters[9] = $"ServerName={ReceiveConfigurationParameters[4]};Key={ReceiveConfigurationParameters[2]};Browser=chrome";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS") == true)
- {
- //****** "正在安装 Cloak-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " Cloak-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/cloak-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "cloak-plugin-server", @"/usr/local/bin/cloak-plugin-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- string bypassUID = client.RunCommand(@"/usr/local/bin/cloak-plugin-server -u").Result.TrimEnd('\r', '\n');
- string generateKey = client.RunCommand(@"/usr/local/bin/cloak-plugin-server -k").Result.TrimEnd('\r', '\n');
- string[] keyCloak = generateKey.Split(new char[] { ',' });
- string publicKey = keyCloak[0];
- string privateKey = keyCloak[1];
-
- serverJson["plugin"] = @"cloak-plugin-server";
- serverJson["plugin_opts"] = $"BypassUID={bypassUID};PrivateKey={privateKey};RedirAddr=127.0.0.1:{failoverPort};DatabasePath=/etc/shadowsocks-libev/userinfo.db;StreamTimeout=300";
- //客户端项
- ReceiveConfigurationParameters[5] = @"cloak";
- ReceiveConfigurationParameters[9] = $"UID={bypassUID};PublicKey={publicKey};Transport=direct;ServerName={ReceiveConfigurationParameters[4]};BrowserSig=chrome;NumConn=4;EncryptionMethod=plain;StreamTimeout=300";
-
- }
- ssPluginType = (string)serverJson["plugin"];
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
-
- string upLoadPath = @"/etc/shadowsocks-libev/config.json";
- UploadConfig(connectionInfo, @"config.json", upLoadPath);
-
- File.Delete(@"config.json");
-
- //安装所使用的插件
- if (String.Equals(ssPluginType, "obfs-server"))
- {
- //****** "正在安装 Simple-obfs Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " Simple-obfs Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/obfs-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "obfs-server", @"/usr/local/bin/obfs-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- }
- else if (String.Equals(ssPluginType, "v2ray-plugin"))
- {
- //****** "正在安装 V2Ray-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " V2Ray-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/v2ray-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "v2ray-plugin", @"/usr/local/bin/v2ray-plugin");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- else if (String.Equals(ssPluginType, "kcptun-plugin-server"))
- {
- //****** "正在安装 Kcptun-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " Kcptun-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/kcptun-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "kcptun-plugin-server", @"/usr/local/bin/kcptun-plugin-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- else if (String.Equals(ssPluginType, "goquiet-plugin-server"))
- {
- //****** "正在安装 GoQuiet-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " GoQuiet-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/goquiet-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "goquiet-plugin-server", @"/usr/local/bin/goquiet-plugin-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- else if (String.Equals(ssPluginType, "cloak-plugin-server"))
- {
-
- }
-
-
- //如果使用v2ray-plugin Quic模式,先要安装acme.sh,申请证书
- if (String.Equals(ReceiveConfigurationParameters[0], "QuicSS") == true)
- {
- //acme.sh安装与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
- //如果使用Web伪装网站模式,需要安装Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS") == true
- )
- {
- //Caddy安装 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\ss\ss_obfs_http_web_config.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\ss\ss_tls_caddy_config.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\ss\WebSocketTLSWeb.caddyfile";
- }
-
- upLoadPath = @"/etc/caddy/Caddyfile";
-
- UploadConfig(connectionInfo, serverConfig, upLoadPath);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
- //程序启动检测SS
- functionResult = SoftStartDetect(client, "ss-server", @"/usr/local/bin/ss-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "SS安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "SS" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "SS";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
- }
-
- //编译SS时,中间监视窗口显示"****"不断增长进度,直到编译结束
- private static bool compileSSend = false;
- private void MonitorCompileSSprocess()
- {
- currentShellCommandResult = "**";
- while (compileSSend == false)
- {
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorActionNoWrap, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果
- Thread.Sleep(1000);
- }
- }
-
- #endregion
-
- #region MTProto相关
- //传递参数启动安装进程
- private void ButtonMtgSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- //传递服务器地址
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text); ;
- //传递服务端口
- ReceiveConfigurationParameters[1] = PreTrim(TextBoxMtgHostPort.Text);
- //传递伪装域名
- if (String.IsNullOrEmpty(PreTrim(TextBoxMtgSites.Text)) == true)
- {
- ReceiveConfigurationParameters[7] = "azure.microsoft.com";
- }
- else
- {
- ReceiveConfigurationParameters[7] = PreTrim(TextBoxMtgSites.Text);
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpMtg(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //Mtg安装进程
- private void StartSetUpMtg(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "mtg", @"/usr/local/bin/mtg");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否为64位系统
- sshShellCommand = @"uname -m";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string resultCmd = currentShellCommandResult;
- if (resultCmd.Contains("x86_64") == false)
- {
- //******"请在x86_64系统中安装MTProto" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_PleaseInstallSoftAtX64").ToString() + "MTProto......");
- //****** "系统环境不满足要求,安装失败!!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_MissingSystemComponents").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- //下载安装脚本安装MTProto 37--40
-
- functionResult = MTProtoInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "mtg", @"/usr/local/bin/mtg");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "正在启动MTProto......" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartSoft").ToString() + "MTProto......";
- MainWindowsShowInfo(currentStatus);
-
- //启动MTProto服务
- functionResult = SoftStartDetect(client, "mtg", @"/usr/local/bin/mtg");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(80);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = @"cat /usr/local/etc/mtg.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = currentShellCommandResult;
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- Thread.Sleep(3000);
- sshShellCommand = @"cat /usr/local/etc/mtg_info.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ReceiveConfigurationParameters[9] = currentShellCommandResult;
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[9]) == true)
- {
- Thread.Sleep(3000);
- sshShellCommand = @"cat /usr/local/etc/mtg_info.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ReceiveConfigurationParameters[9] = currentShellCommandResult;
- }
- sshShellCommand = @"pkill mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = @"systemctl restart mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[9]) == true)
- {
- //***客户端配置获取失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GetClientConfigFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- FunctionResultErr();
- client.Disconnect();
- return;
- }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //Thread.Sleep(1000);
- //if (!Directory.Exists("mtproto_config"))//如果不存在就创建file文件夹
- //{
- // Directory.CreateDirectory("mtproto_config");//创建该文件夹
- //}
- //using (StreamWriter sw = new StreamWriter(@"mtproto_config\mtproto_info.json"))
- //{
- // sw.Write(currentShellCommandResult.ToString());
- //}
-
- //****** "MTProto+TLS安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "MTProto+TLS" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "MTProto";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //下载安装脚本安装MTProto 37--40
- //functionResult = MTProtoInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool MTProtoInstall(SshClient client)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //下载安装脚本安装
- //****** "正在安装MTProto......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "MTProto......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/MTProto/mtg_install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName} {ReceiveConfigurationParameters[1]} {ReceiveConfigurationParameters[7]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- }
- #endregion
-
- #region 其他功能函数及系统工具相关
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
- //产生随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
-
- //产生随机字符串
- private string GenerateRandomStr(int length)
- {
- var rand = System.Security.Cryptography.RandomNumberGenerator.Create();
- byte[] bytes = new byte[length*2];
- rand.GetBytes(bytes);
- string randStr = Convert.ToBase64String(bytes);
- randStr = randStr.Replace("+", "").Replace("/", "").Replace("=", "").Substring(0,length);
- //MessageBox.Show(randStr);
- return randStr;
- }
- //生成保存的shell脚本名称
- private string GenerateRandomScriptFileName(string filename)
- {
- return "/tmp/tmp." + filename + ".sh";
- }
- //判断目录是否存在,不存在则创建
- private static bool CheckDir(string folder)
- {
- try
- {
- if (!Directory.Exists(folder))//如果不存在就创建file文件夹
- Directory.CreateDirectory(folder);//创建该文件夹
- return true;
- }
- catch (Exception)
- {
- return false;
- }
- }
-
- //目录已存在则生成序号递增,并返回所创建的目录路径。
- private string CreateConfigSaveDir(string upperDir, string configDir)
- {
- try
- {
- //string saveFileFolderFirst = configDir;
- int num = 1;
- //string saveFileFolder;
- //saveFileFolder = EncodeURIComponent(configDir);
- string saveFileFolder = configDir.Replace(":", "_");
- CheckDir(upperDir);
- while (Directory.Exists(upperDir + @"\" + saveFileFolder) == true)
- {
- saveFileFolder = configDir + "_copy_" + num.ToString();
- num++;
- }
- CheckDir(upperDir + @"\" + saveFileFolder);
- return upperDir + @"\" + saveFileFolder;
- }
- catch (Exception)
- {
- //string saveFileFolder = "";
- //return upperDir + @"\" + saveFileFolder;
- return upperDir;
- }
-
- }
-
-
- //上传配置文件
- private void UploadConfig(ConnectionInfo connectionInfo, string uploadConfig, string upLoadPath)
- {
- try
- {
- using (var sftpClient = new SftpClient(connectionInfo))
- {
- sftpClient.Connect();
- FileStream openUploadConfigFile = File.OpenRead(uploadConfig);
- sftpClient.UploadFile(openUploadConfigFile, upLoadPath, true);
- openUploadConfigFile.Close();
- sftpClient.Disconnect();
- }
-
- }
- catch (Exception ex2)
- {
- MessageBox.Show("sftp" + ex2.ToString());
- //MessageBox.Show("sftp出现未知错误,上传文件失败,请重试!");
- return;
- }
- }
-
- //下载配置文件
- private void DownloadConfig(ConnectionInfo connectionInfo, string localConfigSavePathAndFileName, string remoteConfigPathAndFileName)
- {
- try
- {
- using (var sftpClient = new SftpClient(connectionInfo))
- {
- sftpClient.Connect();
- FileStream createDownloadConfig = File.Open(localConfigSavePathAndFileName, FileMode.Create);
- sftpClient.DownloadFile(remoteConfigPathAndFileName, createDownloadConfig);
- createDownloadConfig.Close();
-
- sftpClient.Disconnect();
- }
-
- }
- catch (Exception ex2)
- {
- MessageBox.Show("sftp" + ex2.ToString());
- //MessageBox.Show("sftp出现未知错误,下载文件失败,请重试!");
- return;
- }
- }
-
- //伪装网站处理
- //private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
-
- ////处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // //MessageBox.Show(testDomain);
- // string[] tmpUrl = fakeUrl.Split('/');
- // //MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
- //return fakeUrl;
- // }
-
- #region 检测系统内核是否符合安装要求
- //private static bool DetectKernelVersion(string kernelVer)
- //{
- // string[] linuxKernelCompared = kernelVer.Split('.');
- // if (int.Parse(linuxKernelCompared[0]) > 2)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},符合安装要求!");
- // return true;
- // }
- // else if (int.Parse(linuxKernelCompared[0]) < 2)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},V2ray要求内核为2.6.23及以上。请升级内核再安装!");
- // return false;
- // }
- // else if (int.Parse(linuxKernelCompared[0]) == 2)
- // {
- // if (int.Parse(linuxKernelCompared[1]) > 6)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},符合安装要求!");
- // return true;
- // }
- // else if (int.Parse(linuxKernelCompared[1]) < 6)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},V2ray要求内核为2.6.23及以上。请升级内核再安装!");
- // return false;
- // }
- // else if (int.Parse(linuxKernelCompared[1]) == 6)
- // {
- // if (int.Parse(linuxKernelCompared[2]) < 23)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},V2ray要求内核为2.6.23及以上。请升级内核再安装!");
- // return false;
- // }
- // else
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},符合安装要求!");
- // return true;
- // }
-
- // }
- // }
- // return false;
-
- //}
- #endregion
-
- //打开系统工具中的校对时间窗口
- private void ButtonProofreadTime_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ProofreadTimeWindow proofreadTimeWindow = new ProofreadTimeWindow();
- ProofreadTimeWindow.ProfreadTimeReceiveConnectionInfo = connectionInfo;
-
- proofreadTimeWindow.ShowDialog();
-
- }
- //释放80/443端口
- private void ButtonClearOccupiedPorts_Click(object sender, RoutedEventArgs e)
- {
- //****** "80/443端口之一,或全部被占用,将强制停止占用80/443端口的程序?" ******
- MessageBoxResult dialogResult = MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorPortUsed").ToString(), "Stop application", MessageBoxButton.YesNo);
- if (dialogResult == MessageBoxResult.No)
- {
- return;
- }
-
- ConnectionInfo testconnect = GenerateConnectionInfo();
- try
- {
- using (var client = new SshClient(testconnect))
- {
- client.Connect();
-
- //检测是否运行在root权限下
- string testRootAuthority = client.RunCommand(@"id -u").Result;
- if (testRootAuthority.Equals("0\n") == false)
- {
- //******"请使用具有root权限的账户登录主机!!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorRootPermission").ToString());
- client.Disconnect();
- return;
- }
- string cmdTestPort;
- string cmdResult;
- cmdTestPort = @"lsof -n -P -i :443 | grep LISTEN";
- cmdResult = client.RunCommand(cmdTestPort).Result;
-
- if (String.IsNullOrEmpty(cmdResult) == false)
- {
-
- string[] cmdResultArry443 = cmdResult.Split(' ');
- client.RunCommand($"systemctl stop {cmdResultArry443[0]}");
- client.RunCommand($"systemctl disable {cmdResultArry443[0]}");
- client.RunCommand($"kill -9 {cmdResultArry443[3]}");
- }
-
- cmdTestPort = @"lsof -n -P -i :80 | grep LISTEN";
- cmdResult = client.RunCommand(cmdTestPort).Result;
- if (String.IsNullOrEmpty(cmdResult) == false)
- {
- string[] cmdResultArry80 = cmdResult.Split(' ');
- client.RunCommand($"systemctl stop {cmdResultArry80[0]}");
- client.RunCommand($"systemctl disable {cmdResultArry80[0]}");
- client.RunCommand($"kill -9 {cmdResultArry80[3]}");
- }
- //****** "80/443端口释放完毕!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ReleasePortOK").ToString());
- client.Disconnect();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- //启用BBR
- private void ButtonTestAndEnableBBR_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartTestAndEnableBBR(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //启用BBR的主要进程
- private void StartTestAndEnableBBR(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- SetUpProgressBarProcessing(30);
- //****** "BBR测试......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"uname -r";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string[] linuxKernelVerStrBBR = currentShellCommandResult.Split('-');
-
- bool detectResultBBR = DetectKernelVersionBBR(linuxKernelVerStrBBR[0]);
-
- sshShellCommand = @"sysctl net.ipv4.tcp_congestion_control | grep bbr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string resultCmdTestBBR = currentShellCommandResult;
- //如果内核满足大于等于4.9,且还未启用BBR,则启用BBR
- if (detectResultBBR == true && resultCmdTestBBR.Contains("bbr") == false)
- {
- SetUpProgressBarProcessing(60);
- //****** "正在启用BBR......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl -p";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else if (resultCmdTestBBR.Contains("bbr") == true)
- {
- SetUpProgressBarProcessing(100);
- //****** "BBR已经启用了!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRisEnabled").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "系统不满足启用BBR的条件,启用失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();//断开服务器ssh连接
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //检测要启用BBR主要的内核版本
- private static bool DetectKernelVersionBBR(string kernelVer)
- {
- string[] linuxKernelCompared = kernelVer.Split('.');
- if (int.Parse(linuxKernelCompared[0]) > 4)
- {
- return true;
- }
- else if (int.Parse(linuxKernelCompared[0]) < 4)
- {
- return false;
- }
- else if (int.Parse(linuxKernelCompared[0]) == 4)
- {
- if (int.Parse(linuxKernelCompared[1]) >= 9)
- {
- return true;
- }
- else if (int.Parse(linuxKernelCompared[1]) < 9)
- {
- return false;
- }
-
- }
- return false;
-
- }
-
- //启动卸载代理
- private void ButtonRemoveAllSoft_Click(object sender, RoutedEventArgs e)
- {
- //******"仅支持卸载由ProxySU安装的代理软件及相关配置,请确保重要配置已备份。不支持卸载使用其他方法或脚本安装的代理。确定要卸载远程主机上的代理软件吗?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_RemoveAllSoft").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
-
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartRemoveProxySoft(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- }
- //卸载代理进程
- private void StartRemoveProxySoft(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- //Thread.Sleep(3000);
- }
-
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- functionResult = FileCheckExists(client, @"/etc/resolv.conf.proxysu");
- if (functionResult == true)
- {
- sshShellCommand = @"mv /etc/resolv.conf.proxysu /etc/resolv.conf ";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- sshShellCommand = @"command -v apt-get";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getApt = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v dnf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getDnf = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v yum";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getYum = !String.IsNullOrEmpty(currentShellCommandResult);
-
- //设置安装软件所用的命令格式
- if (getApt == true)
- {
- sshCmdUpdate = @"apt-get update";
- //sshCmdInstall = @"apt-get -y install ";
- }
- else if (getDnf == true)
- {
- sshCmdUpdate = @"dnf clean all;dnf makecache";
- //sshCmdInstall = @"dnf -y install ";
- }
- else if (getYum == true)
- {
- sshCmdUpdate = @"yum clean all; yum makecache";
- //sshCmdInstall = @"yum -y install ";
- }
-
- //检测主机是否为纯ipv6的主机
- onlyIpv6 = OnlyIpv6HostDetect(client);
-
- //如果未检测到有效的ip,连接就会被断开
- if (client.IsConnected == false)
- {
- return ;
- }
- if (onlyIpv6 == true)
- {
- functionResult = SetUpNat64(client, true);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return ; }
- //SetUpNat64(client, true);
- //sshShellCommand = $"{sshCmdUpdate}";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- //******"开始卸载......"******
- SetUpProgressBarProcessing(10);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString() + "......";
- MainWindowsShowInfo(currentStatus);
-
- #region 卸载V2Ray
-
- //******"检测系统是否已经安装V2ray......"******03
- SetUpProgressBarProcessing(11);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name v2ray";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
- if (functionResult == true)
- {
- //******"检测到已安装V2Ray!开始卸载V2Ray......"******
- SetUpProgressBarProcessing(12);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "V2Ray!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "V2Ray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop v2ray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} --remove";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable v2ray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/v2ray /var/log/v2ray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name v2ray";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
- if (functionResult == true)
- //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
- {
- //******"V2Ray卸载失败!请向开发者问询!"******
- currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"V2Ray卸载成功!"******
- SetUpProgressBarProcessing(16);
- currentStatus ="V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装V2Ray!"******04
- SetUpProgressBarProcessing(16);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "V2Ray!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载Trojan-go
-
- //******"检测系统是否已经安装Trojan-go......"******03
- SetUpProgressBarProcessing(17);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name trojan-go";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
- if (functionResult == true)
- {
- //******"检测到已安装Trojan-go,开始卸载Trojan-go......"******
- SetUpProgressBarProcessing(18);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Trojan-go!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop trojan-go";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} --remove";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable trojan-go";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/trojan-go /var/log/trojan-go";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name trojan-go";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
- if (functionResult == true)
- {
- //******"Trojan-go卸载失败!请向开发者问询!"******
- currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Trojan-go卸载成功!"******
- SetUpProgressBarProcessing(22);
- currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Trojan-go!"******04
- SetUpProgressBarProcessing(22);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Trojan-go!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载Trojan
-
- //******"检测系统是否已经安装Trojan......"******03
- SetUpProgressBarProcessing(23);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name trojan";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
- if (functionResult == true)
- {
- //******"检测到已安装Trojan,开始卸载Trojan......"******
- SetUpProgressBarProcessing(24);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Trojan!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop trojan";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable trojan";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/bin/trojan /etc/systemd/system/trojan.service /usr/local/etc/trojan";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name trojan";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
- if (functionResult == true)
- {
- //******"Trojan卸载失败!请向开发者问询!"******
- currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Trojan卸载成功!"******
- SetUpProgressBarProcessing(30);
- currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Trojan!"******04
- SetUpProgressBarProcessing(30);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Trojan!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载SSR
-
- //******"检测系统是否已经安装SSR......"******03
- SetUpProgressBarProcessing(31);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SSR......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("1") == true)
- functionResult = FileCheckExists(client, @"/usr/local/shadowsocks/server.py");
- if (functionResult == true)
- {
- //******"检测到已安装SSR,开始卸载SSR......"******
- SetUpProgressBarProcessing(32);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "SSR!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "SSR......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop ssr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable ssr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("1") == true)
- functionResult = FileCheckExists(client, @"/usr/local/shadowsocks/server.py");
- if (functionResult == true)
- {
- //******"SSR卸载失败!请向开发者问询!"******
- currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"SSR卸载成功!"******
- SetUpProgressBarProcessing(36);
- currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装SSR!"******04
- SetUpProgressBarProcessing(36);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "SSR!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载SS (Shadowsoks-libev)
-
- //******"检测系统是否已经安装SS (Shadowsoks-libev)......"******03
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SS (Shadowsoks-libev)......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name ss-server";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/ss-server");
- if (functionResult == true)
- {
- //******"检测到SS(Shadowsoks-libev),开始卸载SS(Shadowsoks-libev)......"******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "SS (Shadowsoks-libev)!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "SS (Shadowsoks-libev)......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop ss-server";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable ss-server";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //卸载插件
- sshShellCommand = @"rm -f /usr/local/bin/obfs-server /usr/local/bin/obfs-local /usr/local/bin/v2ray-plugin /usr/local/bin/kcptun-plugin-server /usr/local/bin/goquiet-plugin-server /usr/local/bin/cloak-plugin-server";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name ss-server";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/ss-server");
- if (functionResult == true)
- {
- //******"SS(Shadowsoks-libev)卸载失败!请向开发者问询!"******
- currentStatus = "SS (Shadowsoks-libev)" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"SS (Shadowsoks-libev)卸载成功!"******
- SetUpProgressBarProcessing(40);
- currentStatus = "SS (Shadowsoks-libev)" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装SS(Shadowsoks-libev)!"******04
- SetUpProgressBarProcessing(40);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "SS (Shadowsoks-libev)!";
- MainWindowsShowInfo(currentStatus);
- }
-
-
- #endregion
-
- #region 卸载acme.sh
-
- //******"检测系统是否已经安装acme.sh......"******03
- SetUpProgressBarProcessing(41);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "acme.sh......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"if [[ -d ~/.acme.sh ]];then echo '1';else echo '0'; fi";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //******"检测到acme.sh,开始卸载acme.sh......"******
- SetUpProgressBarProcessing(42);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "acme.sh!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "acme.sh......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"/root/.acme.sh/acme.sh --uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -r ~/.acme.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [[ -d ~/.acme.sh ]];then echo '1';else echo '0'; fi";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //******"acme.sh卸载失败!请向开发者问询!"******
- currentStatus = "acme.sh" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- sshShellCommand = @"sed -i 's/. ""/root/.acme.sh/acme.sh.env""//g' /root/.bashrc";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //******"acme.sh卸载成功!"******
- SetUpProgressBarProcessing(46);
- currentStatus = "acme.sh" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装acme.sh!"******04
- SetUpProgressBarProcessing(46);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "acme.sh!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
-
- #region 卸载NaiveProxy
-
- //******"检测系统是否已经安装NaiveProxy......"******03
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "NaiveProxy......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/etc/caddy/naive");
- if (functionResult == true)
- {
- //******"检测到NaiveProxy,开始卸载NaiveProxy......"******
- SetUpProgressBarProcessing(49);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "NaiveProxy!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "NaiveProxy......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
-
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/usr/bin/naive");
- if (functionResult == true)
- {
- //******"Caddy/NaiveProxy卸载失败!请向开发者问询!"******
- currentStatus = "NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Caddy/NaiveProxy卸载成功!"******
- SetUpProgressBarProcessing(60);
- currentStatus = "NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装NaiveProxy!"******04
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "NaiveProxy!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
-
- #region 卸载Caddy
-
- //******"检测系统是否已经安装Caddy......"******03
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Caddy......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //******"检测到Caddy,开始卸载Caddy......"******
- SetUpProgressBarProcessing(49);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Caddy!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Caddy......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //检测系统是否支持yum 或 apt-get或zypper
- //如果不存在组件,则命令结果为空,string.IsNullOrEmpty值为真,
-
- sshShellCommand = @"command -v apt-get";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getApt = ! String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v dnf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getDnf = ! String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v yum";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getYum = ! String.IsNullOrEmpty(currentShellCommandResult);
-
- SetUpProgressBarProcessing(55);
-
- sshShellCommand = @"command -v zypper";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getZypper = String.IsNullOrEmpty(currentShellCommandResult);
-
-
- string sshCmdRemove = "";
- //string sshCmdRemove2;
- //设置安装软件所用的命令格式
- if (getApt == true)
- {
- //sshCmdUpdate = @"apt-get update";
- sshCmdRemove = @"apt-get -y autoremove --purge ";
- }
- else if (getDnf == true)
- {
- //sshCmdUpdate = @"dnf -q makecache";
- sshCmdRemove = @"dnf -y remove ";
- }
- else if (getYum == true)
- {
- //sshCmdUpdate = @"yum -q makecache";
- sshCmdRemove = @"yum -y remove ";
- }
- else if (getZypper == true)
- {
- //sshCmdUpdate = @"zypper ref";
- sshCmdRemove = @"zypper -y remove ";
- }
-
- sshShellCommand = $"{sshCmdRemove}caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //******"Caddy卸载失败!请向开发者问询!"******
- currentStatus = "Caddy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Caddy卸载成功!"******
- SetUpProgressBarProcessing(60);
- currentStatus = "Caddy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Caddy!"******04
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Caddy!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载MtProto
- //******"检测系统是否已经安装MtProto......"******03
- SetUpProgressBarProcessing(61);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "MtProto......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name mtg";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
- if (functionResult == true)
- {
- //******"检测到MtProto,开始卸载MtProto......"******
- SetUpProgressBarProcessing(63);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "MtProto!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "MtProto......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /etc/systemd/system/mtg.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/bin/mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/mtg_info.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/mtg.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name mtg";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
- if (functionResult == true)
- {
- //******"MtProto卸载失败!请向开发者问询!"******
- currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"MtProto卸载成功!"******
- SetUpProgressBarProcessing(65);
- currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装MtProto!"******04
- SetUpProgressBarProcessing(65);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "MtProto!";
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- #region 卸载Xay
-
- //******"检测系统是否已经安装Xray......"******03
- SetUpProgressBarProcessing(66);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name v2ray";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- functionResult = FileCheckExists(client, @"/usr/local/bin/xray");
- if (functionResult == true)
- {
- //******"检测到已安装V2Ray!开始卸载Xray......"******
- SetUpProgressBarProcessing(68);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Xray!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop xray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} --remove";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable xray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/xray /var/log/xray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, @"/usr/local/bin/xray");
- if (functionResult == true)
- //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
- {
- //******"V2Ray卸载失败!请向开发者问询!"******
- currentStatus = "Xray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"V2Ray卸载成功!"******
- SetUpProgressBarProcessing(70);
- currentStatus = "Xray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Xray!"******04
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Xray!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- //如果是纯ipv6主机,则需要删除前面设置的Nat64网关
- if (onlyIpv6 == true)
- {
- SetUpNat64(client, false);
- //sshShellCommand = $"{sshCmdUpdate}";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- //******"卸载成功!"******04
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- client.Disconnect();
-
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString());
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- #region 启用Root密码登录
- private void ButtonEnableRootPassWord_Click(object sender, RoutedEventArgs e)
- {
- //******"本功能需要当前登录的账户具有sudo权限,是否为远程主机启用root账户并设置密码?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_EnableRootPassword").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text); ;//传递主机地址
- ReceiveConfigurationParameters[2] = PasswordBoxHostPassword.Password;//传递当前账户密码
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => EnableRootPassWord(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
- //启用Root密码登录进程
- private void EnableRootPassWord(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == true)
- {
- //******"当前账户已经具有root权限,无需再设置!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_AlreadyRoot").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(10);
- string hostPassword = "'" + ReceiveConfigurationParameters[2] + "'";
- //MessageBox.Show(hostPassword);
- sshShellCommand = $"echo {hostPassword} | sudo -S id -u";
- //MessageBox.Show(sshShellCommand);
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == false)
- {
- //******"当前账户无法获取sudo权限,设置失败!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_NoSudoToAccount").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(20);
- string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(30);
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- sshShellCommand = cmdPre + @"echo 'PasswordAuthentication yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitEmptyPasswords no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(60);
- sshShellCommand = cmdPre + @"sudo systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //******"生成20位随机密码!"******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateRandomPassword").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo ''";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- string setPassword = currentShellCommandResult.TrimEnd('\r', '\n') + '\n';
-
- sshShellCommand = cmdPre + $"echo -e \"{setPassword}{setPassword}\" | sudo passwd root";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- client.Disconnect();
-
- //***保存密码信息***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootPasswordSavePasswordInfo").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string filePath = ReceiveConfigurationParameters[4].Replace(':', '_');
- CheckDir(filePath);
- using (StreamWriter sw = new StreamWriter($"{filePath}\\host_password_info.txt"))
- {
- sw.WriteLine(ReceiveConfigurationParameters[4]);
- sw.WriteLine("root");
- sw.WriteLine(setPassword);
- }
-
- SetUpProgressBarProcessing(100);
- //***远程主机Root账户密码登录已启用,密码保存在随后打开的文件夹中!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootPasswordSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- System.Diagnostics.Process.Start("explorer.exe", filePath);
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- #endregion
-
- #region 启用Root证书密钥登录
- private void ButtonEnableRootCert_Click(object sender, RoutedEventArgs e)
- {
- //******"本功能需要当前登录的账户具有root或者sudo权限,是否为远程主机启用root证书密钥登录?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_ButtonEnableRootCert").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);//传递主机地址
- ReceiveConfigurationParameters[2] = PasswordBoxHostPassword.Password;
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => EnableRootCert(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
-
- //启用Root证书密钥登录进程
- private void EnableRootCert(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- string filePath = String.Empty;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == true)
- {
- SetUpProgressBarProcessing(20);
-
- //***正在生成密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertGenerateCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | ssh-keygen -b 2048 -t rsa -f /tmp/rootuser.key -q -N ''";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | ssh-keygen -p -P '' -N '' -m PEM -f /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"mkdir -p /root/.ssh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"cat /tmp/rootuser.key.pub | tee -a /root/.ssh/authorized_keys";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"chmod 777 /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(30);
- //***正在下载密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertDownloadCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- filePath = CreateConfigSaveDir(@"root_cert", ReceiveConfigurationParameters[4].Replace(':', '_'));
- string localConfigSavePathAndFileName = $"{filePath}\\rootuser.key";
- string remoteConfigPathAndFileName = @"/tmp/rootuser.key";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- localConfigSavePathAndFileName = $"{filePath}\\rootuser.key.pub";
- remoteConfigPathAndFileName = @"/tmp/rootuser.key.pub";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- sshShellCommand = @"rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(50);
- //***远程主机启用密钥登录......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertSetCertEnable").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/StrictModes /#StrictModes /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(70);
- sshShellCommand = @"sed -i 's/PubkeyAuthentication /#PubkeyAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/#AuthorizedKeysFile /AuthorizedKeysFile /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- sshShellCommand = @"sed -i 's/#RSAAuthentication /RSAAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PermitRootLogin yes' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(90);
- sshShellCommand = @"echo 'StrictModes no' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PubkeyAuthentication yes' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- else
- {
- SetUpProgressBarProcessing(10);
- string hostPassword = "'" + ReceiveConfigurationParameters[2] + "'";
- //MessageBox.Show(hostPassword);
- sshShellCommand = $"echo {hostPassword} | sudo -S id -u";
- //MessageBox.Show(sshShellCommand);
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //MessageBox.Show(currentShellCommandResult);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == false)
- {
- //******"当前账户无法获取sudo权限,设置失败!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_NoSudoToAccount").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(20);
- string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
- //***正在生成密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertGenerateCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = cmdPre + @"sudo rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"yes | sudo ssh-keygen -b 2048 -t rsa -f /tmp/rootuser.key -q -N ''";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"yes | sudo ssh-keygen -p -P '' -N '' -m PEM -f /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo mkdir -p /root/.ssh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"cat /tmp/rootuser.key.pub | sudo tee -a /root/.ssh/authorized_keys";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo chmod 777 /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(30);
- //***正在下载密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertDownloadCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- filePath = CreateConfigSaveDir(@"root_cert", ReceiveConfigurationParameters[4].Replace(':', '_'));
- string localConfigSavePathAndFileName = $"{filePath}\\rootuser.key";
- string remoteConfigPathAndFileName = @"/tmp/rootuser.key";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- localConfigSavePathAndFileName = $"{filePath}\\rootuser.key.pub";
- remoteConfigPathAndFileName = @"/tmp/rootuser.key.pub";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- sshShellCommand = cmdPre + @"sudo rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(50);
- //***远程主机启用密钥登录......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertSetCertEnable").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/StrictModes /#StrictModes /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(70);
- sshShellCommand = cmdPre + @"sudo sed -i 's/PubkeyAuthentication /#PubkeyAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/#AuthorizedKeysFile /AuthorizedKeysFile /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- sshShellCommand = cmdPre + @"sudo sed -i 's/#RSAAuthentication /RSAAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(90);
- sshShellCommand = cmdPre + @"echo 'StrictModes no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PubkeyAuthentication yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- client.Disconnect();
-
- SetUpProgressBarProcessing(100);
- //******"远程主机root账户证书密钥登录已启用,密钥文件rootuser.key保存在随后打开的文件夹中!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ButtonEnableRootCertSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- System.Diagnostics.Process.Start("explorer.exe", filePath);
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
-
- #endregion
-
- #region 禁止root账户密码登录
- //root禁止密码登录
- private void ButtonRootProhibitsPasswordLogin_Click(object sender, RoutedEventArgs e)
- {
- //******"本功能需要远程主机已经开启了其他登录方式,如密钥方式等,否则将可能造成远程主机无法连接,是否禁止远程主机的root账户密码登录方式?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_ButtonRootProhibitsPasswordLogin").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);//传递主机地址
- ReceiveConfigurationParameters[2] = PasswordBoxHostPassword.Password;//传递主机密码
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => RootProhibitsPasswordLogin(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
-
- //禁止root密码登录进程
- private void RootProhibitsPasswordLogin(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- string filePath = String.Empty;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == true)
- {
- SetUpProgressBarProcessing(20);
-
- //***正在关闭root账户密码登录方式......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetRootProhibitsPasswordLogin").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PasswordAuthentication no' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PermitEmptyPasswords no' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else
- {
- SetUpProgressBarProcessing(10);
- string hostPassword = "'" + ReceiveConfigurationParameters[2] + "'";
- //MessageBox.Show(hostPassword);
- sshShellCommand = $"echo {hostPassword} | sudo -S id -u";
- //MessageBox.Show(sshShellCommand);
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //MessageBox.Show(currentShellCommandResult);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == false)
- {
- //******"当前账户无法获取sudo权限,设置失败!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_NoSudoToAccount").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(20);
- string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
-
- //***正在关闭root账户密码登录方式......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetRootProhibitsPasswordLogin").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PasswordAuthentication no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitEmptyPasswords no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- client.Disconnect();
-
- SetUpProgressBarProcessing(100);
- //******"远程主机root账户密码登录方式已关闭!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_RootProhibitsPasswordLoginOK").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
- }
- #endregion
-
- //安装日志另存为...
- private void ButtonSaveInstalledLog_Click(object sender, RoutedEventArgs e)
- {
- string logSaveName = ChooseSaveFile("Log Save as...", $"{pwdir}");
- if (String.IsNullOrEmpty(logSaveName) == false)
- {
- using (StreamWriter sw = new StreamWriter($"{logSaveName}"))
- {
- sw.WriteLine($"{TextBoxMonitorCommandResults.Text}");
- }
- }
- }
- private string ChooseSaveFile(string title, string initFolder)
- {
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Title = title;
- string localTime = DateTime.Now.ToLocalTime().ToString().Replace(' ', '-').Replace(':', '-').Replace('/', '-').Replace('\\', '-');
- dlg.FileName = $"{PreTrim(TextBoxHost.Text).Replace(':', '_')}_{localTime}.txt"; // Default file name
- dlg.DefaultExt = ".txt"; // Default file extension
- dlg.Filter = "Text documents|*.txt"; // Filter files by extension
- dlg.InitialDirectory = initFolder;
-
- // Process save file dialog box results
- if (dlg.ShowDialog() == true)
- {
- return dlg.FileName;
- }
- else
- {
- return null;
- }
- }
-
- #endregion
-
- #region 标签页控制
-
- private void ButtonWebBrowserHomePage_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndTools.Source = new Uri("https://github.com/proxysu/windows/wiki/ResourcesAndTools");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void ButtonWebBrowserBack_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndTools.GoBack();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserForward_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndTools.GoForward();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
-
-
- #region 免翻网址资源标签
- private void ButtonWebBrowserHomePageFreeWallURL_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndToolsFreeWallURL.Source = new Uri("https://github.com/proxysu/windows/wiki/FreeWallURL");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserBackFreeWallURL_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndToolsFreeWallURL.GoBack();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserForwardFreeWallURL_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndToolsFreeWallURL.GoForward();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- #endregion
-
- #region 常见问题标签
- private void ButtonWebBrowserHomePageCommonError_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserCommonError.Source = new Uri("https://github.com/proxysu/windows/wiki/CommonError");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserBackCommonError_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserCommonError.GoBack();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserForwardCommonError_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserCommonError.GoForward();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
-
- #endregion
- #endregion
-
- #region 测试用代码
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- //string host = ClassModel.DisguiseURLprocessing("www.google.com/accout/");
- //MessageBox.Show(host);
- //saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
- //saveShellScriptFileName = "tmp." + saveShellScriptFileName + ".sh";
- //MessageBox.Show(saveShellScriptFileName);
- //var rand = System.Security.Cryptography.RandomNumberGenerator.Create();
- //byte[] bytes = new byte[8];
- //rand.GetBytes(bytes);
- //string randStr = Convert.ToBase64String(bytes);
- //randStr = randStr.Replace("+","").Replace("/", "").Replace("=","");
- //MessageBox.Show(randStr);
- proxyType = "V2Ray";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- //return;
- //string pwdir = AppDomain.CurrentDomain.BaseDirectory;
- //MessageBox.Show(pwdir);
- //ConnectionInfo connectionInfo = GenerateConnectionInfo();
- //if (connectionInfo == null)
- //{
- // //****** "远程主机连接信息有误,请检查!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- // return;
- //}
- //using (var client = new SshClient(connectionInfo))
- //{
- // client.Connect();
- // if (client.IsConnected == true)
- // {
- // //******"主机登录成功"******
- // SetUpProgressBarProcessing(3);
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- // MainWindowsShowInfo(currentStatus);
-
- // }
- // string fileProxy = @"/usr/local/bin/v2ray";
- // sshShellCommand = $"if [[ -f {fileProxy} ]];then echo '1';else echo '0'; fi";
- // //sshShellCommand = @"if [[ -f /usr/local/bin/v2ray ]];then echo '1';else echo '0'; fi";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- // if (currentShellCommandResult.Trim().Equals("0") == true)
- // {
- // MessageBox.Show("0");
- // }
- // else
- // {
- // MessageBox.Show("1");
- // }
- // // SetUpNat64(client, true);
- // //FilterFastestIP(client);
- // //string cmdErr = client.RunCommand(@"aaa ee").Error;
- // //MessageBox.Show(cmdErr);
- // //SshCommand cmdResult = client.RunCommand(@"pwd");
- // //string result = cmdResult.Result;
- // //MessageBox.Show("result:" + result);
- // //string error = cmdResult.Error;
- // //MessageBox.Show("err:" + error);
-
- // //int cmdExitStatus = cmdResult.ExitStatus;
- // //MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString());
-
- // //SshCommand cmdResultCat = client.RunCommand(@"cat tt.t");
- // //string resultCat = cmdResultCat.Result;
- // //MessageBox.Show("resultCat:" + resultCat);
- // //string errorCat = cmdResultCat.Error;
- // //MessageBox.Show("errCat:" + errorCat);
-
- // //cmdExitStatus = cmdResultCat.ExitStatus;
- // //MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString());
-
- // //SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
- // //CaddyInstall(client);
- // //if (client.IsConnected == true)
- // //{
- // // MessageBox.Show("Connected");
- // //}
- // //if (client.IsConnected == false)
- // //{
- // // MessageBox.Show("disConnected");
- // //}
- //}
- }
-
- private string CaddyInstallTest(SshClient client)
- {
-
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- client.Disconnect();
- }
- return "";
- }
- #endregion
-
- #region 布署代理所用到的步骤函数
-
- //检测主机是否为纯ipv6的主机
- private bool OnlyIpv6HostDetect(SshClient client)
- {
- //****** "正在检测是否为纯ipv6主机......." ******11
- //SetUpProgressBarProcessing(34);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OnlyIpv6HostDetect").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //再次初始化相关变量
- ipv4 = String.Empty;
- ipv6 = String.Empty;
-
- //sshShellCommand = @"curl -4 ip.sb";
- sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv4 --max-time 8";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ipv4 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv6 --max-time 8";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ipv6 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- if (String.IsNullOrEmpty(ipv4) == false)
- {
- return false;
- }
- else
- {
- if (String.IsNullOrEmpty(ipv6) == false)
- {
-
- return true;
- }
- else
- {
- //FunctionResultErr();
- client.Disconnect();
- //****未检测到有效的IP地址......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoIpDetect").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- return false;
- }
- }
-
- }
-
- //设置Nat64与删除设置Nat64
- private bool SetUpNat64(SshClient client,bool set)
- {
- if(set == true)
- {
- //****** "正在查找最快的Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64").ToString();
- MainWindowsShowInfo(currentStatus);
- //string[] dns64 = new string[2];
- var dns64 = FilterFastestIP(client);
-
- if (functionResult == false)
- {
- //****** "未能找到有效的Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64Failed").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- //FunctionResultErr();
- client.Disconnect();
- return false;
- }
-
- //****** "正在设置Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString();
- MainWindowsShowInfo(currentStatus);
-
- functionResult = FileCheckExists(client, @"/etc/resolv.conf.proxysu");
- if (functionResult == false)
- {
- sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- foreach (string gateip in dns64)
- {
- sshShellCommand = $"echo \"nameserver {gateip}\" > /etc/resolv.conf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"curl -fsSL https://api.github.com/repos/proxysu/windows/releases/latest";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- SshCommand currentShellCommand = client.RunCommand(sshShellCommand);
- int cmdExitStatus = currentShellCommand.ExitStatus;
- if (cmdExitStatus == 0)
- {
- return true;
- }
-
- }
-
- }
- else
- {
- //****** "正在删除Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DeleteSetUpNat64").ToString();
- MainWindowsShowInfo(currentStatus);
- sshShellCommand = @"rm /etc/resolv.conf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = @"mv /etc/resolv.conf.proxysu /etc/resolv.conf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- return true;
- }
-
- //筛选最优的NAT64地址
- private string[] FilterFastestIP(SshClient client)
- {
- string[] gateNat64 = {
- "2a01:4f9:c010:3f02::1",
- "2001:67c:2b0::4",
- "2001:67c:2b0::6",
- "2a09:11c0:f1:bbf0::70",
- "2a01:4f8:c2c:123f::1",
- "2001:67c:27e4:15::6411",
- "2001:67c:27e4::64",
- "2001:67c:27e4:15::64",
- "2001:67c:27e4::60",
- "2a00:1098:2b::1",
- "2a03:7900:2:0:31:3:104:161",
- "2a00:1098:2c::1",
- "2a09:11c0:100::53",
- };
-
- List NatDns64s = new List();
- foreach (string gateip in gateNat64)
- {
- sshShellCommand = $"ping6 -c4 {gateip} | grep avg | awk '{{print $4}}'|cut -d/ -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (String.IsNullOrEmpty(currentShellCommandResult) != true)
- {
- if (float.TryParse(currentShellCommandResult, out float delay) == true)
- {
-
- int delayInt = (int)(delay * 1000);
- NatDns64 ipaddr = new NatDns64($"{gateip}", delayInt);
- NatDns64s.Add(ipaddr);
- }
- }
-
- }
- NatDns64s = NatDns64s.OrderBy(o => o.Avg).ToList();
- int listCount = NatDns64s.Count;
- currentStatus = listCount.ToString() + " NAT64 gateways are valid";
- MainWindowsShowInfo(currentStatus);
- if (listCount < 1)
- {
- functionResult = false;
- }
- else
- {
- functionResult = true;
- }
- string[] returnstr = new string[listCount];
- for(int i=0;i= 90)
- {
- //******"本地时间与远程主机时间相差超过限制(90秒),请先用 '系统工具-->时间校对' 校对时间后再设置"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_TimeError").ToString());
- //"时间较对失败......"
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TimeError").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.Disconnect();
- return false;
- }
- //******"时间差符合要求,OK!"******10
- SetUpProgressBarProcessing(33);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TimeOK").ToString();
- MainWindowsShowInfo(currentStatus);
- return true;
- }
-
-
- //检测域名是否解析到当前IP上 34---36
- //functionResult = DomainResolutionCurrentIPDetect(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool DomainResolutionCurrentIPDetect(SshClient client)
- {
- //****** "正在检测域名是否解析到当前VPS的IP上......" ******11
- SetUpProgressBarProcessing(34);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestDomainResolve").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //再次初始化相关变量
- //ipv4 = String.Empty;
- //ipv6 = String.Empty;
- //onlyIpv6 = false;
-
- //sshShellCommand = @"curl -4 ip.sb";
- //sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv4 --max-time 8";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //ipv4 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- //sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv6 --max-time 8";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //ipv6 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- if (onlyIpv6 == false)
- {
- string nativeIp = ipv4;
-
- sshShellCommand = "ping " + ReceiveConfigurationParameters[4] + " -c1 | grep -oE -m1 \"([0-9]{1,3}\\.){3}[0-9]{1,3}\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
- if (String.Equals(nativeIp, resultTestDomainCmd) == true)
- {
- //****** "解析正确!OK!" ******12
- SetUpProgressBarProcessing(36);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
- MainWindowsShowInfo(currentStatus);
- //onlyIpv6 = false;
- return true;
- }
-
- }
- else
- {
-
- string nativeIp = ipv6;
-
- //sshShellCommand = "ping6 " + ReceiveConfigurationParameters[4] + " -c1 | grep -oE -m1 \"([0-9]{1,3}\\.){3}[0-9]{1,3}\"";
- sshShellCommand = $"dig @resolver1.opendns.com AAAA {ReceiveConfigurationParameters[4]} +short -6";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
- if (String.Equals(nativeIp, resultTestDomainCmd) == true)
- {
- //****** "解析正确!OK!" ******12
- SetUpProgressBarProcessing(36);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
- MainWindowsShowInfo(currentStatus);
- //onlyIpv6 = true;
-
- return true;
- }
-
- }
- //****** "域名未能正确解析到当前VPS的IP上!安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorDomainResolve").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "域名未能正确解析到当前VPS的IP上,请检查!若解析设置正确,请等待生效后再重试安装。如果域名使用了CDN,请先关闭!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDomainResolve").ToString());
- //client.Disconnect();
- return false;
-
- }
-
-
- //安装代理程序 37--40
- //functionResult = ProxySoftInstall(client,@"",@"");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool ProxySoftInstall(SshClient client,string proxyName,string downloadUrl)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "正在安装{proxyName}......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} {downloadUrl}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
-
- }
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- }
-
- //程序是否安装成功检测并设置开机启动 41--43
- //soft--要检测的程序
- //condition---成功安装的条件
- //functionResult = SoftInstalledSuccessOrFail(client,"v2ray",@"/usr/local/bin/v2ray");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SoftInstalledSuccessOrFail(SshClient client,string soft,string condition)
- {
- SetUpProgressBarProcessing(41);
- //sshShellCommand = $"find / -name {soft}";
- //sshShellCommand = $"if [[ -f {condition} ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- bool functionResult = FileCheckExists(client, condition);
-
- //if (!currentShellCommandResult.Contains($"{condition}"))
- if (functionResult == false)
- {
- //****** "安装失败,官方脚本运行出错!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorInstallSoftFail").ToString());
- //****** "安装失败,官方脚本运行出错!" ******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorInstallSoftFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.Disconnect();
- return false;
- }
- else
- {
- //****** "安装成功!" ******20
- SetUpProgressBarProcessing(43);
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_SoftInstallSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //开机启动
- sshShellCommand = $"systemctl enable {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- return true;
- }
-
-
- //生成服务端配置 44--46
- //functionResult = GenerateServerConfiguration(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //上传服务配置 47--50
- private bool GenerateServerConfigurations(SshClient client) { return true; }
-
- //acme.sh安装与申请证书 51--57
- //functionResult = AcmeShInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool AcmeShInstall(SshClient client)
- {
-
- //****** "正在安装acme.sh......" ******22
- SetUpProgressBarProcessing(51);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallAcmeSh").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //安装所依赖的软件
- sshShellCommand = $"{sshCmdUpdate}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"{sshCmdInstall}socat";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //解决搬瓦工CentOS缺少问题
- sshShellCommand = $"{sshCmdInstall}automake autoconf libtool";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("Install success") == true)
- {
- //****** "acme.sh安装成功!" ******23
- SetUpProgressBarProcessing(54);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_AcmeShInstallSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "acme.sh安装失败!原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorAcmeShInstallFail").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- sshShellCommand = @"cd ~/.acme.sh/";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"alias acme.sh=~/.acme.sh/acme.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "申请域名证书......" ******24
- SetUpProgressBarProcessing(55);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartApplyCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (onlyIpv6 == true)
- {
- sshShellCommand = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {ReceiveConfigurationParameters[4]} --listen-v6";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else
- {
- sshShellCommand = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {ReceiveConfigurationParameters[4]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- if (currentShellCommandResult.Contains("Cert success") == true)
- {
- //****** "证书申请成功!" ******25
- SetUpProgressBarProcessing(57);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ApplyCertSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书申请失败!原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ApplyCertFail").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
- return true;
-
- }
-
-
-
- //安装证书到代理程序 58--60
- private bool CertInstallProxy(SshClient client)
- {
- return true;
- }
-
-
- //Caddy安装与检测安装是否成功 61--66
- //functionResult = CaddyInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CaddyInstall(SshClient client)
- {
- //****** "安装Caddy......" ******28
- SetUpProgressBarProcessing(61);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallCaddy").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //为真则表示系统有相应的组件。
- if (getApt == true)
- {
-
- sshShellCommand = @"echo ""deb [trusted=yes] https://apt.fury.io/caddy/ /"" | tee -a /etc/apt/sources.list.d/caddy-fury.list";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"apt-get install -y apt-transport-https";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"apt-get update";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"apt-get -y install caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- else if (getDnf == true)
- {
-
- sshShellCommand = @"dnf install 'dnf-command(copr)' -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"dnf copr enable @caddy/caddy -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"dnf makecache";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"dnf -y install caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- else if (getYum == true)
- {
-
- sshShellCommand = @"yum install yum-plugin-copr -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yum copr enable @caddy/caddy -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"yum makecache";
- //currentShellCommandResult = MainWindowsShowCmd(client,sshShellCommand);
-
- sshShellCommand = @"yum -y install caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
-
- string caddyService = @"/lib/systemd/system/caddy.service";
- functionResult = FileCheckExists(client, $"{caddyService}");
- if (functionResult == false)
- {
- caddyService = @"/usr/lib/systemd/system/caddy.service";
- }
- sshShellCommand = $"sed -i 's/AmbientCapabilities/#AmbientCapabilities/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/=caddy/=root/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/LimitNPROC/#LimitNPROC/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/LimitNOFILE/#LimitNOFILE/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl daemon-reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
-
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //****** "Caddy安装成功!" ******29
- SetUpProgressBarProcessing(66);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_InstalledCaddyOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
-
- sshShellCommand = @"systemctl enable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- return true;
-
- }
- functionResult = ProxySoftInstall(client, @"Caddy", @"https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return false; }
-
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //****** "Caddy安装成功!" ******29
- SetUpProgressBarProcessing(66);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_InstalledCaddyOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
-
- sshShellCommand = @"systemctl enable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- return true;
- }
-
- //****** "安装Caddy失败!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString());
- //****** "安装Caddy失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.Disconnect();
- return false;
- }
-
-
- //上传Caddy配置文件67--70
- private bool UpConfigCaddy(SshClient client)
- {
- return true;
- }
-
- //设置Caddy配置文件
- //functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SetCaddyfile(SshClient client,string upLoadPath)
- {
-
- //设置Caddyfile文件中的tls 邮箱,在caddy2中已经不需要设置。
-
- //设置Caddy监听的随机端口
- string randomCaddyListenPortStr = randomCaddyListenPort.ToString();
-
- sshShellCommand = $"sed -i 's/8800/{randomCaddyListenPortStr}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置域名
- ReceiveConfigurationParameters[4] = ReceiveConfigurationParameters[4].TrimEnd(' ');
- sshShellCommand = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/g' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置Path
- sshShellCommand = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[6]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置伪装网站/纯ipv6主机暂不设置
- // && onlyIpv6 == false
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false)
- {
- sshShellCommand = $"sed -i 's/##reverse_Proxy1##/reverse_proxy http:\\/\\/{ReceiveConfigurationParameters[7]} {{/ ' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/##reverse_Proxy2##/header_up Host {ReceiveConfigurationParameters[7]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/##reverse_Proxy3##/}}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- return true;
- }
-
- //程序启动检测
- //soft--要检测的程序
- //condition---成功启动的条件
- //functionResult = SoftStartDetect(client, "v2ray", @"/usr/local/bin/v2ray");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SoftStartDetect(SshClient client,string soft,string condition)
- {
- //****** "正在启动......" ******33
- //SetUpProgressBarProcessing(87);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartSoft").ToString() + $"{soft}......";
- MainWindowsShowInfo(currentStatus);
-
- //启动服务
- sshShellCommand = $"systemctl restart {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- Thread.Sleep(3000);
-
- sshShellCommand = $"ps aux | grep {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains($"{condition}") == true)
- {
- //****** "启动成功!" ******34
- //SetUpProgressBarProcessing(88);
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "启动失败!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(1000);
-
- //****** "正在启动(第二次尝试)!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartSoftSecond").ToString() + $"{soft}";
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(3000);
- sshShellCommand = $"systemctl restart {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- Thread.Sleep(3000);
-
- sshShellCommand = $"ps aux | grep {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains($"{condition}") == true)
- {
- //****** "启动成功!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "启动失败(第二次)!退出安装!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftSecondFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示启动失败原因
- sshShellCommand = $"journalctl -n50 --no-pager --boot -u {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "启动失败,原因如上!请排查原因!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftFailedExit").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "启动失败,原因如上!请排查原因!" ******
- MessageBox.Show($"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftFailedExit").ToString());
- return false;
- }
- }
- return true;
- }
-
- //检测BBR,满足条件并启动 90--95
- //functionResult = DetectBBRandEnable(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool DetectBBRandEnable(SshClient client)
- {
- //测试BBR条件,若满足提示是否启用
- //****** "BBR测试......" ******37
- SetUpProgressBarProcessing(90);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"uname -r";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string[] linuxKernelVerStrBBR = currentShellCommandResult.Split('-');
-
- bool detectResultBBR = DetectKernelVersionBBR(linuxKernelVerStrBBR[0]);
-
- sshShellCommand = @"sysctl net.ipv4.tcp_congestion_control | grep bbr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string resultCmdTestBBR = currentShellCommandResult;
- //如果内核满足大于等于4.9,且还未启用BBR,则启用BBR
- if (detectResultBBR == true && resultCmdTestBBR.Contains("bbr") == false)
- {
- //****** "正在启用BBR......" ******38
- SetUpProgressBarProcessing(93);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl -p";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl net.ipv4.tcp_congestion_control | grep bbr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("bbr") == true)
- {
- //****** "BBR启用成功!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBREnabledSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "系统不满足启用BBR的条件,启用失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- //return false;
- }
- }
- else if (resultCmdTestBBR.Contains("bbr") == true)
- {
- //****** "BBR已经启用了!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRisEnabled").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "系统不满足启用BBR的条件,启用失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- //return false;
- }
-
- //如果是纯ipv6主机,则需要删除前面设置的Nat64网关
- if (onlyIpv6 == true)
- {
- SetUpNat64(client, false);
- sshShellCommand = $"{sshCmdUpdate}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- SetUpProgressBarProcessing(95);
- return true;
- }
-
-
-
-
-
- //生成客户端配置 96--98
-
-
- #endregion
-
-
- }
-
-}
diff --git a/ProxySU/ProofreadTimeWindow.xaml b/ProxySU/ProofreadTimeWindow.xaml
deleted file mode 100644
index 01d9842d..00000000
--- a/ProxySU/ProofreadTimeWindow.xaml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/ProofreadTimeWindow.xaml.cs b/ProxySU/ProofreadTimeWindow.xaml.cs
deleted file mode 100644
index 04992161..00000000
--- a/ProxySU/ProofreadTimeWindow.xaml.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Net;
-using System.Net.Sockets;
-using System.Net.NetworkInformation;
-using System.Runtime.InteropServices;
-using System.Runtime;
-using System.Globalization;
-
-namespace ProxySU
-{
- ///
- /// ProofreadTimeWindow.xaml 的交互逻辑
- ///
- public partial class ProofreadTimeWindow : Window
- {
- public static ConnectionInfo ProfreadTimeReceiveConnectionInfo { get; set; }
- //ProfreadTimeReceiveParameters
-
- public ProofreadTimeWindow()
- {
- InitializeComponent();
-
- }
-
- private void ButtonTestTime_Click(object sender, RoutedEventArgs e)
- {
- using (var client = new SshClient(ProfreadTimeReceiveConnectionInfo))
- {
- client.Connect();
- client.RunCommand("rm -f /etc/localtime");
- client.RunCommand("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
- //获取远程主机的时间戳
- long timeStampVPS = Convert.ToInt64(client.RunCommand("date +%s").Result.ToString());
-
- //获取本地时间戳
- TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
- client.Disconnect();
- if (Math.Abs(timeStampLocal - timeStampVPS) >= 90)
- {
-
- MessageBox.Show("本地时间与远程主机时间相差超过限制(90秒),V2ray无法建立连接");
-
- return;
- }
- else
- {
- MessageBox.Show("误差为:" + Math.Abs(timeStampLocal - timeStampVPS).ToString()+" 可以连接");
- }
- }
- }
-
- private void ButtonProofreading_Click(object sender, RoutedEventArgs e)
- {
- if (RadioButtonUpDateLocalTime.IsChecked == true)
- {
- //将本机电脑与网络时间同步
- DateTime netUTCtime = NetTime.GetUTCTime();
- if (!DateTime.Equals(netUTCtime, new DateTime(1970, 1, 1, 0, 0, 0, 0)))
- {
- DateTime localTime = netUTCtime.ToLocalTime();
- bool setD = UpdateTime.SetDate(localTime);
- if (setD == true)
- {
- MessageBox.Show("本机时间已经更新为网络时间(国家授时中心获取)");
- }
- else
- {
- MessageBox.Show("更新失败,请重试。");
- }
- }
- return;
- }
- using (var client = new SshClient(ProfreadTimeReceiveConnectionInfo))
- {
- client.Connect();
- //设置vps为UTC时区
- client.RunCommand("rm -f /etc/localtime");
- client.RunCommand("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
-
- if (RadioButtonLocalTime.IsChecked == true)
- {
- //以本地时间为准,校正远程主机时间
- //获取本地时间戳
- TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
-
- string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampLocal.ToString()})\"";
-
- client.RunCommand(sshCmd);
- MessageBox.Show("同步本地时间校时完毕");
-
-
- }
- else
- {
- //以网络时间为准,校正远程主机时间
- TimeSpan utcTS = NetTime.GetUTCTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampVPS = Convert.ToInt64(utcTS.TotalSeconds);
- if (timeStampVPS!=0)
- {
-
- string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampVPS.ToString()})\"";
-
- client.RunCommand(sshCmd);
- MessageBox.Show("同步网络时间校时完毕");
- }
-
- }
- client.Disconnect();
- }
-
- }
-
- private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RadioButtonNetworkTime.IsChecked = true;
- }
-
- private void TextBlock_MouseDown_1(object sender, MouseButtonEventArgs e)
- {
- RadioButtonLocalTime.IsChecked = true;
- }
-
- private void TextBlock_MouseDown_2(object sender, MouseButtonEventArgs e)
- {
- RadioButtonUpDateLocalTime.IsChecked = true;
- }
-
- //private void ButtonTEST_Click(object sender, RoutedEventArgs e)
- //{
- // //NetTime netTime = new NetTime();
- // string netDatetime = NetTime.GetUTCTime().ToString();
- // MessageBox.Show(netDatetime);
- // //NetTime netTime = new NetTime();
- // //UpdateTime updateTime = new UpdateTime();
- // //DateTime netDateTime = netTime.GetBeijingTime();
- // //MessageBox.Show(netDateTime.ToString());
- //}
-
- }
-
- ///
- /// 网络时间 代码从网上复制,原网址:https://www.codeleading.com/article/23791981303/
- ///
- public class NetTime
- {
- ///
- /// 从国家授时中心获取标准GMT时间,读取https://www.tsa.cn
- /// GMT时间与UTC时间没有差别,可以UTC=GMT
- ///
- /// 返回网络时间
- public static DateTime GetUTCTime()
- {
- DateTime time;
- ////Thread.Sleep(5000);
- try
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.tsa.cn");
- request.Method = "HEAD";
- request.AllowAutoRedirect = false;
- HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
- string cc = reponse.GetResponseHeader("date");
- reponse.Close();
-
- bool s = GMTStrParse(cc, out time);
- return time;
- }
- catch (Exception ex1)
- {
- if (ex1.ToString().Contains("403"))
- {
- MessageBox.Show("校时操作太频繁,请稍等片刻再操作!");
- }
- else
- {
- MessageBox.Show(ex1.Message);
- }
- return time = new DateTime(1970, 1, 1, 0, 0, 0, 0);
- }
-
- //return time.AddHours(8); //GMT要加8个小时才是北京时间
- }
- public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串,这里转成datetime
- {
- CultureInfo enUS = new CultureInfo("en-US");
- bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
- return s;
- }
-
- }
-
- ///
- /// 更新系统时间,代码从网上复制,原网址:https://www.open-open.com/code/view/1430552965599
- ///
- public class UpdateTime
- {
- //设置系统时间的API函数
- [DllImport("kernel32.dll")]
- private static extern bool SetLocalTime(ref SYSTEMTIME time);
-
- [StructLayout(LayoutKind.Sequential)]
- private struct SYSTEMTIME
- {
- public short year;
- public short month;
- public short dayOfWeek;
- public short day;
- public short hour;
- public short minute;
- public short second;
- public short milliseconds;
- }
-
- ///
- /// 设置系统时间
- ///
- /// 需要设置的时间
- /// 返回系统时间设置状态,true为成功,false为失败
- public static bool SetDate(DateTime dt)
- {
- SYSTEMTIME st;
-
- st.year = (short)dt.Year;
- st.month = (short)dt.Month;
- st.dayOfWeek = (short)dt.DayOfWeek;
- st.day = (short)dt.Day;
- st.hour = (short)dt.Hour;
- st.minute = (short)dt.Minute;
- st.second = (short)dt.Second;
- st.milliseconds = (short)dt.Millisecond;
- bool rt = SetLocalTime(ref st);
- return rt;
- }
- }
-
-}
diff --git a/ProxySU/ProxySU.csproj b/ProxySU/ProxySU.csproj
deleted file mode 100644
index 1dac41db..00000000
--- a/ProxySU/ProxySU.csproj
+++ /dev/null
@@ -1,202 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}
- WinExe
- ProxySU
- ProxySU
- v4.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- ProxySU.ico
-
-
-
- ..\json.net\net40\Newtonsoft.Json.dll
-
-
- ..\qrcoder\net40\QRCoder.dll
-
-
- ..\ssh.net\net40\Renci.SshNet.dll
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
- ProofreadTimeWindow.xaml
-
-
- ResultClientInformation.xaml
-
-
- SSpluginWindow.xaml
-
-
- XayTemplateWindow.xaml
-
-
- V2RayTemplateWindow.xaml
-
-
- TrojanGoTemplateWindow.xaml
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
-
- del "$(TargetDir)*.xml"
-del "$(TargetDir)*.pdb"
-del "$(TargetDir)*.zip"
-mkdir "$(TargetDir)TemplateConfg"
-xcopy /Y /E /R "$(TargetDir)..\..\..\TemplateConfg\*.*" "$(TargetDir)TemplateConfg\"
-"$(TargetDir)..\..\..\7z\7z.exe" a $(TargetDir)Release.zip $(TargetDir) -xr!*config
-rmdir /S /Q "$(TargetDir)..\Beta"
-mkdir "$(TargetDir)..\Beta"
-copy /Y "$(TargetDir)Release.zip" "$(TargetDir)..\Beta\Beta.zip"
-
-
- rmdir /S /Q "$(TargetDir)
-
-
\ No newline at end of file
diff --git a/ProxySU/ProxySU.csproj.user b/ProxySU/ProxySU.csproj.user
deleted file mode 100644
index 2c7a9c0a..00000000
--- a/ProxySU/ProxySU.csproj.user
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- publish\
-
-
-
-
-
- zh-CN
- false
-
-
\ No newline at end of file
diff --git a/ProxySU/ProxySU.ico b/ProxySU/ProxySU.ico
deleted file mode 100644
index 9d7a128c..00000000
Binary files a/ProxySU/ProxySU.ico and /dev/null differ
diff --git a/ProxySU/ResultClientInformation.xaml b/ProxySU/ResultClientInformation.xaml
deleted file mode 100644
index eede1c4c..00000000
--- a/ProxySU/ResultClientInformation.xaml
+++ /dev/null
@@ -1,570 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/ResultClientInformation.xaml.cs b/ProxySU/ResultClientInformation.xaml.cs
deleted file mode 100644
index 719ece9c..00000000
--- a/ProxySU/ResultClientInformation.xaml.cs
+++ /dev/null
@@ -1,4942 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Web;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Runtime.InteropServices;
-
-
-namespace ProxySU
-{
- ///
- /// ResultClientInformation.xaml 的交互逻辑
- ///
- public partial class ResultClientInformation : Window
- {
- private static string saveFileFolder = "";
- private static string configDomainSavePath = "";
- private static string server = MainWindow.ReceiveConfigurationParameters[4];
-
- private static string TextBoxURLDefault;
- private static string TextBoxURLVlessTcp;
- private static string TextBoxURLVlessWs;
- private static string TextBoxURLVmessTcp;
- private static string TextBoxURLVmessWs;
- private static string TextBoxURLTrojanTcp;
-
- private static BitmapSource ImageShareQRcodeDefault;
- private static BitmapSource ImageShareQRcodeVlessTcp;
- private static BitmapSource ImageShareQRcodeVlessWs;
- private static BitmapSource ImageShareQRcodeVmessTcp;
- private static BitmapSource ImageShareQRcodeVmessWs;
- private static BitmapSource ImageShareQRcodeTrojanTcp;
-
-
- [DllImport("user32.dll")]
- private static extern int MessageBoxTimeoutA(IntPtr hWnd, string msg, string Caps, int type, int Id, int time); //引用DLL
-
- public ResultClientInformation()
- {
- InitializeComponent();
-
- if (String.Equals(MainWindow.proxyType, "V2Ray"))
- {
- //显示V2Ray参数,隐藏其他
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Visible;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- //主机地址
- TextBoxHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1];
- //用户ID(uuid)/Trojan密码
- TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
- //额外ID
- TextBoxUUIDextra.Text = "0";
- //加密方式,一般都为auto
- TextBoxEncryption.Text = "auto";
-
- //传输协议
- TextBoxTransmission.Text = "";
- //伪装类型
- TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5];
-
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = "";
-
- //QUIC密钥/mKCP Seed/路径Path
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];
-
- //TLS设置
- TextBoxTLS.Text = "none";
-
- //初始化时,隐藏多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWs.Visibility = Visibility.Collapsed;
- //显示非Trojan的所有参数
- GridNotTrojanParameters.Visibility = Visibility.Visible;
-
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP") == true)
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "http";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "xtls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Http2") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];//获取Host
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if(MainWindow.mKCPvlessIsSet == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBoxEncryption.Text = "none";
- HideAlterId();
- HideGroupBoxClientQRandURL();
- }
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPNone") == true)
- {
- TextBoxCamouflageType.Text = "none";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP") == true)
- {
- TextBoxCamouflageType.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP") == true)
- {
- TextBoxCamouflageType.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo") == true)
- {
- TextBoxCamouflageType.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS") == true)
- {
- TextBoxCamouflageType.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard") == true)
- {
- TextBoxCamouflageType.Text = "wireguard";
- }
-
- TextBoxTransmission.Text = "kcp";
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];//获取mkcp Seed
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowMkcpSeed();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicNone") == true)
- {
- TextBoxCamouflageType.Text = "none";
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicSRTP") == true)
- {
- TextBoxCamouflageType.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Quic2uTP") == true)
- {
- TextBoxCamouflageType.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWechatVideo") == true)
- {
- TextBoxCamouflageType.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicDTLS") == true)
- {
- TextBoxCamouflageType.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWireGuard") == true)
- {
- TextBoxCamouflageType.Text = "wireguard";
- }
-
- TextBoxTransmission.Text = "quic";
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[3];//获取Quic加密方式
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];//获取Quic加密密钥
- TextBoxTLS.Text = "none";
- ShowQuicEncryption();
- ShowQuicKey();
- }
-
- else
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
- }
- CheckDir("v2ray_config");
-
- GenerateV2rayShareQRcodeAndBase64Url();
- #endregion
- }
- else
- {
- //显示多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWs.Visibility = Visibility.Visible;
-
- string proxyfolder = CheckDir("v2ray_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddress.Text);
-
- V2raySetVlessTcpXtls();
- //GenerateV2rayVlessTcpXtlsShareQRcodeAndBase64Url();
-
- V2raySetVlessTcpTls();
- GenerateV2rayVlessTcpTlsShareQRcodeAndBase64Url();
-
- V2raySetVlessWsTls();
- GenerateV2rayVlessWsTlsShareQRcodeAndBase64Url();
-
- V2raySetVmessTcpTls();
- GenerateV2rayVmessTcpTlsShareQRcodeAndBase64Url();
-
- V2raySetVmessWsTls();
- GenerateV2rayVmessWsTlsShareQRcodeAndBase64Url();
-
- GenerateV2rayTrojanShareQRcodeAndBase64Url();
- RadioButtonVlessTcpTls.IsChecked = true;
- }
-
- }
- else if (String.Equals(MainWindow.proxyType, "Xray"))
- {
- //显示Xray参数,隐藏其他
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Visible;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- //主机地址
- TextBoxHostAddressXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxPortXray.Text = MainWindow.ReceiveConfigurationParameters[1];
- //用户ID(uuid)/Trojan密码
- TextBoxUUIDXray.Text = MainWindow.ReceiveConfigurationParameters[2];
- //额外ID
- TextBoxUUIDextraXray.Text = "0";
- //加密方式,一般都为auto
- TextBoxEncryptionXray.Text = "auto";
-
- //传输协议
- TextBoxTransmissionXray.Text = "";
- //伪装类型
- TextBoxCamouflageTypeXray.Text = MainWindow.ReceiveConfigurationParameters[5];
-
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = "";
-
- //QUIC密钥/mKCP Seed/路径Path
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];
-
- //TLS设置
- TextBoxTLSXray.Text = "none";
-
- //初始化时,隐藏多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWsXray.Visibility = Visibility.Collapsed;
- //显示非Trojan的所有参数
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
-
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP") == true)
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "http";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "xtls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Http2") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];//获取Host
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (MainWindow.mKCPvlessIsSet == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBoxEncryptionXray.Text = "none";
- HideAlterIdXray();
- HideGroupBoxClientQRandURL();
- }
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPNone") == true)
- {
- TextBoxCamouflageTypeXray.Text = "none";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS") == true)
- {
- TextBoxCamouflageTypeXray.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wireguard";
- }
-
- TextBoxTransmissionXray.Text = "kcp";
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];//获取mkcp Seed
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowMkcpSeedXray();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicNone") == true)
- {
- TextBoxCamouflageTypeXray.Text = "none";
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicSRTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Quic2uTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWechatVideo") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicDTLS") == true)
- {
- TextBoxCamouflageTypeXray.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWireGuard") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wireguard";
- }
-
- TextBoxTransmissionXray.Text = "quic";
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[3];//获取Quic加密方式
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];//获取Quic加密密钥
- TextBoxTLSXray.Text = "none";
- ShowQuicEncryptionXray();
- ShowQuicKeyXray();
- }
-
- else
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
- }
- CheckDir("xray_config");
-
- GenerateXrayShareQRcodeAndBase64Url();
- #endregion
- }
- else
- {
- //显示多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWsXray.Visibility = Visibility.Visible;
-
- string proxyfolder = CheckDir("xray_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddressXray.Text);
-
- XraySetVlessTcpXtls();
- GenerateXrayVlessTcpXtlsShareQRcodeAndBase64Url();
-
- XraySetVlessTcpTls();
- GenerateXrayVlessTcpTlsShareQRcodeAndBase64Url();
-
- XraySetVlessWsTls();
- GenerateXrayVlessWsTlsShareQRcodeAndBase64Url();
-
- XraySetVmessTcpTls();
- GenerateXrayVmessTcpTlsShareQRcodeAndBase64Url();
-
- XraySetVmessWsTls();
- GenerateXrayVmessWsTlsShareQRcodeAndBase64Url();
-
- GenerateXrayTrojanShareQRcodeAndBase64Url();
- RadioButtonVlessTcpXtlsXray.IsChecked = true;
- }
-
- }
- else if (String.Equals(MainWindow.proxyType, "TrojanGo"))
- {
- //GroupBoxTrojanClient.Header = "Trojan-go 客户端配置参数";
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Visible;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockTrojanGoHost.Visibility = Visibility.Hidden;
- TextBoxTrojanGoHost.Visibility = Visibility.Hidden;
- TextBoxTrojanGoWSPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCaption.Visibility = Visibility.Hidden;
-
- TextBlockMuxSelect.Visibility = Visibility.Hidden;
- GridMuxSelect.Visibility = Visibility.Hidden;
- TextBlockExplainCheckBoxMuxSelectResult.Visibility = Visibility.Hidden;
-
- //******"可用于ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 扫码和导入url。注意:有的客户端可能不支持WebSocket模式。" ******
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainTrojan-go").ToString();
-
- //主机地址
- TextBoxTrojanGoServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxTrojanGoServerPort.Text = "443";
- //密钥(uuid)
- TextBoxTrojanGoServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
- //SNI
- TextBoxTrojanGoSNI.Text = MainWindow.ReceiveConfigurationParameters[4];
- //TrojanGo 使用类型
- TextBoxTrojanGoType.Text = "original";
-
- //WebSocket设置
- if (MainWindow.ReceiveConfigurationParameters[0].Equals("TrojanGoWebSocketTLS2Web"))
- {
- TextBoxTrojanGoType.Text = "ws";
- //Host
- TextBoxTrojanGoHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBlockTrojanGoHost.Visibility = Visibility.Visible;
- TextBoxTrojanGoHost.Visibility = Visibility.Visible;
- //Path
- TextBoxTrojanGoWSPath.Text = MainWindow.ReceiveConfigurationParameters[6];
- TextBoxTrojanGoWSPath.Visibility = Visibility.Visible;
- TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Visible;
- TextBlockTrojanGoCaption.Visibility = Visibility.Visible;
-
- }
- if(String.Equals(MainWindow.ReceiveConfigurationParameters[9],"true") == true)
- {
- TextBoxConcurrency.Text = MainWindow.ReceiveConfigurationParameters[3];
- TextBoxIdle_timeout.Text = MainWindow.ReceiveConfigurationParameters[5];
- TextBlockMuxSelect.Visibility = Visibility.Visible;
- GridMuxSelect.Visibility = Visibility.Visible;
- TextBlockExplainCheckBoxMuxSelectResult.Visibility = Visibility.Visible;
- }
- CheckDir("trojan-go_config");
- GenerateTrojanGoShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "Trojan"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Visible;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainTrojan").ToString();
-
- //主机地址
- TextBoxTrojanServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxTrojanServerPort.Text = "443";
- //密钥(uuid)
- TextBoxTrojanServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
-
- CheckDir("trojan_config");
- GenerateTrojanShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "NaiveProxy"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Visible;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainNaiveProxy").ToString();
-
- TextBoxNaiveServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxNaiveUser.Text = MainWindow.ReceiveConfigurationParameters[3];
- TextBoxNaivePassword.Text = MainWindow.ReceiveConfigurationParameters[2];
- GenerateNaivePrxoyShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "SSR"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Visible;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainSSR").ToString();
-
- //主机地址
- TextBoxSSRHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxSSRPort.Text = "443";
- //密码(uuid)
- TextBoxSSRUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
- //加密方式
- TextBoxSSREncryption.Text = "none";
- //传输协议
- TextBoxSSRTransmission.Text = "auth_chain_a";
- //混淆
- TextBoxSSRCamouflageType.Text = "tls1.2_ticket_auth";
-
- //CheckDir("ssr_config");
- GenerateSSRShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "SS"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Visible;
-
- //主机地址
- TextBoxHostAddressSS.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxPortSS.Text = MainWindow.ReceiveConfigurationParameters[1];
- //密码(uuid)
- TextBoxPasswordSS.Text = MainWindow.ReceiveConfigurationParameters[2];
- //加密方式
- TextBoxEncryptionSS.Text = MainWindow.ReceiveConfigurationParameters[3];
- //插件程序
- TextBoxPluginNameExplainSS.Text = MainWindow.ReceiveConfigurationParameters[5];
- //插件选项
- TextBoxPluginOptionExplainSS.Text = MainWindow.ReceiveConfigurationParameters[9];
- //创建ss配置文件总文件夹
- CheckDir("ss_config");
-
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == true)
- {
- TextBlockPluginNameExplainSS.Visibility = Visibility.Collapsed;
- TextBoxPluginNameExplainSS.Visibility = Visibility.Collapsed;
-
- //TextBoxPluginNameExplainSSpc.Visibility = Visibility.Collapsed;
- TextBlockPluginOptionExplainSS.Visibility = Visibility.Collapsed;
- TextBoxPluginOptionExplainSS.Visibility = Visibility.Collapsed;
-
- TextBlockClientPromptSS.Visibility = Visibility.Collapsed;
- RadioButtonMobile.Visibility = Visibility.Collapsed;
- RadioButtonPC.Visibility = Visibility.Collapsed;
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainSS").ToString();
- }
- else
- {
- //显示插件程序与插件选项
- TextBlockPluginNameExplainSS.Visibility = Visibility.Visible;
- TextBoxPluginNameExplainSS.Visibility = Visibility.Visible;
-
- TextBlockPluginOptionExplainSS.Visibility = Visibility.Visible;
- TextBoxPluginOptionExplainSS.Visibility = Visibility.Visible;
-
- TextBlockClientPromptSS.Visibility = Visibility.Visible;
- RadioButtonMobile.Visibility = Visibility.Visible;
- RadioButtonPC.Visibility = Visibility.Visible;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainSSmobile").ToString();
- TextBlockQrURLexplainSSpc.Text = Application.Current.FindResource("TextBlockQrURLexplainSSpc").ToString();
-
- //转换成PC版plugin格式
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "obfs-local"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\obfs-local.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "v2ray-plugin"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\v2ray-plugin.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "kcptun"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\kcptun-client.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\goquiet-client.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "cloak"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\cloak-client.exe";
- }
- }
-
- GenerateShareQRcodeAndBase64UrlSS();
- //选择手机端做为默认显示
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- RadioButtonMobile.IsChecked = true;
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet"))
- {
- RadioButtonPC.IsChecked = true;
- RadioButtonMobile.Visibility = Visibility.Collapsed;
- TextBlockClientPromptSS.Visibility = Visibility.Collapsed;
- //File.Delete($"ss_config\\{saveFileFolder}\\QR.bmp");
- //File.Delete($"ss_config\\{saveFileFolder}\\url.txt");
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "cloak"))
- {
- RadioButtonPC.IsChecked = true;
- RadioButtonMobile.Visibility = Visibility.Collapsed;
- TextBlockClientPromptSS.Visibility = Visibility.Collapsed;
- //File.Delete($"ss_config\\{saveFileFolder}\\QR.bmp");
- //File.Delete($"ss_config\\{saveFileFolder}\\url.txt");
- }
-
- }
-
- }
- else if (String.Equals(MainWindow.proxyType, "MTProto"))
- {
- //显示MTProto参数,隐藏其他
- GroupBoxClientMTProto.Visibility = Visibility.Visible;
- GroupBoxClientQRandURL.Visibility = Visibility.Collapsed;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- string proxyfolder = CheckDir("mtproto_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, MainWindow.ReceiveConfigurationParameters[4]);
- string configSavePath = configDomainSavePath;
-
- RadioButtonMtgIpv4.IsChecked = true;
-
- JObject jObjectJson = JObject.Parse(MainWindow.ReceiveConfigurationParameters[9]);
-
- if (jObjectJson["ipv6"]["tg_url"].ToString().Contains("nil") == false)
- {
- RadioButtonMtgIpv6.Visibility = Visibility.Visible;
- TextBoxURLMtgTgIpv6.Text = jObjectJson["ipv6"]["tg_url"].ToString();
- ImageShareQRcodeMtgTgIpv6.Source = CreateQRCode(TextBoxURLMtgTgIpv6.Text, $"{configSavePath}\\QRIpv6Tg.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv6Tg.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTgIpv6.Text);
- }
-
- TextBoxURLMtgTmeIpv6.Text = jObjectJson["ipv6"]["tme_url"].ToString();
- ImageShareQRcodeMtgTmeIpv6.Source = CreateQRCode(TextBoxURLMtgTmeIpv6.Text, $"{configSavePath}\\QRIpv6Tme.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv6Tme.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTmeIpv6.Text);
- }
- RadioButtonMtgIpv6.IsChecked = true;
- }
- else
- {
- RadioButtonMtgIpv6.Visibility = Visibility.Collapsed;
- }
-
- if (jObjectJson["ipv4"]["tg_url"].ToString().Contains("nil") == false)
- {
- RadioButtonMtgIpv4.Visibility = Visibility.Visible;
- TextBoxURLMtgTgIpv4.Text = jObjectJson["ipv4"]["tg_url"].ToString();
- ImageShareQRcodeMtgTgIpv4.Source = CreateQRCode(TextBoxURLMtgTgIpv4.Text, $"{configSavePath}\\QRIpv4Tg.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv4Tg.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTgIpv4.Text);
- }
-
- TextBoxURLMtgTmeIpv4.Text = jObjectJson["ipv4"]["tme_url"].ToString();
- ImageShareQRcodeMtgTmeIpv4.Source = CreateQRCode(TextBoxURLMtgTmeIpv4.Text, $"{configSavePath}\\QRIpv4Tme.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv4Tme.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTmeIpv4.Text);
- }
- RadioButtonMtgIpv4.IsChecked = true;
- }
- else
- {
- RadioButtonMtgIpv4.Visibility = Visibility.Collapsed;
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\mtproto_info.json"))
- {
- sw.Write(MainWindow.ReceiveConfigurationParameters[9].ToString());
- }
-
- }
- }
-
- #region V2Ray 相关
-
- #region V2ray参数设置函数
-
- //设置VLESS over TCP with XTLS
- private void V2raySetVlessTcpXtls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVless.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
- //ImageShareQRcode.Source = ImageShareQRcodeDefault;
- //TextBoxURL.Text = TextBoxURLDefault;
-
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "xtls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = "";
-
-
- }
-
- //设置VLESS over TCP with TLS
- private void V2raySetVlessTcpTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVless.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
- //TextBoxURL.Text = TextBoxURLVlessTcp;
- //ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
-
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = "";
- }
-
- //设置VLESS over WS with TLS
- private void V2raySetVlessWsTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVless.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
- //TextBoxURL.Text = TextBoxURLVlessWs;
- //ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
-
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[3];
-
- }
-
- //设置VMess over TCP with TLS
- private void V2raySetVmessTcpTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "http";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[9];
- TextBlockVmessOrVless.Visibility = Visibility.Collapsed;
- //显示下面的二维码显示。
- //HideGroupBoxClientQRandURL();
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessTcp;
- ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
- }
-
- //设置VMess over WS with TLS
- private void V2raySetVmessWsTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];
- TextBlockVmessOrVless.Visibility = Visibility.Collapsed;
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessWs;
- ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
- }
-
- //设置Trojan over TCP with TLS
- private void V2raySetTrojanTcpTls()
- {
- //隐藏所有不是Trojan的参数
- GridNotTrojanParameters.Visibility = Visibility.Collapsed;
- //显示下面的二维码与分享链接
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLTrojanTcp;
- ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- }
- #endregion
-
- #region 界面控制相关
-
- //显示Quic 加密方式
- private void ShowQuicEncryption()
- {
- TextBlockQuicEncryption.Visibility = Visibility.Visible;
- TextBlockHost.Visibility = Visibility.Collapsed;
- }
-
- //显示Host隐藏Quic加密方式
- private void ShowHostName()
- {
- TextBlockHost.Visibility = Visibility.Visible;
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- }
-
- //显示路径Path,隐藏mKCP/Quic Key/复制按钮
- private void ShowPathV2ray()
- {
- TextBlockPath.Visibility = Visibility.Visible;
- TextBlockMkcpSeed.Visibility = Visibility.Collapsed;
- TextBlockQuicKey.Visibility = Visibility.Collapsed;
- }
-
- //显示mKCP Seed/复制按钮,隐藏Path/Quic Key
- private void ShowMkcpSeed()
- {
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeed.Visibility = Visibility.Visible;
- TextBlockQuicKey.Visibility = Visibility.Collapsed;
- }
-
- //显示Quic Key/复制按钮 隐藏Path/mKcp Seed
- private void ShowQuicKey()
- {
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeed.Visibility = Visibility.Collapsed;
- TextBlockQuicKey.Visibility = Visibility.Visible;
- }
-
- //显示额外ID
- private void ShowAlterId()
- {
- TextBlockUUIDextra.Visibility = Visibility.Visible;
- TextBoxUUIDextra.Visibility = Visibility.Visible;
- TextBlockUUIDextraExplanation.Visibility = Visibility.Visible;
-
- }
-
- //隐藏额外ID
- private void HideAlterId()
- {
- TextBlockUUIDextra.Visibility = Visibility.Collapsed;
- TextBoxUUIDextra.Visibility = Visibility.Collapsed;
- TextBlockUUIDextraExplanation.Visibility = Visibility.Collapsed;
-
- }
-
- //显示加密方式
- private void ShowEncryption()
- {
- TextBlockEncryption.Visibility = Visibility.Visible;
- TextBoxEncryption.Visibility = Visibility.Visible;
- }
- //隐藏加密方式
- private void HideEncryption()
- {
- TextBlockEncryption.Visibility = Visibility.Collapsed;
- TextBoxEncryption.Visibility = Visibility.Collapsed;
- }
-
- //显示传输协议
- private void ShowTransferProtocol()
- {
- TextBlockTransferProtocol.Visibility = Visibility.Visible;
- TextBoxTransmission.Visibility = Visibility.Visible;
- }
- //隐藏传输协议
- private void HideTransferProtocol()
- {
- TextBlockTransferProtocol.Visibility = Visibility.Collapsed;
- TextBoxTransmission.Visibility = Visibility.Collapsed;
- }
- //显示伪装类型
- private void ShowTextBlockCamouflageType()
- {
- TextBlockCamouflageType.Visibility = Visibility.Visible;
- TextBoxCamouflageType.Visibility = Visibility.Visible;
- }
- //隐藏伪装类型
- private void HideTextBlockCamouflageType()
- {
- TextBlockCamouflageType.Visibility = Visibility.Collapsed;
- TextBoxCamouflageType.Visibility = Visibility.Collapsed;
- }
-
- //显示二维码与链接分享
- private void ShowGroupBoxClientQRandURL()
- {
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- }
- //隐藏二维码与链接分享
- private void HideGroupBoxClientQRandURL()
- {
- GroupBoxClientQRandURL.Visibility = Visibility.Hidden;
- }
-
- //以下几个为对RadioButton按钮的选中后,界面变化与参数显示
- private void RadioButtonVlessTcpXtls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVlessTcpXtls();
- }
-
- private void RadioButtonVlessTcpTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVlessTcpTls();
- }
-
- private void RadioButtonVlessWsTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVlessWsTls();
- }
-
- private void RadioButtonVmessTcpTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVmessTcpTls();
- }
-
- private void RadioButtonVmessWsTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVmessWsTls();
- }
-
- private void RadioButtonTrojanTcpTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetTrojanTcpTls();
- }
- #endregion
-
- #region 复制参数到剪贴板中
-
- //复制内容到剪贴板函数
- private void CopyToClipboard(string content)
- {
- if (content != "")
- {
- Clipboard.SetDataObject(content);
- //MessageBox.Show(Application.Current.FindResource("MessageBoxShow_V2RayUUIDcopyedToClip").ToString());
- string message = Application.Current.FindResource("MessageBoxShow_V2RayUUIDcopyedToClip").ToString();
- MessageBoxTimeoutA((IntPtr)0, message, "", 0, 0, 600); // 直接调用 0.6秒后自动关闭
- }
- else
- {
- //MessageBox.Show(Application.Current.FindResource("MessageBoxShow_V2RayEmptyToClip").ToString());
- string message = Application.Current.FindResource("MessageBoxShow_V2RayEmptyToClip").ToString();
- MessageBoxTimeoutA((IntPtr)0, message, "", 0, 0, 600); // 直接调用 0.6秒后自动关闭
- }
- }
-
- //复制服务器地址到剪贴板
- private void TextBoxHostAddress_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostAddress.Text);
- }
-
-
- //复制服务器端口到剪贴板
- private void TextBoxPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPort.Text);
- }
-
- //复制UUID到剪贴板
- private void TextBoxUUID_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUID.Text);
- }
-
- //复制额外ID到剪贴板
- private void TextBoxUUIDextra_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUIDextra.Text);
- }
-
- //复制加密方式到剪贴板
- private void TextBoxEncryption_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxEncryption.Text);
- }
-
- //复制传输协议到剪贴板
- private void TextBoxTransmission_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTransmission.Text);
- }
-
- //复制伪装方式到剪贴板
- private void TextBoxCamouflageType_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxCamouflageType.Text);
- }
-
- //复制Host/Quic加密方法到剪贴板
- private void TextBoxHostQuicEncryption_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostQuicEncryption.Text);
- }
-
- //复制Quic Key/mKCP Seed/路径Path 到剪贴板中
- private void TextBoxQuicKeyMkcpSeedPath_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxQuicKeyMkcpSeedPath.Text);
- }
-
- //复制TLS 到剪贴板中
- private void TextBoxTLS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTLS.Text);
- }
-
- //复制URL链接到剪贴板中
- private void TextBoxURL_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURL.Text);
- }
-
- #endregion
-
- #region V2Ray客户端生成
- //生成单方案v2rayN客户端导入文件
- private void GenerateV2rayShareQRcodeAndBase64Url()
- {
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- if (TextBoxTransmission.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmission.Text.Contains("quic")==true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- //MessageBox.Show(v2rayNjsonObject["v"].ToString());
- //MessageBox.Show("step1");
- string proxyfolder = CheckDir("v2ray_config");
- //MessageBox.Show("step2");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddress.Text);
- //MessageBox.Show("step3");
- string configSavePath = configDomainSavePath;
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- TextBoxURL.Text = vmessUrl;
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == false
- && MainWindow.mKCPvlessIsSet == false)
- {
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(vmessUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"{configSavePath}\\QR.bmp");
- }
-
- if (File.Exists(@"v2ray_config\config.json"))
- {
- File.Move(@"v2ray_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerate(sw);
- //sw.WriteLine("config.json");
- ////****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- ////****** "v2ray官方网站:https://www.v2ray.com/" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- ////****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- ////****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- ////****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- ////****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- ////****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- ////****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- ////****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- ////****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- ////****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- ////写入通用配置参数
- //TxtWriteGeneralParameters(sw);
- }
- }
-
- #region VLESS VMESS XTLS WS共存方案生成链接与说明文件
-
- //生成VLESS Vmess Tcp Xtls Ws 配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessVmessTcpXtlsWsShareQRcodeAndBase64Url(string plainSavePath)
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- //string plainSavePath = @"";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = vmessUrl;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
- // if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- // {
- // sw.WriteLine(vmessUrl);
- // }
- //}
- //if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- //{
- // ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //}
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParameters(sw);
- }
- }
-
-
- //生成VLESS over TCP with XTLS的配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessTcpXtlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_xtls_client_config";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLDefault = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLDefault;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLDefault);
-
- //}
-
- // ImageShareQRcodeDefault = CreateQRCode(TextBoxURLDefault, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeDefault;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParameters(sw,false);
-
- }
- }
-
- //生成VLESS over TCP with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessTcp;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessTcp);
-
- //}
-
- // ImageShareQRcodeVlessTcp = CreateQRCode(TextBoxURLVlessTcp, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParameters(sw,false);
-
- }
- }
-
- //生成VLESS over WS with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessWs;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessWs);
-
- //}
-
- // ImageShareQRcodeVlessWs = CreateQRCode(TextBoxURLVlessWs, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParameters(sw,false);
-
- }
- }
-
- //生成VMess over TCP with TLS的配置保存
- private void GenerateV2rayVmessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- if (TextBoxTransmission.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmission.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- TextBoxURLVmessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLVmessTcp);
- }
-
- ImageShareQRcodeVmessTcp = CreateQRCode(TextBoxURLVmessTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerate(sw);
-
- }
- }
-
- //生成VMess over WS with TLS的配置保存
- private void GenerateV2rayVmessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- if (TextBoxTransmission.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- }
- else if (TextBoxTransmission.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = "tls"; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- TextBoxURLVmessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessWs;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
-
- sw.WriteLine(TextBoxURLVmessWs);
-
- }
-
- ImageShareQRcodeVmessWs = CreateQRCode(TextBoxURLVmessWs, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerate(sw);
-
- }
- }
-
- //生成Trojan over TCP with TLS的配置保存
- private void GenerateV2rayTrojanShareQRcodeAndBase64Url()
- {
- //创建保存目录
- string plainSavePath = @"trojan_tcp_tls_client_config";
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
- TextBoxURLTrojanTcp = $"trojan://{TextBoxUUID.Text}@{TextBoxHostAddress.Text}:{TextBoxPort.Text}#{TextBoxHostAddress.Text}";
-
- //TextBoxURL.Text = TextBoxURLTrojanTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLTrojanTcp);
-
- }
- //ImageShareQRcode.Source = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- ImageShareQRcodeTrojanTcp = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- //移动官方程序配置文件到相应目录
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- //ReadmeTxtWriteGenerate(sw);
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddress.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUID.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
-
- }
-
- //写入VMESS的readme.txt文件
- private void ReadmeTxtWriteGenerate(StreamWriter sw)
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParameters(sw);
- }
- //TXT文件中写入通用配置参数---
- private void TxtWriteGeneralParameters(StreamWriter sw,bool alterId = true)
- {
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddress.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUID.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (alterId == true)
- {
- strApplicat = "TextBlockV2RayAlterId";
- strParam = TextBoxUUIDextra.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
- }
-
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxEncryption.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockTransferProtocol";
- strParam = TextBoxTransmission.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockCamouflageType";
- strParam = TextBoxCamouflageType.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockIsOrNotTLS";
- strParam = TextBoxTLS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- strParam = TextBoxHostQuicEncryption.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicEncryption.Text, strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPath.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicKey.Text, strLenth) + strParam);
-
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- strParam = TextBoxHostQuicEncryption.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPath.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockMkcpSeed.Text, strLenth) + strParam);
-
- }
- else
- {
- strParam = TextBoxHostQuicEncryption.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPath.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockPath.Text, strLenth) + strParam);
- }
- }
- #endregion
-
- #endregion
-
- #endregion
-
- #region Xray 相关
-
- #region Xray参数设置函数
-
- //设置VLESS over TCP with XTLS
- private void XraySetVlessTcpXtls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVlessXray.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
-
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "xtls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = "";
-
-
- }
-
- //设置VLESS over TCP with TLS
- private void XraySetVlessTcpTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVlessXray.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
-
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = "";
- }
-
- //设置VLESS over WS with TLS
- private void XraySetVlessWsTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVlessXray.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
-
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[3];
-
- }
-
- //设置VMess over TCP with TLS
- private void XraySetVmessTcpTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "http";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[9];
- TextBlockVmessOrVlessXray.Visibility = Visibility.Collapsed;
- //显示下面的二维码显示。
- //HideGroupBoxClientQRandURL();
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessTcp;
- ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
- }
-
- //设置VMess over WS with TLS
- private void XraySetVmessWsTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];
- TextBlockVmessOrVlessXray.Visibility = Visibility.Collapsed;
- //显示下面的二维码与分享链接
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessWs;
- ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
- }
-
- //设置Trojan over TCP with TLS
- private void XraySetTrojanTcpTls()
- {
- //隐藏所有不是Trojan的参数
- GridNotTrojanParametersXray.Visibility = Visibility.Collapsed;
- //显示下面的二维码与分享链接
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLTrojanTcp;
- ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- }
- #endregion
-
- #region 界面控制相关
-
- //显示Quic 加密方式
- private void ShowQuicEncryptionXray()
- {
- TextBlockQuicEncryptionXray.Visibility = Visibility.Visible;
- TextBlockHostXray.Visibility = Visibility.Collapsed;
- }
-
- //显示Host隐藏Quic加密方式
- private void ShowHostNameXray()
- {
- TextBlockHostXray.Visibility = Visibility.Visible;
- TextBlockQuicEncryptionXray.Visibility = Visibility.Collapsed;
- }
-
- //显示路径Path,隐藏mKCP/Quic Key/复制按钮
- private void ShowPathXray()
- {
- TextBlockPathXray.Visibility = Visibility.Visible;
- TextBlockMkcpSeedXray.Visibility = Visibility.Collapsed;
- TextBlockQuicKeyXray.Visibility = Visibility.Collapsed;
- }
-
- //显示mKCP Seed/复制按钮,隐藏Path/Quic Key
- private void ShowMkcpSeedXray()
- {
- TextBlockPathXray.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeedXray.Visibility = Visibility.Visible;
- TextBlockQuicKeyXray.Visibility = Visibility.Collapsed;
- }
-
- //显示Quic Key/复制按钮 隐藏Path/mKcp Seed
- private void ShowQuicKeyXray()
- {
- TextBlockPathXray.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeedXray.Visibility = Visibility.Collapsed;
- TextBlockQuicKeyXray.Visibility = Visibility.Visible;
- }
-
- //显示额外ID
- private void ShowAlterIdXray()
- {
- TextBlockUUIDextraXray.Visibility = Visibility.Visible;
- TextBoxUUIDextraXray.Visibility = Visibility.Visible;
- TextBlockUUIDextraExplanationXray.Visibility = Visibility.Visible;
-
- }
-
- //隐藏额外ID
- private void HideAlterIdXray()
- {
- TextBlockUUIDextraXray.Visibility = Visibility.Collapsed;
- TextBoxUUIDextraXray.Visibility = Visibility.Collapsed;
- TextBlockUUIDextraExplanationXray.Visibility = Visibility.Collapsed;
-
- }
-
- //显示加密方式
- private void ShowEncryptionXray()
- {
- TextBlockEncryptionXray.Visibility = Visibility.Visible;
- TextBoxEncryptionXray.Visibility = Visibility.Visible;
- }
- //隐藏加密方式
- private void HideEncryptionXray()
- {
- TextBlockEncryptionXray.Visibility = Visibility.Collapsed;
- TextBoxEncryptionXray.Visibility = Visibility.Collapsed;
- }
-
- //显示传输协议
- private void ShowTransferProtocolXray()
- {
- TextBlockTransferProtocolXray.Visibility = Visibility.Visible;
- TextBoxTransmissionXray.Visibility = Visibility.Visible;
- }
- //隐藏传输协议
- private void HideTransferProtocolXray()
- {
- TextBlockTransferProtocolXray.Visibility = Visibility.Collapsed;
- TextBoxTransmissionXray.Visibility = Visibility.Collapsed;
- }
- //显示伪装类型
- private void ShowTextBlockCamouflageTypeXray()
- {
- TextBlockCamouflageTypeXray.Visibility = Visibility.Visible;
- TextBoxCamouflageTypeXray.Visibility = Visibility.Visible;
- }
- //隐藏伪装类型
- private void HideTextBlockCamouflageTypeXray()
- {
- TextBlockCamouflageTypeXray.Visibility = Visibility.Collapsed;
- TextBoxCamouflageTypeXray.Visibility = Visibility.Collapsed;
- }
-
-
- //以下几个为对RadioButton按钮的选中后,界面变化与参数显示
- private void RadioButtonVlessTcpXtlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVlessTcpXtls();
- }
-
- private void RadioButtonVlessTcpTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVlessTcpTls();
- }
-
- private void RadioButtonVlessWsTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVlessWsTls();
- }
-
- private void RadioButtonVmessTcpTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVmessTcpTls();
- }
-
- private void RadioButtonVmessWsTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVmessWsTls();
- }
-
- private void RadioButtonTrojanTcpTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetTrojanTcpTls();
- }
- #endregion
-
- #region 复制参数到剪贴板中
-
-
-
- //复制服务器地址到剪贴板
- private void TextBoxHostAddressXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostAddressXray.Text);
- }
-
-
- //复制服务器端口到剪贴板
- private void TextBoxPortXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPortXray.Text);
- }
-
- //复制UUID到剪贴板
- private void TextBoxUUIDXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUIDXray.Text);
- }
-
- //复制额外ID到剪贴板
- private void TextBoxUUIDextraXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUIDextraXray.Text);
- }
-
- //复制加密方式到剪贴板
- private void TextBoxEncryptionXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxEncryptionXray.Text);
- }
-
- //复制传输协议到剪贴板
- private void TextBoxTransmissionXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTransmissionXray.Text);
- }
-
- //复制伪装方式到剪贴板
- private void TextBoxCamouflageTypeXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxCamouflageTypeXray.Text);
- }
-
- //复制Host/Quic加密方法到剪贴板
- private void TextBoxHostQuicEncryptionXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostQuicEncryptionXray.Text);
- }
-
- //复制Quic Key/mKCP Seed/路径Path 到剪贴板中
- private void TextBoxQuicKeyMkcpSeedPathXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxQuicKeyMkcpSeedPathXray.Text);
- }
-
- //复制TLS 到剪贴板中
- private void TextBoxTLSXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTLSXray.Text);
- }
-
- #endregion
-
- #region Xray客户端生成
- //生成单方案v2rayN客户端导入文件
- private void GenerateXrayShareQRcodeAndBase64Url()
- {
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddressXray.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPortXray.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUIDXray.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextraXray.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmissionXray.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageTypeXray.Text; //设置伪装类型
-
- if (TextBoxTransmissionXray.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmissionXray.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLSXray.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- //MessageBox.Show(v2rayNjsonObject["v"].ToString());
- //MessageBox.Show("step1");
- string proxyfolder = CheckDir("xray_config");
- //MessageBox.Show("step2");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddressXray.Text);
- //MessageBox.Show("step3");
- string configSavePath = configDomainSavePath;
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- TextBoxURL.Text = vmessUrl;
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == false
- && MainWindow.mKCPvlessIsSet == false)
- {
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(vmessUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"{configSavePath}\\QR.bmp");
- }
-
- if (File.Exists(@"xray_config\config.json"))
- {
- File.Move(@"xray_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerateXray(sw);
-
- }
- }
-
- #region VLESS VMESS XTLS WS共存方案生成链接与说明文件
-
- //生成VLESS Vmess Tcp Xtls Ws 配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessVmessTcpXtlsWsShareQRcodeAndBase64Url(string plainSavePath)
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- //string plainSavePath = @"";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = vmessUrl;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
- // if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- // {
- // sw.WriteLine(vmessUrl);
- // }
- //}
- //if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- //{
- // ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //}
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParametersXray(sw);
- }
- }
-
-
- //生成VLESS over TCP with XTLS的配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessTcpXtlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_xtls_client_config";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLDefault = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLDefault;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLDefault);
-
- //}
-
- // ImageShareQRcodeDefault = CreateQRCode(TextBoxURLDefault, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeDefault;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取xray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParametersXray(sw, false);
-
- }
- }
-
- //生成VLESS over TCP with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessTcp;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessTcp);
-
- //}
-
- // ImageShareQRcodeVlessTcp = CreateQRCode(TextBoxURLVlessTcp, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取v2ray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParametersXray(sw, false);
-
- }
- }
-
- //生成VLESS over WS with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessWs;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessWs);
-
- //}
-
- // ImageShareQRcodeVlessWs = CreateQRCode(TextBoxURLVlessWs, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取v2ray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParametersXray(sw, false);
-
- }
- }
-
- //生成VMess over TCP with TLS的配置保存
- private void GenerateXrayVmessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddressXray.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPortXray.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUIDXray.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextraXray.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmissionXray.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageTypeXray.Text; //设置伪装类型
-
- if (TextBoxTransmissionXray.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmissionXray.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLSXray.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- TextBoxURLVmessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLVmessTcp);
- }
-
- ImageShareQRcodeVmessTcp = CreateQRCode(TextBoxURLVmessTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerateXray(sw);
-
- }
- }
-
- //生成VMess over WS with TLS的配置保存
- private void GenerateXrayVmessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddressXray.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPortXray.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUIDXray.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextraXray.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmissionXray.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageTypeXray.Text; //设置伪装类型
-
- if (TextBoxTransmissionXray.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置mKCP Seed
- }
- else if (TextBoxTransmissionXray.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = "tls"; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL
- TextBoxURLVmessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessWs;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLVmessWs);
- }
-
- ImageShareQRcodeVmessWs = CreateQRCode(TextBoxURLVmessWs, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerateXray(sw);
-
- }
- }
-
- //生成Trojan over TCP with TLS的配置保存
- private void GenerateXrayTrojanShareQRcodeAndBase64Url()
- {
- //创建保存目录
- string plainSavePath = @"trojan_tcp_tls_client_config";
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
- TextBoxURLTrojanTcp = $"trojan://{TextBoxUUIDXray.Text}@{TextBoxHostAddressXray.Text}:{TextBoxPortXray.Text}#{TextBoxHostAddressXray.Text}";
-
- //TextBoxURL.Text = TextBoxURLTrojanTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLTrojanTcp);
-
- }
- //ImageShareQRcode.Source = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- ImageShareQRcodeTrojanTcp = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- //移动官方程序配置文件到相应目录
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- //ReadmeTxtWriteGenerate(sw);
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择Xray-windows-64.zip或者Xray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddressXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPortXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUIDXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
-
- }
-
- //写入VMESS的readme.txt文件
- private void ReadmeTxtWriteGenerateXray(StreamWriter sw)
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取xray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParametersXray(sw);
- }
- //TXT文件中写入通用配置参数---
- private void TxtWriteGeneralParametersXray(StreamWriter sw, bool alterId = true)
- {
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddressXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPortXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUIDXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (alterId == true)
- {
- strApplicat = "TextBlockV2RayAlterId";
- strParam = TextBoxUUIDextraXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
- }
-
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockTransferProtocol";
- strParam = TextBoxTransmissionXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockCamouflageType";
- strParam = TextBoxCamouflageTypeXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockIsOrNotTLS";
- strParam = TextBoxTLSXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- strParam = TextBoxHostQuicEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicEncryptionXray.Text, strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPathXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicKeyXray.Text, strLenth) + strParam);
-
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- strParam = TextBoxHostQuicEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPathXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockMkcpSeedXray.Text, strLenth) + strParam);
-
- }
- else
- {
- strParam = TextBoxHostQuicEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPathXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockPathXray.Text, strLenth) + strParam);
- }
- }
- #endregion
-
- #endregion
-
- #endregion
-
- #region TrojanGo 相关
- //生成TrojanGo客户端资料
- private void GenerateTrojanGoShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("trojan-go_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxTrojanGoServerHost.Text);
- string configSavePath = configDomainSavePath;
-
- string trojanGoUrl = GetTrojanGoUrl();
-
- TextBoxURL.Text = trojanGoUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(trojanGoUrl);
-
- }
- ImageShareQRcode.Source = CreateQRCode(trojanGoUrl, $"{configSavePath}\\QR.bmp");
-
- //移动Trojan官方程序配置文件到相应目录
- if (File.Exists(@"trojan-go_config\config.json"))
- {
- File.Move(@"trojan-go_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
-
- //****** "此文件为Trojan-go官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine01").ToString());
-
- //****** "Trojan-go官方网站:https://github.com/p4gefau1t/trojan-go" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine02").ToString());
-
- //sw.WriteLine("Trojan-go官方程序下载地址:https://github.com/p4gefau1t/trojan-go/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine03").ToString());
-
- //sw.WriteLine("下载相应版本,Windows选择Trojan-go-x.xx-win.zip,解压后提取trojan-go.exe。与config.json放在同一目录,运行trojan-go.exe即可。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)扫码导入节点");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine05").ToString());
-
- //sw.WriteLine("Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine06").ToString());
-
- //sw.WriteLine("igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine07").ToString());
-
- //sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
- // sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine08").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine09").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //sw.WriteLine("服务器通用连接配置参数");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxTrojanGoServerHost.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxTrojanGoServerHost.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxTrojanGoServerPort.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxTrojanGoServerPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxTrojanGoServerPassword.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxTrojanGoServerPassword.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** Type: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxTrojanGoServerPassword.Text}");
- //strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxTrojanGoType.Text;
- sw.WriteLine(AlignmentStrFunc("Type:", strLenth) + strParam);
- //sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** WebSocket路径: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "TextBlockTrojanGoWebSocketPath";
- strParam = TextBoxTrojanGoWSPath.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** Mux多路复用 ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "CheckBoxMuxSelect";
- strParam = ":";
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** concurrency: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "concurrency:";
- strParam = TextBoxConcurrency.Text;
- sw.WriteLine(AlignmentStrFunc(strApplicat, strLenth) + strParam);
-
- //****** idle_timeout: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "idle_timeout:";
- strParam = TextBoxIdle_timeout.Text;
- sw.WriteLine(AlignmentStrFunc(strApplicat, strLenth) + strParam);
-
- }
-
- }
-
- #region TrojanGo内容双击复制到剪贴板
- private void TextBoxTrojanGoServerHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoServerHost.Text);
- }
-
- private void TextBoxTrojanGoServerPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoServerPort.Text);
- }
-
- private void TextBoxTrojanGoServerPassword_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoServerPassword.Text);
- }
- private void TextBoxTrojanGoSNI_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoSNI.Text);
- }
- private void TextBoxTrojanGoType_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoType.Text);
- }
- private void TextBoxTrojanGoHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoHost.Text);
- }
- private void TextBoxTrojanGoWSPath_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoWSPath.Text);
- }
- private void TextBoxConcurrency_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxConcurrency.Text);
- }
-
- private void TextBoxIdle_timeout_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxIdle_timeout.Text);
- }
- #endregion
-
- //生成TrojanGo的分享链接
- private string GetTrojanGoUrl()
- {
- string trojanGoPassword = EncodeURIComponent(TextBoxTrojanGoServerPassword.Text);
- string trojanGoHost = TextBoxTrojanGoServerHost.Text;
- string trojanGoPort = TextBoxTrojanGoServerPort.Text;
-
- string trojanGoSni = EncodeURIComponent(TextBoxTrojanGoSNI.Text);
- string trojanGoType= EncodeURIComponent(TextBoxTrojanGoType.Text);
- string trojanGohostName = EncodeURIComponent(TextBoxTrojanGoHost.Text);
-
- string trojanGoPath = EncodeURIComponent(TextBoxTrojanGoWSPath.Text);
- string trojanGoEncryption = EncodeURIComponent("");
- string trojanGoPlugin = EncodeURIComponent("");
-
- string trojanGoRemarks = EncodeURIComponent(trojanGoHost);
-
- //分享链接规范:https://github.com/p4gefau1t/trojan-go/issues/132
- //trojan-go://$(trojan-password)@trojan-host:port/?sni=$(update.microsoft.com)&type=$(original|ws|h2|h2+ws)&host=$(update-01.microsoft.com)&path=$(/update/whatever)&encryption=$(ss;aes-256-gcm:ss-password)&plugin=$(...)#$(descriptive-text)
- //string trojanGoUrl = $"trojan-go://{trojanGoPassword}@{trojanGoHost}:{trojanGoPort}/?sni={trojanGoSni}&type={trojanGoType}&host={trojanGohostName}&path={trojanGoPath}&encryption={trojanGoEncryption}&plugin={trojanGoPlugin}#{trojanGoRemarks}";
-
- //&path={trojanGoPath}
- //&encryption={trojanGoEncryption}
- //&plugin={trojanGoPlugin}
- //#{trojanGoRemarks}
- string trojanGoUrl = $"trojan-go://{trojanGoPassword}@{trojanGoHost}:{trojanGoPort}/?sni={trojanGoSni}&type={trojanGoType}";
-
- if (String.IsNullOrEmpty(trojanGohostName) == false)
- {
- trojanGoUrl += $"&host={trojanGohostName}";
- }
- if (String.IsNullOrEmpty(trojanGoPath) == false)
- {
- trojanGoUrl += $"&path={trojanGoPath}";
- }
- if (String.IsNullOrEmpty(trojanGoEncryption) == false)
- {
- trojanGoUrl += $"&encryption={trojanGoEncryption}";
- }
- if (String.IsNullOrEmpty(trojanGoPlugin) == false)
- {
- trojanGoUrl += $"&plugin={trojanGoPlugin}";
- }
-
- trojanGoUrl += $"#{trojanGoRemarks}";
- return trojanGoUrl;
- }
- private string EncodeURIComponent(string initialUri)
- {
- return Uri.EscapeDataString(initialUri);
- }
-
- //生成Trojan客户端资料
- private void GenerateTrojanShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("trojan_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxTrojanServerHost.Text);
- string configSavePath = configDomainSavePath;
-
- //string saveFileFolderFirst = TextBoxTrojanServerHost.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir("trojan_config");
- //while (Directory.Exists(@"trojan_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"trojan_config\" + saveFileFolder);
- string trojanUrl = $"trojan://{TextBoxTrojanServerPassword.Text}@{TextBoxTrojanServerHost.Text}:{TextBoxTrojanServerPort.Text}#{TextBoxTrojanServerHost.Text}";
- //MessageBox.Show(v2rayNjsonObject.ToString());
- //string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
- TextBoxURL.Text = trojanUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(trojanUrl);
-
- }
- ImageShareQRcode.Source = CreateQRCode(trojanUrl, $"{configSavePath}\\QR.bmp");
-
- //移动Trojan官方程序配置文件到相应目录
- if (File.Exists(@"trojan_config\config.json"))
- {
- File.Move(@"trojan_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
-
- //****** "此文件为Trojan官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine01").ToString());
-
- //****** "Trojan官方网站:https://trojan-gfw.github.io/trojan/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine02").ToString());
-
- //sw.WriteLine("Trojan官方程序下载地址:https://github.com/trojan-gfw/trojan/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine03").ToString());
-
- //sw.WriteLine("下载相应版本,Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录,运行trojan.exe即可。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)扫码导入节点");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine05").ToString());
-
- //sw.WriteLine("Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine06").ToString());
-
- //sw.WriteLine("igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine07").ToString());
-
- //sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine08").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine09").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //sw.WriteLine("服务器通用连接配置参数");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxTrojanGoServerHost.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxTrojanServerHost.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxTrojanGoServerPort.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxTrojanServerPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxTrojanGoServerPassword.Text}");
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxTrojanServerPassword.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
-
- }
-
- }
-
- #region Trojan内容双击复制到剪贴板
-
- private void TextBoxTrojanServerHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanServerHost.Text);
- }
-
- private void TextBoxTrojanServerPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanServerPort.Text);
- }
-
- private void TextBoxTrojanServerPassword_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanServerPassword.Text);
- }
-
- #endregion
-
- #endregion
-
- #region NaiveProxy 相关
- //生成NaiveProxy客户端资料
- private void GenerateNaivePrxoyShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("naive_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxNaiveServerHost.Text);
- string configSavePath = configDomainSavePath;
-
- string naiveUrl = $"naive+https://{TextBoxNaiveUser.Text}:{TextBoxNaivePassword.Text}@{TextBoxNaiveServerHost.Text}:443?padding=true#{TextBoxNaiveServerHost.Text}";
-
- TextBoxURL.Text = naiveUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(naiveUrl);
-
- }
- ImageShareQRcode.Source = CreateQRCode(naiveUrl, $"{configSavePath}\\QR.bmp");
-
- //移动NaiveProxy官方程序配置文件到相应目录
- if (File.Exists(@"naive_config\config.json"))
- {
- File.Move(@"naive_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
-
- //****** "此文件为NaiveProxy官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine01").ToString());
-
- //****** "NaiveProxy官方网站:https://github.com/klzgrad/naiveproxy" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine02").ToString());
-
- //sw.WriteLine("NaiveProxy官方程序下载地址:https://github.com/klzgrad/naiveproxy/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine03").ToString());
-
- //sw.WriteLine("下载相应版本,Windows选择naiveproxy-x.xx-win.zip,解压后提取naive.exe。与config.json放在同一目录,运行naive.exe即可。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //sw.WriteLine("此文件为NaiveSharp(windows)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine05").ToString());
-
- //sw.WriteLine("NaiveSharp(windows)下载网址:https://github.com/KevinZonda/NaiveSharp/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine06").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- sw.WriteLine("url.txt");
-
- //sw.WriteLine("此文件为NaiveSharp(windows)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine05").ToString());
-
- //sw.WriteLine("NaiveSharp(windows)下载网址:https://github.com/KevinZonda/NaiveSharp/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine06").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //sw.WriteLine("服务器通用连接配置参数");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine07").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxNaiveServerHost.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxNaiveServerHost.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 用户名:******
- //sw.WriteLine(Application.Current.FindResource("TextBlockHostUser").ToString() + $"{TextBoxNaiveUser.Text}");
- strApplicat = "TextBlockHostUser";
- strParam = TextBoxNaiveUser.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxNaivePassword.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxNaivePassword.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
-
- }
-
- #region NaiveProxy内容双击复制到剪贴板
- private void TextBoxNaiveServerHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaiveServerHost.Text);
- }
-
- private void TextBoxNaivePort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaivePort.Text);
- }
-
- private void TextBoxNaiveUser_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaiveUser.Text);
- }
-
- private void TextBoxNaivePassword_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaivePassword.Text);
- }
-
-
-
- #endregion
-
- #endregion
-
- #region SSR 相关
- //生成SSR客户端资料
- private void GenerateSSRShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("ssr_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxSSRHostAddress.Text);
- string configSavePath = configDomainSavePath;
- //string saveFileFolderFirst = TextBoxSSRHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir("ssr_config");
- //while (Directory.Exists(@"ssr_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"ssr_config\" + saveFileFolder);
-
- string ssrUrl = GetSSRLinkForServer();
- TextBoxURL.Text = ssrUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(ssrUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(ssrUrl, $"{configSavePath}\\QR.bmp");
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- //sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
-
- //***"此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine05").ToString());
-
- //***"ShadowsocksR (windows)下载网址:https://github.com/shadowsocksrr/shadowsocksr-csharp/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine06").ToString());
-
- //***"SSRR(Android)下载网址:https://github.com/shadowsocksrr/shadowsocksr-android/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine07").ToString());
-
- //***"Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine08").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
-
- //***"此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine09").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //***"服务器通用连接配置参数"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{ TextBoxSSRHostAddress.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxSSRHostAddress.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxSSRPort.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxSSRPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxSSRUUID.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxSSRUUID.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 加密方式: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockEncryption").ToString() + $"{TextBoxSSREncryption.Text}");
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxSSREncryption.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 传输协议: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTransferProtocol").ToString() + $"{TextBoxSSRTransmission.Text}");
- strApplicat = "TextBlockTransferProtocol";
- strParam = TextBoxSSRTransmission.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 混淆: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockCamouflageType").ToString() + $"{TextBoxSSRCamouflageType.Text}");
- strApplicat = "TextBlockCamouflageType";
- strParam = TextBoxSSRCamouflageType.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
- }
-
- #region SSR内容双击复制到剪贴板
-
- private void TextBoxSSRHostAddress_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRHostAddress.Text);
- }
-
- private void TextBoxSSRPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRPort.Text);
- }
-
- private void TextBoxSSRUUID_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRUUID.Text);
- }
-
- private void TextBoxSSREncryption_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSREncryption.Text);
- }
-
- private void TextBoxSSRTransmission_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRTransmission.Text);
- }
-
- private void TextBoxSSRCamouflageType_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRCamouflageType.Text);
- }
- #endregion
-
- //生成SS客户端资料
- private void GenerateShareQRcodeAndBase64UrlSS()
- {
- //创建保存目录
- string proxyfolder = CheckDir("ss_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddressSS.Text);
- string configSavePath = configDomainSavePath;
- //string configSavePath = CreateConfigSaveDir(@"ss_config", TextBoxHostAddressSS.Text);
- string ssUrl;
-
- //生成手机端的URL(无插件时,为电脑手机通用)
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet")==false && String.Equals(TextBoxPluginNameExplainSS.Text, "cloak") == false)
- {
- ssUrl = GetSStoURL(TextBoxPluginNameExplainSS.Text);
- TextBoxURL.Text = ssUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(ssUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(ssUrl, $"{configSavePath}\\QR.bmp");
- }
-
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- //生成电脑端
- ssUrl = GetSStoURL(TextBoxPluginNameExplainSSpc.Text);
- TextBoxURLpcSS.Text = ssUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url_pc.txt"))
- {
- sw.WriteLine(ssUrl);
- }
- ImageShareQRcodeSSpc.Source = CreateQRCode(ssUrl, $"{configSavePath}\\QR_pc.bmp");
- }
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet") == false && String.Equals(TextBoxPluginNameExplainSS.Text, "cloak") == false)
- {
- //sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == true)
- {
- //***"此文件为Shadowsocks (windows)、shadowsocks(Android)、Shadowrocket(ios)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS05").ToString());
-
- }
- else
- {
- //***"此文件为shadowsocks(Android)、Shadowrocket(ios)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS05").ToString());
- }
-
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == true)
- {
- //***"此文件为Shadowsocks (windows)、shadowsocks(Android)、Shadowrocket(ios)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS09").ToString());
- }
- else
- {
- //***"此文件为shadowsocks(Android)、Shadowrocket(ios)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS09").ToString());
- }
- sw.WriteLine("");
- //***"shadowsocks(Android)下载网址:https://github.com/shadowsocks/shadowsocks-android/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS07").ToString());
-
- //***"Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS08").ToString());
- }
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- sw.WriteLine("");
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR_pc.bmp");
-
- //***"此文件为Shadowsocks (windows)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS01").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url_pc.txt");
-
- //***"此文件为Shadowsocks (windows)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS02").ToString());
- sw.WriteLine("");
-
- }
- //***"Shadowsocks(windows)下载网址:https://github.com/shadowsocks/shadowsocks-windows/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS06").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //***"服务器通用连接配置参数"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxHostAddressSS.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddressSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxPortSS.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPortSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxPasswordSS.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxPasswordSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 加密方式: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockEncryption").ToString() + $"{TextBoxEncryptionSS.Text}");
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxEncryptionSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
-
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- //****** 插件程序:: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockPluginNameExplainSS").ToString() + $"{TextBoxPluginNameExplainSS.Text}");
- strApplicat = "TextBlockPluginNameExplainSS";
- strParam = TextBoxPluginNameExplainSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 插件选项: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockPluginOptionExplainSS").ToString() + $"{TextBoxPluginOptionExplainSS.Text}");
- strApplicat = "TextBlockPluginOptionExplainSS";
- strParam = TextBoxPluginOptionExplainSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- sw.WriteLine("-----------------------------------------\n");
- //****** 插件使用说明 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS").ToString());
-
- //****** ProxySU默认所有插件,在Shadowsocks (windows)运行文件所在文件夹的子文件夹plugins下。 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS01").ToString());
-
- //****** 电脑端手动安装插件说明 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS02").ToString());
-
- //****** 先下载插件,各个插件Windows客户端下载地址为: ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS03").ToString());
-
- //****** Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases 只下载 obfs-local.zip ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS04").ToString());
-
- //****** V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64位系统选择:v2ray-plugin-windows-amd64-vx.x.x.tar.gz,32位系统选择:v2ray-plugin-windows-386-vx.x.x.tar.gz (x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS05").ToString());
-
- //****** Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64位系统选择:kcptun-windows-amd64-xxxxxx.tar.gz,32位系统选择:kcptun-plugin-windows-386-xxxxxx.tar.gz (x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS06").ToString());
-
- ////****** GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64位系统选择:gq-client-windows-amd64-x.x.x.exe,32位系统选择:gq-client-windows-386-x.x.x.exe(x为数字,是版本号)******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS07").ToString());
-
- ////****** Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64位系统选择:ck-client-windows-amd64-x.x.x.exe,32位系统选择:ck-client-windows-386-x.x.x.exe(x为数字,是版本号) ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS08").ToString());
-
- //****** 在Shadowsocks (windows)运行文件所在文件夹中,新建文件夹plugins,将obfs-local.zip解压出的文件(两个)全部复到plugins中,
- //v2ray -plugin下载得到的文件,解压出的文件,复制到plugins中,并重命名为:v2ray-plugin.exe。
- //Kcptun -plugin下载得到的文件,解压出两个文件,将其中的client_windows开头的文件,复制到plugins中,并重命名为:kcptun-client.exe。
- //GoQuiet-plugin下载得到的文件,直接复制到plugin中,并重命名为:goquiet-client.exe。
- //Cloak-plugin下载得到的文件,直接复制到plugin中,并重命名为:cloak-client.exe
- //******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS09").ToString());
- //******安装完毕 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS10").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- //******手机安卓客户端插件安装说明 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid02").ToString());
-
- //****** 先下载插件,各个插件安卓客户端下载地址为: ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid03").ToString());
-
- //****** Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases 只下载 obfs-local-nightly-x.x.x.apk(x为数字,是版本号) ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid04").ToString());
-
- //****** V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases 一般选择v2ray--universal-x.x.x.apk(x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid05").ToString());
-
- //****** Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases 一般选择kcptun--universal-x.x.x.apk(x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid06").ToString());
- //******将上述apk文件传到手机,安装即可! ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid07").ToString());
-
- }
-
- }
-
- }
-
- #region SS内容双击复制到剪贴板
- private void TextBoxHostAddressSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostAddressSS.Text);
- }
-
- private void TextBoxPortSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPortSS.Text);
- }
-
- private void TextBoxPasswordSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPasswordSS.Text);
- }
-
- private void TextBoxEncryptionSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxEncryptionSS.Text);
- }
-
- private void TextBoxPluginNameExplainSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPluginNameExplainSS.Text);
- }
- private void TextBoxPluginNameExplainSSpc_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPluginNameExplainSSpc.Text);
- }
-
- private void TextBoxPluginOptionExplainSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPluginOptionExplainSS.Text);
- }
-
- private void TextBoxURLpcSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLpcSS.Text);
- }
-
- #endregion
-
- #endregion
-
- #region MTProto 界面控制
- private void RadioButtonMtgIpv4_Checked(object sender, RoutedEventArgs e)
- {
- GridMtgIpv4.Visibility = Visibility.Visible;
- GridMtgIpv6.Visibility = Visibility.Collapsed;
- }
-
- private void RadioButtonMtgIpv6_Checked(object sender, RoutedEventArgs e)
- {
- GridMtgIpv4.Visibility = Visibility.Collapsed;
- GridMtgIpv6.Visibility = Visibility.Visible;
- }
- private void TextBoxURLMtgTgIpv4_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTgIpv4.Text);
- }
-
- private void TextBoxURLMtgTmeIpv4_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTmeIpv4.Text);
- }
-
- private void TextBoxURLMtgTgIpv6_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTgIpv6.Text);
- }
-
- private void TextBoxURLMtgTmeIpv6_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTmeIpv6.Text);
- }
-
- #endregion
-
- //生成base64
- private string ToBase64Encode(string text)
- {
- if (String.IsNullOrEmpty(text))
- {
- return text;
- }
-
- byte[] textBytes = Encoding.UTF8.GetBytes(text);
- return Convert.ToBase64String(textBytes);
- }
-
- //生成QRcoder图片,并按给出的路径与名称保存,返回窗口显示的图片源
- private BitmapSource CreateQRCode(string varBase64,string configPath)
- {
- QRCodeGenerator qrGenerator = new QRCodeGenerator();
- QRCodeData qrCodeData = qrGenerator.CreateQrCode(varBase64, QRCodeGenerator.ECCLevel.Q);
- QRCode qrCode = new QRCode(qrCodeData);
- Bitmap qrCodeImage = qrCode.GetGraphic(20);
- IntPtr myImagePtr = qrCodeImage.GetHbitmap();
- BitmapSource imgsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
- //ImageShareQRcode.Source = imgsource;
- //DeleteObject(myImagePtr);
- qrCodeImage.Save(configPath);
- return imgsource;
-
- }
-
- //判断目录是否存在,不存在则创建
- private string CheckDir(string folder)
- {
- try
- {
- if (!Directory.Exists(folder))//如果不存在就创建file文件夹
- Directory.CreateDirectory(folder);//创建该文件夹
- return folder;
- }
- catch (Exception)
- {
- return "";
- }
- }
-
- //目录已存在则生成序号递增,并返回所创建的目录路径。
- private string CreateConfigSaveDir(string upperDir,string configDir)
- {
- try
- {
- //string saveFileFolderFirst = configDir;
- int num = 1;
- //saveFileFolder = EncodeURIComponent(configDir);
- saveFileFolder = configDir.Replace(":","_");
- CheckDir(upperDir);
- while (Directory.Exists(upperDir + @"\" + saveFileFolder) == true)
- {
- saveFileFolder = configDir + "_copy_" + num.ToString();
- num++;
- }
- CheckDir(upperDir + @"\" + saveFileFolder);
- return upperDir + @"\" + saveFileFolder;
- }
- catch (Exception)
- {
- saveFileFolder = "";
- return upperDir + @"\" + saveFileFolder;
- }
-
- }
-
- //打开文件夹
- private void ButtonOpenSaveDir_Click(object sender, RoutedEventArgs e)
- {
- string openFolderPath = configDomainSavePath;
- System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
- this.Close();
-
- }
-
- //SSR生成URL链接
- private string GetSSRLinkForServer()
- {
- string server = TextBoxSSRHostAddress.Text;
- string server_port = TextBoxSSRPort.Text;
- string password = TextBoxSSRUUID.Text;
- string protocol = TextBoxSSRTransmission.Text;
- string method = TextBoxSSREncryption.Text;
- string obfs = TextBoxSSRCamouflageType.Text;
-
- string obfsparam="";
- string protocolparam = "";
- string remarks = TextBoxSSRHostAddress.Text;
- string group = TextBoxSSRHostAddress.Text;
- bool udp_over_tcp = true;
- int server_udp_port = 0;
-
- string main_part = server + ":" + server_port + ":" + protocol + ":" + method + ":" + obfs + ":" + EncodeUrlSafeBase64(password);
- string param_str = "obfsparam=" + EncodeUrlSafeBase64(obfsparam ?? "");
- if (!string.IsNullOrEmpty(protocolparam))
- {
- param_str += "&protoparam=" + EncodeUrlSafeBase64(protocolparam);
- }
- if (!string.IsNullOrEmpty(remarks))
- {
- param_str += "&remarks=" + EncodeUrlSafeBase64(remarks);
- }
- if (!string.IsNullOrEmpty(group))
- {
- param_str += "&group=" + EncodeUrlSafeBase64(group);
- }
- if (udp_over_tcp)
- {
- param_str += "&uot=" + "1";
- }
- if (server_udp_port > 0)
- {
- param_str += "&udpport=" + server_udp_port.ToString();
- }
- string base64 = EncodeUrlSafeBase64(main_part + "/?" + param_str);
- return "ssr://" + base64;
- }
-
- //SS生成URL链接,需要给出plugin的内容,用于生成手机端或电脑端的URL
- public string GetSStoURL(string plugin,bool legacyUrl = true)
- {
- string tag = string.Empty;
- string url = string.Empty;
-
- server = TextBoxHostAddressSS.Text;
- string server_port = TextBoxPortSS.Text;
-
- string password = TextBoxPasswordSS.Text;
- string method = TextBoxEncryptionSS.Text;
-
- // plugin = TextBoxPluginNameExplainSS.Text;
- string plugin_opts = TextBoxPluginOptionExplainSS.Text;
-
- string remarks = server;
-
- if (legacyUrl && string.IsNullOrWhiteSpace(plugin))
- {
- // For backwards compatiblity, if no plugin, use old url format
- string parts = $"{method}:{password}@{server}:{server_port}";
- string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
- url = base64;
- }
- else
- {
- // SIP002
- string parts = $"{method}:{password}";
- string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
- string websafeBase64 = base64.Replace('+', '-').Replace('/', '_').TrimEnd('=');
-
- url = string.Format(
- "{0}@{1}:{2}/",
- websafeBase64,
- FormalHostName,
- server_port
- );
-
- if (!String.IsNullOrWhiteSpace(plugin))
- {
-
- string pluginPart = plugin;
- if (!String.IsNullOrWhiteSpace(plugin_opts))
- {
- pluginPart += ";" + plugin_opts;
- }
- string pluginQuery = "?plugin=" + HttpUtility.UrlEncode(pluginPart, Encoding.UTF8);
- url += pluginQuery;
- }
- }
-
- if (!String.IsNullOrEmpty(remarks))
- {
- tag = $"#{HttpUtility.UrlEncode(remarks, Encoding.UTF8)}";
- }
- return $"ss://{url}{tag}";
- }
-
- //格式化主机名称
- private string FormalHostName
- {
- get
- {
- // CheckHostName() won't do a real DNS lookup
- switch (Uri.CheckHostName(server))
- {
- case UriHostNameType.IPv6: // Add square bracket when IPv6 (RFC3986)
- return $"[{server}]";
- default: // IPv4 or domain name
- return server;
- }
- }
- }
- //编码安全Base64
- private string EncodeUrlSafeBase64(byte[] val, bool trim)
- {
- if (trim)
- return Convert.ToBase64String(val).Replace('+', '-').Replace('/', '_').TrimEnd('=');
- else
- return Convert.ToBase64String(val).Replace('+', '-').Replace('/', '_');
- }
- //编码安全Base64重载
- private string EncodeUrlSafeBase64(string val, bool trim = true)
- {
- return EncodeUrlSafeBase64(Encoding.UTF8.GetBytes(val), trim);
- }
-
- private void RadioButtonMobile_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxPluginNameExplainSS.Visibility = Visibility.Visible;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
-
- TextBoxPluginNameExplainSSpc.Visibility = Visibility.Collapsed;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
-
- }
-
- private void RadioButtonPC_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxPluginNameExplainSS.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Collapsed;
-
- TextBoxPluginNameExplainSSpc.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Visible;
- }
-
- ///
- ///生成固定长度的空格字符串
- ///
- ///
- ///
-
- private string SpaceStrFunc(int length)
- {
- string strReturn = string.Empty;
- if (length > 0)
- {
- for (int i = 0; i < length; i++)
- {
- strReturn += " ";
- }
- }
- return strReturn;
- }
-
- ///
- ///将字符串生转化为固定长度左对齐,右补空格
- ///
- ///需要补齐的字符串
- ///补齐后的长度
- ///
-
- private string AlignmentStrFunc(string strTemp, int length)
- {
- byte[] byteStr = System.Text.Encoding.Default.GetBytes(strTemp.Trim());
- int iLength = byteStr.Length;
- int iNeed = length - iLength;
-
- byte[] spaceLen = Encoding.Default.GetBytes(" "); //一个空格的长度
- iNeed = iNeed / spaceLen.Length;
-
- string spaceString = SpaceStrFunc(iNeed);
- //return strTemp + spaceString;
- return spaceString + strTemp;
- }
-
-
- }
-
-
-}
diff --git a/ProxySU/SSpluginWindow.xaml b/ProxySU/SSpluginWindow.xaml
deleted file mode 100644
index a3af977a..00000000
--- a/ProxySU/SSpluginWindow.xaml
+++ /dev/null
@@ -1,279 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/SSpluginWindow.xaml.cs b/ProxySU/SSpluginWindow.xaml.cs
deleted file mode 100644
index f1f508b3..00000000
--- a/ProxySU/SSpluginWindow.xaml.cs
+++ /dev/null
@@ -1,394 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace ProxySU
-{
- ///
- /// SSpluginWindow.xaml 的交互逻辑
- ///
- public partial class SSpluginWindow : Window
- {
- //SS加密方法设定
- public class EncryptionMethodInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
- public SSpluginWindow()
- {
- InitializeComponent();
-
- #region 加密方法选择 初始设置为chacha20-ietf-poly1305
- List methodList = new List();
-
- methodList.Add(new EncryptionMethodInfo { Name = "chacha20-ietf-poly1305", Value = "chacha20-ietf-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "xchacha20-ietf-poly1305", Value = "xchacha20-ietf-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-256-gcm", Value = "aes-256-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-192-gcm", Value = "aes-192-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-128-gcm", Value = "aes-128-gcm" });
-
- ComboBoxEncryptionMethodInfo.ItemsSource = methodList;
-
- ComboBoxEncryptionMethodInfo.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxEncryptionMethodInfo.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxEncryptionMethodInfo.SelectedIndex = 0;
-
- DataContext = this;
- #endregion
- }
-
-
-
- //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
- //代码参考网址:https://blog.csdn.net/weixin_42583999/article/details/103468857
- //调用:UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- private void UncheckLayouts(TabItem activePage)
- {
- foreach (TabItem tabPage in TabControlTemplate.Items)
- {
- if (tabPage == activePage) continue;
- Grid grid = (Grid)tabPage.Content;
- foreach (UIElement element in grid.Children)
- {
- if (element is RadioButton)
- {
- RadioButton radiobutton = (element as RadioButton);
- radiobutton.IsChecked = false;
- }
-
- }
- }
- }
-
-
- //伪装网站处理
- //private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
- //return fakeUrl;
- // }
-
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = true;
- //UncheckLayouts(TabControlTemplate);
- //SS 经典模式被选中
- if (RadioButtonNonePluginSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "NonePluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonNonePluginSS.Content.ToString();
-
- }
- //SS+obfs+http+web伪装模式被选中
- else if (RadioButtonObfsPluginHttpWebSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "ObfsPluginHttpWebSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonObfsPluginHttpWebSS.Content.ToString();
-
- }
- //SS+obfs+TLS+web模式被选中
- else if (RadioButtonObfsPluginHttpsWebSS.IsChecked == true)
- {
-
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "ObfsPluginHttpsWebSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonObfsPluginHttpsWebSS.Content.ToString();
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //V2Ray-Plugin SS+WebSocket 无TLS模式被选中
- else if (RadioButtonWebSocketSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketSS.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxWebSocketPathSS.Text);
- }
-
- //V2Ray-Plugin SS+WebSocket+TLS+Web模式被选中
- else if (RadioButtonWebSocketTLSWebFrontSS.IsChecked == true || RadioButtonWebSocketTLSWebFrontSSHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSWebFrontSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLSWebFrontSS.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxWebSocketPathSS.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
- //V2Ray-Plugin SS+QUIC模式被选中
- else if (RadioButtonQuicSS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicSS.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
-
- }
- //SS+kcptun-plugin模式被选中
- else if (RadioButtonKcptunPluginSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "KcptunPluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonKcptunPluginSS.Content.ToString();
-
- }
- //SS+GoQuiet-Plugin模式被选中
- else if (RadioButtonGoQuietPluginSS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "GoQuietPluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonGoQuietPluginSS.Content.ToString();
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
-
- }
- //SS+Cloak-Plugin模式被选中
- else if (RadioButtonCloakPluginSS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "CloakPluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonCloakPluginSS.Content.ToString();
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
-
- }
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = PreTrim(TextBoxServerListenPortSS.Text);
- //传递uuid密码
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUIDSS.Text);
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
-
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
-
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
-
- #region 其他设置中的界面控制
-
- //无插件的界面
- private void RadioButtonNonePluginSS_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏Websocket Path
- TextBlockWebSocketPathSS.Visibility = Visibility.Collapsed;
- TextBoxWebSocketPathSS.Visibility = Visibility.Collapsed;
- ButtonWebSocketPathSS.Visibility = Visibility.Collapsed;
-
- //隐藏域名
- TextBlockDomainSS.Visibility = Visibility.Collapsed;
- TextBoxDomainSS.Visibility = Visibility.Collapsed;
- //检测域名按钮
- ButtonDomain.Visibility = Visibility.Collapsed;
- //隐藏伪装网站
- TextBlockMaskSites.Visibility = Visibility.Collapsed;
- TextBoxMaskSites.Visibility = Visibility.Collapsed;
-
- //初始化密码
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
- //初始化端口
-
- TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- //使用域名,启用TLS 无Websocket的界面
- private void RadioButtonUseDomainTls_Checked(object sender, RoutedEventArgs e)
- {
-
- TextBoxServerListenPortSS.Text = "443";
- //隐藏Websocket Path
- TextBlockWebSocketPathSS.Visibility = Visibility.Collapsed;
- TextBoxWebSocketPathSS.Visibility = Visibility.Collapsed;
- ButtonWebSocketPathSS.Visibility = Visibility.Collapsed;
-
- //显示域名
- TextBlockDomainSS.Visibility = Visibility.Visible;
- TextBoxDomainSS.Visibility = Visibility.Visible;
- //检测域名按钮
- ButtonDomain.Visibility = Visibility.Collapsed;
- //显示伪装网站
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
-
- //初始化密码
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
- //初始化端口
- //TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //使用V2ray-plugin 的Websocket over https (TLS)
- private void RadioButtonUseDomainWebsocketTls_Checked(object sender, RoutedEventArgs e)
- {
-
- TextBoxServerListenPortSS.Text = "443";
- //显示Websocket Path
- TextBlockWebSocketPathSS.Visibility = Visibility.Visible;
- TextBoxWebSocketPathSS.Visibility = Visibility.Visible;
- ButtonWebSocketPathSS.Visibility = Visibility.Visible;
-
- //显示域名
- TextBlockDomainSS.Visibility = Visibility.Visible;
- TextBoxDomainSS.Visibility = Visibility.Visible;
- //检测域名按钮
- ButtonDomain.Visibility = Visibility.Collapsed;
- //显示伪装网站
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
-
- //初始化密码
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
-
- //初始化端口
-
- //TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
-
- //初始化Websocket Path
- TextBoxWebSocketPathSS.Text = GenerateRandomPath();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- #endregion
-
- //加密方法更改后的动作
- private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
-
- }
-
- //产生随机的uuid
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
- }
-
- //产生随机服务端口
- private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
- }
- //产生随机的Path
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- TextBoxWebSocketPathSS.Text = GenerateRandomPath();
- }
-
- #region 相关参数生成函数
- //产生随机的UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
- //产生随机端口
- private int GenerateRandomPort()
- {
- Random random = new Random();
- return random.Next(30001, 50000);
- }
- //读取加密方式
- private string GetEncryptionMethodSS()
- {
- //string methodName;
- //object methodSelected;
- //methodSelected = ComboBoxEncryptionMethodInfo.SelectedValue;
- //methodName = methodSelected.ToString();
- //return methodName;
- return ComboBoxEncryptionMethodInfo.SelectedValue.ToString();
- }
- //产生随机的Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- Guid uuid = Guid.NewGuid();
- string[] pathArray = uuid.ToString().Split('-');
- string path = pathArray[randomSerialNum];
- return $"/{path}";
- }
-
- #endregion
-
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
-
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomainSS.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
- }
-}
diff --git a/ProxySU/Translations/ProxySU.en-US.xaml b/ProxySU/Translations/ProxySU.en-US.xaml
deleted file mode 100644
index 4007373d..00000000
--- a/ProxySU/Translations/ProxySU.en-US.xaml
+++ /dev/null
@@ -1,617 +0,0 @@
-
-
- The new version has been released!
- Downloading...Wait Prompt...
- The download of the latest version failed, please try again later!
- Download the latest version successfully, the file has been saved in the same directory of the current ProxySU.exe
- Update
- 界面語言:
- Deployment
- Resources
- Free Wall URL
- Common Error
- Host:
- IP or Domain (Not empty)
- Port:
- User:
- Password:
- Key:
- Key file Path (Not Empty)
- Open...
- Password Login
- Key Login
- No Proxy
- Not Login
- Requires Login
- Proxy Addr:
- Save Installation Log...
- Waiting for installation and deployment
- System Tools
-
- Xray template library
- Xray one-click installation
- Upgrade Xay
-
- V2Ray Templates
- V2ray install
- Upgrade V2Ray
- Cancel
- Trojan-Go Templates
- Trojan-Go install
- Upgrade Trojan-Go
- Cancel
- Currently selected plan:
- No plan selected
-
- Parameter settings
- Mode: Trojan+TLS+Caddy
- Domain:
- Port: 443
- Domain Not Empty
- Password:
- Change
- Trojan install
- Upgrade Trojan
- Cancel
-
- Mode: NaiveProxy+TLS+Caddy
- Random
- NaiveProxy install
- Cancel
-
- Mode: SSR+TLS+Caddy
- SSR install
-
-
- Mode: MTProto+TLS
- MTProto install
- Making domain name:
- Recommended https ports 443, 2053, 2083, 2087, 2096, 8443
- The secret key will be randomly generated by the server.
-
-
- SS install
- SS plug-in library
- Classic mode
- Tip: This mode, long time, large traffic use, easy to be blocked and interfered, is not recommended!
- SS Classic
- SS classic use mode, no domain name is required, data is encrypted with high strength, and the data is recognized as unknown data. At present, the traffic is easy to be identified, and it is easy to be interfered and blocked. Use it with caution! Putting here is just a feeling and tribute!
- Simple-obfs plug-in
- Tip: This is a traffic obfuscation scheme used in the early days of SS. The plug-in has not been updated for a long time and is not recommended!
- SS+obfs+http+Web
- Does not require a domain name, the data is highly encrypted, the traffic is confused as http (not the real http), and the use of Web site camouflage can enhance the anti-recognition to a certain extent! CDN is not supported.
- SS+obfs+TLS(https)+Web
- requires a domain name, the use of a domain name will greatly enhance the anti-identification, high-strength data encryption, traffic confusion as https (not real https), the use of Web site camouflage, further enhance the anti-identification! CDN is not supported.
- V2Ray plug-in
- Reminder: ShadowRocket(ios) does not support SS+Quic mode
- SS+WebSocket+TLS+Caddy (Web post)
- SS+WebSocket+TLS+Caddy (Web front)
- Tip: In the above scheme, there is no difference in the use effect between Web front and Web post. In the Web post scheme, the TLS certificate is applied for by acme.sh. After the certificate expires, acme.sh will automatically renew, but you need to manually restart SS to load the new certificate. The certificate in the web front-end solution is automatically applied for and loaded by Caddy without restarting SS.
- SS+QUIC
- V2Ray-Plugin uses QUIC protocol for transmission, and TLS encryption is mandatory. Encrypted data transmission, identified as udp traffic, was originally initiated by Google, advantages: reduced delay, multiplexing, connection migration, domain name is required,
-
- kcptun Plugin
- Reminder: Shadowrocket(ios) does not support GoQuiet-plugin. shadowsocks (Android) does not support GoQuiet-plugin and Cloak-plugin plug-ins
- KCP is a fast and reliable protocol. It can waste 10%-20% of bandwidth than TCP in exchange for a 30%-40% reduction in average latency and a three-fold reduction in maximum latency The transmission effect. Use UDP protocol for transmission, high-strength data encryption, transmission of the same content, kcp generally consumes more traffic than TCP, and will greatly increase the network speed under lines with high packet loss rates, and may be restricted by QOS at individual operators .
- The basic principle is to simulate TLS traffic while disguising the server as a normal web server. This confusion is not the first: simple-obfs and ShadowsocksR’s tls1.2_ticket_auth mode proves this. It works. This plug-in improves the existing methods, and its goal is to make large-scale blockade of HTTPS servers (even IP segments) the only effective way to block SS
- Use encryption to confuse proxy traffic into legitimate HTTPS traffic, and disguise the proxy server as a normal Web server to avoid Internet censorship. It can be seen as an upgraded version of GoQuiet above, optimizing the network connection speed, and not confusing https but real https traffic.
- Plugin program:
- Plugin options:
- Use the compilation method, it will take a little longer, please be patient...
-
-
- Proofreading Time
- Release 80/443
- Enable BBR
- Uninstall Proxy
- Enable root password login
- root prohibits password login
- Enable root certificate key login
- Only the proxy software installed by ProxySU and related configurations are supported. Please make sure that important configurations have been backed up. Uninstalling agents installed using other methods or scripts is not supported. Are you sure you want to uninstall the agent software on the remote host?
- This function requires that the currently logged-in account has sudo permissions. Is the root account enabled and password set for the remote host?
- This function requires that the currently logged-in account has root or sudo authority. Is root certificate key login enabled for the remote host?
- This function requires that the remote host has enabled other login methods, such as key mode, etc., otherwise the remote host may not be able to connect. Is the root account password login method of the remote host prohibited?
- is closing the root account password login method.....
- The remote host root account password login method is closed!
- The root account certificate key login of the remote host has been enabled, and the key file rootuser.key is saved in the subsequent opened folder!
- The current account already has root privileges, no need to set it up!
- The current account cannot obtain sudo permission, the setting failed!
- Generate a 20-digit random password!
- Save password information!
- Generating a key...
- The key is being downloaded...
- The remote host enables key login.......
- The remote host Root account password login is enabled, and the password is saved in the folder opened afterwards!
- Start uninstall......
- Detected installed
- Uninstallation failed! Please ask the developer!
- Uninstall successfully!
-
- Home
- Forward
- Back
- Due to well-known reasons, loading is slow at certain times, please be patient
-
- Trojan-go template library
- http/2 transmission, Caddy2 camouflage website, anti-recognition, CDN of CloudFlare is not currently supported
- Use WebSocket transmission, Caddy2 camouflage website, anti-identification, support CloudFlare CDN
- Parameter settings
- Domain name:
- Port: 443
- Password:
- Use the existing password and paste it directly into the box
- WebSocket Path:
- Mux multiplexing
- The settings here are only valid for the official client configuration file config.json, other clients need to be set manually, and the server automatically adapts.
- This field does not appear in the QR code and sharing URL. The client needs to set it by itself, and the server enables automatic adaptation by default.
- OK
- Cancel
-
- V2Ray Templates
- Recommend
- EarlyPlan
- VLESS
- VLESS is a lightweight transmission protocol. Unlike VMess, VLESS don't depend on the system time. The authentication method is also UUID, but alterId is not required. Currently VLESS does not have its own encryption, please use it for reliable channels, such as TLS. Advantages: It can effectively reduce host resource consumption. Currently VLESS does not support sharing. Please ensure that both the client and server v2ray-core are the latest version.
- XTLS works well on devices with low performance or without AES hard-decoding. For example, XTLS is used on hard routers, and the network speed can be doubled when the CPU is full, or the same The CPU occupancy rate is halved at Internet speed, and for mobile devices, the reduction in the amount of calculation means power saving.Version requires 4.29+ (Domain required) Not support CDN.
- Lightweight protocol VLESS, occupies less host resources, data TLS encrypted transmission, and Caddy2 is used as a disguised website on the node. Suitable for VPS with low configuration, or shared nodes by multiple people, the server client version requires 4.27+ (Domain required) Notsupport CDN.
- VLESS protocol, this type of solution with VMESS is more lightweight. Stability is strong, Caddy2 is front-facing, hidden proxy features, it is recognized as https traffic visiting the website, the strongest anti-blocking recognition, (Domain required) CDN is supported
- VLESS protocol, this type of solution with VMESS is more lightweight. Based on HTTP/2 transmission. Completely implemented in accordance with the HTTP/2 standard, with Caddy2 as the front, hidden proxy features, H2C protocol forwarding to V2Ray, (Domain required) CloudFlare CDN is not supported
- TCP
- WebSocket
- Http/2
- mKCP
- QUIC
- Parameter settings
- Server port:
- Random
- If TLS encryption is used, please keep the default port 443
- Use the existing UUID and paste it directly into the box
- QUIC Key:
- mKCP Seed:
- Enable the mKCP Seed key to enhance anti-recognition, leave it blank to disable it. Version 4.24.2+
- Path:
- VLESS ws path:
- VMESS tcp path:
- VMESS ws path:
- QUIC Encryption:
- Domain name:
- Trojan password is the same as V2ray UUID.
- Mask a website:
- Set this option to increase proxy concealment (can be empty)
- Enter only the domain name, excluding "http" and "/" etc.
- Only forbid root account to log in with password, please make sure that other login methods of root account have taken effect
- The root account will be enabled and set to password login
- will enable or set the root account as the key certificate login
- The input format of the fake URL is wrong! please enter again!
- Strong stability, Caddy2 as the front, hidden proxy feature, recognized as https traffic to the website, the strongest anti-blocking recognition, domain name is required, CDN support
- based on HTTP/2 transmission. Completely implemented in accordance with the HTTP/2 standard, with Caddy2 as the front, hidden proxy features, H2C protocol forwarding to V2Ray, domain name is required, and CloudFlare CDN is not currently supported
- Currently Xray is a superset of V2Ray, and it will have a different development direction from V2Ray in the future.
- VLESS over TCP with XTLS + fallback and shunt to WHATEVER (ultimate configuration), configured and recommended by rprx boss (author of xtls), configure the following six solutions at the same time on the server side, sharing the same domain name and port 443, WS can pass through CDN.
- VLESS over TCP with XTLS + fallback and shunt to WHATEVER (ultimate configuration), configured and recommended by rprx boss (author of xtls), configure the following five solutions at the same time on the server side, sharing the same domain name and port 443, WS can pass through CDN.(If you want to add XTLS scheme, please use Xray configuration)
- Encrypted data transmission will be recognized as unknown tcp traffic
- TCP+Http camouflage
- Encrypted data transmission and HTTP disguise will be recognized as http traffic, but not real http access
- Data encrypted transmission, the transmission protocol uses TLS, it will be recognized as TLS traffic, not equivalent to https traffic characteristics (domain name required)
- TCP+TLS (self-signed certificate)
- Data encrypted transmission, the transmission protocol uses TLS, it will be recognized as TLS traffic, not equivalent to https traffic characteristics (no domain name required)
- Shadowrocket (ios) needs to manually open the "Allow Unsafe" option
- Data encrypted transmission, the transmission protocol uses WebSocket, if TLS is not enabled, it will be recognized as WebSocket traffic.
- Data encrypted transmission, the transmission protocol uses WebSocket, and TLS is enabled, it will be recognized as TLS traffic. (Domain name required),Support CDN.
- WebSocket+TLS (self-signed certificate)
- Data encrypted transmission, the transmission protocol uses WebSocket, and TLS is enabled, and it will be recognized as TLS traffic. (No domain name required)
- The transmission method based on HTTP/2. It is fully implemented in accordance with the HTTP/2 standard and requires a domain name
- HTTP2 (self-signed certificate)
- The transmission method based on HTTP/2. It is fully implemented in accordance with the HTTP/2 standard, uses a self-signed certificate, and does not require a domain name
- mKCP (no camouflage)
- Encrypted data transmission to increase bandwidth usage and reduce delay, udp protocol, no camouflage, will be recognized as udp traffic
- Same as mKCP (without camouflage), add disguised as SRTP packet, it will be recognized as video call data (such as FaceTime)
- Same as mKCP (without camouflage), adding a uTP packet disguised as a uTP data packet will be recognized as BT download data
- Same as mKCP (no camouflage), adding data packets disguised as WeChat video calls
- Same as mKCP (without camouflage), add disguised as DTLS 1.2 data packet
- Same as mKCP (without camouflage), with the addition of disguised as WireGuard packets. (Not the real WireGuard protocol)
- Reminder: Shadowrocket currently does not support QUIC transmission mode.
- QUIC (no camouflage)
- Encrypted data transmission, no pretense will be recognized as udp traffic, originally created by Google, advantages: reduced delay, multiplexing, connection migration
- Same as QUIC (no camouflage), adding a packet disguised as SRTP, it will be recognized as video call data (such as FaceTime)
- Same as QUIC (without camouflage), add disguised as uTP data packet, it will be recognized as BT download data
- Same as QUIC (no camouflage), adding data packets disguised as WeChat video calls
- Same as QUIC (without camouflage), add disguised as DTLS 1.2 packet
- Same as QUIC (without camouflage), adding a pretend to be a WireGuard packet. (Not the real WireGuard protocol)
-
- Sync Network Time
- Correct the remote host time to the network time. Note: The time of the local computer must also be synchronized with the network time, otherwise the local computer V2ray may have a connection error
Recommendation: First use this method to proofread time
- Sync local time
- Synchronize the remote host’s time to the local time. Note: The local computer’s time must be accurate and synchronized with the network time, otherwise there may be connection errors in other clients
Use this method when you can’t check the time when using the network
- Update the local time
- Synchronize the local computer time with the network time.
Note: To use this function, you must run this program as an administrator
- Detection Time
- Proofread
-
- Client configuration parameters
- Server address:
- Port:
- User ID(uuid)/Password:
- Copy
- Copied to the clipboard!
- Empty content!
- alterId:
- The default is 16, and you can fill in a value not exceeding 64. If the client does not have this option, leave it blank
- Encryption method:
- Transfer Protocol:
- Camouflage type(Confuse):
- TLS Set:
- Tip: Double-click the above content window to copy it to the clipboard.
- Path:
- mKCP Seed/QUIC key:
- default auto
- QR/URL
- The above parameters can be entered into the client manually or by scanning. The configuration and related files used for the official client have been stored in the directory. Click the OK button to open
- QR code and URL link can be used
v2rayN(windows)
Qv2ray(windows)
Qv2ray(windows)
Shadowrocket(ios)
v2rayNG(Android)
Import v2ray node
Note: The Vless protocol requires manual input of configuration parameters, and the QR code and URL are invalid
- " can be used for ShadowRocket (ios), ignore (Android), Qv2ray (windows) to scan codes and import URLs. Note: some clients may not support WebSocket mode ."
- "Can be used for ShadowRocket (ios), ignore (Android), Qv2ray (windows) to scan codes and import URLs. Note: Some clients may not support WebSocket mode."
- URL import link for NaiveSharp (windows)
- Used to scan codes and import URL import links for ShadowsocksR (windows), SSRR (android), Shadowrocket (ios)
- For mobile phone client shadowsocks(android), Shadowrocket(ios) scan code and URL import link
- For the computer client Shadowsocks (windows) scan code and URL import link
- Scan code and URL import link for Shadowsocks (windows), shadowsocks(android), Shadowrocket(ios)
- Reminder: The import format of the computer client Shadowsocks (windows) and the mobile client shadowsocks (android) and Shadowrocket (ios) are not compatible. Please select the corresponding format.
- Mobile phone
- Computer side
- TG format QR
- TG format URL (double-click to copy to the clipboard)
- T.ME format QR
- T.ME format URL (double-click to copy to the clipboard)
-
- Host address, host port, and user name are required and cannot be empty!!
- The connection port contains non-numeric characters!
- The login password is required and cannot be empty!!
- The key file is required and cannot be empty!!
- If a proxy is selected, the proxy address and port cannot be empty!
- If the proxy needs to log in, the user name and password for proxy login cannot be empty!
- The remote host connection information is wrong, please check!
- Please select a configuration template first!
- An error occurred, the installation was interrupted...
- Logging in to the remote host...
- The host login is successful!
- Detect whether it is running under root permissions...
- Please use an account with root permissions to log in to the host! !
- Detection result: OK!
- Check whether the system has been installed
- The remote host has been installed
- , it is recommended to uninstall first, or reinstall the system, if the forced installation may fail. Do you force a reinstallation?
- installation canceled, exit
- Selected mandatory installation
- Test result: not installed
- Check whether the system meets the installation requirements...
- The current system kernel version is
- , V2ray requires the kernel to be 2.6.23 and above. Please upgrade the kernel and install again!
- The system kernel version does not meet the requirements, and the installation failed! !
- The system lacks necessary installation components such as: apt||dnf||yum||zypper||Syetemd, the host system is recommended to use: CentOS 7/8, Debian 8/9/10 ,Ubuntu 16.04 and above
- The system environment does not meet the requirements, and the installation fails! !
- Test result: OK!
- It is detected that the system has SELinux enabled and it is working in strict mode. It needs to be changed to relaxed mode! Modifying...
- The modification is complete!
- Proofreading time...
- The difference between the local time and the remote host’s time exceeds the limit (90 seconds), please use'System Tools-->Time Correction' to verify the time before setting
- Time comparison failed...
- The time difference meets the requirements, OK!
- is checking whether the domain name is resolved to the IP of the current VPS...
- is detecting whether it is a pure ipv6 host...
- A valid IP address was not detected...
- Finding the fastest Nat64 gateway...
- Failed to find a valid Nat64 gateway...
- The fastest Nat64 gateway of the current host is:
- Nat64 gateway is being set up......
- Nat64 gateway is being deleted...
- The resolution is correct! OK!
- detects that the current host is a pure ipv6 host, it is not currently supported!
- The domain name could not be correctly resolved to the IP of the current VPS! Installation failed!
- The domain name cannot be correctly resolved to the IP of the current VPS, please check! If the resolution setting is correct, please wait for it to take effect before retrying the installation. If the domain name uses CDN, please close it first!
- Detect port occupancy...
- If one or all of the 80/443 ports are occupied, will the program occupying 80/443 ports be forcibly stopped?
- The port is occupied and the installation failed...
- is releasing port 80/443...
- The release of port 80/443 is complete!
- The port is occupied, will the program occupying this port be forcibly stopped?
- Release the port...
- The port is released!
- Test result: Not occupied!
- The system environment has been tested and the installation requirements are met, and the deployment begins...
- Open the corresponding port of the firewall...
- Installing
- File download failed!
- Compiling, please wait patiently.............
- The installation failed, the script runs incorrectly!
- The installation is successful!
- After installation, upload the configuration file......
- Installing acme.sh......
- acme.sh is installed successfully!
- acme.sh installation failed! The reason is unknown, please ask the developer!
- Apply for domain name certificate...
- The certificate application is successful!
- Certificate application failed! The reason is unknown, please ask the developer!
- Install the certificate to
- The certificate is successfully installed to
- The certificate is installed to
- failed, the reason is unknown, you can ask the developer!
- Install Caddy...
- Test result: Caddy is not installed!
- The installation of Caddy failed!
- Caddy installed successfully!
- is upgrading the Caddy v2.2.0 beta version for Http2Web mode!
- Upload Caddy configuration file...
- Caddy configuration file upload failed!
- The Caddy configuration file is uploaded successfully, OK!
- Starting Caddy...
- Caddy started successfully!
- Caddy failed to start!
- Starting Caddy (second attempt)!
- Caddy failed to start (second time)! Exit the installation!
- Caddy failed to start, the reason is unknown! Please ask the developer!
- Starting
- Startup is successful!
- Startup failed!
- is trying to start the second time
- failed to start (second time)! Exit the installation!
- Startup failed, the reason is as above! Please troubleshoot the reason!
- BBR test...
- Enable BBR...
- BBR has been enabled!
- The system does not meet the conditions for enabling BBR, and the enabling failed!
- BBR is successfully activated!
- Generate client configuration...
- Failed to obtain client configuration!
- The installation is successful, Enjoy it!!
- Installation Failed!
- An error occurred!
- Wrong password or wrong username!
- Please check whether the host address and port are correct, if it passes the proxy, please check whether the proxy is working properly
- The selected key file is wrong or the format is wrong!
- Login using the key, the key file is wrong or the user name is wrong!
- The host address is wrong. If a proxy is used, it may also be the wrong port to connect to the proxy!
- Exit! Reason: The remote host is not installed
- V2Ray using the old installation script is detected...
- The V2Ray using the old installation script is detected. Do you want to uninstall the old version and reinstall it with the new installation script?
- Uninstalling the old version...
- Uninstall the old version, OK!
- Install the new version...
- Migrate the original configuration file.
- has been updated to the latest version.
- The current version of the remote host is: v
- The latest version is:
- Is it upgraded to the latest version?
- Upgrading to the latest version
- The upgrade is successful! It is currently the latest version!
- The upgrade failed. The reason is unknown. Please ask the developer!
- Upgrade is cancelled, exit!
- The remote host is currently the latest version:
- No need to upgrade! drop out!
- The domain name cannot be empty, please check the relevant parameter settings!
- Please install in x86_64 system
- Back up the Trojan configuration file...
- Restore the Trojan configuration file...
- "Caddy has been installed on the remote host, but I’m not sure whether it supports forward proxy. Do I force a reinstallation?"
- Please uninstall Caddy or reinstall the VPS system first!
- Installing dependent software......
- The installation is complete! OK!
- Installing Caddy.....
- The server is being upgraded for NaiveProxy
- The upgrade is complete, OK!
- Optimizing network parameters...
- Optimize network parameters, OK!
-
- This file is the client configuration file used by the official Xay program. It is configured in global mode, socks5 address: 127.0.0.1:1080, http proxy address: 127.0.0.1:1081
- Xray official website: https://github.com/XTLS/Xray-core
- Xray official program download address: https://github.com/XTLS/Xray-core/releases
- Download the corresponding version, select xray-windows-64.zip or xray-windows-32.zip for Windows, extract xray.exe after decompression. Put it in the same directory as config.json, just run xray.exe.
-
- This file is the client configuration file used by the official V2Ray program. It is configured in global mode, socks5 address: 127.0.0.1:1080, http proxy address: 127.0.0.1:1081
- v2ray official website: https://www.v2ray.com/
- v2ray official program download address: https://github.com/v2ray/v2ray-core/releases
- download the corresponding version, Windows select v2ray-windows-64.zip or v2ray-windows-32.zip, extract v2ctl.exe and v2ray.exe after decompression. Put it in the same directory as config.json, just run v2ray.exe.
- This file is v2rayN, Qv2ray, v2rayNG(Android), Shadowrocket(ios) scan code import node
- v2rayN download URL: https://github.com/2dust/v2rayN/releases
- Qv2ray download URL: https://github.com/Qv2ray/Qv2ray/releases
- v2rayNG(Android) download URL: https://github.com/2dust/v2rayNG/releases
- v2rayNG (Android) download URL on Google Play: https://play.google.com/store/apps/details?id=com.v2ray.ang
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is v2rayN, Qv2ray, v2rayNG(Android), Shadowrocket(ios) copy and paste the vmess URL of the imported node
- Server general connection configuration parameters
-
- This file is the client configuration file used by the official Trojan-go program, configured in global mode, http and socks5 address: 127.0.0.1:1080
- Trojan-go official website: https://github.com/p4gefau1t/trojan-go
- Trojan-go official program download address: https://github.com/p4gefau1t/trojan-go/releases
- Download the corresponding version, select Trojan-go-x.xx-win.zip for Windows, extract trojan-go.exe after decompression. Put it in the same directory as config.json, just run trojan-go.exe.
- This file is for Qv2ray (windows), ignore (Android) scan code import node
- Qv2ray (windows) download URL: https://github.com/Qv2ray/Qv2ray/releases
- igniter (Android) download URL: https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is Qv2ray (windows), ignore (Android)copy and paste the URL of the imported node
- Server general connection configuration parameters
-
- This file is the client configuration file used by the official Trojan program. It is configured in global mode, http and socks5 address: 127.0.0.1:1080
- Trojan official website: https://trojan-gfw.github.io/trojan/
- Trojan official program download address: https://github.com/trojan-gfw/trojan/releases
- Download the corresponding version, select Trojan-x.xx-win.zip for Windows, extract trojan.exe after decompression. Put it in the same directory as config.json, just run trojan.exe.
- This file is Qv2ray (windows), ignore (Android), Shadowrocket (ios) scan code import node
- Qv2ray (windows) download URL: https://github.com/Qv2ray/Qv2ray/releases
- igniter (Android) download URL: https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is Qv2ray (windows), ignore (Android), Shadowrocket (ios) copy and paste the URL of the imported node
- Server general connection configuration parameters
-
- This file is the client configuration file used by the official NaiveProxy program, configured in global mode, socks5 address: 127.0.0.1:1080
- NaiveProxy official website: https://github.com/klzgrad/naiveproxy
- NaiveProxy official program download address: https://github.com/klzgrad/naiveproxy/releases
- download the corresponding version, select naiveproxy-x.xx-win.zip for Windows, extract naive.exe after decompression. Put it in the same directory as config.json, just run naive.exe.
- This file is NaiveSharp (windows) copy and paste the URL of the imported node
- NaiveSharp(windows) download URL: https://github.com/KevinZonda/NaiveSharp/releases
- Server general connection configuration parameters
-
- This file is for ShadowsocksR (windows), SSRR (Android), Shadowrocket (ios) scan code import node
- ShadowsocksR (windows) download URL: https://github.com/shadowsocksrr/shadowsocksr-csharp/releases
- SSRR (Android) download URL: https://github.com/shadowsocksrr/shadowsocksr-android/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is ShadowsocksR (windows), SSRR (Android), Shadowrocket (ios) copy and paste the URL of the imported node
- Server general connection configuration parameters
-
- This file is a Shadowsocks (windows) scan code import node
- This file is Shadowsocks (windows) copy and paste the URL of the imported node
- This file is for shadowsocks (Android), Shadowrocket (ios) scan code to import nodes
- Shadowsocks (windows) download URL: https://github.com/shadowsocks/shadowsocks-windows/releases
- shadowsocks (Android) download URL: https://github.com/shadowsocks/shadowsocks-android/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is shadowsocks (Android), Shadowrocket (ios) copy and paste the URL of the imported node
- Server general connection configuration parameters
- plug-in instructions
- ProxySU defaults all plug-ins, under the subfolder plugins of the folder where the Shadowsocks (windows) run file is located.
- Instructions for manually installing the plug-in on the computer
- First download the plug-in, the download address of each plug-in Windows client is:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases only download obfs-local.zip
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64-bit system selection: v2ray-plugin-windows-amd64-vx.xxtar.gz , 32-bit system selection: v2ray-plugin-windows-386-vx.xxtar.gz (x is a number, is the version number)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64-bit system selection: kcptun-windows-amd64-xxxxxx.tar.gz, 32-bit system selection :Kcptun-plugin-windows-386-xxxxxx.tar.gz (x is a number, is the version number)
- GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64-bit system selection: gq-client-windows-amd64-xxxexe, 32-bit system selection: gq-client-windows-386-xxxexe (x is a number, is the version number)
- Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64-bit system selection: ck-client-windows-amd64-xxxexe, 32-bit system selection: ck-client-windows-386-xxxexe (x is a number, is the version number)
- In the folder where the Shadowsocks (windows) run file is located, create a new folder plugins, and copy all the files (two) extracted from obfs-local.zip to plugins, v2ray -plugin download the file, unzip the file, copy it to plugins, and rename it to: v2ray-plugin.exe. Kcptun-plugin downloads the file, unzip the two files, copy the file starting with client_windows into the plugins, and rename it to: kcptun-client.exe. The file downloaded by GoQuiet-plugin is directly copied to the plugin and renamed to: goquiet-client.exe. The file downloaded by Cloak-plugin is directly copied to the plugin and renamed to: cloak-client.exe
- installation completed
- Mobile Android client plug-in installation instructions
- first download the plug-in, the download address of each plug-in Android client is:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases only download obfs-local-nightly-xxxapk (x is a number, is the version Number)
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases Generally choose v2ray--universal-xxxapk (x is a number, is the version number )
- Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases Generally choose kcptun--universal-xxxapk (x is a number, is the version number)
- Transfer the above apk file to the phone and install it!
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU/Translations/ProxySU.zh-CN.xaml b/ProxySU/Translations/ProxySU.zh-CN.xaml
deleted file mode 100644
index 825341a5..00000000
--- a/ProxySU/Translations/ProxySU.zh-CN.xaml
+++ /dev/null
@@ -1,505 +0,0 @@
-
-
- 最新版本已发布了,快去更新一下吧!
- 正在下载最新版,请等待完成提示....
- 最新版下载失败,请稍后重试!
- 下载最新版成功,文件已存入当前ProxySU.exe同一目录
- 下载更新
- Languages:
- 应用布署
- 资源工具
- 免翻网址资源
- 常见问题
- 主机:
- IP或域名(不可为空)
- 端口:
- 用户:
- 密码:
- 密钥:
- 密钥文件存放路径(不可为空)
- 浏览...
- 密码登录
- 密钥登录
- 无代理
- 不需登录
- 需要登录
- 代理地址:
- 安装日志另存为...
- 等待安装布署
- 系统工具
-
- Xray模板库
- Xray一键安装
- 升级Xay
-
- V2Ray模板库
- V2ray一键安装
- 升级V2ray
- 取消
-
- Trojan-Go参数设置
- Trojan-Go一键安装
- 升级Trojan-Go
- 取消
- 当前所选方案:
- 未选择方案
-
- 参数设置
- 模式:Trojan+TLS+Caddy
- 服务器地址(域名):
- 端口:443
- 域名不可为空
- 密码:
- 更新
- Trojan一键安装
- 升级Trojan
- 取消
-
- 模式:NaiveProxy+TLS+Caddy
- 随机
- NaiveProxy一键安装
- 取消
-
- 模式:SSR+TLS+Caddy
- SSR一键安装
-
-
- 模式:MTProto+TLS
- MTProto一键安装
- 伪装域名:
- 推荐用常见https端口443、2053、2083、2087、2096、8443
- 密钥将由服务端随机生成,这里无需设置。
-
-
- SS 一键安装
- SS 插件库
- 经典模式
- 提示:这种模式,长时间,大流量使用,容易被阻断和干扰,不推荐使用!
- SS 经典
- SS经典使用模式,无需域名,数据高强度加密,数据被识别为未知数据。目前流量容易被识别,极易被干扰与阻断,慎重使用!放在这里仅仅只是一种情怀与致敬!
- Simple-obfs 插件
- 提示:这是SS早期使用的流量混淆方案,插件已经长时间不再更新,不推荐使用!
- SS+obfs+http+Web
- 无需域名,数据高强度加密,流量混淆为http(并非真正的http),使用Web网站伪装,可在一定程度上增强抗识别!不支持CDN。
- SS+obfs+TLS(https)+Web
- 需要域名,使用域名将很大增强抗识别,数据高强度加密,流量混淆为https(并非真正的https),使用Web网站伪装,进一步增强抗识别!不支持CDN。
- V2Ray 插件
- 提醒:ShadowRocket(ios)不支持SS+Quic模式
- SS+WebSocket+TLS+Caddy(Web后置)
- SS+WebSocket+TLS+Caddy(Web前置)
- 提示:上面方案中的Web前置与Web后置,使用效果上没有差别,Web后置方案,TLS证书由acme.sh申请,证书到期后,acme.sh会自动续期,但是需要手动重启SS加载新证书。而Web前置方案中的证书由Caddy自动申请并加载,不需要重启SS。
- SS+QUIC
- 通过V2Ray-Plugin使用QUIC协议传输,强制使用TLS加密。数据加密传输,被识别为udp流量,最初由谷歌创始,优点:减少延迟、多路复用、连接迁移,需要域名,
-
- kcptun 插件
- 提醒:Shadowrocket(ios)不支持GoQuiet-plugin插件。shadowsocks(Android)不支持GoQuiet-plugin与Cloak-plugin插件
- KCP是一个快速可靠协议,能以比 TCP浪费10%-20%的带宽的代价,换取平均延迟降低 30%-40%,且最大延迟降低三倍的传输效果。使用UDP协议传输,数据高强度加密,传输同样的内容,kcp 一般比 TCP 消耗更多的流量,在丢包率高的线路下将极大提高网速,在个别运营商处可能会被QOS限制。
- 基本原理为模拟TLS的流量同时将服务器伪装成一个正常的网站服务器,这个混淆思路并非首创:simple-obfs和ShadowsocksR的tls1.2_ticket_auth模式证明这条道是行得通的。此插件对现有的方法进行了改善,其目标为让大规模封锁HTTPS服务器(甚至IP段)成为封锁SS的唯一有效手段
- 通过加密方式将代理流量混淆为合法的HTTPS流量,并将代理服务器伪装成普通的Web服务器以规避互联网审查。可以看成是上面GoQuiet升级版,优化网络连接速度,并且不是混淆https而是真正的https流量。
- 插件程序:
- 插件选项:
- 使用编译方式,时间稍长,请耐心等待......
-
-
- 校对时间
- 释放80/443端口
- 启用BBR
- 卸载代理
- 启用root密码登录
- 启用root证书密钥登录
- root禁止密码登录
- 仅支持卸载由ProxySU安装的代理软件及相关配置,请确保重要配置已备份。不支持卸载使用其他方法或脚本安装的代理。确定要卸载远程主机上的代理软件吗?
- 本功能需要当前登录的账户具有sudo权限,是否为远程主机启用root账户并设置密码?
- 本功能需要当前登录的账户具有root或者sudo权限,是否为远程主机启用root证书密钥登录?
- 本功能需要远程主机已经开启了其他登录方式,如密钥方式等,否则将可能造成远程主机无法连接,是否禁止远程主机的root账户密码登录方式?
- 正在关闭root账户密码登录方式.....
- 远程主机root账户密码登录方式已关闭!
- 远程主机root账户证书密钥登录已启用,密钥文件rootuser.key保存在随后打开的文件夹中!
- 当前账户已经具有root权限,无需再设置!
- 当前账户无法获取sudo权限,设置失败!
- 生成20位随机密码!
- 保存密码信息!
- 正在生成密钥......
- 正在下载密钥......
- 远程主机启用密钥登录.......
- 远程主机Root账户密码登录已启用,密码保存在随后打开的文件夹中!
- 开始卸载
- 检测到已安装
- 卸载失败!请向开发者问询!
- 卸载成功!
-
-
- 主页
- 前进
- 后退
- 由于众所周知的原因,在某些时候,加载缓慢,请耐心等待一下
-
- Trojan-go 模板库
- http/2传输,Caddy2伪装网站,抗识别,暂不支持CloudFlare的CDN
- 使用WebSocket传输,Caddy2伪装网站,抗识别,支持CloudFlare的CDN
- 参数设置
- 域名:
- 端口: 443
- 密码:
- 使用已有密码,直接粘贴到框中
- WebSocket路径:
- Mux多路复用
- 此处设置只对官方客户端配置文件config.json有效,其他客户端需手动设置,服务端自动适配。
- 此字段不出现在QR码及分享URL中,客户端需自行设置,服务端默认启用自动适配。
- 确定
- 取消
-
- V2Ray 模板库
- 推荐方案
- 尝鲜方案
- VLESS协议
- VLESS 是一个无状态的轻量传输协议,与 VMess 不同,VLESS 不依赖于系统时间,认证方式同样为 UUID,但不需要 alterId。目前 VLESS 没有自带加密,请用于可靠信道,如 TLS。优点:可以有效的降低主机资源消耗。目前 VLESS 不支持分享。VLESS 处于公测阶段,测试期间请确保客户端与服务端的 v2ray-core 均为最新版本。
- XTLS 在低性能或没有 AES 硬解的设备上效果出众,如在硬路由上换用 XTLS,同样跑满 CPU 时实现网速 翻倍,或是相同网速时 CPU 占用率减半,而对于移动设备,计算量减少意味着省电。服务端客户端版本要求4.29+ (需域名)不支持CDN。
- 轻量协议VLESS,占用更少主机资源,数据TLS加密传输,用Caddy2在节点上做伪装网站。适合配置低的VPS,或多人共用节点,服务端客户端版本要求4.27+ (需域名)不支持CDN。
- 使用VLESS协议,与VMESS的此类型方案,更轻量。稳定性强,Caddy2做前置,隐藏代理特征,被识别为访问网站的https流量,抗封锁识别最强,需要域名,支持CDN
- 使用VLESS协议,与VMESS的此类型方案,更轻量。基于 HTTP/2 传输。完整按 HTTP/2 标准实现,Caddy2做前置,隐藏代理特征,H2C协议转发到V2Ray,需要域名,暂不支持CloudFlare的CDN
-
- TCP传输协议
- WebSocket传输协议
- Http/2传输协议
- mKCP传输协议
- QUIC传输协议
- 参数设置
- 服务器端口:
- 随机选择
- 若使用TLS加密,请保持默认的443端口
- 使用已有UUID,直接粘贴到框中
- QUIC密钥:
- mKCP Seed:
- 启用mKCP Seed密钥,可增强抗识别,留空则禁用,要求版本4.24.2+
- 路径:
- VLESS ws路径:
- VMESS tcp路径:
- VMESS ws路径:
-
- QUIC加密方式:
- 域名:
- Trojan密码与UUID相同。
- 伪装网站:
- 设置此项可增加代理的隐蔽(可为空)
- 仅仅输入域名,不包括"http"及"/"等
- 仅仅禁止root账户使用密码登录,请确保root账户其他登录方式已生效
- 将启用root账户,并设置为密码登录
- 将启用或设置root账户为密钥证书登录
- 伪装网址输入格式错误!请重新输入!
- 稳定性强,Caddy2做前置,隐藏代理特征,被识别为访问网站的https流量,抗封锁识别最强,需要域名,支持CDN
- 基于 HTTP/2 传输。完整按 HTTP/2 标准实现,Caddy2做前置,隐藏代理特征,H2C协议转发到V2Ray,需要域名,暂不支持CloudFlare的CDN
- 当前Xray是V2Ray的超集,未来与V2Ray会有不同的发展方向。
- VLESS over TCP with XTLS + 回落 and 分流 to WHATEVER(终极配置),由rprx大佬 (xtls作者) 配置并推荐,在服务端同时配置以下六种方案,共用同一域名与443端口,其中 WS 都可以通过 CDN。
- VLESS over TCP with XTLS + 回落 and 分流 to WHATEVER(终极配置),由rprx大佬 (xtls作者) 配置并推荐,在服务端同时配置以下五种方案,共用同一域名与443端口,其中 WS 都可以通过 CDN。(想增加XTLS方案请使用Xray配置)
- TCP+Http伪装
- 数据加密传输,会被识别为未知的tcp流量
- 数据加密传输,并做http伪装,会被识别为http流量,但并不是真正的http访问
- 数据加密传输,传输协议使用TLS,会被识别为TLS流量,不等同于https流量特征 (需域名)
- TCP+TLS(自签证书)
- 数据加密传输,传输协议使用TLS,会被识别为TLS流量,不等同于https流量特征 (无需域名)
- Shadowrocket (ios)需要手动打开“允许不安全”选项
- 数据加密传输,传输协议使用WebSocket,未启用TLS,将被识别为WebSocket流量。
- 数据加密传输,传输协议使用WebSocket,启用TLS,将被识别为TLS流量。(需要域名)支持CDN。
- WebSocket+TLS(自签证书)
- 数据加密传输,传输协议使用WebSocket,启用TLS,将被识别为TLS流量。(无需域名)
- 基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,需要域名
- HTTP2(自签证书)
- 基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,使用自签名证书,不需要域名
- mKCP(无伪装)
- 数据加密传输,以增加带宽占用,减少延迟,udp协议,无伪装,会被识别为udp流量
- 同mKCP(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime)
- 同mKCP(无伪装),增加伪装成 uTP 数据包,会被识别为 BT 下载数据
- 同mKCP(无伪装),增加伪装成微信视频通话的数据包
- 同mKCP(无伪装),增加伪装成 DTLS 1.2 数据包
- 同mKCP(无伪装),增加伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)
- 提醒:Shadowrocket目前暂不支持QUIC的传输模式。
- QUIC(无伪装)
- 数据加密传输,无伪装会被识别为udp流量,最初由谷歌创始,优点:减少延迟、多路复用、连接迁移
- 同QUIC(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime)
- 同QUIC(无伪装),增加伪装成 uTP 数据包,会被识别为 BT 下载数据
- 同QUIC(无伪装),增加伪装成微信视频通话的数据包
- 同QUIC(无伪装),增加伪装成 DTLS 1.2 数据包
- 同QUIC(无伪装),增加伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)
-
- 同步网络时间
- 将远程主机时间校正为网络时间,注意:本机电脑的时间必须也是与网络时间同步的,否则本机电脑V2ray有可能连接出错
推荐:优先使用此方法校对时间
- 同步本机时间
- 将远程主机时间同步为本地时间,注意:本机电脑的时间必须是准确的,与网络时间同步的,否则其他客户端中,有可能连接出错
使用网络校时无法校对时间时,使用此种方法
- 更新本机时间
- 将本机电脑时间与网络时间同步。
注意:使用此项功能,必须以管理员身份运行本程序
- 检测时间误差
- 校对时间
-
- 客户端配置参数
- 服务器地址(address):
- 端口(port):
- 用户ID(uuid)/密码:
- 复制
- 已复制到剪贴板中!
- 空内容!
- 额外ID:
- 不超过64,客户端没此项可不填
- 加密方式:
- 传输协议:
- 伪装类型(混淆):
- TLS设置:
- 提示:双击以上内容窗,即可复制到剪贴板中。
- 路径(Path):
- QUIC密钥:
- mKCP Seed:
- 默认auto
- 二维码/URL
- 以上参数可以手动或扫描输入客户端,用于官方客户端的配置和相关文件已经存放入目录下,点击 确定 按扭可打开
- 二维码和URL链接可用于
v2rayN(windows)
Qv2ray(windows)
Qv2ray(windows)
Shadowrocket(ios)
v2rayNG(Android)
导入v2ray节点
注意:Vless协议需要手动输入配置参数,二维码和URL无效
- "可用于ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 扫码和导入url。注意:有的客户端可能不支持WebSocket模式。"
- "可用于ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 扫码和导入url。注意:有的客户端可能不支持WebSocket模式。"
- 用于NaiveSharp(windows)的URL导入链接
- 用于ShadowsocksR(windows)、SSRR(android)、Shadowrocket(ios)的扫码和URL导入链接
- 用于手机客户端shadowsocks(android)、Shadowrocket(ios)的扫码和URL导入链接
- 用于电脑客户端Shadowsocks (windows)的扫码和URL导入链接
- 用于Shadowsocks (windows)、shadowsocks(android)、Shadowrocket(ios)的扫码和URL导入链接
- 提醒: 电脑客户端Shadowsocks (windows)与手机客户端shadowsocks(android)、Shadowrocket(ios)的导入格式不兼容,请选择相应格式。
- 手机端
- 电脑端
- TG格式QR
- TG格式URL(双击复制到剪切板中)
- T.ME格式QR
- T.ME格式URL(双击复制到剪切板中)
-
-
- 主机地址、主机端口、用户名为必填项,不能为空!!
- 连接端口含有非数字字符!
- 登录密码为必填项,不能为空!!
- 密钥文件为必填项,不能为空!!
- 如果选择了代理,则代理地址与端口不能为空!
- 如果代理需要登录,则代理登录的用户名与密码不能为空!
- 远程主机连接信息有误,请检查!
- 请先选择配置模板!
- 发生错误,安装中断......
- 正在登录远程主机......
- 主机登录成功!
- 检测是否运行在root权限下...
- 请使用具有root权限的账户登录主机!!
- 检测结果:OK!
- 检测系统是否已经安装
- 远程主机已安装
- ,建议先执行卸载,或者重装系统,若强制安装有一定机率失败。是否强制重新安装?
- 安装取消,退出
- 已选择强制安装
- 检测结果:未安装
- 检测系统是否符合安装要求......
- 当前系统内核版本为
- ,V2ray要求内核为2.6.23及以上。请升级内核再安装!
- 系统内核版本不符合要求,安装失败!!
- 系统缺乏必要的安装组件如:apt||dnf||yum||zypper||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本
- 系统环境不满足要求,安装失败!!
- 检测结果:OK!
- 检测到系统启用SELinux,且工作在严格模式下,需改为宽松模式!修改中......
- 修改完毕!
- 校对时间......
- 本地时间与远程主机时间相差超过限制(90秒),请先用 '系统工具-->时间校对' 校对时间后再设置
- 时间较对失败......
- 时间差符合要求,OK!
- 正在检测域名是否解析到当前VPS的IP上......
- 正在检测是否为纯ipv6主机......
- 未检测到有效的IP地址......
- 正在查找最快的Nat64网关......
- 未能找到有效的Nat64网关......
- 当前主机最快的Nat64网关为:
- 正在设置Nat64网关......
- 正在删除Nat64网关......
- 解析正确!OK!
- 检测当前主机为纯ipv6主机,目前暂不支持!
- 域名未能正确解析到当前VPS的IP上!安装失败!
- 域名未能正确解析到当前VPS的IP上,请检查!若解析设置正确,请等待生效后再重试安装。如果域名使用了CDN,请先关闭!
- 检测端口占用情况......
- 80/443端口之一,或全部被占用,将强制停止占用80/443端口的程序?
- 端口被占用,安装失败......
- 正在释放80/443端口......
- 80/443端口释放完毕!
- 端口被占用,将强制停止占用此端口的程序?
- 正在释放端口......
- 端口释放完毕!
- 检测结果:未被占用!
- 系统环境检测完毕,符合安装要求,开始布署......
- 开启防火墙相应端口......
- 正在安装
- 文件下载失败!
- 编译中,请耐心等待.............
- 安装失败,脚本运行出错!
- 安装成功!
- 安装完毕,上传配置文件......
- 正在安装acme.sh......
- acme.sh安装成功!
- acme.sh安装失败!原因未知,请向开发者提问!
- 申请域名证书......
- 证书申请成功!
- 证书申请失败!原因未知,请向开发者提问!
- 安装证书到
- 证书成功安装到
- 证书安装到
- 失败,原因未知,可以向开发者提问!
- 安装Caddy......
- 检测结果:未安装Caddy!
- 安装Caddy失败!
- Caddy安装成功!
- 正在为Http2Web模式升级Caddy v2.2.0测试版!
- 上传Caddy配置文件......
- Caddy配置文件上传失败!
- Caddy配置文件上传成功,OK!
- 正在启动Caddy......
- Caddy启动成功!
- Caddy启动失败!
- 正在启动Caddy(第二次尝试)!
- Caddy启动失败(第二次)!退出安装!
- Caddy启动失败,原因未知!请向开发者问询!
- 正在启动
- 启动成功!
- 启动失败!
- 正在第二次尝试启动
- 启动失败(第二次)!退出安装!
- 启动失败,原因如上!请排查原因!
- BBR测试......
- 正在启用BBR......
- BBR已经启用了!
- 系统不满足启用BBR的条件,启用失败!
- BBR 启用成功!
- 生成客户端配置......
- 客户端配置获取失败!
- 安装成功,祝你玩的愉快!!
- 安装失败!
- 发生错误!
- 密码错误或用户名错误!
- 请检查主机地址及端口是否正确,如果通过代理,请检查代理是否正常工作
- 所选密钥文件错误或者格式不对!
- 使用密钥登录,密钥文件错误或用户名错误!
- 主机地址错误,如果使用了代理,也可能是连接代理的端口错误!
- 退出!原因:远程主机未安装
- 检测到使用旧安装脚本的V2Ray......
- 检测到使用旧安装脚本的V2Ray,是否卸载旧版本并使用新安装脚本重新安装?
- 正在卸载旧版本......
- 卸载旧版本,OK!
- 安装新版本......
- 迁移原配置文件。
- 已更新到最新版本。
- 远程主机当前版本为:v
- 最新版本为:
- 是否升级为最新版本?
- 正在升级到最新版本
- 升级成功!当前已是最新版本!
- 升级失败,原因未知,请向开发者提问!
- 升级取消,退出!
- 远程主机当前已是最新版本:
- 无需升级!退出!
- 域名不能为空,请检查相关参数设置!
- 请在x86_64系统中安装
- 备份Trojan配置文件......
- 恢复Trojan配置文件......
- "远程主机已安装Caddy,但不确定是否支持forward proxy,是否强制重新安装?"
- 请先行卸载Caddy或重装VPS系统!
- 正在安装依赖的软件......
- 安装完毕!OK!
- 正在安装Caddy.....
- 正在为NaiveProxy升级服务端
- 升级完毕,OK!
- 正在优化网络参数......
- 优化网络参数,OK!
-
- 此文件为Xay官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- Xray官方网站:https://github.com/XTLS/Xray-core
- Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases
- 下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取xray.exe。与config.json放在同一目录,运行xray.exe即可。
-
-
- 此文件为V2Ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- v2ray官方网站:https://www.v2ray.com/
- v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases
- 下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。
-
- 此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点
- v2rayN下载网址:https://github.com/2dust/v2rayN/releases
- Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases
- v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases
- v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址
- 服务器通用连接配置参数:
-
- 此文件为Trojan-go官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080
- Trojan-go官方网站:https://github.com/p4gefau1t/trojan-go
- Trojan-go官方程序下载地址:https://github.com/p4gefau1t/trojan-go/releases
- 下载相应版本,Windows选择Trojan-go-x.xx-win.zip,解压后提取trojan-go.exe。与config.json放在同一目录,运行trojan-go.exe即可。
- 此文件为Qv2ray (windows)、igniter(Android)扫码导入节点
- Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为Qv2ray (windows)、igniter(Android)复制粘贴导入节点的网址
- 服务器通用连接配置参数
-
- 此文件为Trojan官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080
- Trojan官方网站:https://trojan-gfw.github.io/trojan/
- Trojan官方程序下载地址:https://github.com/trojan-gfw/trojan/releases
- 下载相应版本,Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录,运行trojan.exe即可。
- 此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)扫码导入节点
- Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)复制粘贴导入节点的网址
- 服务器通用连接配置参数
-
- 此文件为NaiveProxy官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080
- NaiveProxy官方网站:https://github.com/klzgrad/naiveproxy
- NaiveProxy官方程序下载地址:https://github.com/klzgrad/naiveproxy/releases
- 下载相应版本,Windows选择naiveproxy-x.xx-win.zip,解压后提取naive.exe。与config.json放在同一目录,运行naive.exe即可。
- 此文件为NaiveSharp(windows)复制粘贴导入节点的网址
- NaiveSharp(windows)下载网址:https://github.com/KevinZonda/NaiveSharp/releases
- 服务器通用连接配置参数
-
- 此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)扫码导入节点
- ShadowsocksR (windows)下载网址:https://github.com/shadowsocksrr/shadowsocksr-csharp/releases
- SSRR(Android)下载网址:https://github.com/shadowsocksrr/shadowsocksr-android/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)复制粘贴导入节点的网址
- 服务器通用连接配置参数
-
- 此文件为Shadowsocks (windows)扫码导入节点
- 此文件为Shadowsocks (windows)复制粘贴导入节点的网址
- 此文件为shadowsocks(Android)、Shadowrocket(ios)扫码导入节点
- Shadowsocks (windows)下载网址:https://github.com/shadowsocks/shadowsocks-windows/releases
- shadowsocks(Android)下载网址:https://github.com/shadowsocks/shadowsocks-android/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为shadowsocks(Android)、Shadowrocket(ios)复制粘贴导入节点的网址
- 服务器通用连接配置参数
- 插件使用说明
- ProxySU默认所有插件,在Shadowsocks (windows)运行文件所在文件夹的子文件夹plugins下。
- 电脑端手动安装插件说明
- 先下载插件,各个插件Windows客户端下载地址为:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases 只下载 obfs-local.zip
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64位系统选择:v2ray-plugin-windows-amd64-vx.x.x.tar.gz,32位系统选择:v2ray-plugin-windows-386-vx.x.x.tar.gz (x为数字,是版本号)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64位系统选择:kcptun-windows-amd64-xxxxxx.tar.gz,32位系统选择:kcptun-plugin-windows-386-xxxxxx.tar.gz (x为数字,是版本号)
- GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64位系统选择:gq-client-windows-amd64-x.x.x.exe,32位系统选择:gq-client-windows-386-x.x.x.exe(x为数字,是版本号)
- Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64位系统选择:ck-client-windows-amd64-x.x.x.exe,32位系统选择:ck-client-windows-386-x.x.x.exe(x为数字,是版本号)
- 在Shadowsocks (windows)运行文件所在文件夹中,新建文件夹plugins,将obfs-local.zip解压出的文件(两个)全部复制到plugins中,v2ray -plugin下载得到的文件,解压出的文件,复制到plugins中,并重命名为:v2ray-plugin.exe。Kcptun -plugin下载得到的文件,解压出两个文件,将其中的client_windows开头的文件,复制到plugins中,并重命名为:kcptun-client.exe。GoQuiet-plugin下载得到的文件,直接复制到plugin中,并重命名为:goquiet-client.exe。Cloak-plugin下载得到的文件,直接复制到plugin中,并重命名为:cloak-client.exe
- 安装完毕
- 手机安卓客户端插件安装说明
- 先下载插件,各个插件安卓客户端下载地址为:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases 只下载 obfs-local-nightly-x.x.x.apk(x为数字,是版本号)
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases 一般选择v2ray--universal-x.x.x.apk(x为数字,是版本号)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases 一般选择kcptun--universal-x.x.x.apk(x为数字,是版本号)
- 将上述apk文件传到手机,安装即可!
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU/Translations/ProxySU.zh-TW.xaml b/ProxySU/Translations/ProxySU.zh-TW.xaml
deleted file mode 100644
index d6c233eb..00000000
--- a/ProxySU/Translations/ProxySU.zh-TW.xaml
+++ /dev/null
@@ -1,486 +0,0 @@
-
-
- 最新版本已發布了,快去更新一下吧!
- 正在下載最新版,請等待完成提示....
- 最新版下載失敗,請稍後重試!
- 下載最新版成功,文件已存入當前ProxySU.exe同一目錄
- 下載更新
- Languages:
- 應用佈署
- 資源工具
- 免翻網址資源
- 常見問題
- 主機:
- IP或域名(不可為空)
- 端口:
- 用戶:
- 密碼:
- 密鑰::
- 密鑰文件存放路徑(不可為空)
- 瀏覽...
- 密碼登錄
- 密鑰登錄
- 無代理
- 不需登錄
- 需要登錄
- 代理地址:
- 安裝日誌另存為...
- 等待安裝佈署
- 系統工具
-
- Xray模板庫
- Xray一鍵安裝
- 升級Xay
-
- V2Ray模板庫
- V2ray一鍵安裝
- 升級V2Ray
- 取消
- Trojan-Go參數設置
- Trojan-Go一鍵安裝
- 升級Trojan-Go
- 取消
- 當前所選方案:
- 未選擇方案
-
- 參數設置
- 模式:Trojan+TLS+Caddy
- 服務器地址(域名):
- 端口:443
- 域名不可為空
- 密碼:
- 更新
- Trojan一鍵安裝
- 升級Trojan
- 取消
-
- 模式:NaiveProxy+TLS+Caddy
- 隨機
- NaiveProxy一鍵安裝
- 取消
-
- 模式:SSR+TLS+Caddy
- SSR一鍵安裝
-
-
- 模式:MTProto+TLS
- MTProto一鍵安裝
- 偽裝域名:
- 推薦用常見https端口443、2053、2083、2087、2096、8443
- 密鑰將由服務端隨機生成,這裡無需設置。
-
-
- SS 一鍵安裝
- SS 插件庫
- 經典模式
- 提示:這種模式,長時間,大流量使用,容易被阻斷和乾擾,不推薦使用!
- SS 經典
- SS經典使用模式,無需域名,數據高強度加密,數據被識別為未知數據。目前流量容易被識別,極易被干擾與阻斷,慎重使用!放在這裡僅僅只是一種情懷與致敬!
- Simple-obfs 插件
- 提示:這是SS早期使用的流量混淆方案,插件已經長時間不再更新,不推薦使用!
- SS+obfs+http+Web
- 無需域名,數據高強度加密,流量混淆為http(並非真正的http),使用Web網站偽裝,可在一定程度上增強抗識別!不支持CDN。
- SS+obfs+TLS(https)+Web
- 需要域名,使用域名將很大增強抗識別,數據高強度加密,流量混淆為https(並非真正的https),使用Web網站偽裝,進一步增強抗識別!不支持CDN。
- V2Ray 插件
- 提醒:ShadowRocket(ios)不支持SS+Quic模式
- SS+WebSocket+TLS+Caddy(Web後置)
- SS+WebSocket+TLS+Caddy(Web前置)
- 提示:上面方案中的Web前置與Web後置,使用效果上沒有差別,Web後置方案,TLS證書由acme.sh申請,證書到期後, acme.sh會自動續期,但是需要手動重啟SS加載新證書。而Web前置方案中的證書由Caddy自動申請並加載,不需要重啟SS。
- SS+QUIC
- 通過V2Ray-Plugin使用QUIC協議傳輸,強制使用TLS加密。數據加密傳輸,被識別為udp流量,最初由谷歌創始,優點:減少延遲、多路復用、連接遷移,需要域名,
-
- kcptun 插件
- 提醒:Shadowrocket(ios)不支持GoQuiet-plugin插件。 shadowsocks(Android)不支持GoQuiet-plugin與Cloak-plugin插件
- KCP是一個快速可靠協議,能以比TCP浪費10%-20%的帶寬的代價,換取平均延遲降低30%-40%,且最大延遲降低三倍的傳輸效果。使用UDP協議傳輸,數據高強度加密,傳輸同樣的內容,kcp 一般比TCP 消耗更多的流量,在丟包率高的線路下將極大提高網速,在個別運營商處可能會被QOS限制。
- 基本原理為模擬TLS的流量同時將服務器偽裝成一個正常的網站服務器,這個混淆思路並非首創:simple-obfs和ShadowsocksR的tls1.2_ticket_auth模式證明這條道是行得通的。此插件對現有的方法進行了改善,其目標為讓大規模封鎖HTTPS服務器(甚至IP段)成為封鎖SS的唯一有效手段
- 通過加密方式將代理流量混淆為合法的HTTPS流量,並將代理服務器偽裝成普通的Web服務器以規避互聯網審查。可以看成是上面GoQuiet升級版,優化網絡連接速度,並且不是混淆https而是真正的https流量。
- 插件程序:
- 插件選項:
- 使用編譯方式,時間稍長,請耐心等待......
-
-
- 校對時間
- 釋放80/443端口
- 啟用BBR
- 卸載代理
- 啟用root密碼登錄
- root禁止密碼登錄
- 啟用root證書密鑰登錄
- 僅支持卸載由ProxySU安裝的代理軟件及相關配置,請確保重要配置已備份。不支持卸載使用其他方法或腳本安裝的代理。確定要卸載遠程主機上的代理軟件嗎?
- 本功能需要當前登錄的賬戶具有sudo權限,是否為遠程主機啟用root賬戶並設置密碼?
- 本功能需要當前登錄的賬戶具有root或者sudo權限,是否為遠程主機啟用root證書密鑰登錄?
- 本功能需要遠程主機已經開啟了其他登錄方式,如密鑰方式等,否則將可能造成遠程主機無法連接,是否禁止遠程主機的root賬戶密碼登錄方式?
- 正在關閉root賬戶密碼登錄方式.....
- 遠程主機root賬戶密碼登錄方式已關閉!
- 遠程主機root賬戶證書密鑰登錄已啟用,密鑰文件rootuser.key保存在隨後打開的文件夾中!
- 當前賬戶已經具有root權限,無需再設置!
- 當前賬戶無法獲取sudo權限,設置失敗!
- 生成20位隨機密碼!
- 保存密碼信息!
- 正在生成密鑰......
- 正在下載密鑰......
- 遠程主機啟用密鑰登錄.......
- 遠程主機Root賬戶密碼登錄已啟用,密碼保存在隨後打開的文件夾中!
- 開始卸載......
- 檢測到已安裝
- 卸載失敗!請向開發者問詢!
- 卸載成功!
-
- 主頁
- 前進
- 後退
- 由於眾所周知的原因,在某些時候,加載緩慢,請耐心等待一下
-
- Trojan-go 模板庫
- http/2傳輸,Caddy2偽裝網站,抗識別,暫不支持CloudFlare的CDN
- 使用WebSocket傳輸,Caddy2偽裝網站,抗識別,支持CloudFlare的CDN
- 參數設置
- 域名:
- 端口: 443
- 密碼:
- 使用已有密碼,直接粘貼到框中
- WebSocket路徑:
- Mux多路復用
- 此處設置只對官方客戶端配置文件config.json有效,其他客戶端需手動設置,服務端自動適配。
- 此字段不出現在QR碼及分享URL中,客戶端需自行設置,服務端默認啟用自動適配。
- 確定
- 取消
-
- V2Ray 模板庫
- 推薦方案
- 嚐鮮方案
- VLESS協議
- VLESS 是一個無狀態的輕量傳輸協議,與 VMess 不同,VLESS 不依賴於系統時間,認證方式同樣為 UUID,但不需要 alterId。目前 VLESS 沒有自帶加密,請用於可靠信道,如 TLS。優點:可以有效的降低主機資源消耗。目前 VLESS 不支持分享。 VLESS 處於公測階段,測試期間請確保客戶端與服務端的 v2ray-core 均為最新版本。
- XTLS 在低性能或沒有AES 硬解的設備上效果出眾,如在硬路由上換用XTLS,同樣跑滿CPU 時實現網速翻倍,或是相同網速時CPU 佔用率減半,而對於移動設備,計算量減少意味著省電。服務端客戶端版本要求4.29+ (需域名)不支持CDN。
- 輕量協議VLESS,佔用更少主機資源,數據TLS加密傳輸,用Caddy2在節點上做偽裝網站。適合配置低的VPS,或多人共用節點,服務端客戶端版本要求4.27+ (需域名)不支持CDN。
- 使用VLESS協議,與VMESS的此類型方案,更輕量。穩定性強,Caddy2做前置,隱藏代理特徵,被識別為訪問網站的https流量,抗封鎖識別最強,需要域名,支持CDN
- 使用VLESS協議,與VMESS的此類型方案,更輕量。基於 HTTP/2 傳輸。完整按 HTTP/2 標準實現,Caddy2做前置,隱藏代理特徵,H2C協議轉發到V2Ray,需要域名,暫不支持CloudFlare的CDN
- TCP傳輸協議
- WebSocket傳輸協議
- Http/2傳輸協議
- mKCP傳輸協議
- QUIC傳輸協議
- 參數設置
- 服務器端口:
- 隨機選擇
- 若使用TLS加密,請保持默認的443端口
- 使用已有UUID,直接粘貼到框中
- QUIC密鑰:
- mKCP Seed:
- 啟用mKCP Seed密鑰,可增強抗識別,留空則禁用,要求版本4.24.2+
- 路徑:
- VLESS ws路徑:
- VMESS tcp路徑:
- VMESS ws路徑:
- QUIC加密方式:
- 域名:
- Trojan密碼與V2ray的UUID相同。
- 偽裝網站:
- 設置此項可增加代理的隱蔽(可為空)
- 僅僅輸入域名,不包括"http"及"/"等
- 僅僅禁止root賬戶使用密碼登錄,請確保root賬戶其他登錄方式已生效
- 將啟用root賬戶,並設置為密碼登錄
- 將啟用或設置root賬戶為密鑰證書登錄
- 偽裝網址輸入格式錯誤!請重新輸入!
- 穩定性強,Caddy2做前置,隱藏代理特徵,被識別為訪問網站的https流量,抗封鎖識別最強,需要域名,支持CDN
- 基於 HTTP/2 傳輸。完整按 HTTP/2 標準實現,Caddy2做前置,隱藏代理特徵,H2C協議轉發到V2Ray,需要域名,暫不支持CloudFlare的CDN
- 當前Xray是V2Ray的超集,未來與V2Ray會有不同的發展方向。
- VLESS over TCP with XTLS + 回落and 分流to WHATEVER(終極配置),由rprx大佬(xtls作者)配置並推薦,在服務端同時配置以下六種方案,共用同一域名與443端口,其中 WS 都可以通過 CDN。
- VLESS over TCP with XTLS + 回落and 分流to WHATEVER(終極配置),由rprx大佬(xtls作者)配置並推薦,在服務端同時配置以下五種方案,共用同一域名與443端口,其中 WS 都可以通過 CDN。(想增加XTLS方案請使用Xray配置)
- 數據加密傳輸,會被識別為未知的tcp流量
- TCP+Http偽裝
- 數據加密傳輸,並做http偽裝,會被識別為http流量,但並不是真正的http訪問
- 數據加密傳輸,傳輸協議使用TLS,會被識別為TLS流量,不等同於https流量特徵 (需域名)
- TCP+TLS(自簽證書)
- 數據加密傳輸,傳輸協議使用TLS,會被識別為TLS流量,不等同於https流量特徵 (無需域名)
- Shadowrocket (ios)需要手動打開“允許不安全”選項
- 數據加密傳輸,傳輸協議使用WebSocket,未啟用TLS,將被識別為WebSocket流量。
- 數據加密傳輸,傳輸協議使用WebSocket,啟用TLS,將被識別為TLS流量。 (需要域名)支持CDN。
- WebSocket+TLS(自簽證書)
- 數據加密傳輸,傳輸協議使用WebSocket,啟用TLS,將被識別為TLS流量。 (無需域名)
- 基於 HTTP/2 的傳輸方式。它完整按照 HTTP/2 標準實現,需要域名
- HTTP2(自簽證書)
- 基於 HTTP/2 的傳輸方式。它完整按照 HTTP/2 標準實現,使用自簽名證書,不需要域名
- mKCP(無偽裝)
- 數據加密傳輸,以增加帶寬佔用,減少延遲,udp協議,無偽裝,會被識別為udp流量
- 同mKCP(無偽裝),增加偽裝成 SRTP 數據包,會被識別為視頻通話數據(如 FaceTime)
- 同mKCP(無偽裝),增加偽裝成 uTP 數據包,會被識別為 BT 下載數據
- 同mKCP(無偽裝),增加偽裝成微信視頻通話的數據包
- 同mKCP(無偽裝),增加偽裝成 DTLS 1.2 數據包
- 同mKCP(無偽裝),增加偽裝成 WireGuard 數據包。 (並不是真正的 WireGuard 協議)
- 提醒:Shadowrocket目前暫不支持QUIC的傳輸模式。
- QUIC(無偽裝)
- 數據加密傳輸,無偽裝會被識別為udp流量,最初由谷歌創始,優點:減少延遲、多路復用、連接遷移
- 同QUIC(無偽裝),增加偽裝成 SRTP 數據包,會被識別為視頻通話數據(如 FaceTime)
- 同QUIC(無偽裝),增加偽裝成 uTP 數據包,會被識別為 BT 下載數據
- 同QUIC(無偽裝),增加偽裝成微信視頻通話的數據包
- 同QUIC(無偽裝),增加偽裝成 DTLS 1.2 數據包
- 同QUIC(無偽裝),增加偽裝成 WireGuard 數據包。 (並不是真正的 WireGuard 協議)
-
- 同步網絡時間
- 將遠程主機時間校正為網絡時間,注意:本機電腦的時間必須也是與網絡時間同步的,否則本機電腦V2ray有可能連接出錯
推薦:優先使用此方法校對時間
- 同步本機時間
- 將遠程主機時間同步為本地時間,注意:本機電腦的時間必須是準確的,與網絡時間同步的,否則其他客戶端中,有可能連接出錯
使用網絡校時無法校對時間時,使用此種方法
- 更新本機時間
- 將本機電腦時間與網絡時間同步。
注意:使用此項功能,必須以管理員身份運行本程序
- 檢測時間誤差
- 校對時間
-
- 客戶端配置參數
- 服務器地址(address):
- 端口(port):
- 用戶ID(uuid)/密碼:
- 複製
- 已復製到剪貼板中!
- 空內容!
- 額外ID:
- 不超過64,客戶端沒此項可不填
- 加密方式:
- 傳輸協議:
- 偽裝類型(混淆):
- TLS設置:
- 提示:雙擊以上內容窗,即可複製到剪貼板中。
- 路徑(Path):
- mKCP Seed/QUIC密鑰:
- 默認auto
- 二維碼/URL
- 以上參數可以手動或掃描輸入客戶端,用於官方客戶端的配置和相關文件已經存放入目錄下,點擊 確定 按扭可打開
- 二維碼和URL鏈接可用於
v2rayN(windows)
Qv2ray(windows)
Qv2ray(windows)
Shadowrocket(ios)
v2rayNG(Android)
導入v2ray節點
注意:Vless協議需要手動輸入配置參數,二維碼和URL無效
- "可用於ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 掃碼和導入url。注意:有的客戶端可能不支持WebSocket模式。"
- "可用於ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 掃碼和導入url。注意:有的客戶端可能不支持WebSocket模式。"
- 用於NaiveSharp(windows)的URL導入鏈接
- 用於ShadowsocksR(windows)、SSRR(android)、Shadowrocket(ios)的掃碼和導入URL導入鏈接
- 用於手機客戶端shadowsocks(android)、Shadowrocket(ios)的掃碼和URL導入鏈接
- 用於電腦客戶端Shadowsocks (windows)的掃碼和URL導入鏈接
- 用於Shadowsocks (windows)、shadowsocks(android)、Shadowrocket(ios)的掃碼和URL導入鏈接
- 提醒: 電腦客戶端Shadowsocks (windows)與手機客戶端shadowsocks(android)、Shadowrocket(ios)的導入格式不兼容,請選擇相應格式。
- 手機端
- 電腦端
- TG格式QR
- TG格式URL(雙擊複製到剪切板中)
- T.ME格式QR
- T.ME格式URL(雙擊複製到剪切板中)
-
- 主機地址、主機端口、用戶名為必填項,不能為空!!
- 連接端口含有非數字字符!
- 登錄密碼為必填項,不能為空!!
- 密鑰文件為必填項,不能為空!!
- 如果選擇了代理,則代理地址與端口不能為空!
- 如果代理需要登錄,則代理登錄的用戶名與密碼不能為空!
- 遠程主機連接信息有誤,請檢查!
- 請先選擇配置模板!
- 發生錯誤,安裝中斷......
- 正在登錄遠程主機......
- 主機登錄成功!
- 檢測是否運行在root權限下...
- 請使用具有root權限的賬戶登錄主機! !
- 檢測結果:OK!
- 檢測系統是否已經安裝
- 遠程主機已安裝
- ,建議先執行卸載,或者重裝系統,若強制安裝有一定機率失敗。是否強制重新安裝?
- 安裝取消,退出
- 已選擇強制安裝
- 檢測結果:未安裝
- 檢測系統是否符合安裝要求......
- 當前系統內核版本為
- ,V2ray要求內核為2.6.23及以上。請升級內核再安裝!
- 系統內核版本不符合要求,安裝失敗! !
- 系統缺乏必要的安裝組件如:apt||dnf||yum||zypper||Syetemd,主機系統推薦使用:CentOS 7/8,Debian 8/9/10 ,Ubuntu 16.04及以上版本
- 系統環境不滿足要求,安裝失敗! !
- 檢測結果:OK!
- 檢測到系統啟用SELinux,且工作在嚴格模式下,需改為寬鬆模式!修改中......
- 修改完畢!
- 校對時間......
- 本地時間與遠程主機時間相差超過限制(90秒),請先用 '系統工具-->時間校對' 校對時間後再設置
- 時間較對失敗......
- 時間差符合要求,OK!
- 正在檢測域名是否解析到當前VPS的IP上......
- 正在檢測是否為純ipv6主機......
- 未檢測到有效的IP地址......
- 正在查找最快的Nat64網關......
- 未能找到有效的Nat64網關......
- 當前主機最快的Nat64網關為:
- 正在設置Nat64網關......
- 正在刪除Nat64網關......
- 解析正確! OK!
- 檢測當前主機為純ipv6主機,目前暫不支持!
- 域名未能正確解析到當前VPS的IP上!安裝失敗!
- 域名未能正確解析到當前VPS的IP上,請檢查!若解析設置正確,請等待生效後再重試安裝。如果域名使用了CDN,請先關閉!
- 檢測端口占用情況......
- 80/443端口之一,或全部被佔用,將強制停止佔用80/443端口的程序?
- 端口被佔用,安裝失敗......
- 正在釋放80/443端口......
- 80/443端口釋放完畢!
- 端口被佔用,將強制停止佔用此端口的程序?
- 正在釋放端口......
- 端口釋放完畢!
- 檢測結果:未被佔用!
- 系統環境檢測完畢,符合安裝要求,開始佈署......
- 開啟防火牆相應端口......
- 正在安裝
- 文件下載失敗!
- 編譯中,請耐心等待.............
- 安裝失敗,腳本運行出錯!
- 安裝成功!
- 安裝完畢,上傳配置文件......
- 正在安裝acme.sh......
- acme.sh安裝成功!
- acme.sh安裝失敗!原因未知,請向開發者提問!
- 申請域名證書......
- 證書申請成功!
- 證書申請失敗!原因未知,請向開發者提問!
- 安裝證書到
- 證書成功安裝到
- 證書安裝到
- 失敗,原因未知,可以向開發者提問!
- 安裝Caddy......
- 檢測結果:未安裝Caddy!
- 安裝Caddy失敗!
- Caddy安裝成功!
- 正在為Http2Web模式升級Caddy v2.2.0測試版!
- 上傳Caddy配置文件......
- Caddy配置文件上傳失敗!
- Caddy配置文件上傳成功,OK!
- 正在啟動Caddy......
- Caddy啟動成功!
- Caddy啟動失敗!
- 正在啟動Caddy(第二次嘗試)!
- Caddy啟動失敗(第二次)!退出安裝!
- Caddy啟動失敗,原因未知!請向開發者問詢!
- 正在啟動
- 啟動成功!
- 啟動失敗!
- 正在第二次嘗試啟動
- 啟動失敗(第二次)!退出安裝!
- 啟動失敗,原因如上!請排查原因!
- BBR測試......
- 正在啟用BBR......
- BBR已經啟用了!
- 系統不滿足啟用BBR的條件,啟用失敗!
- BBR 啟用成功!
- 生成客戶端配置......
- 客戶端配置獲取失敗!
- 安裝成功,祝你玩的愉快! !
- 安裝失敗!
- 發生錯誤!
- 密碼錯誤或用戶名錯誤!
- 請檢查主機地址及端口是否正確,如果通過代理,請檢查代理是否正常工作
- 所選密鑰文件錯誤或者格式不對!
- 使用密鑰登錄,密鑰文件錯誤或用戶名錯誤!
- 主機地址錯誤,如果使用了代理,也可能是連接代理的端口錯誤!
- 退出!原因:遠程主機未安裝
- 檢測到使用舊安裝腳本的V2Ray......
- 檢測到使用舊安裝腳本的V2Ray,是否卸載舊版本並使用新安裝腳本重新安裝?
- 正在卸載舊版本......
- 卸載舊版本,OK!
- 安裝新版本......
- 遷移原配置文件。
- 已更新到最新版本。
- 遠程主機當前版本為:v
- 最新版本為:
- 是否升級為最新版本?
- 正在升級到最新版本
- 升級成功!當前已是最新版本!
- 升級失敗,原因未知,請向開發者提問!
- 升級取消,退出!
- 遠程主機當前已是最新版本:
- 無需升級!退出!
- 域名不能為空,請檢查相關參數設置!
- 請在x86_64系統中安裝
- 備份Trojan配置文件......
- 恢復Trojan配置文件......
- "遠程主機已安裝Caddy,但不確定是否支持forward proxy,是否強制重新安裝?"
- 請先行卸載Caddy或重裝VPS系統!
- 正在安裝依賴的軟件......
- 安裝完畢! OK!
- 正在安裝Caddy.....
- 正在為NaiveProxy升級服務端
- 升級完畢,OK!
- 正在優化網絡參數......
- 優化網絡參數,OK!
-
- 此文件為Xay官方程序所使用的客戶端配置文件,配置為全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- Xray官方網站:https://github.com/XTLS/Xray-core
- Xray官方程序下載地址:https://github.com/XTLS/Xray-core/releases
- 下載相應版本,Windows選擇xray-windows-64.zip或者xray-windows-32.zip,解壓後提取xray.exe。與config.json放在同一目錄,運行xray.exe即可。
-
- 此文件為V2Ray官方程序所使用的客戶端配置文件,配置為全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- v2ray官方網站:https://www.v2ray.com/
- v2ray官方程序下載地址:https://github.com/v2ray/v2ray-core/releases
- 下載相應版本,Windows選擇v2ray-windows-64.zip或者v2ray-windows-32.zip,解壓後提取v2ctl.exe和v2ray.exe。與config.json放在同一目錄,運行v2ray.exe即可。
- 此文件為v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)掃碼導入節點
- v2rayN下載網址:https://github.com/2dust/v2rayN/releases
- Qv2ray下載網址:https://github.com/Qv2ray/Qv2ray/releases
- v2rayNG(Android)下載網址:https://github.com/2dust/v2rayNG/releases
- v2rayNG(Android)在Google Play下載網址:https://play.google.com/store/apps/details?id=com.v2ray.ang
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)複製粘貼導入節點的vmess網址
- 服務器通用連接配置參數
-
- 此文件為Trojan-go官方程序所使用的客戶端配置文件,配置為全局模式,http與socks5地址:127.0.0.1:1080
- Trojan-go官方網站:https://github.com/p4gefau1t/trojan-go
- Trojan-go官方程序下載地址:https://github.com/p4gefau1t/trojan-go/releases
- 下載相應版本,Windows選擇Trojan-go-x.xx-win.zip,解壓後提取trojan-go.exe。與config.json放在同一目錄,運行trojan-go.exe即可。
- 此文件為Qv2ray (windows)、igniter(Android)掃碼導入節點
- Qv2ray (windows)下載網址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下載網址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為Qv2ray (windows)、igniter(Android)複製粘貼導入節點的網址
- 服務器通用連接配置參數
-
- 此文件為Trojan官方程序所使用的客戶端配置文件,配置為全局模式,http與socks5地址:127.0.0.1:1080
- Trojan官方網站:https://trojan-gfw.github.io/trojan/
- Trojan官方程序下載地址:https://github.com/trojan-gfw/trojan/releases
- 下載相應版本,Windows選擇Trojan-x.xx-win.zip,解壓後提取trojan.exe。與config.json放在同一目錄,運行trojan.exe即可。
- 此文件為Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)掃碼導入節點
- Qv2ray (windows)下載網址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下載網址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)複製粘貼導入節點的網址
- 服務器通用連接配置參數
-
- 此文件為NaiveProxy官方程序所使用的客戶端配置文件,配置為全局模式,socks5地址:127.0.0.1:1080
- NaiveProxy官方網站:https://github.com/klzgrad/naiveproxy
- NaiveProxy官方程序下載地址:https://github.com/klzgrad/naiveproxy/releases
- 下載相應版本,Windows選擇naiveproxy-x.xx-win.zip,解壓後提取naive.exe。與config.json放在同一目錄,運行naive.exe即可。
- 此文件為NaiveSharp(windows)複製粘貼導入節點的網址
- NaiveSharp(windows)下載網址:https://github.com/KevinZonda/NaiveSharp/releases
- 服務器通用連接配置參數
-
- 此文件為ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)掃碼導入節點
- ShadowsocksR (windows)下載網址:https://github.com/shadowsocksrr/shadowsocksr-csharp/releases
- SSRR(Android)下載網址:https://github.com/shadowsocksrr/shadowsocksr-android/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)複製粘貼導入節點的網址
- 服務器通用連接配置參數
-
- 此文件為Shadowsocks (windows)掃碼導入節點
- 此文件為Shadowsocks (windows)複製粘貼導入節點的網址
- 此文件為shadowsocks(Android)、Shadowrocket(ios)掃碼導入節點
- Shadowsocks (windows)下載網址:https://github.com/shadowsocks/shadowsocks-windows/releases
- shadowsocks(Android)下載網址:https://github.com/shadowsocks/shadowsocks-android/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為shadowsocks(Android)、Shadowrocket(ios)複製粘貼導入節點的網址
- 服務器通用連接配置參數
- 插件使用說明
- ProxySU默認所有插件,在Shadowsocks (windows)運行文件所在文件夾的子文件夾plugins下。
- 電腦端手動安裝插件說明
- 先下載插件,各個插件Windows客戶端下載地址為:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases 只下載 obfs-local.zip
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64位系統選擇:v2ray-plugin-windows-amd64-vx.xxtar.gz ,32位系統選擇:v2ray-plugin-windows-386-vx.xxtar.gz (x為數字,是版本號)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64位系統選擇:kcptun-windows-amd64-xxxxxx.tar.gz,32位系統選擇:kcptun-plugin-windows-386-xxxxxx.tar.gz (x為數字,是版本號)
- GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64位系統選擇:gq-client-windows-amd64-xxxexe,32位系統選擇: gq-client-windows-386-xxxexe(x為數字,是版本號)
- Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64位系統選擇:ck-client-windows-amd64-xxxexe,32位系統選擇: ck-client-windows-386-xxxexe(x為數字,是版本號)
- 在Shadowsocks (windows)運行文件所在文件夾中,新建文件夾plugins,將obfs-local.zip解壓出的文件(兩個)全部複製到plugins中,v2ray -plugin下載得到的文件,解壓出的文件,複製到plugins中,並重命名為:v2ray-plugin.exe。 Kcptun -plugin下載得到的文件,解壓出兩個文件,將其中的client_windows開頭的文件,複製到plugins中,並重命名為:kcptun-client.exe。 GoQuiet-plugin下載得到的文件,直接複製到plugin中,並重命名為:goquiet-client.exe。 Cloak-plugin下載得到的文件,直接複製到plugin中,並重命名為:cloak-client.exe
- 安裝完畢
- 手機安卓客戶端插件安裝說明
- 先下載插件,各個插件安卓客戶端下載地址為:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases 只下載obfs-local-nightly-xxxapk(x為數字,是版本號)
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases 一般選擇v2ray--universal-xxxapk(x為數字,是版本號)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases 一般選擇kcptun--universal-xxxapk(x為數字,是版本號)
- 將上述apk文件傳到手機,安裝即可!
-
\ No newline at end of file
diff --git a/ProxySU/TrojanGoTemplateWindow.xaml b/ProxySU/TrojanGoTemplateWindow.xaml
deleted file mode 100644
index 1c59fa48..00000000
--- a/ProxySU/TrojanGoTemplateWindow.xaml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/TrojanGoTemplateWindow.xaml.cs b/ProxySU/TrojanGoTemplateWindow.xaml.cs
deleted file mode 100644
index 59816c7b..00000000
--- a/ProxySU/TrojanGoTemplateWindow.xaml.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace ProxySU
-{
- ///
- /// TrojanGoTemplateWindow.xaml 的交互逻辑
- ///
- public partial class TrojanGoTemplateWindow : Window
- {
- public TrojanGoTemplateWindow()
- {
- InitializeComponent();
- RadioButtonTrojanGoTLS2Web.IsChecked = true;
- CheckBoxMuxSelect.IsChecked = false;
- GridTrojanGoMuxSelected.Visibility = Visibility.Collapsed;
- TextBlockExplainCheckBoxMuxSelect.Visibility = Visibility.Collapsed;
- }
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = "443";
- //传递密码(uuid)
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUID.Text);
- if (RadioButtonTrojanGoTLS2Web.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TrojanGoTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTrojanGoTLS2Web.Content.ToString();
-
- }
- else if (RadioButtonTrojanGoWebSocketTLS2Web.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TrojanGoWebSocketTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTrojanGoWebSocketTLS2Web.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- }
- //传递Mux的concurrency与idle_timeout
- if (CheckBoxMuxSelect.IsChecked == true)
- {
- MainWindow.ReceiveConfigurationParameters[9] = "true";
- MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxConcurrency.Text);
- MainWindow.ReceiveConfigurationParameters[5] = PreTrim(TextBoxIdle_timeout.Text);
- }
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
- //更新密码
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- }
- //更新路径
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPath.Text = $"/{path}";
- //MessageBox.Show(path);
- }
- //private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- //{
- // TextBoxServerListenPort.Text = GetRandomPort();
- //}
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
- private void RadioButtonTrojanTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = uuid.ToString();
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBoxPath.Visibility = Visibility.Collapsed;
- ButtonPath.Visibility = Visibility.Collapsed;
- //Random random = new Random();
- //int randomServerPort = random.Next(10000, 50000);
- //TextBoxServerListenPort.Text = "443";
- }
- private void RadioButtonTrojanGoWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = uuid.ToString();
- TextBlockPath.Visibility = Visibility.Visible;
- TextBoxPath.Visibility = Visibility.Visible;
- ButtonPath.Visibility = Visibility.Visible;
- TextBoxPath.Text = "/trojan";
- }
-
- //生成随机UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
-
- //生成随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
- //生成随机Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- //Guid uuid = Guid.NewGuid();
- string uuid = GenerateRandomUUID();
- string[] pathArray = uuid.Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- }
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
-
- private void CheckBoxMuxSelect_Checked(object sender, RoutedEventArgs e)
- {
- GridTrojanGoMuxSelected.Visibility = Visibility.Visible;
- TextBlockExplainCheckBoxMuxSelect.Visibility = Visibility.Visible;
- }
-
- private void CheckBoxMuxSelect_Unchecked(object sender, RoutedEventArgs e)
- {
- GridTrojanGoMuxSelected.Visibility = Visibility.Collapsed;
- TextBlockExplainCheckBoxMuxSelect.Visibility = Visibility.Collapsed;
- }
-
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
-
- //处理伪装网站域名中的前缀
- //private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
- //return fakeUrl;
- // }
- }
-}
diff --git a/ProxySU/V2RayTemplateWindow.xaml b/ProxySU/V2RayTemplateWindow.xaml
deleted file mode 100644
index a3e05779..00000000
--- a/ProxySU/V2RayTemplateWindow.xaml
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/V2RayTemplateWindow.xaml.cs b/ProxySU/V2RayTemplateWindow.xaml.cs
deleted file mode 100644
index 0b171a6e..00000000
--- a/ProxySU/V2RayTemplateWindow.xaml.cs
+++ /dev/null
@@ -1,1146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-//using System.Windows.Forms;
-
-namespace ProxySU
-{
- ///
- /// WindowTemplateConfiguration.xaml 的交互逻辑
- ///
- public partial class WindowTemplateConfiguration : Window
- {
- //QUIC 加密方法
- public class EncryptionMethodInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
-
- public WindowTemplateConfiguration()
- {
- InitializeComponent();
-
- #region 加密方法选择 初始设置为chacha20-poly1305
- List methodList = new List();
-
- methodList.Add(new EncryptionMethodInfo { Name = "chacha20-poly1305", Value = "chacha20-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-128-gcm", Value = "aes-128-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "none", Value = "none" });
-
- ComboBoxEncryptionMethodInfo.ItemsSource = methodList;
-
- ComboBoxEncryptionMethodInfo.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxEncryptionMethodInfo.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxEncryptionMethodInfo.SelectedIndex = 0;
-
- DataContext = this;
- #endregion
-
- //隐藏QUIC密钥
- FirstQuicHideEncryption();
- RadioButtonVMESSmKCP.IsChecked = true;
- }
- //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
- //代码参考网址:https://blog.csdn.net/weixin_42583999/article/details/103468857
- //调用:UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- private void UncheckLayouts(TabItem activePage)
- {
- foreach (TabItem tabPage in TabControlTemplate.Items)
- {
- if (tabPage == activePage) continue;
- Grid grid = (Grid)tabPage.Content;
- foreach (UIElement element in grid.Children)
- {
- if (element is RadioButton)
- {
- RadioButton radiobutton = (element as RadioButton);
- radiobutton.IsChecked = false;
- }
-
- }
- }
- }
-
- //传递所选择的参数与模板方案
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = true;
-
- #region TCP 传输协议(VMESS)
-
- //TCP模式被选中
- if (RadioButtonTCP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP.Content.ToString();
-
- }
-
- //TCP+http伪装模式被选中
- else if (RadioButtonTCPhttp.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCPhttp.Content.ToString();
- //伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "http";
-
- }
-
- //TCP+TLS模式被选中
- else if (RadioButtonTCP2TLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP2TLS.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //tcp+TLS(自签证书)模式被选中
- else if (RadioButtonTcpTLS2SelfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTcpTLS2SelfSigned.Content.ToString();
-
- //传递域名
- // MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region VLESS协议
-
- //VLESS+TCP+XTLS+Web模式选中
- else if (RadioButtonVlessXtlsTcp.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessXtlsTcp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessXtlsTcp.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+TCP+TLS+Web模式选中
- else if (RadioButtonVlessTcpTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessTcpTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessTcpTlsWeb.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+WebSocket+TLS+Web模式选中
- else if (RadioButtonVlessWebSocketTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessWebSocketTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessWebSocketTlsWeb.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+http2+TLS+Web模式选中
- else if (RadioButtonVlessHttp2Web.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessHttp2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessHttp2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web模式被选中
- else if (RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessVmessXtlsTcpWebSocketWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessVmessXtlsTcpWebSocketHot.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxPathVlessWS.Text);//VLESS ws Path
- MainWindow.ReceiveConfigurationParameters[9] = PreTrim(TextBoxPathVmessTcp.Text);//VMESS tcp Path
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPathVmessWS.Text);//VMESS ws Path
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递混淆方式(VMESS TCP Path方式所用)
- MainWindow.ReceiveConfigurationParameters[5] = "http";
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- #endregion
-
- #region WebSocket传输协议(VMESS)
-
- //webSocket模式被选中
- else if (RadioButtonWebSocket.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "webSocket";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocket.Content.ToString();
-
- }
-
- //WebSocket+TLS模式被选中
- else if (RadioButtonWebSocketTLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //WebSocket+TLS+Web模式被选中
- else if (RadioButtonWebSocketTLS2Web.IsChecked == true|| RadioButtonWebSocketTLS2WebHot.IsChecked==true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //WebSocket+TLS(自签证书)模式被选中
- else if (RadioButtonWebSocketTLSselfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLSselfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region http2传输协议(VMESS)
-
- //http2模式被选中
- else if (RadioButtonHTTP2.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Http2";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //http2+TLS+Web模式被选中
- else if (RadioButtonHTTP2Web.IsChecked == true || RadioButtonHTTP2WebHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //http2(自签证书)模式被选中
- else if (RadioButtonHTTP2selfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2selfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2selfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region mKCP 传输协议 (VMESS)
-
- //mKCP无伪装模式被选中
- else if (RadioButtonMkcpNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonMkcpNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) ==false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+srtp伪装模式被选中
- else if (RadioButton2mKCP2SRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2SRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+utp伪装模式被选中
- else if (RadioButton2mKCPuTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCPuTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wechat-video伪装模式被选中
- else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+dtls伪装模式被选中
- else if (RadioButton2mKCP2DTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2DTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wireguard伪装模式被选中
- else if (RadioButton2mKCP2WireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- #endregion
-
- #region QUIC传输协议(VMESS)
-
- //QUIC无伪装模式被选中
- else if (RadioButtonQuicNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+srtp伪装模式被选中
- else if (RadioButtonQuicSRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicSRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicSRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+utp伪装模式被选中
- else if (RadioButtonQuic2uTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Quic2uTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuic2uTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wechat-video伪装模式被选中
- else if (RadioButtonQuicWechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+dtls伪装模式被选中
- else if (RadioButtonQuicDTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicDTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicDTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wireguard伪装模式被选中
- else if (RadioButtonQuicWireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- #endregion
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = PreTrim(TextBoxServerListenPort.Text);
- //传递uuid
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUID.Text);
-
- if (RadioButtonVLESSmKCP.IsChecked == true)
- {
- MainWindow.mKCPvlessIsSet = true;
- }
- else
- {
- MainWindow.mKCPvlessIsSet = false;
- }
-
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
-
- //取消选择返回主窗口
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
-
- //伪装网站处理
- //DisguiseURLprocessing(string fakeUrl);
- // private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //Console.WriteLine(uri.Host);
-
- ////处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
-
- //}
-
- #region 其他设置中的界面控制
-
- private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "80";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCP2TLS_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessTcpTlsWeb_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessVmessXtlsTcpWebSocketHot_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示复合路径
- ShowVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //生成UUID
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- //单击TextBlockVlessVmessXtlsTcpWebSocket标签则选中RadioButtonVlessVmessXtlsTcpWebSocketHot
- private void TextBlockVlessVmessXtlsTcpWebSocket_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked = true;
- }
- private void RadioButtonTCP2TLSnoDomain_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLSselfSigned_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //mKCP显示界面
- private void RadioButtonMkcp_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏QUIC密钥
- HideQuic();
-
- //显示mKCP Seed
- ShowMkcpSeed();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //QUIC显示界面
- private void RadioButtonQuicNone_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //显示QUIC密钥
- ShowQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
-
- //隐藏QUIC相关项
- private void HideQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- //TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //如果加密方法选择none,则隐藏只QUIC密钥
- private void NoneEncryptionHideQuicKey()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- }
- //窗口初始化时,需要做一次隐藏QUIC加密方法
- private void FirstQuicHideEncryption()
- {
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- }
- //显示QUIC相关项
- private void ShowQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockQuicEncryption.Visibility = Visibility.Visible;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Visible;
-
- //隐藏mKCP相关项
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏mKCP Seed相关项
- private void HideMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
-
- }
- //显示mKCP Seed相关项
- private void ShowMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockMkcpUUID.Visibility = Visibility.Visible;
- //隐藏QUIC标示
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏路径相关项
- private void HidePath()
- {
- //隐藏Path
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBoxPath.Visibility = Visibility.Collapsed;
- ButtonPath.Visibility = Visibility.Collapsed;
- }
- //显示路径相关项
- private void ShowPath()
- {
- HideVlessVmessMultiplePath();//隐藏VLESS VMESS多种方案的路径Path
- //显示Path
- TextBlockPath.Visibility = Visibility.Visible;
- TextBoxPath.Visibility = Visibility.Visible;
- TextBoxPath.Text = "/ray";
- ButtonPath.Visibility = Visibility.Visible;
- }
- //隐藏VLESS VMESS复合方案路径
- private void HideVlessVmessMultiplePath()
- {
- TextBlockPathVlessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVlessWS.Visibility = Visibility.Collapsed;
- TextBlockPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBoxPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBlockPathVmessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVmessWS.Visibility = Visibility.Collapsed;
- ButtonVlessVmessPath.Visibility = Visibility.Collapsed;
- TextBlockTrojanPassword.Visibility = Visibility.Collapsed;
-
- }
- //显示VLESS VMESS复合方案路径
- private void ShowVlessVmessMultiplePath()
- {
- HidePath();//隐藏普通路径Path
- TextBlockPathVlessWs.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Text = "/vlessws";
-
- TextBlockPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Text = "/vmesstcp";
-
- TextBlockPathVmessWs.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Text = "/vmessws";
-
- ButtonVlessVmessPath.Visibility = Visibility.Visible;
- TextBlockTrojanPassword.Visibility = Visibility.Visible;
- }
- //隐藏域名相关项
- private void HideDomain()
- {
- //隐藏域名
- TextBlockDomain.Visibility = Visibility.Collapsed;
- TextBoxDomain.Visibility = Visibility.Collapsed;
- ButtonDomain.Visibility = Visibility.Collapsed;
- }
- //显示域名相关项
- private void ShowDomain()
- {
- //显示域名
- TextBlockDomain.Visibility = Visibility.Visible;
- TextBoxDomain.Visibility = Visibility.Visible;
- //ButtonDomain.Visibility = Visibility.Visible;
- }
- //隐藏伪装网站
- private void HideMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Collapsed;
- TextBoxMaskSites.Visibility = Visibility.Collapsed;
- }
- //显示伪装网站
- private void ShowMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
- }
- #endregion
-
- //产生随机的uuid
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNewUUID.Text = GenerateRandomUUID();
- }
-
- //产生QUIC密钥/mKCP Seed所用的UUID
- private void ButtonQuicAndMkcpSeedUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
- }
-
- //更新随机服务端口
- private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- {
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- }
-
- //更新单方案随机的Path
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPath.Text = $"/{path}";
- }
-
- //更新多方案共存的Path
- private void ButtonVlessVmessPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPathVlessWS.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessTcp.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessWS.Text = $"/{path}";
- }
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
- //生成随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
-
- //生成随机UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
-
- //生成随机Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- //Guid uuid = Guid.NewGuid();
- string uuid = GenerateRandomUUID();
- string[] pathArray = uuid.Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- }
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
-
- //加密方法更改后的动作
- private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- string getMethond = GetEncryptionMethodSS();
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = getMethond;
- if (String.Equals(getMethond,"none"))
- {
- NoneEncryptionHideQuicKey();
- }
- else
- {
- ShowQuic();
- }
-
- }
-
- //读取加密方式
- private string GetEncryptionMethodSS()
- {
- return ComboBoxEncryptionMethodInfo.SelectedValue.ToString();
- }
- private void ButtonDomain_Click(object sender, RoutedEventArgs e)
- {
-
- }
-
-
-
-
-
-
-
-
-
- //private void ButtonTestChecked_Click(object sender, RoutedEventArgs e)
- //{
- // UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
-
- //}
- }
-}
diff --git a/ProxySU/XayTemplateWindow.xaml b/ProxySU/XayTemplateWindow.xaml
deleted file mode 100644
index 0daad4e6..00000000
--- a/ProxySU/XayTemplateWindow.xaml
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/XayTemplateWindow.xaml.cs b/ProxySU/XayTemplateWindow.xaml.cs
deleted file mode 100644
index 10799667..00000000
--- a/ProxySU/XayTemplateWindow.xaml.cs
+++ /dev/null
@@ -1,1146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-//using System.Windows.Forms;
-
-namespace ProxySU
-{
- ///
- /// WindowTemplateConfiguration.xaml 的交互逻辑
- ///
- public partial class XrayWindowTemplateConfiguration : Window
- {
- //QUIC 加密方法
- public class EncryptionMethodInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
-
- public XrayWindowTemplateConfiguration()
- {
- InitializeComponent();
-
- #region 加密方法选择 初始设置为chacha20-poly1305
- List methodList = new List();
-
- methodList.Add(new EncryptionMethodInfo { Name = "chacha20-poly1305", Value = "chacha20-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-128-gcm", Value = "aes-128-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "none", Value = "none" });
-
- ComboBoxEncryptionMethodInfo.ItemsSource = methodList;
-
- ComboBoxEncryptionMethodInfo.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxEncryptionMethodInfo.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxEncryptionMethodInfo.SelectedIndex = 0;
-
- DataContext = this;
- #endregion
-
- //隐藏QUIC密钥
- FirstQuicHideEncryption();
- RadioButtonVMESSmKCP.IsChecked = true;
- }
- //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
- //代码参考网址:https://blog.csdn.net/weixin_42583999/article/details/103468857
- //调用:UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- private void UncheckLayouts(TabItem activePage)
- {
- foreach (TabItem tabPage in TabControlTemplate.Items)
- {
- if (tabPage == activePage) continue;
- Grid grid = (Grid)tabPage.Content;
- foreach (UIElement element in grid.Children)
- {
- if (element is RadioButton)
- {
- RadioButton radiobutton = (element as RadioButton);
- radiobutton.IsChecked = false;
- }
-
- }
- }
- }
-
- //传递所选择的参数与模板方案
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = true;
-
- #region TCP 传输协议(VMESS)
-
- //TCP模式被选中
- if (RadioButtonTCP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP.Content.ToString();
-
- }
-
- //TCP+http伪装模式被选中
- else if (RadioButtonTCPhttp.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCPhttp.Content.ToString();
- //伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "http";
-
- }
-
- //TCP+TLS模式被选中
- else if (RadioButtonTCP2TLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP2TLS.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //tcp+TLS(自签证书)模式被选中
- else if (RadioButtonTcpTLS2SelfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTcpTLS2SelfSigned.Content.ToString();
-
- //传递域名
- // MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region VLESS协议
-
- //VLESS+TCP+XTLS+Web模式选中
- else if (RadioButtonVlessXtlsTcp.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessXtlsTcp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessXtlsTcp.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+TCP+TLS+Web模式选中
- else if (RadioButtonVlessTcpTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessTcpTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessTcpTlsWeb.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+WebSocket+TLS+Web模式选中
- else if (RadioButtonVlessWebSocketTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessWebSocketTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessWebSocketTlsWeb.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+http2+TLS+Web模式选中
- else if (RadioButtonVlessHttp2Web.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessHttp2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessHttp2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web模式被选中
- else if (RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessVmessXtlsTcpWebSocketWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessVmessXtlsTcpWebSocketHot.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxPathVlessWS.Text);//VLESS ws Path
- MainWindow.ReceiveConfigurationParameters[9] = PreTrim(TextBoxPathVmessTcp.Text);//VMESS tcp Path
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPathVmessWS.Text);//VMESS ws Path
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递混淆方式(VMESS TCP Path方式所用)
- MainWindow.ReceiveConfigurationParameters[5] = "http";
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- #endregion
-
- #region WebSocket传输协议(VMESS)
-
- //webSocket模式被选中
- else if (RadioButtonWebSocket.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "webSocket";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocket.Content.ToString();
-
- }
-
- //WebSocket+TLS模式被选中
- else if (RadioButtonWebSocketTLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //WebSocket+TLS+Web模式被选中
- else if (RadioButtonWebSocketTLS2Web.IsChecked == true|| RadioButtonWebSocketTLS2WebHot.IsChecked==true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //WebSocket+TLS(自签证书)模式被选中
- else if (RadioButtonWebSocketTLSselfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLSselfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region http2传输协议(VMESS)
-
- //http2模式被选中
- else if (RadioButtonHTTP2.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Http2";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //http2+TLS+Web模式被选中
- else if (RadioButtonHTTP2Web.IsChecked == true || RadioButtonHTTP2WebHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //http2(自签证书)模式被选中
- else if (RadioButtonHTTP2selfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2selfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2selfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region mKCP 传输协议 (VMESS)
-
- //mKCP无伪装模式被选中
- else if (RadioButtonMkcpNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonMkcpNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) ==false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+srtp伪装模式被选中
- else if (RadioButton2mKCP2SRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2SRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+utp伪装模式被选中
- else if (RadioButton2mKCPuTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCPuTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wechat-video伪装模式被选中
- else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+dtls伪装模式被选中
- else if (RadioButton2mKCP2DTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2DTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wireguard伪装模式被选中
- else if (RadioButton2mKCP2WireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- #endregion
-
- #region QUIC传输协议(VMESS)
-
- //QUIC无伪装模式被选中
- else if (RadioButtonQuicNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+srtp伪装模式被选中
- else if (RadioButtonQuicSRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicSRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicSRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+utp伪装模式被选中
- else if (RadioButtonQuic2uTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Quic2uTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuic2uTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wechat-video伪装模式被选中
- else if (RadioButtonQuicWechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+dtls伪装模式被选中
- else if (RadioButtonQuicDTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicDTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicDTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wireguard伪装模式被选中
- else if (RadioButtonQuicWireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- #endregion
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = PreTrim(TextBoxServerListenPort.Text);
- //传递uuid
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUID.Text);
-
- if (RadioButtonVLESSmKCP.IsChecked == true)
- {
- MainWindow.mKCPvlessIsSet = true;
- }
- else
- {
- MainWindow.mKCPvlessIsSet = false;
- }
-
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
-
- //取消选择返回主窗口
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
-
- //伪装网站处理
- //DisguiseURLprocessing(string fakeUrl);
- // private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //Console.WriteLine(uri.Host);
-
- ////处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
-
- //}
-
- #region 其他设置中的界面控制
-
- private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "80";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCP2TLS_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessTcpTlsWeb_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessVmessXtlsTcpWebSocketHot_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示复合路径
- ShowVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //生成UUID
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- //单击TextBlockVlessVmessXtlsTcpWebSocket标签则选中RadioButtonVlessVmessXtlsTcpWebSocketHot
- private void TextBlockVlessVmessXtlsTcpWebSocket_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked = true;
- }
- private void RadioButtonTCP2TLSnoDomain_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLSselfSigned_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //mKCP显示界面
- private void RadioButtonMkcp_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏QUIC密钥
- HideQuic();
-
- //显示mKCP Seed
- ShowMkcpSeed();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //QUIC显示界面
- private void RadioButtonQuicNone_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //显示QUIC密钥
- ShowQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
-
- //隐藏QUIC相关项
- private void HideQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- //TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //如果加密方法选择none,则隐藏只QUIC密钥
- private void NoneEncryptionHideQuicKey()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- }
- //窗口初始化时,需要做一次隐藏QUIC加密方法
- private void FirstQuicHideEncryption()
- {
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- }
- //显示QUIC相关项
- private void ShowQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockQuicEncryption.Visibility = Visibility.Visible;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Visible;
-
- //隐藏mKCP相关项
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏mKCP Seed相关项
- private void HideMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
-
- }
- //显示mKCP Seed相关项
- private void ShowMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockMkcpUUID.Visibility = Visibility.Visible;
- //隐藏QUIC标示
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏路径相关项
- private void HidePath()
- {
- //隐藏Path
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBoxPath.Visibility = Visibility.Collapsed;
- ButtonPath.Visibility = Visibility.Collapsed;
- }
- //显示路径相关项
- private void ShowPath()
- {
- HideVlessVmessMultiplePath();//隐藏VLESS VMESS多种方案的路径Path
- //显示Path
- TextBlockPath.Visibility = Visibility.Visible;
- TextBoxPath.Visibility = Visibility.Visible;
- TextBoxPath.Text = "/ray";
- ButtonPath.Visibility = Visibility.Visible;
- }
- //隐藏VLESS VMESS复合方案路径
- private void HideVlessVmessMultiplePath()
- {
- TextBlockPathVlessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVlessWS.Visibility = Visibility.Collapsed;
- TextBlockPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBoxPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBlockPathVmessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVmessWS.Visibility = Visibility.Collapsed;
- ButtonVlessVmessPath.Visibility = Visibility.Collapsed;
- TextBlockTrojanPassword.Visibility = Visibility.Collapsed;
-
- }
- //显示VLESS VMESS复合方案路径
- private void ShowVlessVmessMultiplePath()
- {
- HidePath();//隐藏普通路径Path
- TextBlockPathVlessWs.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Text = "/vlessws";
-
- TextBlockPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Text = "/vmesstcp";
-
- TextBlockPathVmessWs.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Text = "/vmessws";
-
- ButtonVlessVmessPath.Visibility = Visibility.Visible;
- TextBlockTrojanPassword.Visibility = Visibility.Visible;
- }
- //隐藏域名相关项
- private void HideDomain()
- {
- //隐藏域名
- TextBlockDomain.Visibility = Visibility.Collapsed;
- TextBoxDomain.Visibility = Visibility.Collapsed;
- ButtonDomain.Visibility = Visibility.Collapsed;
- }
- //显示域名相关项
- private void ShowDomain()
- {
- //显示域名
- TextBlockDomain.Visibility = Visibility.Visible;
- TextBoxDomain.Visibility = Visibility.Visible;
- //ButtonDomain.Visibility = Visibility.Visible;
- }
- //隐藏伪装网站
- private void HideMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Collapsed;
- TextBoxMaskSites.Visibility = Visibility.Collapsed;
- }
- //显示伪装网站
- private void ShowMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
- }
- #endregion
-
- //产生随机的uuid
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNewUUID.Text = GenerateRandomUUID();
- }
-
- //产生QUIC密钥/mKCP Seed所用的UUID
- private void ButtonQuicAndMkcpSeedUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
- }
-
- //更新随机服务端口
- private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- {
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- }
-
- //更新单方案随机的Path
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPath.Text = $"/{path}";
- }
-
- //更新多方案共存的Path
- private void ButtonVlessVmessPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPathVlessWS.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessTcp.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessWS.Text = $"/{path}";
- }
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
- //生成随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
-
- //生成随机UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
-
- //生成随机Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- //Guid uuid = Guid.NewGuid();
- string uuid = GenerateRandomUUID();
- string[] pathArray = uuid.Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- }
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
-
- //加密方法更改后的动作
- private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- string getMethond = GetEncryptionMethodSS();
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = getMethond;
- if (String.Equals(getMethond,"none"))
- {
- NoneEncryptionHideQuicKey();
- }
- else
- {
- ShowQuic();
- }
-
- }
-
- //读取加密方式
- private string GetEncryptionMethodSS()
- {
- return ComboBoxEncryptionMethodInfo.SelectedValue.ToString();
- }
- private void ButtonDomain_Click(object sender, RoutedEventArgs e)
- {
-
- }
-
-
-
-
-
-
-
-
-
- //private void ButtonTestChecked_Click(object sender, RoutedEventArgs e)
- //{
- // UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
-
- //}
- }
-}
diff --git a/ProxySU/bin/Beta/Beta.zip b/ProxySU/bin/Beta/Beta.zip
deleted file mode 100644
index 500116a7..00000000
Binary files a/ProxySU/bin/Beta/Beta.zip and /dev/null differ
diff --git a/ProxySuper.Core/App.cs b/ProxySuper.Core/App.cs
new file mode 100644
index 00000000..919fd052
--- /dev/null
+++ b/ProxySuper.Core/App.cs
@@ -0,0 +1,13 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.ViewModels;
+
+namespace ProxySuper.Core
+{
+ public class App : MvxApplication
+ {
+ public override void Initialize()
+ {
+ RegisterAppStart();
+ }
+ }
+}
diff --git a/ProxySuper.Core/Converters/LoginSecretTypeConverter.cs b/ProxySuper.Core/Converters/LoginSecretTypeConverter.cs
new file mode 100644
index 00000000..56cd8752
--- /dev/null
+++ b/ProxySuper.Core/Converters/LoginSecretTypeConverter.cs
@@ -0,0 +1,22 @@
+using ProxySuper.Core.Models.Hosts;
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace ProxySuper.Core.Converters
+{
+ public class LoginSecretTypeConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value.Equals(parameter);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (parameter == null) return LoginSecretType.Password;
+ return parameter;
+ }
+
+ }
+}
diff --git a/ProxySuper.Core/Converters/ProxyTypeConverter.cs b/ProxySuper.Core/Converters/ProxyTypeConverter.cs
new file mode 100644
index 00000000..92ba31ed
--- /dev/null
+++ b/ProxySuper.Core/Converters/ProxyTypeConverter.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+
+namespace ProxySuper.Core.Converters
+{
+ public class ProxyTypeConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value != null && value.Equals(parameter);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ {
+ return Binding.DoNothing;
+ }
+
+ if (!value.Equals(true))
+ {
+ return Binding.DoNothing;
+ }
+
+ return parameter;
+ }
+ }
+
+ public class BooleanOrConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ return values.OfType().Any(v => v);
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+
+}
diff --git a/ProxySuper.Core/Converters/VisibleConverter.cs b/ProxySuper.Core/Converters/VisibleConverter.cs
new file mode 100644
index 00000000..1379bb46
--- /dev/null
+++ b/ProxySuper.Core/Converters/VisibleConverter.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace ProxySuper.Core.Converters
+{
+ public class VisibleConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value.Equals(true) ? Visibility.Visible : Visibility.Collapsed;//Hidden;//Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ {
+ return false;
+ }
+
+ if (value.Equals(Visibility.Visible))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public class VisibleConverter2 : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ bool isMatch = (value != null && value.Equals(parameter));
+ // 如果匹配则显示,否则隐藏(Collapsed)
+ return isMatch ? Visibility.Visible : Visibility.Collapsed;//Hidden;//Collapsed;
+
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+ public class BooleanOrToVisibilityConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ // 如果任一条件为 true,则返回 Visible,否则返回 Hidden/Collapsed
+ foreach (var value in values)
+ {
+ if (value is bool boolVal && boolVal)
+ {
+ return Visibility.Visible;
+ }
+ }
+ return Visibility.Collapsed;//Hidden;//Collapsed
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/ProxySuper.Core/Converters/YamlJsonConverter.cs b/ProxySuper.Core/Converters/YamlJsonConverter.cs
new file mode 100644
index 00000000..ca56c156
--- /dev/null
+++ b/ProxySuper.Core/Converters/YamlJsonConverter.cs
@@ -0,0 +1,205 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Dynamic;
+using System.IO;
+using YamlDotNet.Serialization;
+using YamlDotNet.Serialization.NamingConventions;
+
+namespace ProxySuper.Core.Converters
+{
+ public class YamlJsonConverter
+ {
+ private readonly IDeserializer _yamlDeserializer;
+ private readonly ISerializer _yamlSerializer;
+
+ public YamlJsonConverter()
+ {
+ _yamlDeserializer = new DeserializerBuilder()
+ .WithNamingConvention(CamelCaseNamingConvention.Instance)
+ .Build();
+
+ _yamlSerializer = new SerializerBuilder()
+ .WithNamingConvention(CamelCaseNamingConvention.Instance)
+ .DisableAliases()
+ .WithIndentedSequences()
+ .Build();
+ }
+
+ ///
+ /// YAML 字符串转 JSON 字符串
+ ///
+ public string YamlToJson(string yaml, bool indentJson = true)
+ {
+ var obj = _yamlDeserializer.Deserialize(yaml);
+ var formatting = indentJson ? Formatting.Indented : Formatting.None;
+ return JsonConvert.SerializeObject(obj, formatting);
+ }
+
+ ///
+ /// JSON 字符串转 YAML 字符串
+ ///
+ public string JsonToYaml(string json)
+ {
+ var obj = JsonConvert.DeserializeObject(json);
+ return _yamlSerializer.Serialize(obj);
+ }
+ }
+
+ public class JsonYamlConverters
+ {
+ ///
+ /// 将JSON字符串转换为YAML字符串。
+ ///
+ /// 要转换的JSON字符串。
+ /// 转换后的YAML字符串。
+ /// 如果jsonString为空或null。
+ /// 如果JSON字符串无效。
+ public static string JsonToYaml(string jsonString)
+ {
+ if (string.IsNullOrWhiteSpace(jsonString))
+ {
+ throw new ArgumentNullException(nameof(jsonString), "JSON字符串不能为空或null。");
+ }
+
+ // 使用自定义转换器将JSON反序列化为ExpandoObject
+ // ExpandoObject 实现了 IDictionary,这通常更受 YamlDotNet 欢迎
+ var settings = new JsonSerializerSettings
+ {
+ Converters = { new ExpandoObjectConverter() }
+ };
+ ExpandoObject expandoObject = JsonConvert.DeserializeObject(jsonString, settings);
+
+
+ // 创建一个序列化器将对象转换为YAML
+ var serializer = new SerializerBuilder()
+ .WithNamingConvention(CamelCaseNamingConvention.Instance) // 可选:设置命名约定
+ .Build();
+
+ // 将对象序列化为YAML字符串
+ return serializer.Serialize(expandoObject);
+ }
+
+ ///
+ /// 将YAML字符串转换为JSON字符串。
+ ///
+ /// 要转换的YAML字符串。
+ /// 转换后的JSON字符串。
+ /// 如果yamlString为空或null。
+ /// 如果YAML字符串无效。
+ public static string YamlToJson(string yamlString)
+ {
+ if (string.IsNullOrWhiteSpace(yamlString))
+ {
+ throw new ArgumentNullException(nameof(yamlString), "YAML字符串不能为空或null。");
+ }
+
+ // 创建一个反序列化器将YAML转换为对象
+ var deserializer = new DeserializerBuilder()
+ .WithNamingConvention(CamelCaseNamingConvention.Instance) // 可选:设置命名约定
+ .Build();
+
+ // 将YAML字符串反序列化为动态对象或JObject
+ // 使用object可以适应各种YAML结构
+ object yamlObject = deserializer.Deserialize(new StringReader(yamlString));
+
+ // 将对象序列化为美化(格式化)的JSON字符串
+ return JsonConvert.SerializeObject(yamlObject, Formatting.Indented);
+ }
+ }
+
+ public class ExpandoObjectConverter : JsonConverter
+ {
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(ExpandoObject);
+ }
+
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ return ReadValue(reader);
+ }
+
+ private object ReadValue(JsonReader reader)
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.StartObject:
+ var expando = new ExpandoObject() as IDictionary;
+ while (reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.PropertyName:
+ var propertyName = reader.Value.ToString();
+ reader.Read();
+ expando[propertyName] = ReadValue(reader);
+ break;
+ case JsonToken.EndObject:
+ return expando;
+ }
+ }
+ break;
+ case JsonToken.StartArray:
+ var list = new List();
+ while (reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.EndArray:
+ return list;
+ case JsonToken.Comment: // Skip comments
+ break;
+ default:
+ list.Add(ReadValue(reader));
+ break;
+ }
+ }
+ break;
+ case JsonToken.Integer:
+ case JsonToken.Float:
+ case JsonToken.String:
+ case JsonToken.Boolean:
+ case JsonToken.Date:
+ case JsonToken.Bytes:
+ return reader.Value;
+ case JsonToken.Null:
+ return null;
+ }
+ return null; // Should not happen with valid JSON
+ }
+
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ // ExpandoObject 实际上会由 JsonSerializer 自行处理,
+ // 但为了完整性,我们也可以在此处实现更严格的转换
+ if (value is IDictionary dictionary)
+ {
+ writer.WriteStartObject();
+ foreach (var kvp in dictionary)
+ {
+ writer.WritePropertyName(kvp.Key);
+ serializer.Serialize(writer, kvp.Value);
+ }
+ writer.WriteEndObject();
+ }
+ else if (value is IEnumerable enumerable)
+ {
+ writer.WriteStartArray();
+ foreach (var item in enumerable)
+ {
+ serializer.Serialize(writer, item);
+ }
+ writer.WriteEndArray();
+ }
+ else
+ {
+ writer.WriteValue(value);
+ }
+ }
+ }
+
+
+
+}
diff --git a/ProxySuper.Core/Helpers/DateTimeUtils.cs b/ProxySuper.Core/Helpers/DateTimeUtils.cs
new file mode 100644
index 00000000..4625b81a
--- /dev/null
+++ b/ProxySuper.Core/Helpers/DateTimeUtils.cs
@@ -0,0 +1,82 @@
+
+using System;
+using System.Globalization;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace ProxySuper.Core.Helpers
+{
+ public static class DateTimeUtils
+ {
+ ///
+ /// 从国家授时中心获取标准GMT时间,读取https://www.tsa.cn
+ /// GMT时间与UTC时间没有差别,可以UTC=GMT
+ ///
+ /// 返回网络时间
+ public static DateTime GetUTCTime()
+ {
+ DateTime time;
+ try
+ {
+ HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.tsa.cn");
+ request.Method = "HEAD";
+ request.AllowAutoRedirect = false;
+ HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
+ string cc = reponse.GetResponseHeader("date");
+ reponse.Close();
+
+ bool s = GMTStrParse(cc, out time);
+ return time;
+ }
+ catch
+ {
+ return new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ }
+ }
+
+ public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串,这里转成datetime
+ {
+ CultureInfo enUS = new CultureInfo("en-US");
+ bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
+ return s;
+ }
+
+ //设置系统时间的API函数
+ [DllImport("kernel32.dll")]
+ private static extern bool SetLocalTime(ref SYSTEMTIME time);
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct SYSTEMTIME
+ {
+ public short year;
+ public short month;
+ public short dayOfWeek;
+ public short day;
+ public short hour;
+ public short minute;
+ public short second;
+ public short milliseconds;
+ }
+
+ ///
+ /// 设置系统时间
+ ///
+ /// 需要设置的时间
+ /// 返回系统时间设置状态,true为成功,false为失败
+ public static bool SetDate(DateTime dt)
+ {
+ SYSTEMTIME st;
+
+ st.year = (short)dt.Year;
+ st.month = (short)dt.Month;
+ st.dayOfWeek = (short)dt.DayOfWeek;
+ st.day = (short)dt.Day;
+ st.hour = (short)dt.Hour;
+ st.minute = (short)dt.Minute;
+ st.second = (short)dt.Second;
+ st.milliseconds = (short)dt.Millisecond;
+ bool rt = SetLocalTime(ref st);
+ return rt;
+ }
+ }
+}
diff --git a/ProxySuper.Core/Helpers/Utils.cs b/ProxySuper.Core/Helpers/Utils.cs
new file mode 100644
index 00000000..76e41b19
--- /dev/null
+++ b/ProxySuper.Core/Helpers/Utils.cs
@@ -0,0 +1,40 @@
+using Newtonsoft.Json;
+using System;
+using System.Linq;
+
+namespace ProxySuper.Core.Services
+{
+ public class Utils
+ {
+ public static string Base64Encode(string plainText)
+ {
+ var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
+ return System.Convert.ToBase64String(plainTextBytes);
+ }
+
+ public static string Base64Decode(string base64EncodedData)
+ {
+ var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
+ return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
+ }
+
+ public static T DeepClone(T obj) where T : class
+ {
+ var serialized = JsonConvert.SerializeObject(obj);
+ return JsonConvert.DeserializeObject(serialized);
+ }
+
+ public static string GetTickID()
+ {
+ return DateTime.Now.Ticks.ToString();
+ }
+
+ private static Random random = new Random();
+ public static string RandomString(int length)
+ {
+ const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ return new string(Enumerable.Repeat(chars, length)
+ .Select(s => s[random.Next(s.Length)]).ToArray());
+ }
+ }
+}
diff --git a/ProxySuper.Core/Helpers/X25519KeyPair.cs b/ProxySuper.Core/Helpers/X25519KeyPair.cs
new file mode 100644
index 00000000..590e2f8b
--- /dev/null
+++ b/ProxySuper.Core/Helpers/X25519KeyPair.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Security.Cryptography;
+using Chaos.NaCl;
+
+namespace ProxySuper.Core.Helpers
+{
+ public class X25519KeyPair
+ {
+ public byte[] _PrivateKey { get; private set; } // 32 bytes
+ public byte[] _PublicKey { get; private set; } // 32 bytes
+
+ public X25519KeyPair()
+ {
+ _PrivateKey = new byte[32];
+ using (var rng = RandomNumberGenerator.Create())
+ {
+ rng.GetBytes(_PrivateKey);
+ }
+ _PublicKey = MontgomeryCurve25519.GetPublicKey(_PrivateKey);
+ }
+
+ public X25519KeyPair(byte[] privateKey)
+ {
+ if (privateKey == null || privateKey.Length != 32)
+ throw new ArgumentException("Private key must be 32 bytes.");
+
+ _PrivateKey = privateKey;
+ _PublicKey = MontgomeryCurve25519.GetPublicKey(_PrivateKey);
+ }
+
+ public static string Base64UrlEncode(byte[] data)
+ {
+ string base64 = Convert.ToBase64String(data); // 标准Base64
+ base64 = base64.TrimEnd('='); // 去掉末尾的 '='
+ base64 = base64.Replace('+', '-'); // '+' 替换成 '-'
+ base64 = base64.Replace('/', '_'); // '/' 替换成 '_'
+ return base64;
+ }
+
+ public string PrivateKey
+ {
+ get { return Base64UrlEncode(_PrivateKey); }
+ }
+
+ public string PublicKey
+ {
+ get { return Base64UrlEncode(_PublicKey); }
+ }
+
+ }
+}
diff --git a/ProxySuper.Core/Helpers/YamlConfigMerger.cs b/ProxySuper.Core/Helpers/YamlConfigMerger.cs
new file mode 100644
index 00000000..34c5a65c
--- /dev/null
+++ b/ProxySuper.Core/Helpers/YamlConfigMerger.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using YamlDotNet.Serialization;
+using YamlDotNet.Serialization.NamingConventions;
+
+namespace ProxySuper.Core.Helpers
+{
+ ///
+ /// 提供静态方法来合并两个 YAML 字符串。
+ /// 它将第二个 YAML 字符串的内容合并到第一个 YAML 字符串中,
+ /// 遵循深度合并字典和追加列表的策略。
+ ///
+ public static class YamlConfigMerger
+ {
+ ///
+ /// 合并两个 YAML 字符串。
+ /// 当键冲突时,第二个 YAML 字符串的值会覆盖第一个字符串的值。
+ /// 对于列表,它会尝试进行追加合并。
+ ///
+ /// 第一个 YAML 字符串(作为基础配置)。
+ /// 第二个 YAML 字符串(其内容将合并到第一个字符串中)。
+ /// 用于 YAML 序列化/反序列化的命名约定。默认为 CamelCaseNamingConvention。
+ /// 合并后的 YAML 字符串。
+ public static string MergeYamlStrings(string yamlString1, string yamlString2, INamingConvention namingConvention = null)
+ {
+ // 默认使用 CamelCaseNamingConvention
+ namingConvention = namingConvention ?? CamelCaseNamingConvention.Instance;
+
+ var deserializer = new DeserializerBuilder()
+ .WithNamingConvention(namingConvention)
+ .Build();
+
+ var serializer = new SerializerBuilder()
+ .WithNamingConvention(namingConvention)
+ .Build();
+
+ // 1. 反序列化两个 YAML 字符串为内部字典表示
+ IDictionary data1 = DeserializeYaml(yamlString1, deserializer);
+ IDictionary data2 = DeserializeYaml(yamlString2, deserializer);
+
+ // 2. 合并两个字典
+ IDictionary mergedData = MergeDictionaries(data1, data2);
+
+ // 3. 序列化合并后的数据回 YAML 字符串
+ return serializer.Serialize(mergedData);
+ }
+
+ ///
+ /// 私有方法:将 YAML 字符串反序列化为 IDictionary。
+ ///
+ /// 要反序列化的 YAML 字符串。
+ /// 用于反序列化的 YamlDotNet Deserializer 实例。
+ /// 表示 YAML 数据的字典。
+ private static IDictionary DeserializeYaml(string yamlString, IDeserializer deserializer)
+ {
+ if (string.IsNullOrWhiteSpace(yamlString))
+ {
+ return new Dictionary();
+ }
+ try
+ {
+ var data = deserializer.Deserialize>(yamlString);
+ return data ?? new Dictionary(); // 如果反序列化结果为 null,则返回空字典
+ }
+ catch (YamlDotNet.Core.YamlException ex)
+ {
+ // 可以在此处添加更详细的日志记录
+ throw new ArgumentException($"Invalid YAML string provided: {ex.Message}", nameof(yamlString), ex);
+ }
+ }
+
+ ///
+ /// 内部递归合并字典的方法。
+ /// sourceDict 将会被 targetDict 中的内容更新或覆盖。
+ /// 对于列表,它会尝试进行追加。
+ ///
+ private static IDictionary MergeDictionaries(IDictionary sourceDict, IDictionary targetDict)
+ {
+ if (sourceDict == null && targetDict == null)
+ {
+ return new Dictionary();
+ }
+ if (sourceDict == null)
+ {
+ return new Dictionary(targetDict);
+ }
+ if (targetDict == null)
+ {
+ return new Dictionary(sourceDict);
+ }
+
+ var result = new Dictionary(sourceDict); // 创建 sourceDict 的一个副本
+
+ foreach (var kvp in targetDict)
+ {
+ var key = kvp.Key;
+ var targetValue = kvp.Value;
+
+ if (result.ContainsKey(key))
+ {
+ var sourceValue = result[key];
+
+ if (sourceValue is IDictionary sourceSubDict &&
+ targetValue is IDictionary targetSubDict)
+ {
+ // 递归合并嵌套的字典
+ result[key] = MergeDictionaries(sourceSubDict, targetSubDict);
+ }
+ else if (sourceValue is IList sourceList &&
+ targetValue is IList targetList)
+ {
+ // 对于列表,简单地追加。
+ // 实际应用中,你可能需要更复杂的列表合并逻辑(例如按 ID 更新、去重等)。
+ var mergedList = new List(sourceList);
+ mergedList.AddRange(targetList);
+ result[key] = mergedList;
+ }
+ else
+ {
+ // 覆盖非字典/非列表的值
+ result[key] = targetValue;
+ }
+ }
+ else
+ {
+ // targetDict 中有而 sourceDict 中没有的键,直接添加
+ result[key] = targetValue;
+ }
+ }
+ return result;
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Caddy.cs b/ProxySuper.Core/Models/Caddy.cs
new file mode 100644
index 00000000..93e3c22c
--- /dev/null
+++ b/ProxySuper.Core/Models/Caddy.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Models
+{
+ public static class Caddy
+ {
+ public static string Service = @"
+[Unit]
+Description=Caddy
+Documentation=https://caddyserver.com/docs/
+After=network.target network-online.target
+Requires=network-online.target
+
+[Service]
+#User=caddy
+#Group=caddy
+User=root
+Group=root
+ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
+ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
+TimeoutStopSec=5s
+#LimitNOFILE=1048576
+#LimitNPROC=512
+PrivateTmp=true
+ProtectSystem=full
+#AmbientCapabilities=CAP_NET_BIND_SERVICE
+
+[Install]
+WantedBy=multi-user.target
+";
+
+ public static string DefaultCaddyFile = @"
+:80 {
+ respond ""Hello world!"";
+}
+";
+ }
+}
diff --git a/ProxySuper.Core/Models/Hosts/Host.cs b/ProxySuper.Core/Models/Hosts/Host.cs
new file mode 100644
index 00000000..f6fb043b
--- /dev/null
+++ b/ProxySuper.Core/Models/Hosts/Host.cs
@@ -0,0 +1,80 @@
+using Microsoft.Win32;
+using MvvmCross.Commands;
+using Newtonsoft.Json;
+using System.ComponentModel;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Models.Hosts
+{
+ public class Host
+ {
+
+ public Host()
+ {
+ Proxy = new LocalProxy();
+ }
+
+
+ public string Tag { get; set; }
+
+ public string Address { get; set; }
+
+ public int Port { get; set; } = 22;
+
+ public string UserName { get; set; }
+
+ public string Password { get; set; }
+
+ public string PrivateKeyPath { get; set; }
+
+ public string PrivateKeyPassPhrase { get; set; }
+
+ public LocalProxy Proxy { get; set; }
+
+ public LoginSecretType SecretType { get; set; }
+
+ //public IMvxCommand UploadPrivateKeyCommand => new MvxCommand(UploadPrivateKey);
+
+ private readonly IMvxCommand _uploadPrivateKeyCommand;
+ public IMvxCommand UploadPrivateKeyCommand => _uploadPrivateKeyCommand ?? new MvxCommand(UploadPrivateKey);
+
+ private void UploadPrivateKey()
+ {
+ var fileDialog = new OpenFileDialog()
+ {
+ Filter = "Private Key (*.pem;*.key)|*.pem;*.key|All File (*.*)|*.*",
+ Title = "Select the private key file"
+ };
+ fileDialog.FileOk += OnFileOk;
+ fileDialog.ShowDialog();
+ }
+
+ private async void OnFileOk(object sender, CancelEventArgs e)
+ {
+ var file = sender as OpenFileDialog;
+ if (file != null)
+ {
+ PrivateKeyPath = file.FileName;
+
+ //Task.Delay(300).ContinueWith((t) =>
+ //{
+ // MessageBox.Show("OK:" + PrivateKeyPath, "Tips");
+ //});
+
+ await Task.Delay(300);
+ MessageBox.Show("OK:" + PrivateKeyPath, "Tips");
+ }
+ else
+ {
+ //Task.Delay(300).ContinueWith((t) =>
+ //{
+ // MessageBox.Show("Error:Unable to get file!", "Tips");
+ //});
+
+ await Task.Delay(300);
+ MessageBox.Show("Error:Unable to get file!", "Tips");
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Hosts/LocalProxy.cs b/ProxySuper.Core/Models/Hosts/LocalProxy.cs
new file mode 100644
index 00000000..c382bbe2
--- /dev/null
+++ b/ProxySuper.Core/Models/Hosts/LocalProxy.cs
@@ -0,0 +1,20 @@
+using Renci.SshNet;
+
+namespace ProxySuper.Core.Models.Hosts
+{
+ public class LocalProxy
+ {
+ public string Address { get; set; } = "127.0.0.1";
+
+ public int Port { get; set; } = 1080;
+
+ public ProxyTypes Type { get; set; }
+
+ public string UserName { get; set; }
+
+ public string Password { get; set; }
+
+ }
+
+
+}
diff --git a/ProxySuper.Core/Models/Hosts/LoginSecretType.cs b/ProxySuper.Core/Models/Hosts/LoginSecretType.cs
new file mode 100644
index 00000000..8ba540a1
--- /dev/null
+++ b/ProxySuper.Core/Models/Hosts/LoginSecretType.cs
@@ -0,0 +1,8 @@
+namespace ProxySuper.Core.Models.Hosts
+{
+ public enum LoginSecretType
+ {
+ Password = 0,
+ PrivateKey = 1
+ }
+}
diff --git a/ProxySuper.Core/Models/ProjectProgress.cs b/ProxySuper.Core/Models/ProjectProgress.cs
new file mode 100644
index 00000000..dad33a35
--- /dev/null
+++ b/ProxySuper.Core/Models/ProjectProgress.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Models
+{
+ public class ProjectProgress
+ {
+ private string _step;
+
+ private string _desc;
+
+ private int _percentage;
+
+ private string _logs;
+
+ public ProjectProgress()
+ {
+ _step = "步骤";
+
+ _desc = "步骤描述";
+
+ _percentage = 0;
+
+ _logs = string.Empty;
+
+ StepUpdate = () => { };
+ }
+
+
+ public Action StepUpdate { get; set; }
+
+ public Action LogsUpdate { get; set; }
+
+ public string Desc
+ {
+ get { return _desc; }
+ set
+ {
+ _desc = value;
+ StepUpdate();
+
+ _logs += _desc + "\n";
+ LogsUpdate();
+ }
+ }
+
+ public string Step
+ {
+ get { return _step; }
+ set
+ {
+ _step = value;
+ StepUpdate();
+
+ _logs += Step + "\n";
+ LogsUpdate();
+ }
+ }
+
+ public int Percentage
+ {
+ get { return _percentage; }
+ set
+ {
+ _percentage = value;
+ StepUpdate();
+ }
+ }
+
+ public string Logs
+ {
+ get { return _logs; }
+ set
+ {
+ _logs = value;
+ LogsUpdate();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProxySuper.Core/Models/Projects/BrookSettings.cs b/ProxySuper.Core/Models/Projects/BrookSettings.cs
new file mode 100644
index 00000000..7bf1adb5
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/BrookSettings.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public class BrookSettings : IProjectSettings
+ {
+ public string Domain { get; set; }
+
+ public string IP { get; set; }
+
+ public string Password { get; set; }
+
+ public BrookType BrookType { get; set; }
+
+ public int Port { get; set; } = 443;
+
+ public List FreePorts
+ {
+ get
+ {
+ if (Port == 443)
+ {
+ return new List { 80, 443 };
+ }
+ return new List { Port };
+ }
+ }
+
+ public string Email => "server@brook.com";
+
+ public ProjectType Type { get; set; } = ProjectType.Brook;
+
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/BrookType.cs b/ProxySuper.Core/Models/Projects/BrookType.cs
new file mode 100644
index 00000000..6f5fc1d7
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/BrookType.cs
@@ -0,0 +1,10 @@
+namespace ProxySuper.Core.Models.Projects
+{
+ public enum BrookType
+ {
+ server,
+ wsserver,
+ wssserver,
+ socks5
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/HysteriaSettings.cs b/ProxySuper.Core/Models/Projects/HysteriaSettings.cs
new file mode 100644
index 00000000..bca8d310
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/HysteriaSettings.cs
@@ -0,0 +1,75 @@
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static QRCoder.PayloadGenerator;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public class HysteriaSettings : IProjectSettings
+ {
+ public HysteriaSettings()
+ {
+ Password = Guid.NewGuid().ToString();
+
+ Email = GetEmailRandom();
+
+ ObfsPassword = Guid.NewGuid().ToString();
+ }
+ public string Domain { get; set; } = "";
+
+ public int Port { get; set; } = 443;
+
+ public string Password { get; set; } = "";
+
+ public bool AutoACME { get; set; } = true;
+
+ public string Email { get; set; } = "";
+
+ public bool EnableObfs { get; set; } = false;
+ public string ObfsPassword { get; set; } = "";
+
+ public int UpMbps { get; set; } = 0;
+
+ public int DownMbps { get; set; } = 0;
+
+ public bool BBRenable { get; set; } = false;
+
+ public string MaskDomain { get; set; } = "";
+
+ public bool EnableUpDisguisedWeb { get; set; } = false;
+
+ public string HysteriaShareLink
+ {
+ get
+ {
+ return ShareLink.BuildHysteria(this);
+ }
+ }
+ public List FreePorts
+ {
+ get
+ {
+ return new List { Port, 80 };
+ }
+ }
+
+ public string GetEmailRandom()
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+ return $"{Guid.NewGuid().ToString().Substring(2, 6)}@gmail.com";
+ }
+
+ public string ClientHysteria2Config { get; set; }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/IProjectSettings.cs b/ProxySuper.Core/Models/Projects/IProjectSettings.cs
new file mode 100644
index 00000000..aa5eb9d3
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/IProjectSettings.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public interface IProjectSettings
+ {
+ ///
+ /// 端口
+ ///
+ int Port { get; set; }
+
+ ///
+ /// 域名
+ ///
+ string Domain { get; set; }
+
+ ///
+ /// 额外需要开放的端口
+ ///
+ List FreePorts { get; }
+
+ ///
+ /// 类型
+ ///
+ //ProjectType Type { get; set; }
+
+ ///
+ /// 邮箱
+ ///
+ string Email { get; }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/MTProtoGoSettings.cs b/ProxySuper.Core/Models/Projects/MTProtoGoSettings.cs
new file mode 100644
index 00000000..26cfabd4
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/MTProtoGoSettings.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public class MTProtoGoSettings : IProjectSettings
+ {
+ public MTProtoGoSettings()
+ {
+ Port = 443;
+
+ Domain = string.Empty;
+
+ Cleartext = "bing.com";
+
+ SecretText = string.Empty;
+ }
+
+ public int Port { get; set; }
+
+ public string Domain { get; set; }
+
+ public List FreePorts => new List { Port };
+
+ public string Email => "";
+
+ public string Cleartext { get; set; }
+
+ public string SecretText { get; set; }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs b/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs
new file mode 100644
index 00000000..f6c457f2
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs
@@ -0,0 +1,53 @@
+using Newtonsoft.Json;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public class NaiveProxySettings : IProjectSettings
+ {
+ public NaiveProxySettings()
+ {
+ Port = 443;
+ }
+
+ public List FreePorts
+ {
+ get
+ {
+ return new List { 80, 443, Port }.Distinct().ToList();
+ }
+ }
+
+ public ProjectType Type { get; set; } = ProjectType.NaiveProxy;
+
+ public int Port { get; set; }
+
+ public string Domain { get; set; }
+
+ public string UserName { get; set; }
+
+ public string Password { get; set; }
+
+ public string MaskDomain { get; set; }
+
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+
+ return $"{UserName + Port.ToString()}@gmail.com";
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/ProjectType.cs b/ProxySuper.Core/Models/Projects/ProjectType.cs
new file mode 100644
index 00000000..93767fac
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/ProjectType.cs
@@ -0,0 +1,13 @@
+namespace ProxySuper.Core.Models.Projects
+{
+ public enum ProjectType
+ {
+ Xray = 0,
+ TrojanGo = 1,
+ NaiveProxy = 2,
+ Brook = 3,
+ V2ray = 4,
+ MTProtoGo = 5,
+ Hysteria2 = 6,
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/RayType.cs b/ProxySuper.Core/Models/Projects/RayType.cs
new file mode 100644
index 00000000..ce2d0989
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/RayType.cs
@@ -0,0 +1,50 @@
+namespace ProxySuper.Core.Models.Projects
+{
+ public enum V2RayType
+ {
+ // 入口
+ //VLESS_RAW_XTLS = 100,
+
+ // VLESS 101开头
+ VLESS_TCP = 101,
+ VLESS_WS = 102,
+ VLESS_H2 = 103,
+ VLESS_KCP = 104,
+ VLESS_QUIC = 105,
+ //VLESS_RAW = 106,
+ VLESS_gRPC = 110,
+
+ // VMESS 201开头
+ VMESS_TCP = 201,
+ VMESS_WS = 202,
+ VMESS_H2 = 203,
+ VMESS_KCP = 204,
+ VMESS_QUIC = 205,
+
+ // Trojan 301开头
+ Trojan_TCP = 301,
+ Trojan_WS = 302,
+
+ // SS
+ ShadowsocksAEAD = 401
+ }
+
+ public enum XrayType
+ {
+ // VLESS 协议
+ VLESS_RAW_XTLS = 100,
+ VLESS_XTLS_RAW_REALITY = 101,
+ VLESS_WS = 102,
+ VLESS_XHTTP = 103,
+ VLESS_gRPC = 104,
+
+ // VMESS 201开头
+ VMESS_KCP = 204,
+
+ // Trojan 301开头
+ Trojan_TCP = 301,
+
+ // SS
+ ShadowsocksAEAD = 401
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs b/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
new file mode 100644
index 00000000..4462cf8d
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
@@ -0,0 +1,91 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public class TrojanGoSettings : IProjectSettings
+ {
+ public TrojanGoSettings()
+ {
+ WithTLS = true;
+ Port = 443;
+ WebSocketPath = "/ws";
+ Password = Guid.NewGuid().ToString();
+ }
+
+ public List FreePorts
+ {
+ get
+ {
+ return new List { 80, 443, Port }.Distinct().ToList();
+ }
+ }
+
+ public ProjectType Type { get; set; } = ProjectType.TrojanGo;
+
+ ///
+ /// 是否安装TLS证书
+ ///
+ public bool WithTLS { get; set; }
+
+ ///
+ /// 域名
+ ///
+ public string Domain { get; set; }
+
+ ///
+ /// 端口
+ ///
+ public int Port { get; set; }
+
+ ///
+ /// 密码
+ ///
+ public string Password { get; set; }
+
+ ///
+ /// 伪装域名
+ ///
+ public string MaskDomain { get; set; }
+
+ ///
+ /// 是否开启WebSocket
+ ///
+ [JsonIgnore]
+ public bool EnableWebSocket
+ {
+ get
+ {
+ return !string.IsNullOrEmpty(WebSocketPath);
+ }
+ }
+
+ ///
+ /// websocket路径
+ ///
+ public string WebSocketPath { get; set; }
+
+
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+ var prefix = Password.Length > 7 ? Password.Substring(0, 7) : Password;
+ return $"{prefix}@gmail.com";
+ }
+ }
+
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/V2raySettings.cs b/ProxySuper.Core/Models/Projects/V2raySettings.cs
new file mode 100644
index 00000000..87b46531
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/V2raySettings.cs
@@ -0,0 +1,187 @@
+using Newtonsoft.Json;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class V2raySettings : IProjectSettings
+ {
+ public static List DisguiseTypes = new List {
+ "none",
+ "srtp",
+ "utp",
+ "wechat-video",
+ "dtls",
+ "wireguard",
+ };
+
+ public V2raySettings()
+ {
+ WithTLS = true;
+
+ var guid = Guid.NewGuid().ToString();
+ Port = 443;
+ VLESS_KCP_Port = 2001;
+ VLESS_QUIC_Port = 2002;
+ VLESS_gRPC_Port = 2003;
+
+ VMESS_KCP_Port = 3001;
+ VMESS_QUIC_Port = 3002;
+ ShadowSocksPort = 4001;
+
+ UUID = guid;
+ Types = new List();
+
+ VLESS_WS_Path = "/" + Utils.RandomString(6);
+ VLESS_KCP_Type = "none";
+ VLESS_KCP_Seed = guid;
+ VLESS_QUIC_Key = "";
+ VLESS_QUIC_Type = "none";
+ VLESS_QUIC_Security = "none";
+ VLESS_QUIC_Type = "none";
+ VLESS_gRPC_ServiceName = Utils.RandomString(7);
+
+ VMESS_WS_Path = "/" + Utils.RandomString(8);
+ VMESS_TCP_Path = "/" + Utils.RandomString(9);
+ VMESS_KCP_Seed = guid;
+ VMESS_QUIC_Key = "";
+ VMESS_KCP_Type = "none";
+ VMESS_QUIC_Security = "none";
+ VMESS_QUIC_Type = "none";
+
+ TrojanPassword = guid;
+
+ ShadowSocksPassword = guid;
+ ShadowSocksMethod = "aes-128-gcm";
+ }
+
+ [JsonIgnore]
+ public bool IsIPAddress
+ {
+ get
+ {
+ return IPAddress.TryParse(Domain, out _);
+ }
+ }
+
+ [JsonIgnore]
+ public List FreePorts
+ {
+ get
+ {
+ var list = new List();
+ list.Add(80);
+ list.Add(Port);
+
+ if (Types.Contains(V2RayType.VLESS_KCP))
+ {
+ list.Add(VLESS_KCP_Port);
+ }
+
+ if (Types.Contains(V2RayType.VLESS_QUIC))
+ {
+ list.Add(VLESS_QUIC_Port);
+ }
+
+ if (Types.Contains(V2RayType.VMESS_KCP))
+ {
+ list.Add(VMESS_KCP_Port);
+ }
+
+ if (Types.Contains(V2RayType.VMESS_QUIC))
+ {
+ list.Add(VMESS_QUIC_Port);
+ }
+
+ if (Types.Contains(V2RayType.ShadowsocksAEAD))
+ {
+ list.Add(ShadowSocksPort);
+ }
+
+ if (Types.Contains(V2RayType.VLESS_gRPC))
+ {
+ list.Add(VLESS_gRPC_Port);
+ }
+
+ return list.Distinct().ToList();
+ }
+ }
+
+ ///
+ /// 是否安装证书,
+ /// 上传自有证书时选False,则不会自动安装证书。
+ ///
+ public bool WithTLS { get; set; }
+
+ ///
+ /// 端口
+ ///
+ public int Port { get; set; }
+
+ ///
+ /// 域名
+ ///
+ public string Domain { get; set; }
+
+ ///
+ /// UUID
+ ///
+ public string UUID { get; set; }
+
+ ///
+ /// 多用户
+ ///
+ public List MulitUUID { get; set; } = new List();
+
+ ///
+ /// 伪装域名
+ ///
+ public string MaskDomain { get; set; }
+
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+ return $"{UUID.Substring(2, 6)}@gmail.com";
+ }
+ }
+
+ ///
+ /// 安装类型
+ ///
+ public List Types { get; set; } = new List();
+
+ ///
+ /// 根据xray类型获取路径
+ ///
+ ///
+ ///
+ public string GetPath(V2RayType type)
+ {
+ switch (type)
+ {
+ case V2RayType.VLESS_WS:
+ return VLESS_WS_Path;
+ case V2RayType.VMESS_TCP:
+ return VMESS_TCP_Path;
+ case V2RayType.VMESS_WS:
+ return VMESS_WS_Path;
+ default:
+ return string.Empty;
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs b/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs
new file mode 100644
index 00000000..9fa4afd0
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs
@@ -0,0 +1,33 @@
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class V2raySettings
+ {
+ ///
+ /// ss password
+ ///
+ public string ShadowSocksPassword { get; set; }
+
+ ///
+ /// ss method
+ ///
+ public string ShadowSocksMethod { get; set; }
+
+ ///
+ /// ss port
+ ///
+ public int ShadowSocksPort { get; set; }
+
+ ///
+ /// share link
+ ///
+ public string ShadowSocksShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.ShadowsocksAEAD, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_Trojan.cs b/ProxySuper.Core/Models/Projects/V2raySettings_Trojan.cs
new file mode 100644
index 00000000..bc5ac882
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/V2raySettings_Trojan.cs
@@ -0,0 +1,17 @@
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class V2raySettings
+ {
+ public string TrojanPassword { get; set; }
+
+ public string Trojan_TCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.Trojan_TCP, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs b/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs
new file mode 100644
index 00000000..14b7372b
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs
@@ -0,0 +1,115 @@
+using ProxySuper.Core.Services;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Documents;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class V2raySettings
+ {
+ ///
+ /// vless tcp shareLink
+ ///
+ public string VLESS_TCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VLESS_TCP, this);
+ }
+ }
+
+ ///
+ /// websocket path
+ ///
+ public string VLESS_WS_Path { get; set; }
+
+ ///
+ /// VLESS WS ShareLink
+ ///
+ public string VLESS_WS_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VLESS_WS, this);
+ }
+ }
+
+ ///
+ /// kcp seed
+ ///
+ public string VLESS_KCP_Seed { get; set; }
+
+ ///
+ /// kcp type
+ ///
+ public string VLESS_KCP_Type { get; set; }
+
+ ///
+ /// kcp port
+ ///
+ public int VLESS_KCP_Port { get; set; }
+
+ ///
+ /// VLESS KCP ShareLink
+ ///
+ public string VLESS_KCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VLESS_KCP, this);
+ }
+ }
+
+ ///
+ /// vless quic security
+ ///
+ public string VLESS_QUIC_Security { get; set; }
+
+ ///
+ /// vless quic type
+ ///
+ public string VLESS_QUIC_Type { get; set; }
+
+ ///
+ /// vless quic port
+ ///
+ public int VLESS_QUIC_Port { get; set; }
+
+ ///
+ /// vless quic key
+ ///
+ public string VLESS_QUIC_Key { get; set; }
+
+ ///
+ /// vless quic ShareLink
+ ///
+ public string VLESS_QUIC_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VLESS_QUIC, this);
+ }
+ }
+
+ ///
+ /// grpc port
+ ///
+ public int VLESS_gRPC_Port { get; set; }
+
+ ///
+ /// grpc service name
+ ///
+ public string VLESS_gRPC_ServiceName { get; set; }
+
+ ///
+ /// vless grpc share link
+ ///
+ public string VLESS_gRPC_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VLESS_gRPC, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs b/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs
new file mode 100644
index 00000000..5bc359bc
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs
@@ -0,0 +1,96 @@
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class V2raySettings
+ {
+ ///
+ /// vmess websocket path
+ ///
+ public string VMESS_WS_Path { get; set; }
+
+ ///
+ /// vmess ws sharelink
+ ///
+ public string VMESS_WS_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VMESS_WS, this);
+ }
+ }
+
+ ///
+ /// mvess tcp path
+ ///
+ public string VMESS_TCP_Path { get; set; }
+
+ ///
+ /// vmess tcp ShareLink
+ ///
+ public string VMESS_TCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VMESS_TCP, this);
+ }
+ }
+
+ ///
+ /// vmess kcp seed
+ ///
+ public string VMESS_KCP_Seed { get; set; }
+
+ ///
+ /// vmess kcp type
+ ///
+ public string VMESS_KCP_Type { get; set; }
+
+ ///
+ /// vmess kcp port
+ ///
+ public int VMESS_KCP_Port { get; set; }
+
+ ///
+ /// vmess kcp ShareLink
+ ///
+ public string VMESS_KCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VMESS_KCP, this);
+ }
+ }
+
+ ///
+ /// vmess quic security
+ ///
+ public string VMESS_QUIC_Security { get; set; }
+
+ ///
+ /// vmess quic type
+ ///
+ public string VMESS_QUIC_Type { get; set; }
+
+ ///
+ /// vmess quic port
+ ///
+ public int VMESS_QUIC_Port { get; set; }
+
+ ///
+ /// vmess quic key
+ ///
+ public string VMESS_QUIC_Key { get; set; }
+
+ ///
+ /// vmess quic ShareLink
+ ///
+ public string VMESS_QUIC_ShareLink
+ {
+ get
+ {
+ return ShareLink.Build(V2RayType.VMESS_QUIC, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/XraySettings.cs b/ProxySuper.Core/Models/Projects/XraySettings.cs
new file mode 100644
index 00000000..d039a25f
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/XraySettings.cs
@@ -0,0 +1,179 @@
+using Newtonsoft.Json;
+using ProxySuper.Core.Services;
+using ProxySuper.Core.Helpers;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class XraySettings : IProjectSettings
+ {
+
+ public XraySettings()
+ {
+ WithTLS = true;
+
+ var guid = Guid.NewGuid().ToString();
+ Port = 443;
+ VLESS_gRPC_Port = 8443;
+ VMESS_KCP_Port = 3001;
+ ShadowSocksPort = 4001;
+
+ UUID = guid;
+ Types = new List();
+
+ VLESS_XHTTP_Path = "/" + Utils.RandomString(6);
+ VLESS_WS_Path = "/" + Utils.RandomString(6);
+ VLESS_gRPC_ServiceName = Utils.RandomString(7);
+
+ VMESS_KCP_Seed = guid;
+ VMESS_KCP_Type = "none";
+
+ TrojanPassword = guid;
+
+ ShadowSocksPassword = guid;
+ ShadowSocksMethod = "aes-128-gcm";
+
+ var x25519Key = new X25519KeyPair();
+ REALITY_privateKey = x25519Key.PrivateKey;
+ REALITY_publicKey = x25519Key.PublicKey;
+ }
+
+ ///
+ /// Xray 使用浏览器的 TLS Client Hello 指纹可选列表
+ ///
+ [JsonIgnore]
+ public static List UTLSList = new List { "", "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized" };
+
+ ///
+ /// Xray 使用浏览器的 TLS Client Hello 指纹参数
+ ///
+ public string UTLS { get; set; } = UTLSList[1];
+
+ [JsonIgnore]
+ public bool IsIPAddress
+ {
+ get
+ {
+ return IPAddress.TryParse(Domain, out _);
+ }
+ }
+
+ [JsonIgnore]
+ public List FreePorts
+ {
+ get
+ {
+ var list = new List();
+ list.Add(80);
+ list.Add(Port);
+
+
+ if (Types.Contains(XrayType.VMESS_KCP))
+ {
+ list.Add(VMESS_KCP_Port);
+ }
+
+
+ if (Types.Contains(XrayType.ShadowsocksAEAD))
+ {
+ list.Add(ShadowSocksPort);
+ }
+
+ if (Types.Contains(XrayType.VLESS_gRPC))
+ {
+ list.Add(VLESS_gRPC_Port);
+ }
+
+ return list.Distinct().ToList();
+ }
+ }
+
+ ///
+ /// 使用REALITY模式时,客户端爬虫初始路径与参数
+ ///
+ public string REALITY_spiderX { get; set; } = "/";
+
+ ///
+ /// 使用REALITY模式时,私钥
+ ///
+ public string REALITY_privateKey { get; set; } = string.Empty;
+
+ ///
+ /// 使用REALITY模式时,公钥
+ ///
+ public string REALITY_publicKey { get; set; } = string.Empty;
+
+ ///
+ /// 是否安装证书,
+ /// 上传自有证书时选False,则不会自动安装证书。
+ ///
+ public bool WithTLS { get; set; }
+
+ ///
+ /// 端口
+ ///
+ public int Port { get; set; }
+
+ ///
+ /// 域名
+ ///
+ public string Domain { get; set; }
+
+ ///
+ /// UUID
+ ///
+ public string UUID { get; set; }
+
+ ///
+ /// 多用户
+ ///
+ public List MulitUUID { get; set; } = new List();
+
+ ///
+ /// 伪装域名
+ ///
+ public string MaskDomain { get; set; }
+
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+ return $"{UUID.Substring(2, 6)}@gmail.com";
+ }
+ }
+
+ ///
+ /// 安装类型
+ ///
+ public List Types { get; set; } = new List();
+
+ ///
+ /// 根据xray类型获取路径
+ ///
+ ///
+ ///
+ public string GetPath(XrayType type)
+ {
+ switch (type)
+ {
+ case XrayType.VLESS_WS:
+ return VLESS_WS_Path;
+ default:
+ return string.Empty;
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/XraySettings_SS.cs b/ProxySuper.Core/Models/Projects/XraySettings_SS.cs
new file mode 100644
index 00000000..b392f541
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/XraySettings_SS.cs
@@ -0,0 +1,33 @@
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class XraySettings
+ {
+ ///
+ /// ss password
+ ///
+ public string ShadowSocksPassword { get; set; }
+
+ ///
+ /// ss method
+ ///
+ public string ShadowSocksMethod { get; set; }
+
+ ///
+ /// ss port
+ ///
+ public int ShadowSocksPort { get; set; }
+
+ ///
+ /// share link
+ ///
+ public string ShadowSocksShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.ShadowsocksAEAD, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/XraySettings_Trojan.cs b/ProxySuper.Core/Models/Projects/XraySettings_Trojan.cs
new file mode 100644
index 00000000..62e8ead1
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/XraySettings_Trojan.cs
@@ -0,0 +1,17 @@
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class XraySettings
+ {
+ public string TrojanPassword { get; set; }
+
+ public string Trojan_TCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.Trojan_TCP, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/XraySettings_VLESS.cs b/ProxySuper.Core/Models/Projects/XraySettings_VLESS.cs
new file mode 100644
index 00000000..aa7d8551
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/XraySettings_VLESS.cs
@@ -0,0 +1,103 @@
+using ProxySuper.Core.Services;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Documents;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class XraySettings
+ {
+
+ ///
+ /// vless xtls 流控参数可选列表
+ ///
+
+ //流控参数在服务端只有两种 ""/null, "xtls-rprx-vision",客户端可以选择三种:""/null, "xtls-rprx-vision", "xtls-rprx-vision-udp443".
+ //但是选择了XTLS模式就是默认服务端flow不是""/null,所以这里不再填加""/null这一项。
+ //如果服务端开启了流控,客户端也必须开启流控,否则会报错。
+ //同样如果服务端没有开启流控,客户端也不能开启流控,否则会报错。
+ public static List FlowList = new List { "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
+
+ ///
+ /// vless xtls 流控参数
+ ///
+ public string Flow { get; set; } = FlowList[0];
+
+ ///
+ /// vless xtls reality shareLink
+ ///
+ public string VLESS_RAW_XTLS_REALITY_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.VLESS_XTLS_RAW_REALITY, this);
+ }
+ }
+
+
+ ///
+ /// vless xtls shareLink
+ ///
+ public string VLESS_RAW_XTLS_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.VLESS_RAW_XTLS, this);
+ }
+ }
+
+
+ ///
+ /// vless xhttp path
+ ///
+ public string VLESS_XHTTP_Path { get; set; }
+
+ ///
+ /// VLESS XHTTP ShareLink
+ ///
+ public string VLESS_XHTTP_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.VLESS_XHTTP, this);
+ }
+ }
+
+ ///
+ /// websocket path
+ ///
+ public string VLESS_WS_Path { get; set; }
+
+ ///
+ /// VLESS WS ShareLink
+ ///
+ public string VLESS_WS_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.VLESS_WS, this);
+ }
+ }
+
+ ///
+ /// grpc port
+ ///
+ public int VLESS_gRPC_Port { get; set; }
+
+ ///
+ /// grpc service name
+ ///
+ public string VLESS_gRPC_ServiceName { get; set; }
+
+ ///
+ /// vless grpc share link
+ ///
+ public string VLESS_gRPC_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.VLESS_gRPC, this);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Models/Projects/XraySettings_VMESS.cs b/ProxySuper.Core/Models/Projects/XraySettings_VMESS.cs
new file mode 100644
index 00000000..0e6bd472
--- /dev/null
+++ b/ProxySuper.Core/Models/Projects/XraySettings_VMESS.cs
@@ -0,0 +1,48 @@
+using ProxySuper.Core.Services;
+using System.Collections.Generic;
+
+namespace ProxySuper.Core.Models.Projects
+{
+ public partial class XraySettings
+ {
+ ///
+ /// vmess kcp 数据包头部伪装类型
+ ///
+ public static List DisguiseTypes = new List {
+ "none",
+ "srtp",
+ "utp",
+ "wechat-video",
+ "dtls",
+ "wireguard",
+ "dns",
+ };
+
+ ///
+ /// vmess kcp seed 混淆密码
+ ///
+ public string VMESS_KCP_Seed { get; set; }
+
+ ///
+ /// vmess kcp type
+ ///
+ public string VMESS_KCP_Type { get; set; }
+
+ ///
+ /// vmess kcp port
+ ///
+ public int VMESS_KCP_Port { get; set; }
+
+ ///
+ /// vmess kcp ShareLink
+ ///
+ public string VMESS_KCP_ShareLink
+ {
+ get
+ {
+ return ShareLink.XrayBuild(XrayType.VMESS_KCP, this);
+ }
+ }
+
+ }
+}
diff --git a/ProxySuper.Core/Models/Record.cs b/ProxySuper.Core/Models/Record.cs
new file mode 100644
index 00000000..aa80c6cb
--- /dev/null
+++ b/ProxySuper.Core/Models/Record.cs
@@ -0,0 +1,134 @@
+using MvvmCross.ViewModels;
+using Newtonsoft.Json;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Text;
+
+namespace ProxySuper.Core.Models
+{
+ [JsonObject]
+ public class Record : MvxViewModel
+ {
+ public Record()
+ {
+ _isChecked = false;
+ }
+
+ private Host _host;
+ private bool _isChecked;
+
+ [JsonProperty("id")]
+ public string Id { get; set; }
+
+ [JsonProperty("host")]
+ public Host Host
+ {
+ get { return _host; }
+ set
+ {
+ _host = value;
+ RaisePropertyChanged("Host");
+ }
+ }
+
+ [JsonProperty("v2raySettings")]
+ public V2raySettings V2raySettings { get; set; }
+
+ [JsonProperty("xraySettings")]
+ public XraySettings XraySettings { get; set; }
+
+ [JsonProperty("trojanGoSettings")]
+ public TrojanGoSettings TrojanGoSettings { get; set; }
+
+ [JsonProperty("naiveProxySettings")]
+ public NaiveProxySettings NaiveProxySettings { get; set; }
+
+ [JsonProperty("brook")]
+ public BrookSettings BrookSettings { get; set; }
+
+ [JsonProperty("mtProtoGoSettings")]
+ public MTProtoGoSettings MTProtoGoSettings { get; set; }
+
+ [JsonProperty]
+ public HysteriaSettings HysteriaSettings { get; set; }
+
+
+ [JsonIgnore]
+ public ProjectType Type
+ {
+ get
+ {
+ if (XraySettings != null) return ProjectType.Xray;
+
+ if (V2raySettings != null) return ProjectType.V2ray;
+
+ if (TrojanGoSettings != null) return ProjectType.TrojanGo;
+
+ if (NaiveProxySettings != null) return ProjectType.NaiveProxy;
+
+ if (MTProtoGoSettings != null) return ProjectType.MTProtoGo;
+
+ if (HysteriaSettings != null) return ProjectType.Hysteria2;
+
+ return ProjectType.Brook;
+ }
+ }
+
+ [JsonIgnore]
+ public bool IsChecked
+ {
+ get
+ {
+ return _isChecked;
+ }
+ set
+ {
+ _isChecked = value;
+ RaisePropertyChanged("IsChecked");
+ }
+ }
+
+ [JsonIgnore]
+ public Action OnSave { get; set; } = () => { };
+
+ public string GetShareLink()
+ {
+ if (Type == ProjectType.V2ray)
+ {
+ StringBuilder strBuilder = new StringBuilder();
+ V2raySettings.Types.ForEach(type =>
+ {
+ var link = ShareLink.Build(type, V2raySettings);
+ strBuilder.AppendLine(link);
+ });
+ return strBuilder.ToString();
+ }
+
+ if (Type == ProjectType.Xray)
+ {
+ StringBuilder strBuilder = new StringBuilder();
+ XraySettings.Types.ForEach(type =>
+ {
+ var link = ShareLink.XrayBuild(type, XraySettings);
+ strBuilder.AppendLine(link);
+ });
+ return strBuilder.ToString();
+ }
+
+ if (Type == ProjectType.TrojanGo)
+ {
+ return ShareLink.BuildTrojanGo(TrojanGoSettings);
+ }
+
+ if (Type == ProjectType.NaiveProxy)
+ {
+ return ShareLink.BuildNaiveProxy(NaiveProxySettings);
+ }
+
+ return string.Empty;
+ }
+
+ }
+}
diff --git a/ProxySuper.Core/Properties/AssemblyInfo.cs b/ProxySuper.Core/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..b26cc8e3
--- /dev/null
+++ b/ProxySuper.Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("ProxySuper.Core")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ProxySuper.Core")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("15779ee6-d8ca-44bf-bfe2-941e155eef3f")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ProxySuper.Core/ProxySU.ico b/ProxySuper.Core/ProxySU.ico
new file mode 100644
index 00000000..955b1e26
Binary files /dev/null and b/ProxySuper.Core/ProxySU.ico differ
diff --git a/ProxySuper.Core/ProxySuper.Core.csproj b/ProxySuper.Core/ProxySuper.Core.csproj
new file mode 100644
index 00000000..51a3453d
--- /dev/null
+++ b/ProxySuper.Core/ProxySuper.Core.csproj
@@ -0,0 +1,178 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {15779EE6-D8CA-44BF-BFE2-941E155EEF3F}
+ Library
+ Properties
+ ProxySuper.Core
+ ProxySuper.Core
+ v4.7.2
+ latest
+ 512
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ ProxySU.ico
+
+
+
+ ..\packages\Chaos.NaCl.Standard.1.0.0\lib\netstandard2.0\Chaos.NaCl.dll
+
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
+
+
+ ..\packages\MvvmCross.8.0.2\lib\net461\MvvmCross.dll
+
+
+ False
+ ..\json.net\net40\Newtonsoft.Json.dll
+
+
+
+
+ ..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll
+
+
+ ..\packages\SSH.NET.2023.0.0\lib\net462\Renci.SshNet.dll
+
+
+
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+ ..\packages\System.Console.4.3.1\lib\net46\System.Console.dll
+
+
+
+ ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+
+
+
+
+
+
+
+
+ ..\packages\YamlDotNet.16.3.0\lib\net47\YamlDotNet.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.Core/Services/BrookService.cs b/ProxySuper.Core/Services/BrookService.cs
new file mode 100644
index 00000000..d5904ff6
--- /dev/null
+++ b/ProxySuper.Core/Services/BrookService.cs
@@ -0,0 +1,171 @@
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Services
+{
+ public class BrookService : ServiceBase
+ {
+ private string brookServiceTemp = @"
+ [Unit]
+ Description=brook service
+ After=network.target syslog.target
+ Wants=network.target
+
+ [Service]
+ Type=simple
+ ExecStart=##run_cmd##
+
+ [Install]
+ WantedBy=multi-user.target";
+
+
+ public BrookService(Host host, BrookSettings settings) : base(host, settings)
+ {
+ }
+
+ public void Install()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "安装Brook";
+ Progress.Percentage = 0;
+
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "安装必要的系统工具";
+ InstallSystemTools();
+ Progress.Percentage = 40;
+
+ Progress.Desc = "配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 50;
+
+
+ Progress.Step = "检测网络环境";
+ EnsureNetwork();
+ Progress.Percentage = 60;
+ if (Settings.BrookType == BrookType.wssserver)
+ {
+ Progress.Desc = "检测域名是否绑定本机IP";
+ ValidateDomain();
+ Progress.Percentage = 80;
+ }
+
+ Progress.Step = "安装Brook服务";
+ InstallBrook();
+
+ Progress.Percentage = 100;
+ Progress.Step = "安装Brook成功";
+ Progress.Desc = "安装Brook成功";
+
+ AppendCommand("分享连接:");
+ AppendCommand(ShareLink.BuildBrook(Settings));
+
+ NavigationService.Navigate(Settings);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void InstallBrook()
+ {
+ Progress.Desc = "执行Brook安装文件";
+ string url = "https://github.com/txthinking/brook/releases/latest/download/brook_linux_amd64";
+ if (ArchType == ArchType.arm)
+ {
+ url = url.Replace("brook_linux_amd64", "brook_linux_arm7");
+ }
+
+ RunCmd($"curl -L {url} -o /usr/bin/brook");
+ RunCmd("chmod +x /usr/bin/brook");
+
+ Progress.Desc = "设置Brook服务";
+ var brookService = brookServiceTemp.Replace("##run_cmd##", GetRunBrookCommand());
+
+ RunCmd("rm -rf /etc/systemd/system/brook.service");
+ RunCmd("touch /etc/systemd/system/brook.service");
+ RunCmd($"echo \"{brookService}\" > /etc/systemd/system/brook.service");
+ RunCmd("sudo chmod 777 /etc/systemd/system/brook.service");
+
+ Progress.Desc = "启动Brook服务";
+ RunCmd("systemctl enable brook");
+ RunCmd("systemctl restart brook");
+ }
+
+ private string GetRunBrookCommand()
+ {
+ var runBrookCmd = string.Empty;
+
+ if (Settings.BrookType == BrookType.server)
+ {
+ return $"/usr/bin/brook server --listen :{Settings.Port} --password {Settings.Password}";
+ }
+
+ if (Settings.BrookType == BrookType.wsserver)
+ {
+ return $"/usr/bin/brook wsserver --listen :{Settings.Port} --password {Settings.Password}";
+ }
+
+ if (Settings.BrookType == BrookType.wssserver)
+ {
+ return $"/usr/bin/brook wssserver --domain {Settings.Domain} --password {Settings.Password}";
+ }
+
+ if (Settings.BrookType == BrookType.socks5)
+ {
+ var ip = IsOnlyIPv6 ? IPv6 : IPv4;
+ return $"/usr/bin/brook socks5 --socks5 {ip}:{Settings.Port}";
+ }
+
+ return runBrookCmd;
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "卸载Brook";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "停止Brook服务";
+ RunCmd("systemctl stop brook");
+ RunCmd("systemctl disable brook");
+ Progress.Percentage = 30;
+
+ Progress.Desc = "删除Brook相关文件";
+ RunCmd("rm -rf /etc/systemd/system/brook.service");
+ RunCmd("rm -rf /usr/bin/brook");
+ Progress.Percentage = 80;
+
+ Progress.Desc = "重置防火墙设置";
+ ResetFirewalld();
+
+ Progress.Percentage = 100;
+ Progress.Desc = "卸载完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+ }
+}
diff --git a/ProxySuper.Core/Services/HysteriaService.cs b/ProxySuper.Core/Services/HysteriaService.cs
new file mode 100644
index 00000000..02f50850
--- /dev/null
+++ b/ProxySuper.Core/Services/HysteriaService.cs
@@ -0,0 +1,398 @@
+using Microsoft.Win32;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using ProxySuper.Core.Converters;
+using ProxySuper.Core.Helpers;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Templates;
+using Renci.SshNet.Messages;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Dynamic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web;
+using System.Windows;
+using YamlDotNet.Core;
+using YamlDotNet.Serialization;
+using YamlDotNet.Serialization.NamingConventions;
+
+namespace ProxySuper.Core.Services
+{
+ public class HysteriaService : ServiceBase
+ {
+ public HysteriaService(Host host, HysteriaSettings settings) : base(host, settings)
+ {
+ }
+
+
+ public void Install()
+ {
+ try
+ {
+ Task.Factory.StartNew(() =>
+ {
+ Progress.Step = "安装Hysteria";
+ Progress.Percentage = 0;
+
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "安装必要的系统工具";
+ InstallSystemTools();
+ Progress.Percentage = 40;
+
+ Progress.Desc = "配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 50;
+
+ Progress.Step = "检测网络环境";
+ EnsureNetwork();
+ Progress.Percentage = 60;
+
+
+ Progress.Desc = "检测域名是否绑定本机IP";
+ ValidateDomain();
+ Progress.Percentage = 80;
+
+ Progress.Step = "上传Hysteria配置文件";
+ string yamlConfig = BuildYamlConfig();
+ UploadConfigFile(yamlConfig);
+ Progress.Step = "安装Hysteria服务";
+ InstallHysteria();
+
+ Progress.Percentage = 100;
+ Progress.Step = "安装Hysteria成功";
+ Progress.Desc = "安装Hysteria成功";
+
+ if (Settings.AutoACME == false)
+ {
+ Progress.Step = "请手动上传SSL证书";
+ Progress.Desc = "请手动上传SSL证书";
+ }
+
+ if (Settings.EnableUpDisguisedWeb == true)
+ {
+ Progress.Step = "请手动上传伪装网站内容";
+ Progress.Desc = "请手动上传伪装网站内容";
+ }
+ });
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "卸载Hysteria";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "停止Hysteria服务";
+ RunCmd("systemctl stop hysteria-server.service");
+ RunCmd("systemctl disable hysteria-server.service");
+ Progress.Percentage = 30;
+
+ Progress.Desc = "删除Hysteria相关文件";
+ RunCmd("bash <(curl -fsSL https://get.hy2.sh/) --remove");
+ //RunCmd("rm -rf /etc/systemd/system/Hysteria.service");
+ //RunCmd("rm -rf /usr/bin/Hysteria");
+ Progress.Percentage = 80;
+
+ Progress.Desc = "重置防火墙设置";
+ ResetFirewalld();
+
+ Progress.Percentage = 100;
+ Progress.Desc = "卸载完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ /*
+ private string HysteriaServiceTemp = @"
+ [Unit]
+ Description=hysteria service
+ After=network.target syslog.target
+ Wants=network.target
+
+ [Service]
+ Type=simple
+ ExecStart=##run_cmd##
+
+ [Install]
+ WantedBy=multi-user.target";
+ */
+ private void InstallHysteria()
+ {
+ Progress.Desc = "执行Hysteria安装文件,及设置Hysteria服务";
+ RunCmd($"bash <(curl -fsSL https://get.hy2.sh/)");
+
+ /*
+ string url = "https://github.com/apernet/hysteria/releases/download/v1.3.4/hysteria-linux-386";
+ string targetPath = "/usr/bin/hysteria/hysteria-linux-386";
+
+ if (ArchType == ArchType.arm)
+ {
+ url = url.Replace("hysteria-linux-386", "hysteria-linux-arm");
+ targetPath = targetPath.Replace("hysteria-linux-386", "hysteria-linux-arm");
+ }
+
+ RunCmd($"curl -L {url} -o {targetPath}");
+ RunCmd($"chmod +x {targetPath}");
+
+ Progress.Desc = "设置Hysteria服务";
+ var cmd = targetPath + " -c /usr/bin/hysteria/config.json server";
+ var hysteriaService = HysteriaServiceTemp.Replace("##run_cmd##", cmd);
+
+ RunCmd("rm -rf /etc/systemd/system/hysteria.service");
+ RunCmd("touch /etc/systemd/system/hysteria.service");
+
+ RunCmd($"echo \"{hysteriaService}\" > /etc/systemd/system/hysteria.service");
+ RunCmd("sudo chmod 777 /etc/systemd/system/hysteria.service");
+
+ */
+
+
+ Progress.Desc = "启动Hysteria服务";
+ RunCmd("systemctl enable hysteria-server.service");
+ RunCmd("systemctl restart hysteria-server.service");
+ }
+
+ private static string ConfigFile_base = HysteriaConfigTemplates.ServerHysteria2Config_base;
+ private static string ConfigFile_acme = HysteriaConfigTemplates.ServerHysteria2Config_acme;
+ private static string ConfigFile_tls = HysteriaConfigTemplates.ServerHysteria2Config_tls;
+ private static string ConfigFile_masquerade_proxy = HysteriaConfigTemplates.ServerHysteria2Config_masquerade_proxy;
+ private static string ConfigFile_masquerade_file = HysteriaConfigTemplates.ServerHysteria2Config_masquerade_file;
+ private static string ConfigFile_bbr = HysteriaConfigTemplates.ServerHysteria2Config_bbr;
+ private static string ConfigFile_obfs = HysteriaConfigTemplates.ServerAndClientHysteria2Config_obfs;
+ private static string ConfigFile_bandwidth = HysteriaConfigTemplates.ServerAndClientHysteria2Config_bandwidth;
+
+ private static string ClientConfigFile_base = HysteriaConfigTemplates.ClientHysteria2Config_base;
+
+
+ public void UploadCert()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadCert;
+ fileDialog.ShowDialog();
+ }
+
+ public void UploadWeb()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadWeb;
+ fileDialog.ShowDialog();
+ }
+
+
+ #region 私有方法
+
+ private string BuildYamlConfig()
+ {
+ dynamic yamlConfigBase = LoadYamlConfigToJsonObject(ConfigFile_base);
+ yamlConfigBase.listen = ":" + Settings.Port;
+ yamlConfigBase.auth.password = Settings.Password;
+ string yamlConfig = JsonObjectToYamlConfig(yamlConfigBase);
+
+ dynamic yamlClientConfigBase = LoadYamlConfigToJsonObject(ClientConfigFile_base);
+ yamlClientConfigBase.server = $"{Settings.Domain}:{Settings.Port}";
+ yamlClientConfigBase.auth = Settings.Password;
+ string yamlClientConfig = JsonObjectToYamlConfig(yamlClientConfigBase);
+
+ if (Settings.AutoACME == true)
+ {
+ dynamic yamlConfigAcme = LoadYamlConfigToJsonObject(ConfigFile_acme);
+ yamlConfigAcme.acme.domains[0] = Settings.Domain;
+ yamlConfigAcme.acme.email = Settings.Email;
+ string _yamlConfigAcme = JsonObjectToYamlConfig(yamlConfigAcme);
+ yamlConfig = YamlConfigMerger.MergeYamlStrings(yamlConfig, _yamlConfigAcme, CamelCaseNamingConvention.Instance);
+ }
+ else
+ {
+ yamlConfig = YamlConfigMerger.MergeYamlStrings(yamlConfig, ConfigFile_tls, CamelCaseNamingConvention.Instance);
+ }
+
+ if (Settings.EnableObfs == true)
+ {
+ dynamic yamlConfigObfs = LoadYamlConfigToJsonObject(ConfigFile_obfs);
+ yamlConfigObfs.obfs.salamander.password = Settings.ObfsPassword;
+ string _yamlConfigObfs = JsonObjectToYamlConfig(yamlConfigObfs);
+ yamlConfig = YamlConfigMerger.MergeYamlStrings(yamlConfig, _yamlConfigObfs, CamelCaseNamingConvention.Instance);
+
+ dynamic yamlClientConfigObfs = LoadYamlConfigToJsonObject(ConfigFile_obfs);
+ yamlClientConfigObfs.obfs.salamander.password = Settings.ObfsPassword;
+ string _yamlClientConfigObfs = JsonObjectToYamlConfig(yamlClientConfigObfs);
+ yamlClientConfig = YamlConfigMerger.MergeYamlStrings(yamlClientConfig, _yamlClientConfigObfs, CamelCaseNamingConvention.Instance);
+
+ }
+
+ if (Settings.EnableUpDisguisedWeb == true)
+ {
+ yamlConfig = YamlConfigMerger.MergeYamlStrings(yamlConfig, ConfigFile_masquerade_file, CamelCaseNamingConvention.Instance);
+ }
+ else if (string.IsNullOrEmpty(Settings.MaskDomain) == false)
+ {
+ dynamic yamlConfigMasquerade_proxy = LoadYamlConfigToJsonObject(ConfigFile_masquerade_proxy);
+
+ var prefix = "https://";
+ if (Settings.MaskDomain.StartsWith("http://"))
+ {
+ prefix = "http://";
+ }
+ var domain = Settings.MaskDomain
+ .TrimStart("http://".ToCharArray())
+ .TrimStart("https://".ToCharArray());
+
+ yamlConfigMasquerade_proxy.masquerade.proxy.url = $"{prefix}{domain}";// Settings.MaskDomain;
+ string _yamlConfigMasquerade_proxy = JsonObjectToYamlConfig(yamlConfigMasquerade_proxy);
+ yamlConfig = YamlConfigMerger.MergeYamlStrings(yamlConfig, _yamlConfigMasquerade_proxy, CamelCaseNamingConvention.Instance);
+ }
+
+ Settings.ClientHysteria2Config = yamlClientConfig;
+ return yamlConfig;
+ }
+
+ private void UploadConfigFile(string yamlConfig)
+ {
+ RunCmd("mkdir -p /etc/hysteria");
+ WriteToFile(yamlConfig, "/etc/hysteria/config.yaml");
+ }
+
+ private dynamic LoadYamlConfigToJsonObject(string yamlConfigString)
+ {
+ var JsonStr = JsonYamlConverters.YamlToJson(yamlConfigString);
+
+ return JToken.Parse(JsonStr);
+ }
+
+ private string JsonObjectToYamlConfig(dynamic jsonObj)
+ {
+ var jsonStr = JsonConvert.SerializeObject(jsonObj, Formatting.Indented);
+ return JsonYamlConverters.JsonToYaml(jsonStr);
+ }
+
+ private void DoUploadCert(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Percentage = 0;
+ Progress.Step = "上传自有证书";
+ Progress.Desc = "检测系统环境";
+
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ var oldFileName = $"ssl_{DateTime.Now.Ticks}";
+ RunCmd($"mv /etc/hysteria/ssl /etc/hysteria/{oldFileName}");
+
+ RunCmd("mkdir -p /etc/hysteria/ssl");
+ UploadFile(stream, "/etc/hysteria/ssl/ssl.zip");
+ RunCmd("unzip /etc/hysteria/ssl/ssl.zip -d /etc/hysteria/ssl");
+ }
+
+ var crtFiles = RunCmd("find /etc/hysteria/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ var keyFiles = RunCmd("find /etc/hysteria/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ if (crtFiles.Length > 0 && keyFiles.Length > 0)
+ {
+ RunCmd($"mv {crtFiles[0]} /etc/hysteria/ssl/hysteria_ssl.crt");
+ RunCmd($"mv {keyFiles[0]} /etc/hysteria/ssl/hysteria_ssl.key");
+ }
+ else
+ {
+ Progress.Step = "上传失败";
+ Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
+ return;
+ }
+
+ Progress.Desc = "重启Hysteria服务";
+ RunCmd("systemctl restart hysteria");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "上传证书完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void DoUploadWeb(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Step = "上传静态网站";
+ Progress.Desc = "上传静态网站";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "创建网站目录";
+ if (!FileExists("/var/www/hymasq"))
+ {
+ RunCmd("mkdir -p /var/www/hymasq");
+ }
+ RunCmd("rm -rf /var/www/hymasq/*");
+ Progress.Percentage = 40;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ UploadFile(stream, "/var/www/hymasq/webfile.zip");
+ RunCmd("unzip /var/www/hymasq/webfile.zip -d /var/www/hymasq");
+ }
+ RunCmd("chmod -R 777 /var/www/hymasq");
+ Progress.Percentage = 80;
+
+
+ Progress.Percentage = 90;
+
+ Progress.Desc = "重启Hysteria服务";
+ RunCmd("systemctl restart hysteria");
+ Progress.Percentage = 100;
+
+ Progress.Desc = "上传静态网站成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/Services/MTProtoGoService.cs b/ProxySuper.Core/Services/MTProtoGoService.cs
new file mode 100644
index 00000000..ce67bc24
--- /dev/null
+++ b/ProxySuper.Core/Services/MTProtoGoService.cs
@@ -0,0 +1,160 @@
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Services
+{
+ public class MTProtoGoService : ServiceBase
+ {
+ public MTProtoGoService(Host host, MTProtoGoSettings settings) : base(host, settings)
+ {
+ }
+
+ public void Install()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "1. 检测系统环境";
+ Progress.Percentage = 0;
+
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 15;
+
+ Progress.Step = "2. 安装必要的系统工具";
+ InstallSystemTools();
+ Progress.Percentage = 25;
+
+ Progress.Step = "3. 配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 35;
+
+ Progress.Step = "4. 安装docker";
+ InstallDocker();
+ Progress.Percentage = 50;
+
+ Progress.Step = "5. 生成密钥";
+ //RunCmd("docker pull nineseconds/mtg:2"); //拉取v2版本命令,但是似乎不用也可以。
+ //下面的命令是v1版本的命令格式。可以保留。将来如启用v1,可用。
+ //Settings.SecretText = RunCmd($"docker run nineseconds/mtg:1 generate-secret -c {Settings.Cleartext} tls").TrimEnd('\n');
+ Settings.SecretText = RunCmd($"docker run nineseconds/mtg:2 generate-secret {Settings.Cleartext}").TrimEnd('\n');
+ Progress.Percentage = 65;
+
+ Progress.Step = "6. 生成配置文件";
+ Progress.Desc = "创建配置";
+ RunCmd("touch /etc/mtg.toml");
+
+ Progress.Desc = "写入配置内容";
+ RunCmd($"echo \"secret=\\\"{Settings.SecretText}\\\"\" > /etc/mtg.toml");
+ RunCmd($"echo \"bind-to=\\\"0.0.0.0:{Settings.Port}\\\"\" >> /etc/mtg.toml");
+ Progress.Percentage = 80;
+
+ Progress.Step = "7. 启动MTProto服务";
+ RunCmd($"docker run -d -v /etc/mtg.toml:/config.toml --name=mtg --restart=always -p {Settings.Port + ":" + Settings.Port} nineseconds/mtg:2");
+ Progress.Desc = "设置自启动MTProto服务";
+
+ Progress.Step = "安装完成";
+ Progress.Percentage = 100;
+
+ AppendCommand("Host: " + Settings.Domain);
+ AppendCommand("Port: " + Settings.Port);
+ AppendCommand("Secret: " + Settings.SecretText);
+
+ NavigationService.Navigate(Settings);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Percentage = 0;
+ Progress.Step = "卸载MTProto";
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ Progress.Percentage = 30;
+
+ Progress.Desc = "删除docker容器";
+ var cid = RunCmd("docker ps -q --filter name=mtg");
+ RunCmd($"docker stop {cid}");
+ RunCmd($"docker rm {cid}");
+ Progress.Percentage = 100;
+ Progress.Desc = "卸载完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateSettings()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Percentage = 0;
+ Progress.Step = "更新MTProto配置";
+
+ Progress.Desc = "暂停MTProto服务";
+ var cid = RunCmd("docker ps -q --filter name=mtg");
+ RunCmd($"docker stop {cid}");
+ Progress.Percentage = 50;
+
+ Progress.Desc = "生成密钥";
+ //Settings.SecretText = RunCmd($"docker run nineseconds/mtg:1 generate-secret -c {Settings.Cleartext} tls").TrimEnd('\n'); //v1版本
+ Settings.SecretText = RunCmd($"docker run nineseconds/mtg:2 generate-secret {Settings.Cleartext}").TrimEnd('\n');
+ Progress.Percentage = 65;
+
+ Progress.Desc = "修改配置文件";
+ RunCmd($"echo \"secret=\\\"{Settings.SecretText}\\\"\" > /etc/mtg.toml");
+ RunCmd($"echo \"bind-to=\\\"0.0.0.0:{Settings.Port}\\\"\" >> /etc/mtg.toml");
+ Progress.Percentage = 80;
+
+ Progress.Desc = "重启MTProto服务";
+ RunCmd($"docker restart {cid}");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "更新配置成功";
+
+ AppendCommand("Host: " + Settings.Domain);
+ AppendCommand("Port: " + Settings.Port);
+ AppendCommand("Secret: " + Settings.SecretText);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void InstallDocker()
+ {
+ Progress.Desc = "执行docker安装脚本";
+ RunCmd("yes | curl https://get.docker.com | sh");
+
+ if (!FileExists("/usr/bin/docker"))
+ {
+ Progress.Desc = "docker安装失败";
+ throw new Exception("docker安装失败");
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/Services/NaiveProxyService.cs b/ProxySuper.Core/Services/NaiveProxyService.cs
new file mode 100644
index 00000000..b483f9d4
--- /dev/null
+++ b/ProxySuper.Core/Services/NaiveProxyService.cs
@@ -0,0 +1,283 @@
+using Microsoft.Win32;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using ProxySuper.Core.Templates;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Services
+{
+ public class NaiveProxyService : ServiceBase
+ {
+ public NaiveProxyService(Host host, NaiveProxySettings settings) : base(host, settings)
+ {
+ }
+
+ public void Install()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ var index = 1;
+
+ Progress.Step = $"{index++}. 检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Step = $"{index++}. 安装系统必要工具";
+ InstallSystemTools();
+ Progress.Percentage = 30;
+
+ Progress.Step = $"{index++}. 配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 40;
+
+ Progress.Step = $"{index++}. 检测网络环境";
+ EnsureNetwork();
+ Progress.Percentage = 50;
+
+ Progress.Step = $"{index++}. 检测域名是否绑定到本机";
+ ValidateDomain();
+ Progress.Percentage = 60;
+
+ Progress.Step = $"{index++}. 安装NaiveProxy";
+ InstallNaiveProxy();
+ Progress.Percentage = 80;
+
+ Progress.Step = $"{index++}. 优化网络参数";
+ ConfigNetwork();
+ Progress.Percentage = 90;
+
+ Progress.Step = $"{index++}. 启动BBR";
+ EnableBBR();
+
+ Progress.Desc = "重启Caddy服务";
+ RunCmd("systemctl restart caddy");
+
+ Progress.Percentage = 100;
+ Progress.Step = "NaiveProxy安装成功";
+ Progress.Desc = string.Empty;
+
+ AppendCommand("分享连接:");
+ AppendCommand(ShareLink.BuildNaiveProxy(Settings));
+
+ NavigationService.Navigate(Settings);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "卸载NaiveProxy";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "正在卸载...";
+ RunCmd("rm -rf caddy_install.sh");
+ Progress.Percentage = 10;
+
+ RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
+ Progress.Percentage = 20;
+
+ RunCmd("yes | bash caddy_install.sh uninstall");
+ Progress.Percentage = 80;
+
+ RunCmd("rm -rf caddy_install.sh");
+ Progress.Percentage = 100;
+ Progress.Step = "卸载NaiveProxy成功";
+ Progress.Desc = "卸载NaiveProxy成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateSettings()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "更新配置";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 30;
+
+ UploadCaddySettings();
+ Progress.Desc = "重启Caddy服务";
+ RunCmd("systemctl restart caddy");
+ Progress.Percentage = 100;
+
+ Progress.Step = "更新配置成功";
+ Progress.Desc = string.Empty;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UploadWeb()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadWeb;
+ fileDialog.ShowDialog();
+ }
+
+
+ #region 私有方法
+
+ private void DoUploadWeb(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Step = "上传静态网站";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "创建网站目录";
+ if (!FileExists("/usr/share/caddy"))
+ {
+ RunCmd("mkdir -p /usr/share/caddy");
+ }
+ RunCmd("rm -rf /usr/share/caddy/*");
+ Progress.Percentage = 40;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ UploadFile(stream, "/usr/share/caddy/caddy.zip");
+ RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
+ RunCmd("chmod -R 777 /usr/share/caddy");
+ Progress.Percentage = 700;
+ }
+
+ Progress.Desc = "上传Caddy配置文件";
+ UploadCaddySettings(useCustomWeb: true);
+ Progress.Percentage = 90;
+
+ Progress.Desc = "重启caddy服务";
+ RunCmd("systemctl restart caddy");
+ Progress.Percentage = 100;
+ Progress.Desc = "上传静态网站成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void InstallNaiveProxy()
+ {
+ Progress.Desc = "下载NaiveProxy安装文件";
+ RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh yes | bash");
+
+ Progress.Desc = "设置NaiveProxy开机启动";
+ RunCmd("systemctl enable caddy");
+
+ Progress.Desc = "上传配置文件";
+ UploadCaddySettings(false);
+ }
+
+ private void ConfigNetwork()
+ {
+ RunCmd(@"bash -c 'echo ""fs.file-max = 51200"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.core.rmem_max = 67108864"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.core.wmem_max = 67108864"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.core.rmem_default = 65536"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.core.wmem_default = 65536"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.core.netdev_max_backlog = 4096"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.core.somaxconn = 4096"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_syncookies = 1"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_reuse = 1"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_recycle = 0"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_fin_timeout = 30"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_keepalive_time = 1200"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.ip_local_port_range = 10000 65000"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_syn_backlog = 4096"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_tw_buckets = 5000"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_rmem = 4096 87380 67108864"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_wmem = 4096 65536 67108864"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_mtu_probing = 1"" >> /etc/sysctl.conf'");
+ RunCmd(@"sysctl -p");
+ }
+
+ private void UploadCaddySettings(bool useCustomWeb = false)
+ {
+ Progress.Desc = "生成配置文件";
+ var caddyStr = BuildConfig(useCustomWeb);
+
+ if (FileExists("/etc/caddy/Caddyfile"))
+ {
+ RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
+ }
+
+ Progress.Desc = "上传配置文件";
+ WriteToFile(caddyStr, "/etc/caddy/Caddyfile");
+ }
+
+ private string BuildConfig(bool useCustomWeb = false)
+ {
+ var jsonStr = NaiveServerCaddyfile.BaseCaddyFile;//File.ReadAllText("Templates/NaiveProxy/naive_server.caddyfile");
+ jsonStr = jsonStr.Replace("##port##", Settings.Port.ToString());
+ jsonStr = jsonStr.Replace("##domain##", Settings.Domain);
+ jsonStr = jsonStr.Replace("##basicauth##", $"basic_auth {Settings.UserName} {Settings.Password}");
+
+ if (!useCustomWeb && !string.IsNullOrEmpty(Settings.MaskDomain))
+ {
+ var prefix = "http://";
+ if (Settings.MaskDomain.StartsWith("https://"))
+ {
+ prefix = "https://";
+ }
+ var domain = Settings.MaskDomain
+ .TrimStart("http://".ToCharArray())
+ .TrimStart("https://".ToCharArray());
+
+ jsonStr = jsonStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
+ }
+ else
+ {
+ jsonStr = jsonStr.Replace("##reverse_proxy##", "");
+ jsonStr = jsonStr.Replace("#file_server", "file_server");
+ }
+ return jsonStr;
+ }
+
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/Services/ServiceBase.cs b/ProxySuper.Core/Services/ServiceBase.cs
new file mode 100644
index 00000000..7a8c8e1e
--- /dev/null
+++ b/ProxySuper.Core/Services/ServiceBase.cs
@@ -0,0 +1,846 @@
+using MvvmCross;
+using MvvmCross.Navigation;
+using ProxySuper.Core.Helpers;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using Renci.SshNet;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Navigation;
+
+namespace ProxySuper.Core.Services
+{
+ public enum ArchType
+ {
+ x86,
+ arm
+ }
+
+ public enum CmdType
+ {
+ None,
+ Yum,
+ Apt,
+ Dnf
+ }
+
+ public abstract class ServiceBase where TSettings : IProjectSettings
+ {
+ private Host _host;
+
+ private SshClient _sshClient;
+
+ private ProjectProgress _progress;
+
+ public ServiceBase(Host host, TSettings settings)
+ {
+ _host = host;
+
+ Settings = settings;
+
+ var connection = CreateConnectionInfo();
+ if (connection != null)
+ {
+ _sshClient = new SshClient(connection);
+ }
+
+ _progress = new ProjectProgress();
+
+ ArchType = ArchType.x86;
+
+ CmdType = CmdType.None;
+
+ IPv4 = string.Empty;
+
+ IPv6 = string.Empty;
+
+ IsOnlyIPv6 = false;
+
+ NavigationService = Mvx.IoCProvider.Resolve();
+ }
+
+ public string RunCmd(string command)
+ {
+ AppendCommand(command);
+
+ string result;
+ if (_sshClient.IsConnected)
+ {
+ result = _sshClient.CreateCommand(command).Execute();
+ }
+ else
+ {
+ result = "连接已断开";
+ }
+
+ AppendCommand(result);
+
+ return result;
+ }
+
+ public ProjectProgress Progress => _progress;
+
+ public TSettings Settings { get; set; }
+
+ public ArchType ArchType { get; set; }
+
+ public CmdType CmdType { get; set; }
+
+ public string IPv4 { get; set; }
+
+ public string IPv6 { get; set; }
+
+ public bool IsOnlyIPv6 { get; set; }
+
+ public IMvxNavigationService NavigationService { get; set; }
+
+
+ #region 公用方法
+ public void Connect()
+ {
+ Task.Run(() =>
+ {
+ if (_sshClient == null)
+ {
+ MessageBox.Show("无法建立连接,连接参数有误!");
+ return;
+ }
+
+ if (_sshClient.IsConnected == false)
+ {
+ Progress.Desc = ("正在与服务器建立连接");
+ try
+ {
+ _sshClient.Connect();
+ Progress.Desc = ("建立连接成功");
+ }
+ catch (Exception e)
+ {
+ Progress.Desc = ("连接失败," + e.Message);
+ }
+ }
+ });
+ }
+
+ public void Disconnect()
+ {
+ Task.Run(() =>
+ {
+ _sshClient?.Disconnect();
+ });
+ }
+
+ protected void WriteToFile(string text, string path)
+ {
+ using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
+ {
+ using (var sftp = new SftpClient(_sshClient.ConnectionInfo))
+ {
+ try
+ {
+ sftp.Connect();
+ sftp.UploadFile(stream, path, true);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ sftp.Disconnect();
+ }
+ }
+ }
+ }
+
+ protected bool FileExists(string path)
+ {
+ var cmdStr = $"if [[ -f {path} ]];then echo '1';else echo '0'; fi";
+ var cmd = RunCmd(cmdStr);
+ return cmd.Trim() == "1";
+ }
+
+ protected void SyncTimeDiff()
+ {
+ RunCmd("rm -f /etc/localtime");
+ RunCmd("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
+
+ var result = RunCmd("date +%s");
+ var vpsSeconds = Convert.ToInt64(result);
+ var localSeconds = (int)(DateTime.Now.ToUniversalTime() - DateTime.Parse("1970-01-01")).TotalSeconds;
+
+ if (Math.Abs(vpsSeconds - localSeconds) >= 90)
+ {
+ // 同步本地时间
+ var netUtcTime = DateTimeUtils.GetUTCTime();
+ DateTimeUtils.SetDate(netUtcTime.ToLocalTime());
+
+ // 同步VPS时间
+ var utcTS = DateTimeUtils.GetUTCTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ long timeStampVPS = Convert.ToInt64(utcTS.TotalSeconds);
+ RunCmd($"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampVPS.ToString()})\"");
+ }
+ }
+
+ protected void ValidateDomain()
+ {
+ var domainIP = RunCmd($"ping \"{Settings.Domain}\" -c 1" + @" | sed '1{s/[^(]*(//;s/).*//;q}'")
+ .Trim('\r', '\n');
+
+ if (IsOnlyIPv6)
+ {
+ Progress.Desc = ($"本机IP({IPv6})");
+ if (IPv6 != domainIP)
+ {
+ //throw new Exception("域名解析地址与服务器IP不匹配!");
+ }
+ }
+ else
+ {
+ Progress.Desc = ($"本机IP({IPv4})");
+ Progress.Desc = ($"域名IP({domainIP})");
+ if (IPv4 != domainIP)
+ {
+ //throw new Exception("域名解析地址与服务器IP不匹配!");
+ }
+ }
+ }
+
+ protected void EnableBBR()
+ {
+ Progress.Desc = ("检查系统是否满足启动BBR条件");
+ var osVersion = RunCmd("uname -r");
+ var canInstallBBR = CheckKernelVersionBBR(osVersion.Split('-')[0]);
+
+ var bbrInfo = RunCmd("sysctl net.ipv4.tcp_congestion_control | grep bbr");
+ var installed = bbrInfo.Contains("bbr");
+ if (canInstallBBR && !installed)
+ {
+ RunCmd(@"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'");
+ RunCmd(@"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'");
+ RunCmd(@"sysctl -p");
+
+ if (IsOnlyIPv6)
+ {
+ RemoveNat64();
+ }
+ Progress.Desc = ("启动BBR成功");
+ }
+
+ if (!canInstallBBR)
+ {
+ Progress.Desc = ("系统不满足启用BBR条件,启动失败。");
+ }
+
+ }
+
+ ///
+ /// 安装证书
+ ///
+ ///
+ ///
+ protected void InstallCert(string dirPath, string certName, string keyName)
+ {
+ string certPath = dirPath + "/" + certName;
+ string keyPath = dirPath + "/" + keyName;
+
+ Progress.Desc = ("安装Acme软件");
+ #region 安装Acme
+ // 安装依赖
+ RunCmd(GetInstallCmd("socat"));
+
+ // 解决搬瓦工CentOS缺少问题
+ RunCmd(GetInstallCmd("automake autoconf libtool"));
+
+ // 安装Acme
+ var result = RunCmd($"curl https://get.acme.sh yes | sh");
+ if (!result.Contains("nstall success"))
+ {
+ throw new Exception("安装 Acme 失败,请联系开发者!");
+ }
+
+ RunCmd("alias acme.sh=~/.acme.sh/acme.sh");
+
+ #endregion
+
+
+ #region 申请证书
+ Progress.Desc = ("正在申请证书");
+ // 申请证书
+ var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Settings.Domain} {(IsOnlyIPv6 ? "--listen-v6" : "")} --pre-hook \"systemctl stop caddy\" --post-hook \"systemctl start caddy\" --server letsencrypt";
+ result = RunCmd(cmd);
+
+
+ if (result.Contains("success"))
+ {
+ Progress.Desc = ("申请证书成功");
+ }
+ else
+ {
+ Progress.Desc = ("申请证书失败,如果申请次数过多请更换二级域名,或联系开发者!");
+ throw new Exception("申请证书失败,如果申请次数过多请更换二级域名,或联系开发者!");
+ }
+ #endregion
+
+ // 安装证书
+ Progress.Desc = ("安装TLS证书");
+ RunCmd($"mkdir -p {dirPath}");
+ RunCmd($"/root/.acme.sh/acme.sh --installcert -d {Settings.Domain} --certpath {certPath} --keypath {keyPath} --capath {certPath}");
+
+ result = RunCmd($@"if [ ! -f ""{keyPath}"" ]; then echo ""0""; else echo ""1""; fi | head -n 1");
+
+ if (result.Contains("1"))
+ {
+ Progress.Desc = ("安装证书成功");
+ }
+ else
+ {
+ Progress.Desc = ("安装证书失败,请联系开发者!");
+ throw new Exception("安装证书失败,请联系开发者!");
+ }
+
+ RunCmd($"chmod 755 {dirPath}");
+ }
+
+ protected void UploadFile(Stream stream, string path)
+ {
+ using (var sftp = new SftpClient(_sshClient.ConnectionInfo))
+ {
+ sftp.Connect();
+ sftp.UploadFile(stream, path, true);
+ sftp.Disconnect();
+ }
+ }
+
+ public void EnsureRootUser()
+ {
+ // 禁止一些可能产生的干扰信息
+ RunCmd(@"sed -i 's/echo/#echo/g' ~/.bashrc");
+ RunCmd(@"sed -i 's/echo/#echo/g' ~/.profile");
+
+ var result = RunCmd("id -u");
+ if (!result.Equals("0\n"))
+ {
+ throw new Exception("请使用Root权限账户登录!");
+ }
+ }
+
+ public void UninstallCaddy()
+ {
+ Progress.Desc = "关闭Caddy服务";
+ RunCmd("systemctl stop caddy");
+ RunCmd("systemctl disable caddy");
+
+ Progress.Desc = "彻底删除Caddy文件";
+ RunCmd("rm -rf /etc/systemd/system/caddy.service");
+ RunCmd("rm -rf /usr/bin/caddy");
+ RunCmd("rm -rf /usr/share/caddy");
+ RunCmd("rm -rf /etc/caddy");
+ }
+
+ public void EnsureSystemEnv()
+ {
+ // cpu架构
+ Progress.Desc = ("检测CPU架构");
+ EnsureCPU();
+
+ // 安装命令类型
+ Progress.Desc = ("检测系统安装命令");
+ EnsureCmdType();
+
+ // systemctl
+ Progress.Desc = ("检测Systemctl");
+ EnsureSystemctl();
+
+ // SELinux
+ Progress.Desc = ("检测SELinux");
+ ConfigSELinux();
+ }
+
+ public void InstallSystemTools()
+ {
+ Progress.Desc = ("更新安装包");
+ RunUpdateCmd();
+
+ Progress.Desc = ("安装sudo工具");
+ InstallSoftware("sudo");
+
+ Progress.Desc = ("安装curl工具");
+ InstallSoftware("curl");
+
+ Progress.Desc = ("安装wget工具");
+ InstallSoftware("wget");
+
+ Progress.Desc = ("安装ping工具");
+ InstallSoftware("ping");
+
+ Progress.Desc = ("安装unzip工具");
+ InstallSoftware("unzip");
+
+ Progress.Desc = ("安装cron工具");
+ InstallSoftware("cron");
+
+ Progress.Desc = ("安装lsof工具");
+ InstallSoftware("lsof");
+
+ Progress.Desc = ("安装systemd工具");
+ InstallSoftware("systemd");
+ }
+
+ public void ConfigFirewalld()
+ {
+ Progress.Desc = ("释放被占用的端口");
+ Settings.FreePorts.ForEach(port => SetPortFree(port));
+
+ Progress.Desc = ("开放需要的端口");
+ OpenPort(Settings.FreePorts.ToArray());
+ }
+
+ public void ResetFirewalld()
+ {
+ ClosePort(Settings.FreePorts.ToArray());
+ }
+
+ public void EnsureNetwork()
+ {
+ string cmd;
+
+ Progress.Desc = ("检测IPv4");
+ cmd = RunCmd(@"curl -4 ip.sb");
+ IPv4 = cmd.TrimEnd('\r', '\n');
+
+ Progress.Desc = ($"IPv4地址为{IPv4}");
+ if (!string.IsNullOrEmpty(IPv4))
+ {
+ IsOnlyIPv6 = false;
+ }
+ else
+ {
+ Progress.Desc = ("检测IPv6");
+ cmd = RunCmd(@"curl -6 ip.sb");
+ IPv6 = cmd.TrimEnd('\r', '\n');
+ Progress.Desc = ($"IPv6地址为{IPv6}");
+
+ IsOnlyIPv6 = true;
+ SetNat64();
+ }
+
+ if (string.IsNullOrEmpty(IPv4) && string.IsNullOrEmpty(IPv6))
+ {
+ throw new Exception("未检测到服务器公网IP,请检查网络或重试。");
+ }
+ }
+
+ public void InstallCaddy()
+ {
+ RunCmd("rm -rf caddy.tar.gz");
+ RunCmd("rm -rf /etc/caddy");
+ RunCmd("rm -rf /usr/share/caddy");
+
+ var url = "https://github.com/caddyserver/caddy/releases/download/v2.4.3/caddy_2.4.3_linux_amd64.tar.gz";
+ if (ArchType == ArchType.arm)
+ {
+ url = "https://github.com/caddyserver/caddy/releases/download/v2.4.3/caddy_2.4.3_linux_armv7.tar.gz";
+ }
+
+ RunCmd($"wget -O caddy.tar.gz {url}");
+ RunCmd("mkdir -p /etc/caddy");
+ RunCmd("tar -zxvf caddy.tar.gz -C /etc/caddy");
+ RunCmd("cp -rf /etc/caddy/caddy /usr/bin");
+ WriteToFile(Caddy.DefaultCaddyFile, "/etc/caddy/Caddyfile");
+ WriteToFile(Caddy.Service, "/etc/systemd/system/caddy.service");
+ RunCmd("systemctl daemon-reload");
+ RunCmd("systemctl enable caddy");
+
+ RunCmd("mkdir -p /usr/share/caddy");
+ RunCmd("chmod 775 /usr/share/caddy");
+
+ if (!FileExists("/usr/bin/caddy"))
+ {
+ throw new Exception("Caddy服务器安装失败,请联系开发者!");
+ }
+ }
+ #endregion
+
+
+ #region 检测System环境
+ private void EnsureCPU()
+ {
+ var result = RunCmd("uname -m");
+ if (result.Contains("x86"))
+ {
+ ArchType = ArchType.x86;
+ }
+ else if (result.Contains("arm") || result.Contains("arch"))
+ {
+ ArchType = ArchType.arm;
+ }
+ }
+
+ private void EnsureCmdType()
+ {
+ var result = string.Empty;
+
+ if (CmdType == CmdType.None)
+ {
+ result = RunCmd("command -v apt");
+ if (!string.IsNullOrEmpty(result))
+ {
+ CmdType = CmdType.Apt;
+ }
+ }
+
+ if (CmdType == CmdType.None)
+ {
+ result = RunCmd("command -v dnf");
+ if (!string.IsNullOrEmpty(result))
+ {
+ CmdType = CmdType.Dnf;
+ }
+ }
+
+ if (CmdType == CmdType.None)
+ {
+ result = RunCmd("command -v yum");
+ if (!string.IsNullOrEmpty(result))
+ {
+ CmdType = CmdType.Yum;
+ }
+ }
+
+ if (CmdType == CmdType.None)
+ {
+ throw new Exception("未检测到正确的系统安装命令,请尝试使用ProxySU推荐的系统版本安装!");
+ }
+ }
+
+ private void EnsureSystemctl()
+ {
+ var result = RunCmd("command -v systemctl");
+ if (string.IsNullOrEmpty(result))
+ {
+ throw new Exception("系统缺少 systemctl 组件,请尝试使用ProxySU推荐的系统版本安装!");
+ }
+ }
+
+ private void ConfigSELinux()
+ {
+ // SELinux
+ var result = RunCmd("command -v getenforce");
+ var isSELinux = !string.IsNullOrEmpty(result);
+
+ // 判断是否启用了SELinux,如果启用了,并且工作在Enforcing模式下,则改为Permissive模式
+ if (isSELinux)
+ {
+ result = RunCmd("getenforce");
+
+ // 检测到系统启用SELinux,且工作在严格模式下,需改为宽松模式
+ if (result.Contains("Enforcing"))
+ {
+ RunCmd("setenforce 0");
+ RunCmd(@"sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config");
+ }
+ }
+ }
+ #endregion
+
+
+ #region 私有方法
+
+ protected void SetNat64()
+ {
+ var dns64List = FilterFastestIP();
+ if (dns64List.Count == 0)
+ {
+ throw new Exception("未找到有效的Nat64网关");
+ }
+
+ var exists = FileExists("/etc/resolv.conf.proxysu");
+ if (!exists)
+ {
+ var cmdStr = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu";
+ RunCmd(cmdStr);
+ }
+
+ foreach (var gateip in dns64List)
+ {
+ RunCmd($"echo \"nameserver {gateip}\" > /etc/resolv.conf");
+ }
+ }
+
+ protected void RemoveNat64()
+ {
+ RunCmd("rm /etc/resolv.conf");
+ RunCmd("mv /etc/resolv.conf.proxysu /etc/resolv.conf");
+ }
+
+ protected void AppendCommand(string command)
+ {
+ if (!command.EndsWith("\n"))
+ {
+ command += "\n";
+ }
+ Progress.Logs += command;
+ }
+
+ private List FilterFastestIP()
+ {
+ string[] gateNat64 = {
+ "2a01:4f9:c010:3f02::1",
+ "2001:67c:2b0::4",
+ "2001:67c:2b0::6",
+ "2a09:11c0:f1:bbf0::70",
+ "2a01:4f8:c2c:123f::1",
+ "2001:67c:27e4:15::6411",
+ "2001:67c:27e4::64",
+ "2001:67c:27e4:15::64",
+ "2001:67c:27e4::60",
+ "2a00:1098:2b::1",
+ "2a03:7900:2:0:31:3:104:161",
+ "2a00:1098:2c::1",
+ "2a09:11c0:100::53",
+ };
+
+ Dictionary dns64List = new Dictionary();
+ foreach (var gateip in gateNat64)
+ {
+ var cmdStr = $"ping6 -c4 {gateip} | grep avg | awk '{{print $4}}'|cut -d/ -f2";
+ var cmd = RunCmd(cmdStr);
+ if (!string.IsNullOrEmpty(cmd))
+ {
+ if (float.TryParse(cmd, out float delay))
+ {
+ dns64List.Add(gateip, delay);
+ }
+ }
+ }
+
+ //return dns64List.Keys.ToList();
+ return dns64List.OrderBy(kv => kv.Value).Select(kv => kv.Key).ToList();
+
+ }
+
+ private bool CheckKernelVersionBBR(string kernelVer)
+ {
+ string[] linuxKernelCompared = kernelVer.Split('.');
+ if (int.Parse(linuxKernelCompared[0]) > 4)
+ {
+ return true;
+ }
+ else if (int.Parse(linuxKernelCompared[0]) < 4)
+ {
+ return false;
+ }
+ else if (int.Parse(linuxKernelCompared[0]) == 4)
+ {
+ if (int.Parse(linuxKernelCompared[1]) >= 9)
+ {
+ return true;
+ }
+ else if (int.Parse(linuxKernelCompared[1]) < 9)
+ {
+ return false;
+ }
+
+ }
+ return false;
+
+ }
+
+ private void SetPortFree(int port)
+ {
+ string result = RunCmd($"lsof -n -P -i :{port} | grep LISTEN");
+
+ if (!string.IsNullOrEmpty(result))
+ {
+ string[] process = result.Split(' ');
+ RunCmd($"systemctl stop {process[0]}");
+ RunCmd($"systemctl disable {process[0]}");
+ RunCmd($"pkill {process[0]}");
+ }
+ }
+
+ private void OpenPort(params int[] portList)
+ {
+ string cmd;
+
+ cmd = RunCmd("command -v firewall-cmd");
+ if (!string.IsNullOrEmpty(cmd))
+ {
+ //有很奇怪的vps主机,在firewalld未运行时,端口是关闭的,无法访问。所以要先启动firewalld
+ //用于保证acme.sh申请证书成功
+ cmd = RunCmd("firewall-cmd --state");
+ if (cmd.Trim() != "running")
+ {
+ RunCmd("systemctl restart firewalld");
+ }
+
+ // 保持 ssh 端口开放
+ RunCmd($"firewall-cmd --add-port={_host.Port}/tcp --permanent");
+ foreach (var port in portList)
+ {
+ RunCmd($"firewall-cmd --add-port={port}/tcp --permanent");
+ RunCmd($"firewall-cmd --add-port={port}/udp --permanent");
+ }
+
+ RunCmd("yes | firewall-cmd --reload");
+ }
+ else
+ {
+ cmd = RunCmd("command -v ufw");
+ if (string.IsNullOrEmpty(cmd))
+ {
+ RunCmd(GetInstallCmd("ufw"));
+ RunCmd("echo y | ufw enable");
+ }
+
+ // 保持 ssh 端口开放
+ RunCmd($"ufw allow {_host.Port}/tcp");
+ foreach (var port in portList)
+ {
+ RunCmd($"ufw allow {port}/tcp");
+ RunCmd($"ufw allow {port}/udp");
+ }
+ RunCmd("yes | ufw reload");
+ }
+ }
+
+ private void ClosePort(params int[] portList)
+ {
+ string cmd;
+
+ cmd = RunCmd("command -v firewall-cmd");
+ if (!string.IsNullOrEmpty(cmd))
+ {
+ //有很奇怪的vps主机,在firewalld未运行时,端口是关闭的,无法访问。所以要先启动firewalld
+ //用于保证acme.sh申请证书成功
+ cmd = RunCmd("firewall-cmd --state");
+ if (cmd.Trim() != "running")
+ {
+ RunCmd("systemctl restart firewalld");
+ }
+
+ foreach (var port in portList)
+ {
+ RunCmd($"firewall-cmd --remove-port={port}/tcp --permanent");
+ RunCmd($"firewall-cmd --remove-port={port}/udp --permanent");
+ }
+ RunCmd("yes | firewall-cmd --reload");
+ }
+ else
+ {
+ cmd = RunCmd("command -v ufw");
+ if (!string.IsNullOrEmpty(cmd))
+ {
+ foreach (var port in portList)
+ {
+ RunCmd($"ufw delete allow {port}/tcp");
+ RunCmd($"ufw delete allow {port}/udp");
+ }
+ RunCmd("yes | ufw reload");
+ }
+ }
+ }
+
+ private void InstallSoftware(string software)
+ {
+ var result = RunCmd($"command -v {software}");
+ if (string.IsNullOrEmpty(result))
+ {
+ RunCmd(GetInstallCmd(software));
+ }
+ }
+
+ private string GetInstallCmd(string soft)
+ {
+ if (CmdType == CmdType.Apt)
+ {
+ return $"apt install -y {soft}";
+ }
+ else if (CmdType == CmdType.Yum)
+ {
+ return $"yum install -y {soft}";
+ }
+ else
+ {
+ return $"dnf install -y {soft}";
+ }
+ }
+
+ private void RunUpdateCmd()
+ {
+ if (CmdType == CmdType.Apt)
+ {
+ RunCmd($"apt update -y");
+ }
+ else if (CmdType == CmdType.Yum)
+ {
+ RunCmd($"yum update -y");
+ }
+ else
+ {
+ RunCmd($"dnf update -y");
+ }
+ }
+
+
+ private ConnectionInfo CreateConnectionInfo()
+ {
+ try
+ {
+ var authMethods = new List();
+
+ if (_host.SecretType == LoginSecretType.Password)
+ {
+ authMethods.Add(new PasswordAuthenticationMethod(_host.UserName, _host.Password));
+ }
+
+ if (_host.SecretType == LoginSecretType.PrivateKey)
+ {
+ PrivateKeyFile keyFile;
+ if (string.IsNullOrEmpty(_host.PrivateKeyPassPhrase))
+ {
+ keyFile = new PrivateKeyFile(_host.PrivateKeyPath);
+ }
+ else
+ {
+ keyFile = new PrivateKeyFile(_host.PrivateKeyPath, _host.PrivateKeyPassPhrase);
+ }
+ authMethods.Add(new PrivateKeyAuthenticationMethod(_host.UserName, keyFile));
+ }
+
+ if (_host.Proxy.Type == ProxyTypes.None)
+ {
+ return new ConnectionInfo(
+ host: _host.Address,
+ username: _host.UserName,
+ port: _host.Port,
+ authenticationMethods: authMethods.ToArray());
+ }
+
+ return new ConnectionInfo(
+ host: _host.Address,
+ port: _host.Port,
+ username: _host.UserName,
+ proxyType: _host.Proxy.Type,
+ proxyHost: _host.Proxy.Address,
+ proxyPort: _host.Proxy.Port,
+ proxyUsername: _host.Proxy.UserName,
+ proxyPassword: _host.Proxy.Password,
+ authenticationMethods: authMethods.ToArray());
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ return null;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/Services/ShareLink.cs b/ProxySuper.Core/Services/ShareLink.cs
new file mode 100644
index 00000000..deecf28e
--- /dev/null
+++ b/ProxySuper.Core/Services/ShareLink.cs
@@ -0,0 +1,488 @@
+
+using Newtonsoft.Json;
+using ProxySuper.Core.Models.Projects;
+using System;
+using System.Net;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Web;
+
+namespace ProxySuper.Core.Services
+{
+ public class ShareLink
+ {
+ public static string BuildHysteria(HysteriaSettings settings)
+ {
+ //hysteria2://[auth@]hostname[:port]/?[key=value]&[key=value]...
+ //hysteria2://letmein@example.com:123,5000-6000/?insecure=1&obfs=salamander&obfs-password=gawrgura&pinSHA256=deadbeef&sni=real.example.com
+ var auth = HttpUtility.UrlEncode(settings.Password);
+
+ if (settings.EnableObfs == true)
+ {
+ //var _obfsPassword = settings.ObfsPassword;
+ return $"hysteria2://{auth}@{settings.Domain}:{settings.Port}/?obfs=salamander&obfs-password={settings.ObfsPassword}";
+ }
+ return $"hysteria2://{auth}@{settings.Domain}:{settings.Port}";
+
+ }
+ public static string BuildBrook(BrookSettings settings)
+ {
+ var password = HttpUtility.UrlEncode(settings.Password);
+
+ if (settings.BrookType == BrookType.server)
+ {
+ var address = HttpUtility.UrlEncode($"{settings.IP}:{settings.Port}");
+ return $"brook://server?password={password}&server={address}";
+ }
+
+ if (settings.BrookType == BrookType.wsserver)
+ {
+ var address = HttpUtility.UrlEncode($"ws://{settings.IP}:{settings.Port}");
+ return $"brook://wsserver?password={password}&wsserver={address}";
+ }
+
+ if (settings.BrookType == BrookType.wssserver)
+ {
+ var address = HttpUtility.UrlEncode($"wss://{settings.Domain}:{settings.Port}");
+ return $"brook://wssserver?password={password}&wssserver={address}";
+ }
+
+ if (settings.BrookType == BrookType.socks5)
+ {
+ var address = HttpUtility.UrlEncode($"socks5://{settings.IP}:{settings.Port}");
+ return $"brook://socks5?password={password}&socks5={address}";
+ }
+
+ return string.Empty;
+ }
+
+ public static string BuildNaiveProxy(NaiveProxySettings settings)
+ {
+ StringBuilder strBuilder = new StringBuilder();
+ strBuilder.Append("naive+https://");
+ strBuilder.Append($"{settings.UserName}:{settings.Password}");
+ strBuilder.Append($"@{settings.Domain}:{settings.Port}");
+ strBuilder.Append("?padding=true#naive_proxy");
+
+ return strBuilder.ToString();
+ }
+
+ public static string BuildTrojanGo(TrojanGoSettings settings)
+ {
+ StringBuilder strBuilder = new StringBuilder();
+ strBuilder.Append("trojan-go://");
+
+ strBuilder.Append($"{HttpUtility.UrlEncode(settings.Password)}@{settings.Domain}:{settings.Port}/?");
+ if (settings.EnableWebSocket)
+ {
+ strBuilder.Append($"type=ws&path={HttpUtility.UrlEncode(settings.WebSocketPath)}&");
+ }
+ else
+ {
+ strBuilder.Append("type=original&");
+ }
+ strBuilder.Append($"#{HttpUtility.UrlEncode("trojan-go")}");
+
+ return strBuilder.ToString();
+ }
+
+ #region V2Ray ShareLink
+ public static string Build(V2RayType v2rayType, V2raySettings settings)
+ {
+
+ switch (v2rayType)
+ {
+ case V2RayType.VLESS_TCP:
+ //case RayType.VLESS_RAW_XTLS:
+ case V2RayType.VLESS_WS:
+ case V2RayType.VLESS_KCP:
+ case V2RayType.VLESS_QUIC:
+ case V2RayType.VLESS_gRPC:
+ case V2RayType.Trojan_TCP:
+ return BuildVlessShareLink(v2rayType, settings);
+ case V2RayType.VMESS_TCP:
+ case V2RayType.VMESS_WS:
+ case V2RayType.VMESS_KCP:
+ case V2RayType.VMESS_QUIC:
+ return BuildVmessShareLink(v2rayType, settings);
+ case V2RayType.ShadowsocksAEAD:
+ return BuildShadowSocksShareLink(settings);
+ default:
+ return string.Empty;
+ }
+ }
+
+ private static string BuildShadowSocksShareLink(V2raySettings settings)
+ {
+ var _method = settings.ShadowSocksMethod;
+ var _password = settings.ShadowSocksPassword;
+ var _server = settings.Domain;
+ var _port = settings.ShadowSocksPort;
+
+ var base64URL = Utils.Base64Encode($"{_method}:{_password}@{_server}:{_port}");
+ return "ss://" + base64URL + "#ShadowSocks";
+ }
+
+ private static string BuildVmessShareLink(V2RayType v2rayType, V2raySettings settings)
+ {
+ var vmess = new Vmess
+ {
+ v = "2",
+ add = settings.Domain,
+ port = settings.Port.ToString(),
+ id = settings.UUID,
+ aid = "0",
+ net = "",
+ type = "none",
+ host = "",
+ path = "",
+ tls = "tls",
+ ps = "",
+ };
+
+ switch (v2rayType)
+ {
+ case V2RayType.VMESS_TCP:
+ vmess.ps = "vmess-tcp-tls";
+ vmess.net = "tcp";
+ vmess.type = "http";
+ vmess.path = settings.VMESS_TCP_Path;
+ break;
+ case V2RayType.VMESS_WS:
+ vmess.ps = "vmess-ws-tls";
+ vmess.net = "ws";
+ vmess.type = "none";
+ vmess.path = settings.VMESS_WS_Path;
+ break;
+ case V2RayType.VMESS_KCP:
+ vmess.ps = "vmess-mKCP";
+ vmess.port = settings.VMESS_KCP_Port.ToString();
+ vmess.net = "kcp";
+ vmess.type = settings.VMESS_KCP_Type;
+ vmess.path = settings.VMESS_KCP_Seed;
+ vmess.tls = "";
+ break;
+ case V2RayType.VMESS_QUIC:
+ vmess.ps = "vmess-quic";
+ vmess.port = settings.VMESS_QUIC_Port.ToString();
+ vmess.net = "quic";
+ vmess.type = settings.VMESS_QUIC_Type;
+ vmess.path = settings.VMESS_QUIC_Key;
+ vmess.host = settings.VMESS_QUIC_Security;
+ vmess.tls = "tls";
+ break;
+ default:
+ return string.Empty;
+ }
+
+ var base64Url = Utils.Base64Encode(JsonConvert.SerializeObject(vmess));
+ return $"vmess://" + base64Url;
+ }
+
+ private static string BuildVlessShareLink(V2RayType v2rayType, V2raySettings settings)
+ {
+ var _protocol = string.Empty;
+ var _uuid = settings.UUID;
+ var _domain = settings.Domain;
+ var _port = settings.Port;
+ var _type = string.Empty;
+ var _encryption = "none";
+ var _security = "tls";
+ var _path = "/";
+ var _host = settings.Domain;
+ var _descriptiveText = string.Empty;
+
+ switch (v2rayType)
+ {
+ case V2RayType.VLESS_TCP:
+ _protocol = "vless";
+ _type = "tcp";
+ _descriptiveText = "vless-tcp-tls";
+ break;
+ //case RayType.VLESS_RAW_XTLS:
+ // _protocol = "vless";
+ // _type = "tcp";
+ // _security = "tls";
+ // _descriptiveText = "vless-tcp-xtls";
+ // break;
+ case V2RayType.VLESS_WS:
+ _protocol = "vless";
+ _type = "ws";
+ _path = settings.VLESS_WS_Path;
+ _descriptiveText = "vless-ws-tls";
+ break;
+ case V2RayType.VLESS_KCP:
+ _protocol = "vless";
+ _type = "kcp";
+ _port = settings.VLESS_KCP_Port;
+ _security = "none";
+ _descriptiveText = "vless-mKCP";
+ break;
+ case V2RayType.VLESS_QUIC:
+ _protocol = "vless";
+ _port = settings.VLESS_QUIC_Port;
+ _type = "quic";
+ _security = "tls";
+ _descriptiveText = "vless-quic";
+ break;
+ case V2RayType.VLESS_gRPC:
+ _protocol = "vless";
+ _type = "grpc";
+ _port = settings.VLESS_gRPC_Port;
+ _descriptiveText = "vless-gRPC";
+ break;
+ case V2RayType.Trojan_TCP:
+ _protocol = "trojan";
+ _uuid = settings.TrojanPassword;
+ _descriptiveText = "trojan-tcp";
+ break;
+ default:
+ throw new Exception("暂未实现的协议");
+ }
+
+
+ string parametersURL = string.Empty;
+ if (v2rayType != V2RayType.Trojan_TCP)
+ {
+ // 4.3 传输层相关段
+ parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}";
+
+ // kcp
+ if (v2rayType == V2RayType.VLESS_KCP)
+ {
+ parametersURL += $"&seed={settings.VLESS_KCP_Seed}&headerType={settings.VLESS_KCP_Type}";
+ }
+
+ if (v2rayType == V2RayType.VLESS_QUIC)
+ {
+ parametersURL += $"&quicSecurity={settings.VLESS_QUIC_Security}";
+ if (settings.VLESS_QUIC_Security != "none")
+ {
+ parametersURL += $"&key={HttpUtility.UrlEncode(settings.VLESS_QUIC_Key)}";
+ }
+ parametersURL += $"&headerType={settings.VLESS_QUIC_Type}";
+ }
+ /*
+ // 4.4 TLS 相关段
+ if (settings is XraySettings)
+ {
+ if (v2rayType == RayType.VLESS_RAW_XTLS)
+ {
+ var xraySettings = settings as XraySettings;
+ parametersURL += $"&flow={xraySettings.Flow}";
+ }
+ }
+ */
+
+ if (v2rayType == V2RayType.VLESS_gRPC)
+ {
+ parametersURL += $"&serviceName={settings.VLESS_gRPC_ServiceName}&mode=gun";
+ }
+ }
+
+
+ return $"{_protocol}://{HttpUtility.UrlEncode(_uuid)}@{_domain}:{_port}{parametersURL}#{HttpUtility.UrlEncode(_descriptiveText)}";
+ }
+
+ #endregion
+
+ #region Xray ShareLink
+ public static string XrayBuild(XrayType xrayType, XraySettings settings)
+ {
+
+ switch (xrayType)
+ {
+ case XrayType.VLESS_RAW_XTLS:
+ case XrayType.VLESS_XTLS_RAW_REALITY:
+ case XrayType.VLESS_XHTTP:
+ case XrayType.VLESS_WS:
+ case XrayType.VLESS_gRPC:
+ case XrayType.Trojan_TCP:
+ return XrayBuildVlessShareLink(xrayType, settings);
+
+ case XrayType.VMESS_KCP:
+ return XrayBuildVmessShareLink(xrayType, settings);
+ case XrayType.ShadowsocksAEAD:
+ return XrayBuildShadowSocksShareLink(settings);
+ default:
+ return string.Empty;
+ }
+ }
+
+ private static string XrayBuildShadowSocksShareLink(XraySettings settings)
+ {
+ var _method = settings.ShadowSocksMethod;
+ var _password = settings.ShadowSocksPassword;
+ var _server = settings.Domain;
+ var _port = settings.ShadowSocksPort;
+
+ var base64URL = Utils.Base64Encode($"{_method}:{_password}@{_server}:{_port}");
+ return "ss://" + base64URL + "#ShadowSocks";
+ }
+
+ private static string XrayBuildVmessShareLink(XrayType xrayType, XraySettings settings)
+ {
+ var vmess = new Vmess
+ {
+ v = "2",
+ add = settings.Domain,
+ port = settings.Port.ToString(),
+ id = settings.UUID,
+ aid = "0",
+ net = "",
+ type = "none",
+ host = "",
+ path = "",
+ tls = "tls",
+ ps = "",
+ };
+
+ switch (xrayType)
+ {
+ case XrayType.VMESS_KCP:
+ vmess.ps = "vmess-mKCP";
+ vmess.port = settings.VMESS_KCP_Port.ToString();
+ vmess.net = "kcp";
+ vmess.type = settings.VMESS_KCP_Type;
+ vmess.path = settings.VMESS_KCP_Seed;
+ vmess.tls = "";
+ break;
+
+ default:
+ return string.Empty;
+ }
+
+ var base64Url = Utils.Base64Encode(JsonConvert.SerializeObject(vmess));
+ return $"vmess://" + base64Url;
+ }
+
+ private static string XrayBuildVlessShareLink(XrayType xrayType, XraySettings settings)
+ {
+ var _protocol = string.Empty;
+ var _uuid = settings.UUID;
+ var _domain = settings.Domain;
+ var _port = settings.Port;
+ var _type = string.Empty;
+ var _encryption = "none";
+ var _security = "tls";
+ var _path = "/";
+ var _host = settings.Domain;
+ var _descriptiveText = string.Empty;
+
+ var _flow = settings.Flow;
+ var _sni = settings.MaskDomain;
+ var _fingerprint = settings.UTLS;
+ var _publicKey = settings.REALITY_publicKey;
+ var _spiderX = settings.REALITY_spiderX;
+ var _headerType = "none";
+
+ var _alpn = string.Empty;
+ var _mode = string.Empty;
+
+ switch (xrayType)
+ {
+ case XrayType.VLESS_XTLS_RAW_REALITY:
+ _protocol = "vless";
+ _type = "tcp";
+ _security = "reality";
+ _flow = settings.Flow;
+ _sni = settings.MaskDomain;
+ _fingerprint = settings.UTLS;
+ _publicKey = settings.REALITY_publicKey;
+ _spiderX = settings.REALITY_spiderX;
+ _headerType = "none";
+ _host = settings.MaskDomain;
+ _descriptiveText = "vless-xtls-reality";
+ break;
+ case XrayType.VLESS_RAW_XTLS:
+ _protocol = "vless";
+ _type = "tcp";
+ _security = "tls";
+ _descriptiveText = "vless-tcp-xtls";
+ break;
+ case XrayType.VLESS_XHTTP:
+ _protocol = "vless";
+ _type = "xhttp";
+ _path = settings.VLESS_XHTTP_Path;
+ _alpn = "h3,h2,http/1.1";
+ _mode = "packet-up";
+ _descriptiveText = "vless-xhttp";
+ break;
+ case XrayType.VLESS_WS:
+ _protocol = "vless";
+ _type = "ws";
+ _path = settings.VLESS_WS_Path;
+ _descriptiveText = "vless-ws-tls";
+ break;
+ case XrayType.VLESS_gRPC:
+ _protocol = "vless";
+ _type = "grpc";
+ _port = settings.VLESS_gRPC_Port;
+ _descriptiveText = "vless-gRPC";
+ break;
+ case XrayType.Trojan_TCP:
+ _protocol = "trojan";
+ _uuid = settings.TrojanPassword;
+ _descriptiveText = "trojan-tcp";
+ break;
+ default:
+ throw new Exception("暂未实现的协议");
+ }
+
+
+ string parametersURL = string.Empty;
+ if (xrayType != XrayType.Trojan_TCP && xrayType != XrayType.VLESS_XTLS_RAW_REALITY)
+ {
+ // 4.3 传输层相关段
+ parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}";
+
+ // xhttp
+ if (xrayType == XrayType.VLESS_XHTTP)
+ {
+ parametersURL += $"&alpn={HttpUtility.UrlEncode(_alpn)}&mode={_mode}";
+ }
+
+
+ // 4.4 TLS 相关段
+
+ if (xrayType == XrayType.VLESS_RAW_XTLS)
+ {
+
+ parametersURL += $"&flow={settings.Flow}";
+ }
+
+ if (xrayType == XrayType.VLESS_gRPC)
+ {
+ parametersURL += $"&serviceName={settings.VLESS_gRPC_ServiceName}&mode=gun";
+ }
+ }
+
+ if (xrayType == XrayType.VLESS_XTLS_RAW_REALITY)
+ {
+ parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&flow={_flow}&sni={_sni}&fp={_fingerprint}&pbk={_publicKey}&spx={HttpUtility.UrlEncode(_spiderX)}&headerType={_headerType}&host={_host}";
+
+ }
+
+ return $"{_protocol}://{HttpUtility.UrlEncode(_uuid)}@{_domain}:{_port}{parametersURL}#{HttpUtility.UrlEncode(_descriptiveText)}";
+ }
+ #endregion
+
+ }
+
+
+
+ class Vmess
+ {
+ public string v { get; set; }
+ public string ps { get; set; }
+ public string add { get; set; }
+ public string port { get; set; }
+ public string id { get; set; }
+ public string aid { get; set; }
+ public string net { get; set; }
+ public string type { get; set; }
+ public string host { get; set; }
+ public string path { get; set; }
+ public string tls { get; set; }
+ }
+}
diff --git a/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs b/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs
new file mode 100644
index 00000000..4aab35e8
--- /dev/null
+++ b/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs
@@ -0,0 +1,67 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Templates;
+using System.IO;
+
+namespace ProxySuper.Core.Services
+{
+ public class TrojanGoConfigBuilder
+ {
+ public static readonly int WebPort = 8088;
+
+ public static readonly string TrojanGoSettingPath = TrojanGoTemplates.TrojanGoJson;
+
+ public static readonly string CaddyFilePath = TrojanGoTemplates.BaseCaddyfile;
+
+ public static string BuildTrojanGoConfig(TrojanGoSettings parameters)
+ {
+ var jsonStr = TrojanGoSettingPath;
+ var settings = JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
+
+ settings["remote_port"] = WebPort;
+ settings["password"][0] = parameters.Password;
+ settings["ssl"]["sni"] = parameters.Domain;
+
+ if (parameters.EnableWebSocket)
+ {
+ settings["websocket"]["enabled"] = true;
+ settings["websocket"]["path"] = parameters.WebSocketPath;
+ settings["websocket"]["host"] = parameters.Domain;
+ }
+
+ return JsonConvert.SerializeObject(settings, Formatting.Indented, new JsonSerializerSettings()
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ }
+
+ public static string BuildCaddyConfig(TrojanGoSettings parameters, bool useCustomWeb = false)
+ {
+ var caddyStr = CaddyFilePath;
+ caddyStr = caddyStr.Replace("##domain##", parameters.Domain);
+ caddyStr = caddyStr.Replace("##port##", WebPort.ToString());
+
+ if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
+ {
+ var prefix = "http://";
+ if (parameters.MaskDomain.StartsWith("https://"))
+ {
+ prefix = "https://";
+ }
+ var domain = parameters.MaskDomain
+ .TrimStart("http://".ToCharArray())
+ .TrimStart("https://".ToCharArray());
+
+ caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
+ }
+ else
+ {
+ caddyStr = caddyStr.Replace("##reverse_proxy##", "");
+ }
+
+ return caddyStr;
+ }
+ }
+
+}
diff --git a/ProxySuper.Core/Services/TrojanGoService.cs b/ProxySuper.Core/Services/TrojanGoService.cs
new file mode 100644
index 00000000..5a37d2e8
--- /dev/null
+++ b/ProxySuper.Core/Services/TrojanGoService.cs
@@ -0,0 +1,401 @@
+using Microsoft.Win32;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Services
+{
+ public class TrojanGoService : ServiceBase
+ {
+ public TrojanGoService(Host host, TrojanGoSettings settings) : base(host, settings)
+ {
+ }
+
+ public void Install()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Percentage = 0;
+ Progress.Step = "安装TrojanGo";
+ Progress.Desc = "安装TrojanGo";
+ EnsureRootUser();
+
+ if (FileExists("/usr/local/bin/trojan-go"))
+ {
+ var btnResult = MessageBox.Show("已经安装Trojan-Go,是否需要重装?", "提示", MessageBoxButton.YesNo);
+ if (btnResult == MessageBoxResult.No)
+ {
+ MessageBox.Show("安装终止", "提示");
+ return;
+ }
+ }
+
+ var index = 1;
+ Progress.Step = $"{index++}. 检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 10;
+
+ Progress.Step = $"{index++}. 安装必要的系统工具";
+ InstallSystemTools();
+ Progress.Percentage = 30;
+
+ Progress.Step = $"{index++}. 配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 40;
+
+ Progress.Step = $"{index++}. 检测网络环境";
+ EnsureNetwork();
+ Progress.Percentage = 50;
+
+ Progress.Step = $"{index++}. 检测域名是否解析到本机";
+ ValidateDomain();
+ Progress.Percentage = 60;
+
+ Progress.Step = $"{index++}. 安装Caddy服务";
+ InstallCaddy();
+ Progress.Percentage = 70;
+
+ Progress.Step = $"{index++}. 安装TrojanGo";
+ InstallTrojanGo();
+ Progress.Percentage = 80;
+
+ Progress.Step = $"{index++}. 上传Caddy配置文件";
+ UploadCaddySettings();
+ Progress.Percentage = 90;
+
+ Progress.Step = $"{index++}. 启动BBR";
+ EnableBBR();
+
+ Progress.Step = $"{index++}. 重启caddy服务";
+ RunCmd("systemctl restart caddy");
+
+ Progress.Desc = "启用Trojan-Go开机启动";
+ RunCmd("systemctl enable trojan-go");
+ RunCmd("systemctl restart trojan-go");
+
+ AppendCommand("分享连接:");
+ AppendCommand(ShareLink.BuildTrojanGo(Settings));
+
+ Progress.Percentage = 100;
+ Progress.Step = "安装成功";
+ Progress.Desc = string.Empty;
+
+ if (!Settings.WithTLS)
+ {
+ Progress.Step = "安装成功,请上传您的 TLS 证书。";
+ }
+ else
+ {
+ NavigationService.Navigate(Settings);
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Step = "卸载Trojgan-Go";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "停止Trojan—Go服务";
+ RunCmd("systemctl stop trojan-go");
+ Progress.Percentage = 40;
+
+
+ Progress.Desc = "卸载Caddy";
+ UninstallCaddy();
+ Progress.Percentage = 60;
+
+ Progress.Desc = "卸载Trojan-Go";
+ RunCmd("rm -rf /usr/local/bin/trojan-go");
+ RunCmd("rm -rf /usr/local/etc/trojan-go");
+ Progress.Percentage = 90;
+
+ Progress.Desc = "删除 acme.sh";
+ RunCmd("acme.sh --uninstall");
+ RunCmd("rm -r ~/.acme.sh");
+
+ Progress.Percentage = 100;
+ Progress.Step = "卸载Trojan-Go成功";
+ Progress.Desc = string.Empty;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateSettings()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "更新配置文件";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 30;
+
+ Progress.Desc = "更新配置文件";
+ UploadTrojanGoSettings();
+ Progress.Percentage = 70;
+
+ Progress.Desc = "重启caddy服务";
+ RunCmd("systemctl restart caddy");
+ Progress.Percentage = 80;
+
+ Progress.Desc = "重启Trojan-Go服务器";
+ RunCmd("systemctl restart trojan-go");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "更新配置成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UploadWeb()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadWeb;
+ fileDialog.ShowDialog();
+ }
+
+ public void UploadCert()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadCert;
+ fileDialog.ShowDialog();
+ }
+
+ public void ApplyForCert()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+
+ Progress.Step = "续签证书";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "安装TLS证书";
+ InstallCert(
+ dirPath: "/usr/local/etc/trojan-go",
+ certName: "trojan-go.crt",
+ keyName: "trojan-go.key");
+ Progress.Percentage = 90;
+
+ Progress.Desc = "重启Trojan-go服务";
+ RunCmd("systemctl restart trojan-go");
+
+ Progress.Percentage = 100;
+ Progress.Step = "续签证书成功";
+ Progress.Desc = "续签证书成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ #region 私有方法
+
+
+ private void DoUploadCert(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Percentage = 0;
+ Progress.Step = "上传自有证书";
+ Progress.Desc = "检测系统环境";
+
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ var oldFileName = $"ssl_{DateTime.Now.Ticks}";
+ RunCmd($"mv /usr/local/etc/trojan-go/ssl /usr/local/etc/trojan-go/{oldFileName}");
+
+ RunCmd("mkdir -p /usr/local/etc/trojan-go/ssl");
+ UploadFile(stream, "/usr/local/etc/trojan-go/ssl/ssl.zip");
+ RunCmd("unzip /usr/local/etc/trojan-go/ssl/ssl.zip -d /usr/local/etc/trojan-go/ssl");
+ }
+
+ var crtFiles = RunCmd("find /usr/local/etc/trojan-go/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ var keyFiles = RunCmd("find /usr/local/etc/trojan-go/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ if (crtFiles.Length > 0 && keyFiles.Length > 0)
+ {
+ RunCmd($"mv {crtFiles[0]} /usr/local/etc/trojan-go/ssl/trojan-go.crt");
+ RunCmd($"mv {keyFiles[0]} /usr/local/etc/trojan-go/ssl/trojan-go.key");
+ }
+ else
+ {
+ Progress.Step = "上传失败";
+ Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
+ return;
+ }
+
+ Progress.Desc = "重启trojan-go服务";
+ RunCmd("systemctl restart trojan-go");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "上传证书完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void DoUploadWeb(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Step = "上传静态网站";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "创建网站目录";
+ if (!FileExists("/usr/share/caddy"))
+ {
+ RunCmd("mkdir -p /usr/share/caddy");
+ }
+ RunCmd("rm -rf /usr/share/caddy/*");
+ Progress.Percentage = 40;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ UploadFile(stream, "/usr/share/caddy/caddy.zip");
+ RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
+ RunCmd("chmod -R 777 /usr/share/caddy");
+ Progress.Percentage = 700;
+ }
+
+ Progress.Desc = "上传Caddy配置文件";
+ UploadCaddySettings(useCustomWeb: true);
+ Progress.Percentage = 90;
+
+ Progress.Desc = "重启caddy服务";
+ RunCmd("systemctl restart caddy");
+ Progress.Percentage = 100;
+ Progress.Desc = "上传静态网站成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void UploadCaddySettings(bool useCustomWeb = false)
+ {
+ var config = TrojanGoConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
+ var stream = new MemoryStream(Encoding.UTF8.GetBytes(config));
+ if (FileExists("/etc/caddy/Caddyfile"))
+ {
+ RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
+ }
+ UploadFile(stream, "/etc/caddy/Caddyfile");
+ }
+
+ private void InstallTrojanGo()
+ {
+ RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh yes | bash");
+ var success = FileExists("/usr/local/bin/trojan-go");
+ if (success == false)
+ {
+ throw new Exception("trojan-go 安装失败,请联系开发者!");
+ }
+
+ Progress.Desc = "设置Trojan-Go权限";
+ RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/trojan-go.service");
+ RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/trojan-go.service");
+ RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/trojan-go.service");
+ RunCmd($"systemctl daemon-reload");
+
+ if (Settings.WithTLS)
+ {
+ Progress.Desc = "安装TLS证书";
+ InstallCert(
+ dirPath: "/usr/local/etc/trojan-go/ssl",
+ certName: "trojan-go.crt",
+ keyName: "trojan-go.key");
+ }
+
+ Progress.Desc = "上传Trojan-Go配置文件";
+ UploadTrojanGoSettings();
+ }
+
+ private void UploadTrojanGoSettings()
+ {
+ // 上传配置
+ Progress.Desc = "生成配置文件";
+ var settings = TrojanGoConfigBuilder.BuildTrojanGoConfig(Settings);
+ var stream = new MemoryStream(Encoding.UTF8.GetBytes(settings));
+
+ Progress.Desc = "正在上传配置文件";
+ UploadFile(stream, "/usr/local/etc/trojan-go/config.json");
+
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/ProxySuper.Core/Services/V2rayConfigBuilder.cs b/ProxySuper.Core/Services/V2rayConfigBuilder.cs
new file mode 100644
index 00000000..11885fd0
--- /dev/null
+++ b/ProxySuper.Core/Services/V2rayConfigBuilder.cs
@@ -0,0 +1,264 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Templates;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Services
+{
+ public class V2rayConfigBuilder
+ {
+ private static string ServerLog = V2rayConfigTemplates.ServerGeneralConfig_log;
+ private static string ServerDns = V2rayConfigTemplates.ServerGeneralConfig_dns;
+ private static string ServerRouting = V2rayConfigTemplates.ServerGeneralConfig_routing_BlockPrivateIP;
+ private static string ServerInbounds = V2rayConfigTemplates.ServerGeneralConfig_inbounds;
+ private static string ServerOutbounds = V2rayConfigTemplates.ServerGeneralConfig_outbounds;
+ private static string CaddyFile = CaddyFiles.BaseCaddyFile;
+
+ public static int VLESS_TCP_Port = 1110;
+ public static int VLESS_WS_Port = 1111;
+ public static int VLESS_H2_Port = 1112;
+
+ public static int VMESS_TCP_Port = 1210;
+ public static int VMESS_WS_Port = 1211;
+ public static int VMESS_H2_Port = 1212;
+
+ public static int Trojan_TCP_Port = 1310;
+ public static int Trojan_WS_Port = 1311;
+
+ public static int FullbackPort = 8080;
+
+
+
+ public static dynamic LoadV2rayConfig()
+ {
+
+ dynamic logObj = LoadJsonObj(ServerLog);
+ dynamic dnsObj = LoadJsonObj(ServerDns);
+ dynamic routingObj = LoadJsonObj(ServerRouting);
+ dynamic inboundsObj = LoadJsonObj(ServerInbounds);
+ dynamic outboundsObj = LoadJsonObj(ServerOutbounds);
+
+ return new
+ {
+ log = logObj["log"],
+ dns = dnsObj["dns"],
+ routing = routingObj["routing"],
+ inbounds = inboundsObj["inbounds"],
+ outbounds = outboundsObj["outbounds"]
+ };
+ }
+
+ public static string BuildCaddyConfig(V2raySettings parameters, bool useCustomWeb = false)
+ {
+ var caddyStr = CaddyFile;// File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
+ caddyStr = caddyStr.Replace("##domain##", parameters.IsIPAddress ? "" : parameters.Domain);
+ caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
+
+ if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
+ {
+ var prefix = "http://";
+ if (parameters.MaskDomain.StartsWith("https://"))
+ {
+ prefix = "https://";
+ }
+ var domain = parameters.MaskDomain
+ .TrimStart("http://".ToCharArray())
+ .TrimStart("https://".ToCharArray());
+
+ caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
+ }
+ else
+ {
+ caddyStr = caddyStr.Replace("##reverse_proxy##", "");
+ }
+
+ return caddyStr;
+ }
+
+ private static void SetClients(dynamic bound, List uuidList)
+ {
+ bound.settings.clients.Clear();
+ uuidList.ForEach(id =>
+ {
+ object obj;
+
+ obj = new { id = id };
+
+ bound.settings.clients.Add(JToken.FromObject(obj));
+ });
+ }
+
+
+ public static string BuildV2rayConfig(V2raySettings parameters)
+ {
+ var uuidList = new List();
+ uuidList.Add(parameters.UUID);
+ uuidList.AddRange(parameters.MulitUUID);
+
+ var xrayConfig = LoadV2rayConfig();
+
+ var baseBound = LoadJsonObj(V2rayConfigTemplates.VLESS_TCP_TLS_ServerConfig);//GetBound("VLESS_TCP_TLS.json");
+ baseBound.port = parameters.Port;
+ baseBound.settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = FullbackPort
+ }));
+ xrayConfig.inbounds.Add(baseBound);
+ SetClients(baseBound, uuidList);
+
+ #region Fullbacks
+
+ if (parameters.Types.Contains(V2RayType.VLESS_WS))
+ {
+ var wsInbound = LoadJsonObj(V2rayConfigTemplates.VLESS_WS_ServerConfig); //GetBound("VLESS_WS.json");
+ wsInbound.port = VLESS_WS_Port;
+ SetClients(wsInbound, uuidList);
+ wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
+ baseBound.settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = VLESS_WS_Port,
+ path = parameters.VLESS_WS_Path,
+ xver = 1,
+ }));
+ xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
+ }
+
+ if (parameters.Types.Contains(V2RayType.VMESS_TCP))
+ {
+ var mtcpBound = LoadJsonObj(V2rayConfigTemplates.VMESS_TCP_ServerConfig); //GetBound("VMESS_TCP.json");
+ mtcpBound.port = VMESS_TCP_Port;
+ SetClients(mtcpBound, uuidList);
+ mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
+ baseBound.settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = VMESS_TCP_Port,
+ path = parameters.VMESS_TCP_Path,
+ xver = 1,
+ }));
+ xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
+ }
+
+ if (parameters.Types.Contains(V2RayType.VMESS_WS))
+ {
+ var mwsBound = LoadJsonObj(V2rayConfigTemplates.VMESS_WS_ServerConfig); //GetBound("VMESS_WS.json");
+ mwsBound.port = VMESS_WS_Port;
+ SetClients(mwsBound, uuidList);
+ mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
+ baseBound.settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = VMESS_WS_Port,
+ path = parameters.VMESS_WS_Path,
+ xver = 1,
+ }));
+ xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
+ }
+
+ if (parameters.Types.Contains(V2RayType.Trojan_TCP))
+ {
+ var trojanTcpBound = LoadJsonObj(V2rayConfigTemplates.Trojan_ServerConfig); //GetBound("Trojan_TCP.json");
+ trojanTcpBound.port = Trojan_TCP_Port;
+ trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
+ trojanTcpBound.settings.fallbacks[0].dest = FullbackPort;
+ baseBound.settings.fallbacks[0] = JToken.FromObject(new
+ {
+ dest = Trojan_TCP_Port,
+ xver = 1,
+ });
+ xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
+ }
+ #endregion
+
+ #region VLESS GRPC
+ if (parameters.Types.Contains(V2RayType.VLESS_gRPC))
+ {
+ var gRPCInBound = LoadJsonObj(V2rayConfigTemplates.VLESS_gRPC_ServerConfig); //GetBound("VLESS_gRPC.json");
+ gRPCInBound.port = parameters.VLESS_gRPC_Port;
+ SetClients(gRPCInBound, uuidList);
+ gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
+ gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
+ xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
+ }
+ #endregion
+
+ #region VLESS KCP
+ if (parameters.Types.Contains(V2RayType.VLESS_KCP))
+ {
+ var kcpBound = LoadJsonObj(V2rayConfigTemplates.VLESS_KCP_ServerConfig); //GetBound("VLESS_KCP.json");
+ kcpBound.port = parameters.VLESS_KCP_Port;
+ SetClients(kcpBound, uuidList);
+ kcpBound.streamSettings.kcpSettings.header.type = parameters.VLESS_KCP_Type;
+ kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed;
+ xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
+ }
+ #endregion
+
+ #region VLESS QUIC
+ if (parameters.Types.Contains(V2RayType.VLESS_QUIC))
+ {
+ var quicBound = LoadJsonObj(V2rayConfigTemplates.VLESS_QUIC_ServerConfig); //GetBound("VLESS_QUIC.json");
+ quicBound.port = parameters.VLESS_QUIC_Port;
+ SetClients(quicBound, uuidList);
+ quicBound.streamSettings.quicSettings.security = parameters.VLESS_QUIC_Security;
+ quicBound.streamSettings.quicSettings.key = parameters.VLESS_QUIC_Key;
+ quicBound.streamSettings.quicSettings.header.type = parameters.VLESS_QUIC_Type;
+ xrayConfig.inbounds.Add(JToken.FromObject(quicBound));
+ }
+ #endregion
+
+ #region VMESS KCP
+ if (parameters.Types.Contains(V2RayType.VMESS_KCP))
+ {
+ var kcpBound = LoadJsonObj(V2rayConfigTemplates.VMESS_KCP_ServerConfig); //GetBound("VMESS_KCP.json");
+ kcpBound.port = parameters.VMESS_KCP_Port;
+ SetClients(kcpBound, uuidList);
+ kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
+ kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
+ xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
+ }
+ #endregion
+
+ #region VMESS QUIC
+ if (parameters.Types.Contains(V2RayType.VMESS_QUIC))
+ {
+ var quicBound = LoadJsonObj(V2rayConfigTemplates.VMESS_QUIC_ServerConfig); //GetBound("VMESS_QUIC.json");
+ quicBound.port = parameters.VMESS_QUIC_Port;
+ SetClients(quicBound, uuidList);
+ quicBound.streamSettings.quicSettings.security = parameters.VMESS_QUIC_Security;
+ quicBound.streamSettings.quicSettings.key = parameters.VMESS_QUIC_Key;
+ quicBound.streamSettings.quicSettings.header.type = parameters.VMESS_QUIC_Type;
+ xrayConfig.inbounds.Add(JToken.FromObject(quicBound));
+ }
+ #endregion
+
+ #region Shadowsocks
+ if (parameters.Types.Contains(V2RayType.ShadowsocksAEAD))
+ {
+ var ssBound = LoadJsonObj(V2rayConfigTemplates.Shadowsocks_ServerConfig); //GetBound("Shadowsocks-AEAD.json");
+ ssBound.port = parameters.ShadowSocksPort;
+ ssBound.settings.password = parameters.ShadowSocksPassword;
+ ssBound.settings.method = parameters.ShadowSocksMethod;
+ xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
+ }
+ #endregion
+
+ return JsonConvert.SerializeObject(
+ xrayConfig,
+ Formatting.Indented,
+ new JsonSerializerSettings()
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ }
+
+ private static dynamic LoadJsonObj(string jsonStr)
+ {
+ return JToken.Parse(jsonStr);
+ }
+ }
+}
diff --git a/ProxySuper.Core/Services/V2rayService.cs b/ProxySuper.Core/Services/V2rayService.cs
new file mode 100644
index 00000000..73479d8b
--- /dev/null
+++ b/ProxySuper.Core/Services/V2rayService.cs
@@ -0,0 +1,449 @@
+using Microsoft.Win32;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Services
+{
+ public class V2rayService : ServiceBase
+ {
+ public V2rayService(Host host, V2raySettings settings) : base(host, settings)
+ {
+ }
+
+ public void Install()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ int index = 1;
+ EnsureRootUser();
+
+ if (FileExists("/usr/local/bin/v2ray"))
+ {
+ var btnResult = MessageBox.Show("已经安装v2ray,是否需要重装?", "提示", MessageBoxButton.YesNo);
+ if (btnResult == MessageBoxResult.No)
+ {
+ MessageBox.Show("安装终止", "提示");
+ return;
+ }
+ }
+
+ Progress.Step = $"{index++}. 检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 5;
+
+ Progress.Step = $"{index++}. 安装必要的系统工具";
+ InstallSystemTools();
+ Progress.Percentage = 15;
+
+ Progress.Step = $"{index++}. 配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 20;
+
+ Progress.Step = $"{index++}. 检测网络环境";
+ EnsureNetwork();
+ if (Settings.IsIPAddress)
+ {
+ Progress.Desc = ("检查域名是否解析正确");
+ ValidateDomain();
+ }
+ Progress.Percentage = 25;
+
+ Progress.Step = $"{index}. 同步系统和本地时间";
+ SyncTimeDiff();
+ Progress.Percentage = 30;
+
+ Progress.Step = $"{index++}. 安装Caddy服务器";
+ InstallCaddy();
+ Progress.Percentage = 50;
+
+ Progress.Step = $"{index++}. 安装V2ray-Core";
+ InstallV2ray();
+ Progress.Percentage = 80;
+
+ Progress.Step = $"{index++}. 上传Web服务器配置";
+ UploadCaddyFile();
+ Progress.Percentage = 90;
+
+ Progress.Step = $"{index++}. 启动BBR";
+ EnableBBR();
+
+ Progress.Desc = "重启V2ray服务";
+
+ RunCmd("systemctl restart caddy");
+ RunCmd("systemctl restart v2ray");
+
+ Progress.Percentage = 100;
+ Progress.Step = "安装成功";
+ Progress.Desc = string.Empty;
+
+ if (!Settings.WithTLS)
+ {
+ Progress.Step = "安装成功,请上传您的 TLS 证书。";
+ }
+ else
+ {
+ NavigationService.Navigate(Settings);
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateSettings()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "更新V2ray配置";
+ Progress.Percentage = 0;
+ EnsureRootUser();
+ var index = 0;
+
+ Progress.Desc = $"{index++}. 检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = $"{index++}. 配置防火墙";
+ RunCmd("systemctl stop v2ray");
+ RunCmd("systemctl stop caddy");
+ ConfigFirewalld();
+ Progress.Percentage = 40;
+
+ Progress.Desc = $"{index++}. 上传V2ray配置文件";
+ var configJson = V2rayConfigBuilder.BuildV2rayConfig(Settings);
+ WriteToFile(configJson, "/usr/local/etc/v2ray/config.json");
+ Progress.Percentage = 70;
+
+ Progress.Desc = $"{index++}. 上传Caddy配置文件";
+ UploadCaddyFile();
+ Progress.Percentage = 90;
+
+ Progress.Desc = $"{index++}. 重启v2ray服务";
+ RunCmd("systemctl restart caddy");
+ RunCmd("systemctl restart v2ray");
+ Progress.Percentage = 100;
+
+ Progress.Desc = ("更新配置成功");
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateV2rayCore()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "更新V2ray-Core";
+ Progress.Percentage = 0;
+
+ EnsureRootUser();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "下载最新版本V2ray-Core";
+ EnsureSystemEnv();
+ Progress.Percentage = 40;
+
+ RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
+ RunCmd("systemctl restart v2ray");
+ Progress.Percentage = 100;
+
+ Progress.Desc = "更新V2ray-Core成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ var index = 1;
+ Progress.Percentage = 0;
+
+ Progress.Step = $"{index++}. 检测系统环境";
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Step = $"{index++}. 卸载Caddy服务";
+ UninstallCaddy();
+ Progress.Percentage = 40;
+
+ Progress.Step = $"{index++}. 卸载V2ray服务";
+ UninstallV2ray();
+ Progress.Percentage = 60;
+
+ Progress.Step = $"{index++}. 卸载Acme证书申请服务";
+ UninstallAcme();
+ Progress.Percentage = 80;
+
+ Progress.Step = $"{index++}. 重置防火墙端口";
+ ResetFirewalld();
+ Progress.Percentage = 100;
+
+ Progress.Step = "卸载完成";
+ Progress.Desc = "卸载完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UploadCert()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadCert;
+ fileDialog.ShowDialog();
+ }
+
+ public void UploadWeb()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadWeb;
+ fileDialog.ShowDialog();
+ }
+
+ public void ApplyForCert()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Percentage = 0;
+ Progress.Step = "续签证书";
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+
+ Progress.Desc = "安装证书";
+ InstallCert(
+ dirPath: "/usr/local/etc/v2ray/ssl",
+ certName: "v2ray_ssl.crt",
+ keyName: "v2ray_ssl.key");
+
+ Progress.Percentage = 90;
+ Progress.Desc = "重启服务";
+ RunCmd("systemctl restart v2ray");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "续签证书成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+
+ #region 似有方法
+
+ private void DoUploadCert(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Percentage = 0;
+ Progress.Step = "上传自有证书";
+ Progress.Desc = "检测系统环境";
+
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ var oldFileName = $"ssl_{DateTime.Now.Ticks}";
+ RunCmd($"mv /usr/local/etc/v2ray/ssl /usr/local/etc/v2ray/{oldFileName}");
+
+ RunCmd("mkdir -p /usr/local/etc/v2ray/ssl");
+ UploadFile(stream, "/usr/local/etc/v2ray/ssl/ssl.zip");
+ RunCmd("unzip /usr/local/etc/v2ray/ssl/ssl.zip -d /usr/local/etc/v2ray/ssl");
+ }
+
+ var crtFiles = RunCmd("find /usr/local/etc/v2ray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ var keyFiles = RunCmd("find /usr/local/etc/v2ray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ if (crtFiles.Length > 0 && keyFiles.Length > 0)
+ {
+ RunCmd($"mv {crtFiles[0]} /usr/local/etc/v2ray/ssl/v2ray_ssl.crt");
+ RunCmd($"mv {keyFiles[0]} /usr/local/etc/v2ray/ssl/v2ray_ssl.key");
+ }
+ else
+ {
+ Progress.Step = "上传失败";
+ Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
+ return;
+ }
+
+ Progress.Desc = "重启V2ray服务";
+ RunCmd("systemctl restart v2ray");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "上传证书完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void DoUploadWeb(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Step = "上传静态网站";
+ Progress.Desc = "上传静态网站";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "创建网站目录";
+ if (!FileExists("/usr/share/caddy"))
+ {
+ RunCmd("mkdir -p /usr/share/caddy");
+ }
+ RunCmd("rm -rf /usr/share/caddy/*");
+ Progress.Percentage = 40;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ UploadFile(stream, "/usr/share/caddy/caddy.zip");
+ RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
+ }
+ RunCmd("chmod -R 777 /usr/share/caddy");
+ Progress.Percentage = 80;
+
+ Progress.Desc = "上传Web配置文件";
+ UploadCaddyFile(useCustomWeb: true);
+ Progress.Percentage = 90;
+
+ Progress.Desc = "重启caddy服务";
+ RunCmd("systemctl restart caddy");
+ Progress.Percentage = 100;
+
+ Progress.Desc = "上传静态网站成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void InstallV2ray()
+ {
+ Progress.Desc = ("开始安装V2ray-Core");
+ RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
+
+ if (!FileExists("/usr/local/bin/v2ray"))
+ {
+ Progress.Desc = ("V2ray-Core安装失败,请联系开发者");
+ throw new Exception("V2ray-Core安装失败,请联系开发者");
+ }
+
+ Progress.Desc = ("设置V2ray-Core权限");
+ RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/v2ray.service");
+ RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/v2ray.service");
+ RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/v2ray.service");
+ RunCmd($"systemctl daemon-reload");
+ RunCmd("systemctl enable v2ray");
+
+ if (FileExists("/usr/local/etc/v2ray/config.json"))
+ {
+ RunCmd(@"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1");
+ }
+ Progress.Percentage = 60;
+
+ if (Settings.WithTLS && !Settings.IsIPAddress)
+ {
+ Progress.Desc = ("安装TLS证书");
+ InstallCert(
+ dirPath: "/usr/local/etc/v2ray/ssl",
+ certName: "v2ray_ssl.crt",
+ keyName: "v2ray_ssl.key");
+ Progress.Percentage = 75;
+ }
+
+ Progress.Desc = ("生成v2ray服务器配置文件");
+ var configJson = V2rayConfigBuilder.BuildV2rayConfig(Settings);
+ WriteToFile(configJson, "/usr/local/etc/v2ray/config.json");
+ }
+
+ private void UploadCaddyFile(bool useCustomWeb = false)
+ {
+ var configJson = V2rayConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
+
+ if (FileExists("/etc/caddy/Caddyfile"))
+ {
+ RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
+ }
+ WriteToFile(configJson, "/etc/caddy/Caddyfile");
+ }
+
+
+ private void UninstallV2ray()
+ {
+ Progress.Desc = "关闭V2ray服务";
+ RunCmd("systemctl stop v2ray");
+ RunCmd("systemctl disable v2ray");
+
+ Progress.Desc = "卸载V2ray";
+ RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove");
+ }
+
+ private void UninstallAcme()
+ {
+ Progress.Desc = "卸载 acme.sh";
+ RunCmd("acme.sh --uninstall");
+
+ Progress.Desc = "删除 acme.sh 相关文件";
+ RunCmd("rm -rf ~/.acme.sh");
+ }
+
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/Services/XrayConfigBuilder.cs b/ProxySuper.Core/Services/XrayConfigBuilder.cs
new file mode 100644
index 00000000..c766c321
--- /dev/null
+++ b/ProxySuper.Core/Services/XrayConfigBuilder.cs
@@ -0,0 +1,245 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Templates;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace ProxySuper.Core.Services
+{
+ public class XrayConfigBuilder
+ {
+ private static string ServerLog = XrayConfigTemplates.ServerGeneralConfig_log;
+ private static string ServerDns = XrayConfigTemplates.ServerGeneralConfig_dns;
+ private static string ServerRouting = XrayConfigTemplates.ServerGeneralConfig_routing_BlockPrivateIP;
+ private static string ServerInbounds = XrayConfigTemplates.ServerGeneralConfig_inbounds;
+ private static string ServerOutbounds = XrayConfigTemplates.ServerGeneralConfig_outbounds;
+ private static string CaddyFile = CaddyFiles.BaseCaddyFile;
+
+ public static int VLESS_WS_Port = 1111;
+ //public static int VLESS_XHTTP_Port ;
+
+ public static int Trojan_TCP_Port = 1310;
+ public static int Trojan_WS_Port = 1311;
+
+ public static int FullbackPort = 8080;
+
+
+
+ public static dynamic LoadXrayConfig()
+ {
+ dynamic logObj = LoadJsonObj(ServerLog);
+ dynamic dnsObj = LoadJsonObj(ServerDns);
+ dynamic routingObj = LoadJsonObj(ServerRouting);
+ dynamic inboundsObj = LoadJsonObj(ServerInbounds);
+ dynamic outboundsObj = LoadJsonObj(ServerOutbounds);
+
+ return new
+ {
+ log = logObj["log"],
+ dns = dnsObj["dns"],
+ routing = routingObj["routing"],
+ inbounds = inboundsObj["inbounds"],
+ outbounds = outboundsObj["outbounds"]
+ };
+ }
+
+ public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb = false)
+ {
+ var caddyStr = CaddyFile;
+ caddyStr = caddyStr.Replace("##domain##", parameters.IsIPAddress ? "" : parameters.Domain);
+ caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
+
+ if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
+ {
+ var prefix = "http://";
+ if (parameters.MaskDomain.StartsWith("https://"))
+ {
+ prefix = "https://";
+ }
+ var domain = parameters.MaskDomain
+ .TrimStart("http://".ToCharArray())
+ .TrimStart("https://".ToCharArray())
+ .TrimEnd('/');
+
+ caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
+ }
+ else
+ {
+ caddyStr = caddyStr.Replace("##reverse_proxy##", "");
+ }
+
+ return caddyStr;
+ }
+
+ private static void SetClients(dynamic bound, List uuidList, bool withXtls = false, string flow = "")
+ {
+ bound.settings.clients.Clear();
+ uuidList.ForEach(id =>
+ {
+ object obj;
+ if (!withXtls)
+ {
+ obj = new { id = id };
+ }
+ else
+ {
+ flow = "xtls-rprx-vision";//Xray不再同时兼容普通tls与xtls。服务端与客户端必须一致。
+ obj = new { id = id, flow = flow };
+ }
+
+ bound.settings.clients.Add(JToken.FromObject(obj));
+ });
+ }
+
+ public static string BuildXrayConfig(XraySettings parameters)
+ {
+ var uuidList = new List();
+ uuidList.Add(parameters.UUID);
+ uuidList.AddRange(parameters.MulitUUID);
+
+ var xrayConfig = LoadXrayConfig();
+
+ #region VLESS_XTLS_REALITY
+
+ if (parameters.Types.Contains(XrayType.VLESS_XTLS_RAW_REALITY))
+ {
+ var xtlsRealityBound = LoadJsonObj(XrayConfigTemplates.VLESS_XTLS_RAW_REALITY_ServerConfig);
+ xtlsRealityBound.inbounds[0].port = parameters.Port;
+ xtlsRealityBound.inbounds[0].settings.port = 4431;//parameters.Port;
+ xtlsRealityBound.inbounds[1].port = 4431;//parameters.Port;
+ xtlsRealityBound.inbounds[1].settings.clients[0].id = parameters.UUID;
+ xtlsRealityBound.inbounds[1].streamSettings.realitySettings.target = parameters.MaskDomain + ":443";
+ xtlsRealityBound.inbounds[1].streamSettings.realitySettings.serverNames[0] = parameters.MaskDomain;
+ xtlsRealityBound.inbounds[1].streamSettings.realitySettings.privateKey = parameters.REALITY_privateKey;
+ xtlsRealityBound.routing.rules[0].domain[0] = parameters.MaskDomain;
+ xtlsRealityBound.Merge(JToken.Parse(XrayConfigTemplates.ServerGeneralConfig_log));
+ xtlsRealityBound.Merge(JToken.Parse(XrayConfigTemplates.ServerGeneralConfig_outbounds));
+ SetClients(xtlsRealityBound.inbounds[1], uuidList, withXtls: true, flow: parameters.Flow);
+ xrayConfig = xtlsRealityBound;
+ }
+
+ #endregion
+
+ #region VLESS_XHTTP
+
+ if (parameters.Types.Contains(XrayType.VLESS_XHTTP))
+ {
+ var xhttpInbound = LoadJsonObj(XrayConfigTemplates.VLESS_XHTTP_ServerConfig);
+ xhttpInbound.port = parameters.Port;
+ xhttpInbound.settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = FullbackPort
+ }));
+ SetClients(xhttpInbound, uuidList);
+ xhttpInbound.streamSettings.xhttpSettings.path = parameters.VLESS_XHTTP_Path;
+ xrayConfig.inbounds.Add(JToken.FromObject(xhttpInbound));
+ }
+
+ #endregion
+
+ #region VLESS_XTLS
+ if (parameters.Types.Contains(XrayType.VLESS_RAW_XTLS) || parameters.Types.Contains(XrayType.VLESS_WS) || parameters.Types.Contains(XrayType.Trojan_TCP))
+ {
+ var xtlsBound = LoadJsonObj(XrayConfigTemplates.VLESS_XTLS_ServerConfig);
+ xtlsBound.port = parameters.Port;
+ xtlsBound.settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = FullbackPort
+ }));
+ SetClients(xtlsBound, uuidList, withXtls: true, flow: parameters.Flow);
+ xrayConfig.inbounds.Add(xtlsBound);
+ }
+ #endregion
+
+ #region VLESS_WS
+
+ if (parameters.Types.Contains(XrayType.VLESS_WS))
+ {
+ var wsInbound = LoadJsonObj(XrayConfigTemplates.VLESS_WS_ServerConfig);
+ wsInbound.port = VLESS_WS_Port;
+ SetClients(wsInbound, uuidList);
+ wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
+ xrayConfig.inbounds[0].settings.fallbacks.Add(JToken.FromObject(new
+ {
+ dest = VLESS_WS_Port,
+ path = parameters.VLESS_WS_Path,
+ xver = 1,
+ }));
+ xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
+ }
+
+ #endregion
+
+ #region Trojan_TCP
+
+ if (parameters.Types.Contains(XrayType.Trojan_TCP))
+ {
+ var trojanTcpBound = LoadJsonObj(XrayConfigTemplates.Trojan_ServerConfig);
+ trojanTcpBound.port = Trojan_TCP_Port;
+ trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
+ trojanTcpBound.settings.fallbacks[0].dest = FullbackPort;
+ xrayConfig.inbounds[0].settings.fallbacks[0] = JToken.FromObject(new
+ {
+ dest = Trojan_TCP_Port,
+ xver = 1,
+ });
+ xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
+ }
+ #endregion
+
+ #region VLESS GRPC
+ if (parameters.Types.Contains(XrayType.VLESS_gRPC))
+ {
+ var gRPCInBound = LoadJsonObj(XrayConfigTemplates.VLESS_gRPC_ServerConfig);
+ gRPCInBound.port = parameters.VLESS_gRPC_Port;
+ SetClients(gRPCInBound, uuidList);
+ gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
+ gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
+ xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
+ }
+ #endregion
+
+ #region VMESS KCP
+ if (parameters.Types.Contains(XrayType.VMESS_KCP))
+ {
+ var kcpBound = LoadJsonObj(XrayConfigTemplates.VMESS_KCP_ServerConfig);
+ kcpBound.port = parameters.VMESS_KCP_Port;
+ SetClients(kcpBound, uuidList);
+ kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
+ kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
+ xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
+ }
+ #endregion
+
+ #region Shadowsocks
+ if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
+ {
+ var ssBound = LoadJsonObj(XrayConfigTemplates.Shadowsocks_ServerConfig);
+ ssBound.port = parameters.ShadowSocksPort;
+ ssBound.settings.password = parameters.ShadowSocksPassword;
+ ssBound.settings.method = parameters.ShadowSocksMethod;
+ xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
+ }
+ #endregion
+
+ return JsonConvert.SerializeObject(
+ xrayConfig,
+ Formatting.Indented,
+ new JsonSerializerSettings()
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ }
+
+
+ private static dynamic LoadJsonObj(string jsonStr)
+ {
+ return JToken.Parse(jsonStr);
+ }
+
+ }
+
+}
diff --git a/ProxySuper.Core/Services/XrayService.cs b/ProxySuper.Core/Services/XrayService.cs
new file mode 100644
index 00000000..5933cf5b
--- /dev/null
+++ b/ProxySuper.Core/Services/XrayService.cs
@@ -0,0 +1,453 @@
+using Microsoft.Win32;
+using ProxySuper.Core.Helpers;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.Services
+{
+ public class XrayService : ServiceBase
+ {
+
+ public XrayService(Host host, XraySettings settings) : base(host, settings)
+ {
+ }
+
+ public void Install()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ int index = 1;
+ EnsureRootUser();
+
+ if (FileExists("/usr/local/bin/xray"))
+ {
+ var btnResult = MessageBox.Show("已经安装Xray,是否需要重装?", "提示", MessageBoxButton.YesNo);
+ if (btnResult == MessageBoxResult.No)
+ {
+ MessageBox.Show("安装终止", "提示");
+ return;
+ }
+ }
+
+ Progress.Step = $"{index++}. 检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 5;
+
+ Progress.Step = $"{index++}. 安装必要的系统工具";
+ InstallSystemTools();
+ Progress.Percentage = 15;
+
+ Progress.Step = $"{index++}. 配置防火墙";
+ ConfigFirewalld();
+ Progress.Percentage = 20;
+
+ Progress.Step = $"{index++}. 检测网络环境";
+ EnsureNetwork();
+ if (Settings.IsIPAddress)
+ {
+ Progress.Desc = ("检查域名是否解析正确");
+ ValidateDomain();
+ }
+ Progress.Percentage = 25;
+
+ Progress.Step = $"{index}. 同步系统和本地时间";
+ SyncTimeDiff();
+ Progress.Percentage = 30;
+
+ Progress.Step = $"{index++}. 安装Caddy服务器";
+ InstallCaddy();
+ Progress.Percentage = 50;
+
+ Progress.Step = $"{index++}. 安装Xray-Core";
+ InstallXray();
+ Progress.Percentage = 80;
+
+ Progress.Step = $"{index++}. 上传Web服务器配置";
+ UploadCaddyFile();
+ Progress.Percentage = 90;
+
+ Progress.Step = $"{index++}. 启动BBR";
+ EnableBBR();
+
+ Progress.Desc = "重启Xray服务";
+ RunCmd("systemctl restart caddy");
+ RunCmd("systemctl restart xray");
+
+ Progress.Percentage = 100;
+ Progress.Step = "安装成功";
+ Progress.Desc = string.Empty;
+
+ if (!Settings.WithTLS && (Settings.Types.Contains(XrayType.VLESS_RAW_XTLS)
+ || Settings.Types.Contains(XrayType.VLESS_WS)
+ || Settings.Types.Contains(XrayType.VLESS_gRPC)
+ || Settings.Types.Contains(XrayType.Trojan_TCP)
+ )
+ )
+ {
+ Progress.Step = "安装成功,请上传您的 TLS 证书。";
+ }
+ else
+ {
+ NavigationService.Navigate(Settings);
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateSettings()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "更新Xray配置";
+ Progress.Percentage = 0;
+ EnsureRootUser();
+ var index = 0;
+
+ Progress.Desc = $"{index++}. 检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = $"{index++}. 配置防火墙";
+ RunCmd("systemctl stop xray");
+ RunCmd("systemctl stop caddy");
+ ConfigFirewalld();
+ Progress.Percentage = 40;
+
+ Progress.Desc = $"{index++}. 上传Xray配置文件";
+ var configJson = XrayConfigBuilder.BuildXrayConfig(Settings);
+ WriteToFile(configJson, "/usr/local/etc/xray/config.json");
+ Progress.Percentage = 70;
+
+ Progress.Desc = $"{index++}. 上传Caddy配置文件";
+ UploadCaddyFile();
+ Progress.Percentage = 90;
+
+ Progress.Desc = $"{index++}. 重启xray服务";
+ RunCmd("systemctl restart caddy");
+ RunCmd("systemctl restart xray");
+ Progress.Percentage = 100;
+
+ Progress.Desc = ("更新配置成功");
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UpdateXrayCore()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Step = "更新Xray-Core";
+ Progress.Percentage = 0;
+
+ EnsureRootUser();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "下载最新版本Xray-Core";
+ EnsureSystemEnv();
+ Progress.Percentage = 40;
+
+ RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
+ RunCmd("systemctl restart xray");
+ Progress.Percentage = 100;
+
+ Progress.Desc = "更新Xray-Core成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void Uninstall()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ var index = 1;
+ Progress.Percentage = 0;
+
+ Progress.Step = $"{index++}. 检测系统环境";
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Step = $"{index++}. 卸载Caddy服务";
+ UninstallCaddy();
+ Progress.Percentage = 40;
+
+ Progress.Step = $"{index++}. 卸载Xray服务";
+ UninstallXray();
+ Progress.Percentage = 60;
+
+ Progress.Step = $"{index++}. 卸载Acme证书申请服务";
+ UninstallAcme();
+ Progress.Percentage = 80;
+
+ Progress.Step = $"{index++}. 重置防火墙端口";
+ ResetFirewalld();
+ Progress.Percentage = 100;
+
+ Progress.Step = "卸载完成";
+ Progress.Desc = "卸载完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ public void UploadCert()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadCert;
+ fileDialog.ShowDialog();
+ }
+
+ public void UploadWeb()
+ {
+ var fileDialog = new OpenFileDialog();
+ fileDialog.Filter = "压缩文件|*.zip";
+ fileDialog.FileOk += DoUploadWeb;
+ fileDialog.ShowDialog();
+ }
+
+ public void ApplyForCert()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ Progress.Percentage = 0;
+ Progress.Step = "续签证书";
+
+ Progress.Desc = "检测系统环境";
+ EnsureRootUser();
+ EnsureSystemEnv();
+
+ Progress.Desc = "安装证书";
+ InstallCert(
+ dirPath: "/usr/local/etc/xray/ssl",
+ certName: "xray_ssl.crt",
+ keyName: "xray_ssl.key");
+
+ Progress.Percentage = 90;
+ Progress.Desc = "重启服务";
+ RunCmd("systemctl restart xray");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "续签证书成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+
+ #region 私有方法
+
+ private void DoUploadCert(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Percentage = 0;
+ Progress.Step = "上传自有证书";
+ Progress.Desc = "检测系统环境";
+
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ var oldFileName = $"ssl_{DateTime.Now.Ticks}";
+ RunCmd($"mv /usr/local/etc/xray/ssl /usr/local/etc/xray/{oldFileName}");
+
+ RunCmd("mkdir -p /usr/local/etc/xray/ssl");
+ UploadFile(stream, "/usr/local/etc/xray/ssl/ssl.zip");
+ RunCmd("unzip /usr/local/etc/xray/ssl/ssl.zip -d /usr/local/etc/xray/ssl");
+ }
+
+ var crtFiles = RunCmd("find /usr/local/etc/xray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ var keyFiles = RunCmd("find /usr/local/etc/xray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ if (crtFiles.Length > 0 && keyFiles.Length > 0)
+ {
+ RunCmd($"mv {crtFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.crt");
+ RunCmd($"mv {keyFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.key");
+ }
+ else
+ {
+ Progress.Step = "上传失败";
+ Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
+ return;
+ }
+
+ Progress.Desc = "重启Xray服务";
+ RunCmd("systemctl restart xray");
+
+ Progress.Percentage = 100;
+ Progress.Desc = "上传证书完成";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void DoUploadWeb(object sender, CancelEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ EnsureRootUser();
+
+ Progress.Step = "上传静态网站";
+ Progress.Desc = "上传静态网站";
+ Progress.Percentage = 0;
+
+ Progress.Desc = "检测系统环境";
+ EnsureSystemEnv();
+ Progress.Percentage = 20;
+
+ Progress.Desc = "创建网站目录";
+ if (!FileExists("/usr/share/caddy"))
+ {
+ RunCmd("mkdir -p /usr/share/caddy");
+ }
+ RunCmd("rm -rf /usr/share/caddy/*");
+ Progress.Percentage = 40;
+
+ Progress.Desc = "正在上传文件";
+ var file = sender as OpenFileDialog;
+ using (var stream = file.OpenFile())
+ {
+ UploadFile(stream, "/usr/share/caddy/caddy.zip");
+ RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
+ }
+ RunCmd("chmod -R 777 /usr/share/caddy");
+ Progress.Percentage = 80;
+
+ Progress.Desc = "上传Web配置文件";
+ UploadCaddyFile(useCustomWeb: true);
+ Progress.Percentage = 90;
+
+ Progress.Desc = "重启caddy服务";
+ RunCmd("systemctl restart caddy");
+ Progress.Percentage = 100;
+
+ Progress.Desc = "上传静态网站成功";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
+
+ private void InstallXray()
+ {
+ Progress.Desc = ("开始安装Xray-Core");
+ RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
+
+ if (!FileExists("/usr/local/bin/xray"))
+ {
+ Progress.Desc = ("Xray-Core安装失败,请联系开发者");
+ throw new Exception("Xray-Core安装失败,请联系开发者");
+ }
+
+ Progress.Desc = ("设置Xray-core权限");
+ RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/xray.service");
+ RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/xray.service");
+ RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/xray.service");
+ RunCmd($"systemctl daemon-reload");
+
+ if (FileExists("/usr/local/etc/xray/config.json"))
+ {
+ RunCmd(@"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1");
+ }
+ Progress.Percentage = 60;
+
+ if (Settings.WithTLS && !Settings.IsIPAddress)
+ {
+ Progress.Desc = ("安装TLS证书");
+ InstallCert(
+ dirPath: "/usr/local/etc/xray/ssl",
+ certName: "xray_ssl.crt",
+ keyName: "xray_ssl.key");
+ Progress.Percentage = 75;
+ }
+
+ Progress.Desc = ("生成Xray服务器配置文件");
+ var configJson = XrayConfigBuilder.BuildXrayConfig(Settings);
+ WriteToFile(configJson, "/usr/local/etc/xray/config.json");
+ }
+
+ private void UploadCaddyFile(bool useCustomWeb = false)
+ {
+ var configJson = XrayConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
+
+ if (FileExists("/etc/caddy/Caddyfile"))
+ {
+ RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
+ }
+ WriteToFile(configJson, "/etc/caddy/Caddyfile");
+ }
+
+ private void UninstallXray()
+ {
+ Progress.Desc = "关闭Xray服务";
+ RunCmd("systemctl stop xray");
+ RunCmd("systemctl disable xray");
+
+ Progress.Desc = "卸载Xray";
+ RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ remove");
+ }
+
+ private void UninstallAcme()
+ {
+ Progress.Desc = "卸载 acme.sh";
+ RunCmd("acme.sh --uninstall");
+
+ Progress.Desc = "删除 acme.sh 相关文件";
+ RunCmd("rm -rf ~/.acme.sh");
+ }
+
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/Templates/CaddyFiles.cs b/ProxySuper.Core/Templates/CaddyFiles.cs
new file mode 100644
index 00000000..fd8c6855
--- /dev/null
+++ b/ProxySuper.Core/Templates/CaddyFiles.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Templates
+{
+ public static class CaddyFiles
+ {
+ public static string BaseCaddyFile = """
+ :##port## {
+ root * /usr/share/caddy
+ file_server
+ ##reverse_proxy##
+ }
+
+ ##domain##:80 {
+ redir https://##domain##{uri}
+ }
+ """;
+ }
+}
diff --git a/ProxySuper.Core/Templates/HysteriaConfigTemplates.cs b/ProxySuper.Core/Templates/HysteriaConfigTemplates.cs
new file mode 100644
index 00000000..9d3a1f78
--- /dev/null
+++ b/ProxySuper.Core/Templates/HysteriaConfigTemplates.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Templates
+{
+ public static class HysteriaConfigTemplates
+ {
+
+ #region ServerHysteria2Config
+ public static string ServerHysteria2Config_base = """
+ listen: :443
+
+ auth:
+ type: password
+ password: your_password
+
+ sniff:
+ enable: true
+ timeout: 2s
+ rewriteDomain: false
+ tcpPorts: 80,443,8000-9000
+ udpPorts: all
+ """;
+
+ public static string ServerHysteria2Config_acme = """
+ acme:
+ domains:
+ - domain1.com
+ email: your@email.net
+ ca: letsencrypt
+ """;
+
+ public static string ServerHysteria2Config_tls = """
+ tls:
+ cert: /etc/hysteria/ssl/hysteria_ssl.crt
+ key: /etc/hysteria/ssl/hysteria_ssl.key
+ sniGuard: dns-san
+ """;
+
+ public static string ServerHysteria2Config_masquerade_proxy = """
+ masquerade:
+ type: proxy
+ proxy:
+ url: https://some.site.net
+ rewriteHost: true
+ insecure: false
+ listenHTTP: :80
+ listenHTTPS: :443
+ forceHTTPS: true
+ """;
+
+ public static string ServerHysteria2Config_masquerade_file = """
+ masquerade:
+ type: file
+ file:
+ dir: /var/www/hymasq
+ listenHTTP: :80
+ listenHTTPS: :443
+ forceHTTPS: true
+ """;
+
+
+ public static string ServerHysteria2Config_bbr = """
+ ignoreClientBandwidth: true
+ """;
+
+ public static string ServerHysteria1ConfigTemplateOld = """
+ {
+ "listen": ":36712",
+ "acme": {
+ "domains": [
+ "your.domain.com"
+ ],
+ "email": "your@email.com"
+ },
+ "obfs": "8ZuA2Zpqhuk8yakXvMjDqEXBwY"
+ }
+ """;
+ #endregion
+
+ #region ServerAndClientHysteria2Config
+ public static string ServerAndClientHysteria2Config_obfs = """
+ obfs:
+ type: salamander
+ salamander:
+ password: cry_me_a_r1ver
+ """;
+
+ public static string ServerAndClientHysteria2Config_bandwidth = """
+ bandwidth:
+ up: 0 gbps
+ down: 0 gbps
+ """;
+ #endregion
+
+ #region ClientHysteria2Config
+ public static string ClientHysteria2Config_base = """
+ server: example.com
+ auth: some_password
+ bandwidth:
+ up: 20 mbps
+ down: 100 mbps
+ socks5:
+ listen: 127.0.0.1:1080
+ http:
+ listen: 127.0.0.1:8080
+ """;
+
+ public static string ClientHysteria2Config_url = """
+ server: hysteria2://user:pass@example.com/
+ """;
+
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/Templates/NaiveServerCaddyfile.cs b/ProxySuper.Core/Templates/NaiveServerCaddyfile.cs
new file mode 100644
index 00000000..1b2d9ef8
--- /dev/null
+++ b/ProxySuper.Core/Templates/NaiveServerCaddyfile.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Templates
+{
+ public static class NaiveServerCaddyfile
+ {
+ public static string BaseCaddyFile = """
+ :##port##, ##domain##
+ route {
+ forward_proxy {
+ ##basicauth##
+ hide_ip
+ hide_via
+ probe_resistance
+ }
+ #file_server { root /usr/share/caddy }
+ }
+ ##reverse_proxy##
+ """;
+ }
+}
diff --git a/ProxySuper.Core/Templates/TrojanGoTemplates.cs b/ProxySuper.Core/Templates/TrojanGoTemplates.cs
new file mode 100644
index 00000000..c94411f2
--- /dev/null
+++ b/ProxySuper.Core/Templates/TrojanGoTemplates.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Templates
+{
+ public static class TrojanGoTemplates
+ {
+ public static string BaseCaddyfile = """
+ :##port## {
+ root * /usr/share/caddy
+ file_server
+ ##reverse_proxy##
+ }
+
+ ##domain##:80 {
+ redir https://##domain##{uri}
+ }
+ """;
+
+ public static string TrojanGoJson = """
+ {
+ "log_level": 5,
+ "run_type": "server",
+ "local_addr": "0.0.0.0",
+ "local_port": 443,
+ "remote_addr": "127.0.0.1",
+ "remote_port": 80,
+ "password": [
+ ""
+ ],
+ "ssl": {
+ "cert": "/usr/local/etc/trojan-go/ssl/trojan-go.crt",
+ "key": "/usr/local/etc/trojan-go/ssl/trojan-go.key",
+ "sni": "example.com"
+ },
+ "websocket": {
+ "enabled": false,
+ "path": "/ws",
+ "host": "example.com"
+ }
+ }
+
+ """;
+ }
+}
diff --git a/ProxySuper.Core/Templates/V2rayConfigTemplates.cs b/ProxySuper.Core/Templates/V2rayConfigTemplates.cs
new file mode 100644
index 00000000..a191525b
--- /dev/null
+++ b/ProxySuper.Core/Templates/V2rayConfigTemplates.cs
@@ -0,0 +1,667 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Templates
+{
+ public static class V2rayConfigTemplates
+ {
+ #region VLESS_TCP_TLS_ServerConfig
+ public static string VLESS_TCP_TLS_ServerConfig = """
+ {
+ "port": 443,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": "",
+ "level": 0
+ }
+ ],
+ "decryption": "none",
+ "fallbacks": []
+ },
+ "streamSettings": {
+ "network": "tcp",
+ "security": "tls",
+ "tlsSettings": {
+ "alpn": [
+ "http/1.1"
+ ],
+ "certificates": [
+ {
+ "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
+ "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
+ }
+ ]
+ }
+ }
+ }
+ """;
+ public static string VLESS_TCP_TLS_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VLESS_WS_ServerConfig
+ public static string VLESS_WS_ServerConfig = """
+ {
+ "port": 1234,
+ "listen": "127.0.0.1",
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "ws",
+ "security": "none",
+ "wsSettings": {
+ "acceptProxyProtocol": true,
+ "path": "/websocket"
+ }
+ }
+ }
+
+ """;
+ public static string VLESS_WS_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VLESS_QUIC_ServerConfig
+ public static string VLESS_QUIC_ServerConfig = """
+ {
+ "port": 2000,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "quic",
+ "quicSettings": {
+ "security": "none",
+ "key": "",
+ "header": {
+ "type": "none"
+ }
+ },
+ "security": "tls",
+ "tlsSettings": {
+ "certificates": [
+ {
+ "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
+ "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
+ }
+ ]
+ }
+ }
+ }
+ """;
+ public static string VLESS_QUIC_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VLESS_KCP_ServerConfig
+ public static string VLESS_KCP_ServerConfig = """
+ {
+ "port": 3456,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "mkcp",
+ "kcpSettings": {
+ "uplinkCapacity": 100,
+ "downlinkCapacity": 100,
+ "congestion": true,
+ "header": {
+ "type": "none"
+ },
+ "seed": null
+ }
+ }
+ }
+
+ """;
+ public static string VLESS_KCP_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VLESS_HTTP2_ServerConfig
+ public static string VLESS_HTTP2_ServerConfig = """
+ {
+ "port": 1234,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "decryption": "none",
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "h2",
+ "httpSettings": {
+ "path": ""
+ }
+ }
+ }
+ """;
+ public static string VLESS_HTTP2_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VLESS_gRPC_ServerConfig
+ public static string VLESS_gRPC_ServerConfig = """
+ {
+ "port": 2002,
+ "listen": "0.0.0.0",
+ "protocol": "vless",
+ "settings": {
+ "decryption": "none",
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "grpc",
+ "security": "tls",
+ "tlsSettings": {
+ "serverName": "domain",
+ "alpn": [
+ "h2"
+ ],
+ "certificates": [
+ {
+ "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
+ "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
+ }
+ ]
+ },
+ "grpcSettings": {
+ "serviceName": "service_name"
+ }
+ }
+ }
+
+ """;
+ public static string VLESS_gRPC_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VMESS_WS_ServerConfig
+ public static string VMESS_WS_ServerConfig = """
+ {
+ "port": 3456,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "ws",
+ "security": "none",
+ "wsSettings": {
+ "acceptProxyProtocol": true,
+ "path": "/vmessws"
+ }
+ }
+ }
+
+ """;
+ public static string VMESS_WS_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VMESS_TCP_ServerConfig
+ public static string VMESS_TCP_ServerConfig = """
+ {
+ "port": 443,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "tcp",
+ "security": "none",
+ "tcpSettings": {
+ "acceptProxyProtocol": true,
+ "header": {
+ "type": "http",
+ "request": {
+ "path": [
+ "/vmesstcp"
+ ]
+ }
+ }
+ }
+ }
+ }
+
+ """;
+ public static string VMESS_TCP_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VMESS_QUIC_ServerConfig
+ public static string VMESS_QUIC_ServerConfig = """
+ {
+ "port": 3000,
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "quic",
+ "quicSettings": {
+ "security": "none",
+ "key": "",
+ "header": {
+ "type": "none"
+ }
+ },
+ "security": "tls",
+ "tlsSettings": {
+ "certificates": [
+ {
+ "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
+ "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
+ }
+ ]
+ }
+ }
+ }
+ """;
+ public static string VMESS_QUIC_ClientConfig = """
+
+ """;
+ #endregion
+
+
+ #region VMESS KCP Configs
+ public static string VMESS_KCP_ServerConfig = """
+ {
+ "port": 3456,
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "mkcp",
+ "kcpSettings": {
+ "uplinkCapacity": 100,
+ "downlinkCapacity": 100,
+ "congestion": true,
+ "header": {
+ "type": "none"
+ },
+ "seed": null
+ }
+ }
+ }
+
+ """;
+ public static string VMESS_KCP_ClientConfig = """
+
+ """;
+ #endregion
+
+
+ #region VMESS_HTTP2_ServerConfig
+ public static string VMESS_HTTP2_ServerConfig = """
+ {
+ "port": 1234,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "h2",
+ "httpSettings": {
+ "path": ""
+ }
+ }
+ }
+ """;
+ public static string VMESS_HTTP2_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VMESS_gRPC_ServerConfig
+ public static string VMESS_gRPC_ServerConfig = """
+ {
+ "port": 2002,
+ "listen": "0.0.0.0",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "grpc",
+ "security": "tls",
+ "tlsSettings": {
+ "serverName": "domain",
+ "alpn": [
+ "h2"
+ ],
+ "certificates": [
+ {
+ "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
+ "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
+ }
+ ]
+ },
+ "grpcSettings": {
+ "serviceName": "service_name"
+ }
+ }
+ }
+
+ """;
+ public static string VMESS_gRPC_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region Trojan Configs
+ public static string Trojan_ServerConfig = """
+ {
+ "port": 1310,
+ "listen": "127.0.0.1",
+ "protocol": "trojan",
+ "settings": {
+ "clients": [
+ {
+ "password": ""
+ }
+ ],
+ "fallbacks": [
+ {
+ "dest": 8080
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "tcp",
+ "security": "none",
+ "tcpSettings": {
+ "acceptProxyProtocol": true
+ }
+ }
+ }
+
+ """;
+ public static string Trojan_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region Shadowsocks Configs
+ public static string Shadowsocks_ServerConfig = """
+ {
+ "port": 12345,
+ "protocol": "shadowsocks",
+ "settings": {
+ "password": "",
+ "method": "aes-128-gcm",
+ "network": "tcp,udp"
+ }
+ }
+ """;
+ public static string Shadowsocks_ClientConfig = """
+
+ """;
+ #endregion
+
+
+ #region ServerGeneralConfig
+ public static string ServerGeneralConfig_log = """
+ {
+ "log": {
+ "access": "none",
+ "loglevel": "none"
+ }
+ }
+ """;
+
+ public static string ServerGeneralConfig_outbounds = """
+ {
+ "outbounds": [
+ {
+ "protocol": "freedom",
+ "tag": "direct"
+ },
+ {
+ "protocol": "blackhole",
+ "tag": "block"
+ }
+ ]
+ }
+ """;
+
+ public static string ServerGeneralConfig_inbounds = """
+ {
+ "inbounds": []
+ }
+
+ """;
+
+ public static string ServerGeneralConfig_dns = """
+ {
+ "dns": {}
+ }
+ """;
+
+ public static string ServerGeneralConfig_routing_BlockPrivateIPAndCN = """
+ {
+ "routing": {
+ "rules": [
+ {
+ "ip": [
+ "geoip:private",
+ "geoip:cn"
+ ],
+ "outboundTag": "block"
+ }
+ ]
+ }
+ }
+ """;
+
+ public static string ServerGeneralConfig_routing_BlockPrivateIP = """
+ {
+ "routing": {
+ "rules": [
+ {
+ "ip": [
+ "geoip:private"
+ ],
+ "outboundTag": "block"
+ }
+ ]
+ }
+ }
+ """;
+
+ #endregion
+
+
+ #region ClientGeneralConfig
+ public static string ClientGeneralConfig_log = """
+ {
+ "log": {
+ "loglevel": "warning"
+ }
+ }
+ """;
+
+ public static string ClientGeneralConfig_inbounds = """
+ {
+ "inbounds": [
+ {
+ "port": 10808,
+ "protocol": "socks",
+ "settings": {
+ "udp": true,
+ "auth": "noauth"
+ }
+ }
+ ]
+ }
+ """;
+
+
+ public static string ClientGeneralConfig_outbounds = """
+ {
+ "outbounds": []
+ }
+ """;
+
+ public static string ClientGeneralConfig_dns = """
+ {
+ "dns": {}
+ }
+ """;
+
+ public static string ClientGeneralConfig_routing = """
+ {
+ "routing": {}
+ }
+ """;
+
+ public static string ClientGeneralConfig_WhiteList = """
+ {
+ "outbounds": [
+ {
+ "tag": "direct",
+ "protocol": "freedom"
+ },
+ {
+ "tag": "block",
+ "protocol": "blackhole"
+ }
+ ],
+ "dns": {
+ "servers": [
+ "1.1.1.1",
+ "8.8.8.8",
+ "8.8.4.4",
+ "2001:4860:4860::8888",
+ "2001:4860:4860::8844",
+ "https://1.1.1.1/dns-query",
+ "https://dns.google/dns-query",
+ {
+ "address": "223.5.5.5",
+ "domains": [
+ "geosite:cn"
+ ],
+ "expectIPs": [
+ "geoip:cn"
+ ]
+ }
+ {
+ "address": "2400:3200::1",
+ "domains": [
+ "geosite:cn"
+ ],
+ "expectIPs": [
+ "geoip:cn"
+ ]
+ }
+ ]
+ },
+ "routing": {
+ "domainStrategy": "IPIfNonMatch",
+ "rules": [
+ {
+ "network": "udp",
+ "port": "443",
+ "outboundTag": "blocked"
+ },
+ {
+ "ip": [
+ "223.5.5.5",
+ "2400:3200::1",
+ "geoip:private",
+ "geoip:cn"
+ ],
+ "outboundTag": "direct"
+ },
+ {
+ "domain": ["geosite:cn"],
+ "outboundTag": "direct"
+ }
+ ]
+ }
+ }
+ """;
+
+ #endregion
+
+ public static string BaseConfig = """
+ {
+ "log": {},
+ "dns": {},
+ "routing": {},
+ "inbounds": [],
+ "outbounds": []
+ }
+ """;
+ }
+}
diff --git a/ProxySuper.Core/Templates/XrayConfigTemplates.cs b/ProxySuper.Core/Templates/XrayConfigTemplates.cs
new file mode 100644
index 00000000..c78b5a69
--- /dev/null
+++ b/ProxySuper.Core/Templates/XrayConfigTemplates.cs
@@ -0,0 +1,641 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.Templates
+{
+ public static class XrayConfigTemplates
+ {
+ #region VLESS_XTLS_RAW_REALITY Configs
+ //参考自https://github.com/XTLS/Xray-examples/tree/main/VLESS-TCP-REALITY%20(without%20being%20stolen)
+ //添加 xtls-rprx-vision
+ public static string VLESS_XTLS_RAW_REALITY_ServerConfig = """
+ {
+ "inbounds": [
+ {
+ "tag": "dokodemo-in",
+ "port": 443,
+ "protocol": "dokodemo-door",
+ "settings": {
+ "address": "127.0.0.1",
+ "port": 4431,
+ "network": "tcp"
+ },
+ "sniffing": {
+ "enabled": true,
+ "destOverride": [
+ "tls"
+ ],
+ "routeOnly": true
+ }
+ },
+ {
+ "listen": "127.0.0.1",
+ "port": 4431,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": "",
+ "flow": "xtls-rprx-vision"
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "raw",
+ "security": "reality",
+ "realitySettings": {
+ "target": "speed.cloudflare.com:443",
+ "serverNames": [
+ "speed.cloudflare.com"
+ ],
+ "privateKey": "",
+ "shortIds": [ "" ]
+ }
+ },
+ "sniffing": {
+ "enabled": true,
+ "destOverride": [
+ "http",
+ "tls",
+ "quic"
+ ],
+ "routeOnly": true
+ }
+ }
+ ],
+ "routing": {
+ "rules": [
+ {
+ "inboundTag": [
+ "dokodemo-in"
+ ],
+ "domain": [
+ "speed.cloudflare.com"
+ ],
+ "outboundTag": "direct"
+ },
+ {
+ "inboundTag": [
+ "dokodemo-in"
+ ],
+ "outboundTag": "block"
+ }
+ ]
+ }
+ }
+ """;
+
+ public static string VLESS_XTLS_REALITY_ClientConfig = """
+ {
+ "outbounds": [
+ {
+ "protocol": "vless",
+ "settings": {
+ "vnext": [
+ {
+ "address": "127.0.0.1",
+ "port": 443,
+ "users": [
+ {
+ "id": "",
+ "flow": "xtls-rprx-vision",
+ "encryption": "none"
+ }
+ ]
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "raw",
+ "security": "reality",
+ "realitySettings": {
+ "fingerprint": "chrome",
+ "serverName": "speed.cloudflare.com",
+ "publicKey": "",
+ "spiderX": "/",
+ "shortId": ""
+ }
+ },
+ "tag": "proxy"
+ }
+ ]
+ }
+ """;
+ #endregion
+
+ #region VLESS XHTTP Configs
+
+ public static string VLESS_XHTTP_ServerConfig = """
+ {
+ "port": 443,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none",
+ "fallbacks": []
+ },
+ "streamSettings": {
+ "network": "xhttp",
+ "xhttpSettings": {
+ "path": ""
+ },
+ "security": "tls",
+ "tlsSettings": {
+ "rejectUnknownSni": true,
+ "minVersion": "1.2",
+ "certificates": [
+ {
+ "ocspStapling": 3600,
+ "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
+ "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
+ }
+ ]
+ }
+
+ }
+ }
+ """;
+
+ public static string VLESS_XHTTP_ClientConfig = """
+ {
+ "outbounds": [
+ {
+ "tag": "proxy",
+ "protocol": "vless",
+ "settings": {
+ "vnext": [
+ {
+ "address": "",
+ "port": 443,
+ "users": [
+ {
+ "id": "",
+ "encryption": "none"
+ }
+ ]
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "xhttp",
+ "security": "tls",
+ "tlsSettings": {
+ "allowInsecure": false,
+ "alpn": [
+ "h3",
+ "h2",
+ "http/1.1"
+ ]
+ },
+ "xhttpSettings": {
+ "path": "",
+ "mode": "packet-up"
+ }
+ }
+ }
+ ]
+ }
+
+ """;
+ #endregion
+
+ #region VLESS XTLS Configs
+ public static string VLESS_XTLS_ServerConfig = """
+ {
+ "port": 443,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": "",
+ "flow": "xtls-rprx-vision"
+ }
+ ],
+ "decryption": "none",
+ "fallbacks": []
+ },
+ "streamSettings": {
+ "network": "raw",
+ "security": "tls",
+ "tlsSettings": {
+ "rejectUnknownSni": true,
+ "minVersion": "1.2",
+ "certificates": [
+ {
+ "ocspStapling": 3600,
+ "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
+ "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
+ }
+ ]
+ }
+ }
+ }
+ """;
+ public static string VLESS_XTLS_ClientConfig = """
+
+ """;
+
+ #endregion
+
+ #region VLESS WS Configs
+ public static string VLESS_WS_ServerConfig = """
+ {
+ "port": 1234,
+ "listen": "127.0.0.1",
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "ws",
+ "security": "none",
+ "wsSettings": {
+ "acceptProxyProtocol": true,
+ "path": "/websocket"
+ }
+ }
+ }
+
+ """;
+ public static string VLESS_WS_ClientConfig = """
+ {
+ "outbounds": [
+ {
+ "protocol": "vless",
+ "settings": {
+ "vnext": [
+ {
+ "address": "",
+ "port": 443,
+ "users": [
+ {
+ "id": "",
+ "encryption": "none",
+ "level": 0
+ }
+ ]
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "ws",
+ "security": "tls",
+ "tlsSettings": {
+ "serverName": ""
+ },
+ "wsSettings": {
+ "path": ""
+ }
+ }
+ }
+ ]
+ }
+
+ """;
+ #endregion
+
+ #region VLESS gRPC Configs
+ public static string VLESS_gRPC_ServerConfig = """
+ {
+ "port": 2002,
+ "listen": "0.0.0.0",
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "grpc",
+ "security": "tls",
+ "tlsSettings": {
+ "serverName": "domain",
+ "alpn": [
+ "h2"
+ ],
+ "certificates": [
+ {
+ "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
+ "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
+ }
+ ]
+ },
+ "grpcSettings": {
+ "serviceName": "service_name"
+ }
+ }
+ }
+
+ """;
+ public static string VLESS_gRPC_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region Trojan Configs
+ public static string Trojan_ServerConfig = """
+ {
+ "port": 1310,
+ "listen": "127.0.0.1",
+ "protocol": "trojan",
+ "settings": {
+ "clients": [
+ {
+ "password": ""
+ }
+ ],
+ "fallbacks": [
+ {
+ "dest": 8080
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "raw",
+ "security": "none",
+ "tcpSettings": {
+ "acceptProxyProtocol": true
+ }
+ }
+ }
+
+ """;
+ public static string Trojan_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region Shadowsocks Configs
+ public static string Shadowsocks_ServerConfig = """
+ {
+ "port": 12345,
+ "protocol": "shadowsocks",
+ "settings": {
+ "password": "",
+ "method": "aes-128-gcm",
+ "network": "tcp,udp"
+ }
+ }
+ """;
+ public static string Shadowsocks_ClientConfig = """
+
+ """;
+ #endregion
+
+ #region VMESS KCP Configs
+ public static string VMESS_KCP_ServerConfig = """
+ {
+ "port": 3456,
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": ""
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "mkcp",
+ "kcpSettings": {
+ "uplinkCapacity": 100,
+ "downlinkCapacity": 100,
+ "congestion": true,
+ "header": {
+ "type": "none"
+ },
+ "seed": null
+ }
+ }
+ }
+
+ """;
+ public static string VMESS_KCP_ClientConfig = """
+
+ """;
+ #endregion
+
+
+
+
+ #region ServerGeneralConfig
+ public static string ServerGeneralConfig_log = """
+ {
+ "log": {
+ "access": "none",
+ "loglevel": "none"
+ }
+ }
+ """;
+
+ public static string ServerGeneralConfig_outbounds = """
+ {
+ "outbounds": [
+ {
+ "protocol": "freedom",
+ "tag": "direct"
+ },
+ {
+ "protocol": "blackhole",
+ "tag": "block"
+ }
+ ]
+ }
+ """;
+
+ public static string ServerGeneralConfig_inbounds = """
+ {
+ "inbounds": []
+ }
+
+ """;
+
+ public static string ServerGeneralConfig_dns = """
+ {
+ "dns": {}
+ }
+ """;
+
+ public static string ServerGeneralConfig_routing_BlockPrivateIPAndCN = """
+ {
+ "routing": {
+ "rules": [
+ {
+ "ip": [
+ "geoip:private",
+ "geoip:cn"
+ ],
+ "outboundTag": "block"
+ }
+ ]
+ }
+ }
+ """;
+
+ public static string ServerGeneralConfig_routing_BlockPrivateIP = """
+ {
+ "routing": {
+ "rules": [
+ {
+ "ip": [
+ "geoip:private"
+ ],
+ "outboundTag": "block"
+ }
+ ]
+ }
+ }
+ """;
+
+ #endregion
+
+
+ #region ClientGeneralConfig
+ public static string ClientGeneralConfig_log = """
+ {
+ "log": {
+ "loglevel": "warning"
+ }
+ }
+ """;
+
+ public static string ClientGeneralConfig_inbounds = """
+ {
+ "inbounds": [
+ {
+ "port": 10808,
+ "protocol": "socks",
+ "settings": {
+ "udp": true,
+ "auth": "noauth"
+ }
+ }
+ ]
+ }
+ """;
+
+
+ public static string ClientGeneralConfig_outbounds = """
+ {
+ "outbounds": []
+ }
+ """;
+
+ public static string ClientGeneralConfig_dns = """
+ {
+ "dns": {}
+ }
+ """;
+
+ public static string ClientGeneralConfig_routing = """
+ {
+ "routing": {}
+ }
+ """;
+
+ public static string ClientGeneralConfig_WhiteList = """
+ {
+ "outbounds": [
+ {
+ "tag": "direct",
+ "protocol": "freedom"
+ },
+ {
+ "tag": "block",
+ "protocol": "blackhole"
+ }
+ ],
+ "dns": {
+ "servers": [
+ "1.1.1.1",
+ "8.8.8.8",
+ "8.8.4.4",
+ "2001:4860:4860::8888",
+ "2001:4860:4860::8844",
+ "https://1.1.1.1/dns-query",
+ "https://dns.google/dns-query",
+ {
+ "address": "223.5.5.5",
+ "domains": [
+ "geosite:cn"
+ ],
+ "expectIPs": [
+ "geoip:cn"
+ ]
+ }
+ {
+ "address": "2400:3200::1",
+ "domains": [
+ "geosite:cn"
+ ],
+ "expectIPs": [
+ "geoip:cn"
+ ]
+ }
+ ]
+ },
+ "routing": {
+ "domainMatcher": "mph",
+ "domainStrategy": "IPIfNonMatch",
+ "rules": [
+ {
+ "network": "udp",
+ "port": "443",
+ "outboundTag": "blocked"
+ },
+ {
+ "ip": [
+ "223.5.5.5",
+ "2400:3200::1",
+ "geoip:private",
+ "geoip:cn"
+ ],
+ "outboundTag": "direct"
+ },
+ {
+ "domain": ["geosite:cn"],
+ "outboundTag": "direct"
+ }
+ ]
+ }
+ }
+ """;
+
+ #endregion
+
+ public static string BaseConfig = """
+ {
+ "log": {},
+ "dns": {},
+ "routing": {},
+ "inbounds": [],
+ "outbounds": []
+ }
+ """;
+
+
+
+
+
+
+
+
+
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/BrookConfigViewModel.cs b/ProxySuper.Core/ViewModels/BrookConfigViewModel.cs
new file mode 100644
index 00000000..99d9421c
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/BrookConfigViewModel.cs
@@ -0,0 +1,24 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class BrookConfigViewModel : MvxViewModel
+ {
+ public BrookSettings Settings { get; set; }
+
+ public override void Prepare(BrookSettings parameter)
+ {
+ Settings = parameter;
+ }
+
+ public string Link
+ {
+ get
+ {
+ return ShareLink.BuildBrook(Settings);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/BrookEditorViewModel.cs b/ProxySuper.Core/ViewModels/BrookEditorViewModel.cs
new file mode 100644
index 00000000..29ef9e5d
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/BrookEditorViewModel.cs
@@ -0,0 +1,102 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class BrookEditorViewModel : MvxViewModel
+ {
+ public BrookEditorViewModel(IMvxNavigationService navigationService)
+ {
+ NavigationService = navigationService;
+ }
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public BrookSettings Settings { get; set; }
+
+ public List BrookTypes
+ {
+ get
+ {
+ return new List {
+ BrookType.server.ToString(),
+ BrookType.wsserver.ToString(),
+ BrookType.wssserver.ToString(),
+ BrookType.socks5.ToString(),
+ };
+ }
+ }
+
+ public string CheckedBrookType
+ {
+ get
+ {
+ return Settings.BrookType.ToString();
+ }
+ set
+ {
+ Settings.BrookType = (BrookType)Enum.Parse(typeof(BrookType), value);
+
+ if (Settings.BrookType == BrookType.wssserver)
+ {
+ Settings.Port = 443;
+ RaisePropertyChanged("Settings");
+ }
+ RaisePropertyChanged("EnablePort");
+ RaisePropertyChanged("EnableDomain");
+ RaisePropertyChanged("EnableIP");
+ }
+ }
+
+ public bool EnablePort => Settings.BrookType != BrookType.wssserver;
+
+ public bool EnableDomain => Settings.BrookType == BrookType.wssserver;
+
+ public bool EnableIP => Settings.BrookType != BrookType.wssserver;
+
+ public IMvxCommand SaveCommand => new MvxCommand(() => Save());
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.BrookSettings;
+ }
+
+ public void Save()
+ {
+ NavigationService.Close(this, new Record()
+ {
+ Id = Id,
+ Host = Host,
+ BrookSettings = Settings,
+ });
+ }
+
+ private void SaveAndInstall()
+ {
+ var record = new Record
+ {
+ Id = this.Id,
+ Host = this.Host,
+ BrookSettings = Settings,
+ };
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs b/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs
new file mode 100644
index 00000000..c3bc429b
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs
@@ -0,0 +1,65 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class BrookInstallViewModel : MvxViewModel
+ {
+ Host _host;
+
+ BrookSettings _settings;
+
+ BrookService _service;
+
+ public override void Prepare(Record parameter)
+ {
+ _host = parameter.Host;
+ _settings = parameter.BrookSettings;
+ }
+
+ public override Task Initialize()
+ {
+ _service = new BrookService(_host, _settings);
+ _service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _service.Connect();
+ return base.Initialize();
+ }
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _service.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+ public ProjectProgress Progress => _service.Progress;
+
+ public string Logs => _service.Progress.Logs;
+
+ public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".brook.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/EnableRootViewModel.cs b/ProxySuper.Core/ViewModels/EnableRootViewModel.cs
new file mode 100644
index 00000000..3ae228c5
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/EnableRootViewModel.cs
@@ -0,0 +1,168 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models.Hosts;
+using Renci.SshNet;
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class EnableRootViewModel : MvxViewModel
+ {
+ private SshClient _sshClient;
+
+ public EnableRootViewModel()
+ {
+ Host = new Host();
+ }
+
+ public Host Host { get; set; }
+
+ public string RootUserName { get; set; }
+
+ public string RootPassword { get; set; }
+
+ public string OutputText { get; set; }
+
+ public IMvxCommand ExecuteCommand => new MvxCommand(Execute);
+
+ public override void ViewDisappearing()
+ {
+ base.ViewDisappearing();
+ if (_sshClient != null)
+ {
+ _sshClient.Disconnect();
+ _sshClient.Dispose();
+ }
+ }
+
+ public void Execute()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ OpenConnect();
+ if (!_sshClient.IsConnected)
+ {
+ MessageBox.Show("连接失败,请重试!");
+ return;
+ }
+
+ string result = string.Empty;
+ result = RunCmd("id -u");
+
+ if (result.TrimEnd('\r', '\n') == "0")
+ {
+ MessageBox.Show("当前账户已经具有root权限,无需再设置!");
+ return;
+ }
+
+ result = RunCmd($"echo {Host.Password} | sudo -S id -u");
+ if (result.TrimEnd('\r', '\n') != "0")
+ {
+ MessageBox.Show("当前账户无法获取sudo权限,设置失败!");
+ return;
+ }
+
+ string cmdPre = $"echo {Host.Password} | sudo -S id -u" + ';';
+ RunCmd(cmdPre + "sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config");
+ RunCmd(cmdPre + "sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config");
+ RunCmd(cmdPre + "sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config");
+ RunCmd(cmdPre + "echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config");
+ RunCmd(cmdPre + "echo 'PasswordAuthentication yes' | sudo tee -a /etc/ssh/sshd_config");
+ RunCmd(cmdPre + "echo 'PermitEmptyPasswords no' | sudo tee -a /etc/ssh/sshd_config");
+ RunCmd(cmdPre + "sudo systemctl restart sshd");
+
+ result = RunCmd(@"cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo ''");
+ string setPassword = result.TrimEnd('\r', '\n') + '\n';
+ RunCmd(cmdPre + $"echo \"{setPassword}{setPassword}\" | sudo passwd root");
+ RunCmd("sudo systemctl restart sshd");
+
+ RootUserName = "root";
+ RootPassword = setPassword.Trim('\n');
+ RaisePropertyChanged("RootUserName");
+ RaisePropertyChanged("RootPassword");
+
+
+ var filePath = Host.Address.Replace(':', '_');
+ using (StreamWriter sw = new StreamWriter("Logs\\host_password_info.txt"))
+ {
+ sw.WriteLine(Host.Address);
+ sw.WriteLine("root");
+ sw.WriteLine(setPassword);
+ }
+ WriteOutput("设置成功,账号信息保存在Logs/host_password_info.txt");
+ WriteOutput("账号:\nroot");
+ WriteOutput($"密码:\n{setPassword}");
+ });
+ }
+
+ protected string RunCmd(string cmdStr)
+ {
+ var cmd = _sshClient.CreateCommand(cmdStr);
+ WriteOutput(cmdStr);
+
+ var result = cmd.Execute();
+ WriteOutput(result);
+ return result;
+ }
+
+ private void WriteOutput(string text)
+ {
+ OutputText += text + '\n';
+ RaisePropertyChanged("OutputText");
+ }
+
+
+ private void OpenConnect()
+ {
+ WriteOutput("正在建立连接...");
+ var conneInfo = CreateConnectionInfo(Host);
+ _sshClient = new SshClient(conneInfo);
+ try
+ {
+ _sshClient.Connect();
+ WriteOutput("Connected...");
+ }
+ catch (Exception ex)
+ {
+ WriteOutput(ex.Message);
+ MessageBox.Show(ex.Message);
+ }
+ }
+
+ private ConnectionInfo CreateConnectionInfo(Host host)
+ {
+ AuthenticationMethod auth = null;
+
+ if (host.SecretType == LoginSecretType.Password)
+ {
+ auth = new PasswordAuthenticationMethod(host.UserName, host.Password);
+ }
+ else if (host.SecretType == LoginSecretType.PrivateKey)
+ {
+ auth = new PrivateKeyAuthenticationMethod(host.UserName, new PrivateKeyFile(host.PrivateKeyPath));
+ }
+
+ if (host.Proxy.Type == ProxyTypes.None)
+ {
+ return new ConnectionInfo(host.Address, host.Port, host.UserName, auth);
+ }
+ else
+ {
+ return new ConnectionInfo(
+ host: host.Address,
+ port: host.Port,
+ username: host.UserName,
+ proxyType: host.Proxy.Type,
+ proxyHost: host.Proxy.Address,
+ proxyPort: host.Proxy.Port,
+ proxyUsername: host.Proxy.UserName,
+ proxyPassword: host.Proxy.Password,
+ authenticationMethods: auth);
+ }
+
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/HomeViewModel.cs b/ProxySuper.Core/ViewModels/HomeViewModel.cs
new file mode 100644
index 00000000..13c8bc28
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/HomeViewModel.cs
@@ -0,0 +1,380 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Serialization;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class HomeViewModel : MvxViewModel
+ {
+ private readonly IMvxNavigationService _navigationService;
+
+ public HomeViewModel(IMvxNavigationService navigationService)
+ {
+ _navigationService = navigationService;
+ ReadRecords();
+ }
+
+ public void ReadRecords()
+ {
+ List records = new List();
+ if (File.Exists("Data/Record.json"))
+ {
+ var json = File.ReadAllText("Data/Record.json");
+ records = JsonConvert.DeserializeObject>(json);
+ }
+
+ this.Records = new MvxObservableCollection();
+
+ records.ForEach(item =>
+ {
+ if (string.IsNullOrEmpty(item.Id))
+ {
+ item.Id = Guid.NewGuid().ToString();
+ }
+ this.Records.Add(item);
+ });
+ }
+
+ public void SaveToJson()
+ {
+ var json = JsonConvert.SerializeObject(Records, Formatting.Indented, new JsonSerializerSettings
+ {
+ ContractResolver = new CamelCasePropertyNamesContractResolver()
+ });
+ if (!Directory.Exists("Data"))
+ {
+ Directory.CreateDirectory("Data");
+ }
+ File.WriteAllText("Data/Record.json", json);
+ }
+
+ public void SortDone(string id)
+ {
+ var item = Records.Where(x => x.Id == id).FirstOrDefault();
+ if (item == null) return;
+
+ var index = Records.IndexOf(item);
+ if (index >= Records.Count - 1) return;
+
+ Records.Remove(item);
+ Records.Insert(index + 1, item);
+
+ RaisePropertyChanged("Records");
+ SaveToJson();
+ }
+
+ public void SortUp(string id)
+ {
+ var item = Records.Where(x => x.Id == id).FirstOrDefault();
+ if (item == null) return;
+
+ var index = Records.IndexOf(item);
+ if (index <= 0) return;
+
+ Records.Remove(item);
+ Records.Insert(index - 1, item);
+
+ RaisePropertyChanged("Records");
+ SaveToJson();
+ }
+
+ public MvxObservableCollection Records { get; set; }
+
+ public IMvxCommand SortUpCommand => new MvxCommand(SortUp);
+
+ public IMvxCommand SortDoneCommand => new MvxCommand(SortDone);
+
+ public IMvxCommand AddV2rayCommand => new MvxAsyncCommand(AddV2rayRecord);
+
+ public IMvxCommand AddXrayCommand => new MvxAsyncCommand(AddXrayRecord);
+
+ public IMvxCommand AddTrojanGoCommand => new MvxAsyncCommand(AddTrojanGoRecord);
+
+ public IMvxCommand AddNaiveProxyCommand => new MvxAsyncCommand(AddNaiveProxyRecord);
+
+ public IMvxCommand AddMTProtoGoCommand => new MvxAsyncCommand(AddMTProtoGoRecord);
+
+ public IMvxCommand AddBrookCommand => new MvxAsyncCommand(AddBrookRecord);
+
+ public IMvxCommand AddHysteria2Command => new MvxAsyncCommand(AddHysteria2Record);
+
+ public IMvxCommand RemoveCommand => new MvxAsyncCommand(DeleteRecord);
+
+ public IMvxCommand EditCommand => new MvxAsyncCommand(EditRecord);
+
+ public IMvxCommand ViewConfigCommand => new MvxAsyncCommand(ViewConfig);
+
+ public IMvxCommand InstallCommand => new MvxAsyncCommand(GoToInstall);
+
+ public async Task AddV2rayRecord()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.V2raySettings = new V2raySettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+ SaveToJson();
+ }
+
+ public async Task AddXrayRecord()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.XraySettings = new XraySettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+ SaveToJson();
+ }
+
+ public async Task AddTrojanGoRecord()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.TrojanGoSettings = new TrojanGoSettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+
+ SaveToJson();
+ }
+
+ public async Task AddMTProtoGoRecord()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.MTProtoGoSettings = new MTProtoGoSettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+
+ SaveToJson();
+ }
+
+ public async Task AddNaiveProxyRecord()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.NaiveProxySettings = new NaiveProxySettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+
+ SaveToJson();
+ }
+
+ public async Task AddBrookRecord()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.BrookSettings = new BrookSettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+
+ SaveToJson();
+ }
+
+ public async Task AddHysteria2Record()
+ {
+ Record record = new Record();
+ record.Id = Utils.GetTickID();
+ record.Host = new Host();
+ record.HysteriaSettings = new HysteriaSettings();
+
+ var result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ Records.Add(result);
+
+ SaveToJson();
+ }
+
+
+ public async Task EditRecord(string id)
+ {
+ var record = Records.FirstOrDefault(x => x.Id == id);
+ if (record == null) return;
+
+ Record result = null;
+ if (record.Type == ProjectType.V2ray)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.V2raySettings = result.V2raySettings;
+ }
+ if (record.Type == ProjectType.Xray)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.XraySettings = result.XraySettings;
+ }
+ if (record.Type == ProjectType.TrojanGo)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.TrojanGoSettings = result.TrojanGoSettings;
+ }
+ if (record.Type == ProjectType.NaiveProxy)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.NaiveProxySettings = result.NaiveProxySettings;
+ }
+ if (record.Type == ProjectType.Brook)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.BrookSettings = result.BrookSettings;
+ }
+ if (record.Type == ProjectType.MTProtoGo)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.MTProtoGoSettings = result.MTProtoGoSettings;
+ }
+ if (record.Type == ProjectType.Hysteria2)
+ {
+ result = await _navigationService.Navigate(record);
+ if (result == null) return;
+
+ record.Host = result.Host;
+ record.HysteriaSettings = result.HysteriaSettings;
+ }
+
+ SaveToJson();
+ }
+
+ public async Task DeleteRecord(string id)
+ {
+ var result = MessageBox.Show($"您确认删除主机吗?", "提示", MessageBoxButton.OKCancel);
+ if (result == MessageBoxResult.OK)
+ {
+ var record = Records.FirstOrDefault(x => x.Id == id);
+ if (record != null)
+ {
+ Records.Remove(record);
+ SaveToJson();
+ }
+ }
+ await Task.CompletedTask;
+ }
+
+ public async Task ViewConfig(string id)
+ {
+ var record = Records.FirstOrDefault(x => x.Id == id);
+ if (record == null) return;
+
+ if (record.Type == ProjectType.V2ray)
+ {
+ await _navigationService.Navigate(record.V2raySettings);
+ }
+ if (record.Type == ProjectType.Xray)
+ {
+ await _navigationService.Navigate(record.XraySettings);
+ }
+ if (record.Type == ProjectType.TrojanGo)
+ {
+ await _navigationService.Navigate(record.TrojanGoSettings);
+ }
+ if (record.Type == ProjectType.NaiveProxy)
+ {
+ await _navigationService.Navigate(record.NaiveProxySettings);
+ }
+ if (record.Type == ProjectType.Brook)
+ {
+ await _navigationService.Navigate(record.BrookSettings);
+ }
+ if (record.Type == ProjectType.MTProtoGo)
+ {
+ await _navigationService.Navigate(record.MTProtoGoSettings);
+ }
+ if (record.Type == ProjectType.Hysteria2)
+ {
+ await _navigationService.Navigate(record.HysteriaSettings);
+ }
+ }
+
+ public async Task GoToInstall(string id)
+ {
+ var record = Records.FirstOrDefault(x => x.Id == id);
+ if (record == null) return;
+ record.OnSave = SaveToJson;
+
+ if (record.Type == ProjectType.V2ray)
+ {
+ await _navigationService.Navigate(record);
+ }
+ if (record.Type == ProjectType.Xray)
+ {
+ await _navigationService.Navigate(record);
+ }
+ if (record.Type == ProjectType.TrojanGo)
+ {
+ await _navigationService.Navigate(record);
+ }
+ if (record.Type == ProjectType.NaiveProxy)
+ {
+ await _navigationService.Navigate(record);
+ }
+ if (record.Type == ProjectType.Brook)
+ {
+ await _navigationService.Navigate(record);
+ }
+ if (record.Type == ProjectType.MTProtoGo)
+ {
+ await _navigationService.Navigate(record);
+ }
+ if (record.Type == ProjectType.Hysteria2)
+ {
+ await _navigationService.Navigate(record);
+ }
+
+ SaveToJson();
+ }
+
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/HysteriaConfigViewModel.cs b/ProxySuper.Core/ViewModels/HysteriaConfigViewModel.cs
new file mode 100644
index 00000000..68cbe6f2
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/HysteriaConfigViewModel.cs
@@ -0,0 +1,100 @@
+using MvvmCross.ViewModels;
+using Newtonsoft.Json;
+using ProxySuper.Core.Models.Projects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class HysteriaConfigViewModel : MvxViewModel
+ {
+ public HysteriaSettings Settings { get; set; }
+
+ public override void Prepare(HysteriaSettings parameter)
+ {
+ Settings = parameter;
+ }
+
+ public string Domain
+ {
+ get => Settings.Domain;
+ set
+ {
+ Settings.Domain = value;
+ RaisePropertyChanged("Domain");
+ }
+ }
+
+ public int Port
+ {
+ get => Settings.Port;
+ set
+ {
+ Settings.Port = value;
+ RaisePropertyChanged("Port");
+ }
+ }
+
+ public string Password
+ {
+ get => Settings.Password;
+ set
+ {
+ Settings.Password = value;
+ RaisePropertyChanged("Password");
+ }
+ }
+
+ public string ObfsPassword
+ {
+ get
+ {
+ if(Settings.EnableObfs == true)
+ {
+ return Settings.ObfsPassword;
+ }
+ return "";
+ }//=> Settings.ObfsPassword;
+ set
+ {
+ Settings.ObfsPassword = value;
+ RaisePropertyChanged("ObfsPassword");
+ }
+ }
+
+ public string HysteriaShareLink
+ {
+ get => Settings.HysteriaShareLink;
+
+ }
+
+
+ public string ClientYamlConfig {
+
+ get
+ {
+ /*
+ var jsonData = new
+ {
+ server = $"{Settings.Domain}:{Settings.Port}",
+ obfs = Settings.ObfsPassword,
+ up_mbps = 10,
+ down_mbps = 50,
+ socks5 = new
+ {
+ listen = "127.0.0.1:1080"
+ },
+ http = new
+ {
+ listen = "127.0.0.1:1081"
+ }
+ };
+ */
+ return Settings.ClientHysteria2Config;//JsonConvert.SerializeObject(jsonData, Formatting.Indented);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs b/ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs
new file mode 100644
index 00000000..7bd40c46
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs
@@ -0,0 +1,68 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Navigation;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class HysteriaEditorViewModel : MvxViewModel
+ {
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public HysteriaSettings Settings { get; set; }
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public IMvxCommand SaveCommand => new MvxCommand(() => Save());
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ public HysteriaEditorViewModel(IMvxNavigationService mvxNavigationService)
+ {
+ NavigationService = mvxNavigationService;
+ }
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.HysteriaSettings;
+ }
+
+ public void Save()
+ {
+ NavigationService.Close(this, new Record
+ {
+ Id = Id,
+ Host = Host,
+ HysteriaSettings = Settings,
+ });
+ }
+
+ public void SaveAndInstall()
+ {
+ var record = new Record
+ {
+ Id = Id,
+ Host = Host,
+ HysteriaSettings = Settings,
+ };
+
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs b/ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs
new file mode 100644
index 00000000..0125eec2
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs
@@ -0,0 +1,69 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class HysteriaInstallViewModel : MvxViewModel
+ {
+ public Host _host { get; set; }
+
+ public HysteriaSettings _settings { get; set; }
+
+ public HysteriaService _service { get; set; }
+
+ public override void Prepare(Record parameter)
+ {
+ _host = parameter.Host;
+ _settings = parameter.HysteriaSettings;
+ }
+
+ public override Task Initialize()
+ {
+ _service = new HysteriaService(_host, _settings);
+ _service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _service.Connect();
+ return base.Initialize();
+ }
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _service.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+ public ProjectProgress Progress => _service.Progress;
+
+ public string Logs => _service.Progress.Logs;
+
+ public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
+
+ public IMvxCommand UploadCertCommand => new MvxCommand(_service.UploadCert);
+
+ public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".hysteria.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/MTProtoGoConfigViewModel.cs b/ProxySuper.Core/ViewModels/MTProtoGoConfigViewModel.cs
new file mode 100644
index 00000000..a6058ca5
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/MTProtoGoConfigViewModel.cs
@@ -0,0 +1,21 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Projects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class MTProtoGoConfigViewModel : MvxViewModel
+ {
+ public MTProtoGoSettings Settings { get; set; }
+
+ public override void Prepare(MTProtoGoSettings parameter)
+ {
+ Settings = parameter;
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/MTProtoGoEditorViewModel.cs b/ProxySuper.Core/ViewModels/MTProtoGoEditorViewModel.cs
new file mode 100644
index 00000000..fa983bfa
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/MTProtoGoEditorViewModel.cs
@@ -0,0 +1,66 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class MTProtoGoEditorViewModel : MvxViewModel
+ {
+ public MTProtoGoEditorViewModel(IMvxNavigationService navigationService)
+ {
+ NavigationService = navigationService;
+ }
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public IMvxCommand SaveCommand => new MvxCommand(Save);
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public MTProtoGoSettings Settings { get; set; }
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.MTProtoGoSettings;
+ }
+
+ private void Save()
+ {
+ NavigationService.Close(this, new Record
+ {
+ Id = this.Id,
+ Host = this.Host,
+ MTProtoGoSettings = Settings,
+ });
+ }
+
+ private void SaveAndInstall()
+ {
+ var record = new Record
+ {
+ Id = this.Id,
+ Host = this.Host,
+ MTProtoGoSettings = Settings,
+ };
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/MTProtoGoInstallViewModel.cs b/ProxySuper.Core/ViewModels/MTProtoGoInstallViewModel.cs
new file mode 100644
index 00000000..794d4f18
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/MTProtoGoInstallViewModel.cs
@@ -0,0 +1,94 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class MTProtoGoInstallViewModel : MvxViewModel
+ {
+ Host _host;
+
+ MTProtoGoSettings _settings;
+
+ MTProtoGoService _mtproxyService;
+
+ Action _onSave;
+
+ public override void Prepare(Record parameter)
+ {
+ _host = parameter.Host;
+ _settings = parameter.MTProtoGoSettings;
+ _onSave = parameter.OnSave;
+ }
+
+ public override Task Initialize()
+ {
+ _mtproxyService = new MTProtoGoService(_host, _settings);
+ _mtproxyService.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _mtproxyService.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _mtproxyService.Connect();
+ return base.Initialize();
+ }
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _mtproxyService.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+ public ProjectProgress Progress
+ {
+ get => _mtproxyService.Progress;
+ }
+
+ public string Logs
+ {
+ get => _mtproxyService.Progress.Logs;
+ }
+
+
+ #region Command
+
+ public IMvxCommand InstallCommand => new MvxCommand(() =>
+ {
+ _mtproxyService.Install();
+
+ // 安装时生成的Secret需要保存
+ _onSave();
+ });
+
+ public IMvxCommand UpdateSettingsCommand => new MvxCommand(() =>
+ {
+ _mtproxyService.UpdateSettings();
+
+ // 安装时生成的Secret需要保存
+ _onSave();
+ });
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_mtproxyService.Uninstall);
+
+ #endregion
+
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".mtproxy-go.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs
new file mode 100644
index 00000000..8e59f65f
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs
@@ -0,0 +1,24 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class NaiveProxyConfigViewModel : MvxViewModel
+ {
+ public NaiveProxySettings Settings { get; set; }
+
+ public override void Prepare(NaiveProxySettings parameter)
+ {
+ Settings = parameter;
+ }
+
+ public string Link
+ {
+ get
+ {
+ return ShareLink.BuildNaiveProxy(Settings);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs
new file mode 100644
index 00000000..cb131e41
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs
@@ -0,0 +1,63 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class NaiveProxyEditorViewModel : MvxViewModel
+ {
+ public NaiveProxyEditorViewModel(IMvxNavigationService navigationService)
+ {
+ NavigationService = navigationService;
+ }
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public NaiveProxySettings Settings { get; set; }
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.NaiveProxySettings;
+ }
+
+
+ public IMvxCommand SaveCommand => new MvxCommand(Save);
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ private void Save()
+ {
+ NavigationService.Close(this, new Record
+ {
+ Id = Id,
+ Host = Host,
+ NaiveProxySettings = Settings
+ });
+ }
+
+
+ private void SaveAndInstall()
+ {
+ var record = new Record
+ {
+ Id = this.Id,
+ Host = this.Host,
+ NaiveProxySettings = Settings,
+ };
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs
new file mode 100644
index 00000000..29870767
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs
@@ -0,0 +1,75 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class NaiveProxyInstallViewModel : MvxViewModel
+ {
+ Host _host;
+
+ NaiveProxySettings _settings;
+
+ NaiveProxyService _service;
+
+ public override void Prepare(Record parameter)
+ {
+ _host = parameter.Host;
+ _settings = parameter.NaiveProxySettings;
+ }
+
+ public override Task Initialize()
+ {
+ _service = new NaiveProxyService(_host, _settings);
+ _service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _service.Connect();
+ return base.Initialize();
+ }
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _service.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+
+ public ProjectProgress Progress => _service.Progress;
+
+ public string Logs => _service.Progress.Logs;
+
+
+ #region Commands
+
+ public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
+
+ public IMvxCommand UpdateSettingsCommand => new MvxCommand(_service.UpdateSettings);
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
+
+ public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
+
+ #endregion
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".naiveproxy.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/ShareLinkViewModel.cs b/ProxySuper.Core/ViewModels/ShareLinkViewModel.cs
new file mode 100644
index 00000000..749d86bf
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/ShareLinkViewModel.cs
@@ -0,0 +1,31 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class ShareLinkViewModel : MvxViewModel>
+ {
+ public List Records { get; set; }
+
+ public override void Prepare(List parameter)
+ {
+ Records = parameter;
+ }
+
+ public string ShareLinks
+ {
+ get
+ {
+ StringBuilder sb = new StringBuilder();
+ Records.ForEach(record =>
+ {
+ var link = record.GetShareLink();
+ sb.AppendLine(link);
+ });
+ return sb.ToString();
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/TrojanGoConfigViewModel.cs b/ProxySuper.Core/ViewModels/TrojanGoConfigViewModel.cs
new file mode 100644
index 00000000..ff469e22
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/TrojanGoConfigViewModel.cs
@@ -0,0 +1,24 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class TrojanGoConfigViewModel : MvxViewModel
+ {
+ public TrojanGoSettings Settings { get; set; }
+
+ public override void Prepare(TrojanGoSettings parameter)
+ {
+ Settings = parameter;
+ }
+
+ public string Link
+ {
+ get
+ {
+ return ShareLink.BuildTrojanGo(Settings);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/TrojanGoEditorViewModel.cs b/ProxySuper.Core/ViewModels/TrojanGoEditorViewModel.cs
new file mode 100644
index 00000000..737e9b03
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/TrojanGoEditorViewModel.cs
@@ -0,0 +1,63 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class TrojanGoEditorViewModel : MvxViewModel
+ {
+ public TrojanGoEditorViewModel(IMvxNavigationService navigationService)
+ {
+ NavigationService = navigationService;
+ }
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public IMvxCommand SaveCommand => new MvxCommand(Save);
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public TrojanGoSettings Settings { get; set; }
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.TrojanGoSettings;
+ }
+
+ private void Save()
+ {
+ NavigationService.Close(this, new Record
+ {
+ Id = this.Id,
+ Host = this.Host,
+ TrojanGoSettings = Settings,
+ });
+ }
+
+ private void SaveAndInstall()
+ {
+ var record = new Record
+ {
+ Id = this.Id,
+ Host = this.Host,
+ TrojanGoSettings = Settings,
+ };
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ }
+
+
+}
diff --git a/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs b/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs
new file mode 100644
index 00000000..e4582958
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs
@@ -0,0 +1,85 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class TrojanGoInstallViewModel : MvxViewModel
+ {
+ Host _host;
+
+ TrojanGoSettings _settings;
+
+ TrojanGoService _trojanGoService;
+
+ public override void Prepare(Record parameter)
+ {
+ _host = parameter.Host;
+ _settings = parameter.TrojanGoSettings;
+ }
+
+ public override Task Initialize()
+ {
+ _trojanGoService = new TrojanGoService(_host, _settings);
+ _trojanGoService.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _trojanGoService.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _trojanGoService.Connect();
+ return base.Initialize();
+ }
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _trojanGoService.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+ public ProjectProgress Progress
+ {
+ get => _trojanGoService.Progress;
+ }
+
+ public string Logs
+ {
+ get => _trojanGoService.Progress.Logs;
+ }
+
+
+ #region Command
+
+ public IMvxCommand InstallCommand => new MvxCommand(_trojanGoService.Install);
+
+ public IMvxCommand UpdateSettingsCommand => new MvxCommand(_trojanGoService.UpdateSettings);
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_trojanGoService.Uninstall);
+
+ public IMvxCommand UploadCertCommand => new MvxCommand(_trojanGoService.UploadCert);
+
+ public IMvxCommand UploadWebCommand => new MvxCommand(_trojanGoService.UploadWeb);
+
+ public IMvxCommand ApplyForCertCommand => new MvxCommand(_trojanGoService.ApplyForCert);
+
+ #endregion
+
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".trojan-go.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs b/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs
new file mode 100644
index 00000000..51fc185d
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs
@@ -0,0 +1,109 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models.Projects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class V2rayConfigViewModel : MvxViewModel
+ {
+ public V2raySettings Settings { get; set; }
+
+ public override void Prepare(V2raySettings parameter)
+ {
+ Settings = parameter;
+ }
+
+
+ public bool Checked_VLESS_TCP
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VLESS_TCP);
+ }
+ }
+
+ public bool Checked_VLESS_WS
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VLESS_WS);
+ }
+ }
+
+ public bool Checked_VLESS_KCP
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VLESS_KCP);
+ }
+ }
+
+ public bool Checked_VLESS_QUIC
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VLESS_QUIC);
+ }
+ }
+
+ public bool Checked_VLESS_gRPC
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VLESS_gRPC);
+ }
+ }
+
+ public bool Checked_VMESS_TCP
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VMESS_TCP);
+ }
+ }
+
+ public bool Checked_VMESS_WS
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VMESS_WS);
+ }
+ }
+
+ public bool Checked_VMESS_KCP
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VMESS_KCP);
+ }
+ }
+
+ public bool Checked_VMESS_QUIC
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VMESS_QUIC);
+ }
+ }
+
+ public bool Checked_Trojan_TCP
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.Trojan_TCP);
+ }
+ }
+
+ public bool CheckedShadowSocks
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.ShadowsocksAEAD);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs b/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs
new file mode 100644
index 00000000..b8ac26bf
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs
@@ -0,0 +1,572 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public partial class V2rayEditorViewModel : MvxViewModel
+ {
+ public V2rayEditorViewModel(IMvxNavigationService navigationService)
+ {
+ NavigationService = navigationService;
+ }
+
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public V2raySettings Settings { get; set; }
+
+ public IMvxCommand SaveCommand => new MvxCommand(Save);
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.V2raySettings;
+ }
+
+ public void Save()
+ {
+ NavigationService.Close(this, new Record()
+ {
+ Id = Id,
+ Host = Host,
+ V2raySettings = Settings,
+ });
+ }
+
+ public void SaveAndInstall()
+ {
+ var record = new Record()
+ {
+ Id = Id,
+ Host = Host,
+ V2raySettings = Settings,
+ };
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ }
+
+ public partial class V2rayEditorViewModel
+ {
+ public List KcpTypes => V2raySettings.DisguiseTypes;
+
+ public List QuicTypes => V2raySettings.DisguiseTypes;
+
+ ///
+ /// https://www.v2ray.com/chapter_02/transport/quic.html
+ ///
+ public List QuicSecurities => new List {
+ "none",
+ "aes-128-gcm",
+ "chacha20-poly1305"
+ };
+
+ ///
+ /// https://www.v2ray.com/chapter_02/protocols/shadowsocks.html
+ ///
+ public List ShadowSocksMethods => new List {
+ "aes-256-cfb",
+ "aes-128-cfb",
+ "chacha20",
+ "chacha20-ietf",
+ "aes-256-gcm",
+ "aes-128-gcm",
+ "chacha20-poly1305"
+ };
+
+ public IMvxCommand RandomUuid => new MvxCommand(() => GetUuid());
+
+ public bool WithTLS
+ {
+ get => Settings.WithTLS;
+ set
+ {
+ Settings.WithTLS = value;
+ RaisePropertyChanged("Port");
+ }
+ }
+
+ public int Port
+ {
+ get => Settings.Port;
+ set
+ {
+ Settings.Port = value;
+ RaisePropertyChanged("Port");
+ }
+ }
+
+ public int VLESS_KCP_Port
+ {
+ get => Settings.VLESS_KCP_Port;
+ set
+ {
+ Settings.VLESS_KCP_Port = value;
+ RaisePropertyChanged("VLESS_KCP_Port");
+ }
+ }
+
+ public int VMESS_KCP_Port
+ {
+ get => Settings.VMESS_KCP_Port;
+ set
+ {
+ Settings.VMESS_KCP_Port = value;
+ RaisePropertyChanged("VMESS_KCP_Port");
+ }
+ }
+
+ public string UUID
+ {
+ get => Settings.UUID;
+ set
+ {
+ Settings.UUID = value;
+ RaisePropertyChanged("UUID");
+ }
+ }
+
+ public string MultiUUID
+ {
+ get => string.Join(",", Settings.MulitUUID);
+ set
+ {
+ var input = value.Replace(',', ',');
+ var arr = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
+ arr.RemoveAll(x => x == this.UUID);
+ Settings.MulitUUID = arr;
+ RaisePropertyChanged("MultiUUID");
+ }
+ }
+
+ public string Domain
+ {
+ get => Settings.Domain;
+ set
+ {
+ Settings.Domain = value;
+ RaisePropertyChanged("Domain");
+ }
+ }
+
+ public string MaskDomain
+ {
+ get => Settings.MaskDomain;
+ set
+ {
+ Settings.MaskDomain = value;
+ RaisePropertyChanged("MaskDomain");
+ }
+ }
+
+ #region Torjan
+ public string TrojanPassword
+ {
+ get => Settings.TrojanPassword;
+ set => Settings.TrojanPassword = value;
+ }
+ public bool Checked_Trojan_TCP
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.Trojan_TCP);
+ }
+ set
+ {
+ if (value == true)
+ {
+ if (!Settings.Types.Contains(V2RayType.Trojan_TCP))
+ Settings.Types.Add(V2RayType.Trojan_TCP);
+ }
+ else
+ {
+ Settings.Types.Remove(V2RayType.Trojan_TCP);
+ }
+ RaisePropertyChanged("Checked_Trojan_TCP");
+ }
+ }
+ public string Trojan_TCP_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.Trojan_TCP, Settings);
+ }
+ #endregion
+
+ #region ShadowSocks
+ public int ShadowSocksPort
+ {
+ get => Settings.ShadowSocksPort;
+ set
+ {
+ Settings.ShadowSocksPort = value;
+ RaisePropertyChanged("ShadowSocksPort");
+ }
+ }
+ public bool CheckedShadowSocks
+ {
+
+ get => Settings.Types.Contains(V2RayType.ShadowsocksAEAD);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.ShadowsocksAEAD);
+ RaisePropertyChanged("CheckedShadowSocks");
+ }
+ }
+
+ public string ShadowSocksPassword
+ {
+ get => Settings.ShadowSocksPassword;
+ set => Settings.ShadowSocksPassword = value;
+ }
+ public string ShadowSocksMethod
+ {
+ get => Settings.ShadowSocksMethod;
+ set
+ {
+ var namespaceStr = typeof(ComboBoxItem).FullName + ":";
+ var trimValue = value.Replace(namespaceStr, "");
+ trimValue = trimValue.Trim();
+ Settings.ShadowSocksMethod = trimValue;
+ RaisePropertyChanged("ShadowSocksMethod");
+ }
+ }
+ public string ShadowSocksShareLink
+ {
+ get => ShareLink.Build(V2RayType.ShadowsocksAEAD, Settings);
+ }
+ #endregion
+
+
+ private void CheckBoxChanged(bool value, V2RayType type)
+ {
+ if (value == true)
+ {
+ if (!Settings.Types.Contains(type))
+ {
+ Settings.Types.Add(type);
+ }
+ }
+ else
+ {
+ Settings.Types.RemoveAll(x => x == type);
+ }
+ }
+
+
+
+ private void GetUuid()
+ {
+ UUID = Guid.NewGuid().ToString();
+ RaisePropertyChanged("UUID");
+ }
+
+ }
+
+ ///
+ /// VMESS SETTINGS
+ ///
+ public partial class V2rayEditorViewModel
+ {
+ #region VMESS TCP
+ public bool Checked_VMESS_TCP
+ {
+ get => Settings.Types.Contains(V2RayType.VMESS_TCP);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VMESS_TCP);
+ RaisePropertyChanged("Checked_VMESS_TCP");
+ }
+ }
+ public string VMESS_TCP_Path
+ {
+ get => Settings.VMESS_TCP_Path;
+ set => Settings.VMESS_TCP_Path = value;
+ }
+ public string VMESS_TCP_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VMESS_TCP, Settings);
+ }
+ #endregion
+
+ #region VMESS WS
+ public bool Checked_VMESS_WS
+ {
+ get => Settings.Types.Contains(V2RayType.VMESS_WS);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VMESS_WS);
+ RaisePropertyChanged("Checked_VMESS_WS");
+ }
+ }
+ public string VMESS_WS_Path
+ {
+ get => Settings.VMESS_WS_Path;
+ set => Settings.VMESS_WS_Path = value;
+ }
+ public string VMESS_WS_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VMESS_WS, Settings);
+ }
+ #endregion
+
+ #region VMESS KCP
+ public string VMESS_KCP_Seed
+ {
+ get => Settings.VMESS_KCP_Seed;
+ set => Settings.VMESS_KCP_Seed = value;
+ }
+ public string VMESS_KCP_Type
+ {
+ get => Settings.VMESS_KCP_Type;
+ set
+ {
+ var namespaceStr = typeof(ComboBoxItem).FullName + ":";
+ var trimValue = value.Replace(namespaceStr, "");
+ trimValue = trimValue.Trim();
+ Settings.VMESS_KCP_Type = trimValue;
+ RaisePropertyChanged("VMESS_KCP_Type");
+ }
+ }
+ public bool Checked_VMESS_KCP
+ {
+ get => Settings.Types.Contains(V2RayType.VMESS_KCP);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VMESS_KCP);
+ RaisePropertyChanged("Checked_VMESS_KCP");
+ }
+ }
+ public string VMESS_KCP_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VMESS_KCP, Settings);
+ }
+ #endregion
+
+ #region VMESS QUIC
+ public bool Checked_VMESS_QUIC
+ {
+ get => Settings.Types.Contains(V2RayType.VMESS_QUIC);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VMESS_QUIC);
+ RaisePropertyChanged(nameof(Checked_VMESS_QUIC));
+ }
+ }
+ public string VMESS_QUIC_Key
+ {
+ get => Settings.VMESS_QUIC_Key;
+ set
+ {
+ Settings.VMESS_QUIC_Key = value;
+ RaisePropertyChanged(nameof(VMESS_QUIC_Key));
+ }
+ }
+ public string VMESS_QUIC_Security
+ {
+ get => Settings.VMESS_QUIC_Security;
+ set
+ {
+ Settings.VMESS_QUIC_Security = value;
+ RaisePropertyChanged(nameof(VMESS_QUIC_Security));
+ }
+ }
+ public string VMESS_QUIC_Type
+ {
+ get => Settings.VMESS_QUIC_Type;
+ set
+ {
+ Settings.VMESS_QUIC_Type = value;
+ RaisePropertyChanged(nameof(VMESS_QUIC_Type));
+ }
+ }
+ public int VMESS_QUIC_Port
+ {
+ get => Settings.VMESS_QUIC_Port;
+ set
+ {
+ Settings.VMESS_QUIC_Port = value;
+ RaisePropertyChanged(nameof(VMESS_QUIC_Port));
+ }
+ }
+ public string VMESS_QUIC_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VMESS_QUIC, Settings);
+ }
+ #endregion
+
+ }
+
+
+ ///
+ /// VLESS SETTINGS
+ ///
+ public partial class V2rayEditorViewModel
+ {
+ #region VLESS TCP
+ public bool Checked_VLESS_TCP
+ {
+ get => Settings.Types.Contains(V2RayType.VLESS_TCP);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VLESS_TCP);
+ RaisePropertyChanged("Checked_VLESS_TCP");
+ }
+ }
+ public string VLESS_TCP_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VLESS_TCP, Settings);
+ }
+ #endregion
+
+ #region VLESS WS
+ public string VLESS_WS_Path
+ {
+ get => Settings.VLESS_WS_Path;
+ set => Settings.VLESS_WS_Path = value;
+ }
+ public bool Checked_VLESS_WS
+ {
+ get
+ {
+ return Settings.Types.Contains(V2RayType.VLESS_WS);
+ }
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VLESS_WS);
+ RaisePropertyChanged("Checked_VLESS_WS");
+ }
+ }
+ public string VLESS_WS_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VLESS_WS, Settings);
+ }
+ #endregion
+
+ #region VLESS KCP
+ public string VLESS_KCP_Seed
+ {
+ get => Settings.VLESS_KCP_Seed;
+ set => Settings.VLESS_KCP_Seed = value;
+ }
+ public string VLESS_KCP_Type
+ {
+ get => Settings.VLESS_KCP_Type;
+ set
+ {
+ var namespaceStr = typeof(ComboBoxItem).FullName + ":";
+ var trimValue = value.Replace(namespaceStr, "");
+ trimValue = trimValue.Trim();
+ Settings.VLESS_KCP_Type = trimValue;
+ RaisePropertyChanged("VLESS_KCP_Type");
+ }
+ }
+ public bool Checked_VLESS_KCP
+ {
+ get => Settings.Types.Contains(V2RayType.VLESS_KCP);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VLESS_KCP);
+ RaisePropertyChanged("Checked_VLESS_KCP");
+ }
+ }
+ public string VLESS_KCP_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VLESS_KCP, Settings);
+ }
+ #endregion
+
+ #region VLESS QUIC
+ public bool Checked_VLESS_QUIC
+ {
+ get => Settings.Types.Contains(V2RayType.VLESS_QUIC);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VLESS_QUIC);
+ RaisePropertyChanged(nameof(Checked_VLESS_QUIC));
+ }
+ }
+ public string VLESS_QUIC_Key
+ {
+ get => Settings.VLESS_QUIC_Key; set
+ {
+ Settings.VLESS_QUIC_Key = value;
+ RaisePropertyChanged(nameof(VLESS_QUIC_Key));
+ }
+ }
+ public string VLESS_QUIC_Security
+ {
+ get => Settings.VLESS_QUIC_Security;
+ set
+ {
+ Settings.VLESS_QUIC_Security = value;
+ RaisePropertyChanged(nameof(VLESS_QUIC_Security));
+ }
+ }
+ public string VLESS_QUIC_Type
+ {
+ get => Settings.VLESS_QUIC_Type;
+ set
+ {
+ Settings.VLESS_QUIC_Type = value;
+ RaisePropertyChanged(nameof(VLESS_QUIC_Type));
+ }
+ }
+ public int VLESS_QUIC_Port
+ {
+ get => Settings.VLESS_QUIC_Port;
+ set
+ {
+ Settings.VLESS_QUIC_Port = value;
+ RaisePropertyChanged(nameof(VLESS_QUIC_Port));
+ }
+ }
+ public string VLESS_QUIC_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VLESS_QUIC, Settings);
+ }
+ #endregion
+
+ #region VLESS gRPC
+ public string VLESS_gRPC_ServiceName
+ {
+ get => Settings.VLESS_gRPC_ServiceName;
+ set => Settings.VLESS_gRPC_ServiceName = value;
+ }
+ public int VLESS_gRPC_Port
+ {
+ get => Settings.VLESS_gRPC_Port;
+ set => Settings.VLESS_gRPC_Port = value;
+ }
+ public bool Checked_VLESS_gRPC
+ {
+ get => Settings.Types.Contains(V2RayType.VLESS_gRPC);
+ set
+ {
+ CheckBoxChanged(value, V2RayType.VLESS_gRPC);
+ RaisePropertyChanged("Checked_VLESS_gRPC");
+ }
+ }
+ public string VLESS_gRPC_ShareLink
+ {
+ get => ShareLink.Build(V2RayType.VLESS_gRPC, Settings);
+ }
+ #endregion
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/V2rayInstallViewModel.cs b/ProxySuper.Core/ViewModels/V2rayInstallViewModel.cs
new file mode 100644
index 00000000..0bfa7aa8
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/V2rayInstallViewModel.cs
@@ -0,0 +1,88 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class V2rayInstallViewModel : MvxViewModel
+ {
+ Host _host;
+
+ V2raySettings _settings;
+
+ V2rayService _service;
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _service.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+ public override void Prepare(Record parameter)
+ {
+ this._host = parameter.Host;
+ this._settings = parameter.V2raySettings;
+ }
+
+ public override Task Initialize()
+ {
+ _service = new V2rayService(_host, _settings);
+ _service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _service.Connect();
+
+ return base.Initialize();
+ }
+
+ public ProjectProgress Progress
+ {
+ get => _service.Progress;
+ }
+
+ public string Logs
+ {
+ get => _service.Progress.Logs;
+ }
+
+
+
+ #region Command
+
+ public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
+
+ public IMvxCommand UpdateSettingsCommand => new MvxCommand(_service.UpdateSettings);
+
+ public IMvxCommand UpdateV2rayCoreCommand => new MvxCommand(_service.UpdateV2rayCore);
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
+
+ public IMvxCommand UploadCertCommand => new MvxCommand(_service.UploadCert);
+
+ public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
+
+ public IMvxCommand ApplyForCertCommand => new MvxCommand(_service.ApplyForCert);
+
+ #endregion
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".v2ray.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs b/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs
new file mode 100644
index 00000000..1b6851d3
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs
@@ -0,0 +1,92 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models.Projects;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class XrayConfigViewModel : MvxViewModel
+ {
+
+ public XraySettings Settings { get; set; }
+
+ public override void Prepare(XraySettings parameter)
+ {
+ Settings = parameter;
+ }
+
+ public string Flow
+ {
+ get { return Settings.Flow; }
+ }
+
+ public string UTLS
+ {
+ get { return Settings.UTLS; }
+ }
+
+ public bool Checked_VLESS_XTLS_RAW_REALITY
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_XTLS_RAW_REALITY);
+ }
+ }
+
+
+ public bool Checked_VLESS_RAW_XTLS
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_RAW_XTLS);
+ }
+ }
+
+
+ public bool Checked_VLESS_XHTTP
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_XHTTP);
+ }
+ }
+
+ public bool Checked_VLESS_WS
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_WS);
+ }
+ }
+
+ public bool Checked_VLESS_gRPC
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_gRPC);
+ }
+ }
+
+ public bool Checked_VMESS_KCP
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VMESS_KCP);
+ }
+ }
+
+ public bool Checked_Trojan_TCP
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.Trojan_TCP);
+ }
+ }
+
+ public bool CheckedShadowSocks
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.ShadowsocksAEAD);
+ }
+ }
+ }
+}
diff --git a/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs b/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs
new file mode 100644
index 00000000..42043675
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs
@@ -0,0 +1,507 @@
+using MvvmCross.Commands;
+using MvvmCross.Navigation;
+using MvvmCross.ViewModels;
+using Newtonsoft.Json.Linq;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public partial class XrayEditorViewModel : MvxViewModel
+ {
+ public XrayEditorViewModel(IMvxNavigationService navigationService)
+ {
+ NavigationService = navigationService;
+ }
+
+
+ public string Id { get; set; }
+
+ public Host Host { get; set; }
+
+ public XraySettings Settings { get; set; }
+
+ public IMvxCommand SaveCommand => new MvxCommand(Save);
+
+ public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
+
+ public IMvxNavigationService NavigationService { get; }
+
+ public override void Prepare(Record parameter)
+ {
+ var record = Utils.DeepClone(parameter);
+ Id = record.Id;
+ Host = record.Host;
+ Settings = record.XraySettings;
+ }
+
+ public void Save()
+ {
+ if (Settings.Types.Count > 0)
+ {
+ NavigationService.Close(this, new Record()
+ {
+ Id = Id,
+ Host = Host,
+ XraySettings = Settings,
+ });
+ }
+ else
+ {
+ MessageBox.Show("Error:No configuration was selected!", "Tips");
+ }
+
+ }
+
+ public void SaveAndInstall()
+ {
+ if (Settings.Types.Count > 0)
+ {
+ var record = new Record()
+ {
+ Id = Id,
+ Host = Host,
+ XraySettings = Settings,
+ };
+ NavigationService.Close(this, record);
+ NavigationService.Navigate(record);
+ }
+ else
+ {
+ MessageBox.Show("Error:No configuration was selected!", "Tips");
+ }
+
+ }
+ }
+
+ public partial class XrayEditorViewModel
+ {
+ public List UTLSList { get => XraySettings.UTLSList; }
+
+ /*
+ public List QuicTypes => XraySettings.DisguiseTypes;
+
+ public List QuicSecurities => new List
+ {
+ "none",
+ "aes-128-gcm",
+ "chacha20-poly1305"
+ };
+ */
+
+ public IMvxCommand RandomUuid => new MvxCommand(() => GetUuid());
+
+ public bool WithTLS
+ {
+ get => Settings.WithTLS;
+ set
+ {
+ Settings.WithTLS = value;
+ RaisePropertyChanged("WithTLS");
+ }
+ }
+
+ public int Port
+ {
+ get => Settings.Port;
+ set
+ {
+ Settings.Port = value;
+ RaisePropertyChanged("Port");
+ }
+ }
+
+
+ public string UTLS
+ {
+ get => Settings.UTLS;
+ set
+ {
+ Settings.UTLS = value;
+ RaisePropertyChanged(nameof(UTLS));
+ }
+ }
+
+
+ public int VMESS_KCP_Port
+ {
+ get => Settings.VMESS_KCP_Port;
+ set
+ {
+ Settings.VMESS_KCP_Port = value;
+ RaisePropertyChanged("VMESS_KCP_Port");
+ }
+ }
+
+ public string UUID
+ {
+ get => Settings.UUID;
+ set
+ {
+ Settings.UUID = value;
+ RaisePropertyChanged("UUID");
+ }
+ }
+
+ public string MultiUUID
+ {
+ get => string.Join(",", Settings.MulitUUID);
+ set
+ {
+ var input = value.Replace(',', ',');
+ var arr = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
+ arr.RemoveAll(x => x == this.UUID);
+ Settings.MulitUUID = arr;
+ RaisePropertyChanged("MultiUUID");
+ }
+ }
+
+ public string Domain
+ {
+ get => Settings.Domain;
+ set
+ {
+ Settings.Domain = value;
+ RaisePropertyChanged("Domain");
+ }
+ }
+
+ public string MaskDomain
+ {
+ get => Settings.MaskDomain;
+ set
+ {
+ Settings.MaskDomain = value;
+ RaisePropertyChanged("MaskDomain");
+ }
+ }
+
+ #region Trojan
+ public string TrojanPassword
+ {
+ get => Settings.TrojanPassword;
+ set => Settings.TrojanPassword = value;
+ }
+
+ public bool Checked_Trojan_TCP
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.Trojan_TCP);
+ }
+ set
+ {
+ if (value == true)
+ {
+ if (!Settings.Types.Contains(XrayType.Trojan_TCP))
+ Settings.Types.Add(XrayType.Trojan_TCP);
+ }
+ else
+ {
+ Settings.Types.Remove(XrayType.Trojan_TCP);
+ }
+ RaisePropertyChanged("Checked_Trojan_TCP");
+ }
+ }
+ public string Trojan_TCP_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.Trojan_TCP, Settings);
+ }
+ #endregion
+
+ #region ShadowSocks
+ public int ShadowSocksPort
+ {
+ get => Settings.ShadowSocksPort;
+ set
+ {
+ Settings.ShadowSocksPort = value;
+ RaisePropertyChanged("ShadowSocksPort");
+ }
+ }
+ public bool CheckedShadowSocks
+ {
+
+ get => Settings.Types.Contains(XrayType.ShadowsocksAEAD);
+ set
+ {
+ CheckBoxChanged(value, XrayType.ShadowsocksAEAD);
+ RaisePropertyChanged("CheckedShadowSocks");
+ }
+ }
+ public string ShadowSocksPassword
+ {
+ get => Settings.ShadowSocksPassword;
+ set => Settings.ShadowSocksPassword = value;
+ }
+ public List ShadowSocksMethods => new List
+ {
+ "2022-blake3-aes-128-gcm",
+ "2022-blake3-aes-256-gcm",
+ "2022-blake3-chacha20-poly1305",
+ "aes-256-gcm",
+ "aes-128-gcm",
+ "chacha20-poly1305",
+ "none"
+ };
+ public string ShadowSocksMethod
+ {
+ get => Settings.ShadowSocksMethod;
+ set
+ {
+ var namespaceStr = typeof(ComboBoxItem).FullName + ":";
+ var trimValue = value.Replace(namespaceStr, "");
+ trimValue = trimValue.Trim();
+ Settings.ShadowSocksMethod = trimValue;
+ RaisePropertyChanged("ShadowSocksMethod");
+ }
+ }
+ public string ShadowSocksShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.ShadowsocksAEAD, Settings);
+ }
+ #endregion
+
+ private void CheckBoxChanged(bool value, XrayType type)
+ {
+ if (value == true)
+ {
+ if (!Settings.Types.Contains(type))
+ {
+ Settings.Types.Add(type);
+ }
+ }
+ else
+ {
+ Settings.Types.RemoveAll(x => x == type);
+ }
+ }
+
+ private void GetUuid()
+ {
+ UUID = Guid.NewGuid().ToString();
+ RaisePropertyChanged("UUID");
+ }
+
+ }
+
+ ///
+ /// VMESS
+ ///
+ public partial class XrayEditorViewModel
+ {
+
+ #region VMESS KCP
+ public List KcpTypes => XraySettings.DisguiseTypes;
+ public string VMESS_KCP_Seed
+ {
+ get => Settings.VMESS_KCP_Seed;
+ set => Settings.VMESS_KCP_Seed = value;
+ }
+ public string VMESS_KCP_Type
+ {
+ get => Settings.VMESS_KCP_Type;
+ set
+ {
+ var namespaceStr = typeof(ComboBoxItem).FullName + ":";
+ var trimValue = value.Replace(namespaceStr, "");
+ trimValue = trimValue.Trim();
+ Settings.VMESS_KCP_Type = trimValue;
+ RaisePropertyChanged("VMESS_KCP_Type");
+ }
+ }
+ public bool Checked_VMESS_KCP
+ {
+ get => Settings.Types.Contains(XrayType.VMESS_KCP);
+ set
+ {
+ CheckBoxChanged(value, XrayType.VMESS_KCP);
+ RaisePropertyChanged("Checked_VMESS_KCP");
+ if(value && !Checked_VLESS_RAW_XTLS
+ && !Checked_VLESS_WS
+ && !Checked_VLESS_gRPC
+ && !Checked_Trojan_TCP)
+ {
+ WithTLS = false;
+ }
+ else
+ {
+ WithTLS = true;
+ }
+ }
+ }
+ public string VMESS_KCP_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.VMESS_KCP, Settings);
+ }
+ #endregion
+
+ }
+
+ ///
+ /// VLESS
+ ///
+ public partial class XrayEditorViewModel
+ {
+
+ public List FlowList { get => XraySettings.FlowList; }
+
+ public string Flow
+ {
+ get => Settings.Flow;
+ set
+ {
+ Settings.Flow = value;
+ RaisePropertyChanged(nameof(Flow));
+ }
+ }
+
+ public string REALITY_spiderX
+ {
+ get => Settings.REALITY_spiderX;
+ set => Settings.REALITY_spiderX = value;
+ }
+
+
+ #region VLESS XTLS(RAW) REALITY
+
+ public bool Checked_VLESS_XTLS_RAW_REALITY
+ {
+ get => Settings.Types.Contains(XrayType.VLESS_XTLS_RAW_REALITY);
+ set
+ {
+ CheckBoxChanged(value, XrayType.VLESS_XTLS_RAW_REALITY);
+ RaisePropertyChanged("Checked_VLESS_XTLS_RAW_REALITY");
+ if (value)
+ {
+ WithTLS = false;
+ }
+ else
+ {
+ WithTLS = true;
+ }
+ }
+ }
+ public string VLESS_XTLS_RAW_REALITY_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.VLESS_XTLS_RAW_REALITY, Settings);
+ }
+
+ #endregion
+
+ #region VLESS XTLS(RAW)
+
+ public bool Checked_VLESS_RAW_XTLS
+ {
+ get => Settings.Types.Contains(XrayType.VLESS_RAW_XTLS);
+ set
+ {
+ CheckBoxChanged(value, XrayType.VLESS_RAW_XTLS);
+ RaisePropertyChanged("Checked_VLESS_RAW_XTLS");
+ if (value)
+ {
+ WithTLS = true;
+ }
+ }
+ }
+ public string VLESS_RAW_XTLS_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.VLESS_RAW_XTLS, Settings);
+ }
+ #endregion
+
+ #region VLESS XHTTP
+ public string VLESS_XHTTP_Path
+ {
+ get => Settings.VLESS_XHTTP_Path;
+ set => Settings.VLESS_XHTTP_Path = value;
+ }
+ public bool Checked_VLESS_XHTTP
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_XHTTP);
+ }
+ set
+ {
+ CheckBoxChanged(value, XrayType.VLESS_XHTTP);
+ RaisePropertyChanged("Checked_VLESS_XHTTP");
+ if (value)
+ {
+ WithTLS = true;
+ }
+ }
+ }
+ public string VLESS_XHTTP_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.VLESS_XHTTP, Settings);
+ }
+ #endregion
+
+ #region VLESS WS
+ public string VLESS_WS_Path
+ {
+ get => Settings.VLESS_WS_Path;
+ set => Settings.VLESS_WS_Path = value;
+ }
+ public bool Checked_VLESS_WS
+ {
+ get
+ {
+ return Settings.Types.Contains(XrayType.VLESS_WS);
+ }
+ set
+ {
+ CheckBoxChanged(value, XrayType.VLESS_WS);
+ RaisePropertyChanged("Checked_VLESS_WS");
+ if (value)
+ {
+ WithTLS = true;
+ }
+ }
+ }
+ public string VLESS_WS_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.VLESS_WS, Settings);
+ }
+ #endregion
+
+ #region VLESS gRPC
+ public string VLESS_gRPC_ServiceName
+ {
+ get => Settings.VLESS_gRPC_ServiceName;
+ set => Settings.VLESS_gRPC_ServiceName = value;
+ }
+ public int VLESS_gRPC_Port
+ {
+ get => Settings.VLESS_gRPC_Port;
+ set => Settings.VLESS_gRPC_Port = value;
+ }
+ public bool Checked_VLESS_gRPC
+ {
+ get => Settings.Types.Contains(XrayType.VLESS_gRPC);
+ set
+ {
+ CheckBoxChanged(value, XrayType.VLESS_gRPC);
+ RaisePropertyChanged("Checked_VLESS_gRPC");
+ if (value)
+ {
+ WithTLS = true;
+ }
+ }
+ }
+ public string VLESS_gRPC_ShareLink
+ {
+ get => ShareLink.XrayBuild(XrayType.VLESS_gRPC, Settings);
+ }
+ #endregion
+ }
+
+}
diff --git a/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs b/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs
new file mode 100644
index 00000000..f7d483e3
--- /dev/null
+++ b/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs
@@ -0,0 +1,88 @@
+using MvvmCross.Commands;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.Models.Hosts;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.Services;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.Core.ViewModels
+{
+ public class XrayInstallViewModel : MvxViewModel
+ {
+ Host _host;
+
+ XraySettings _settings;
+
+ XrayService _xrayService;
+
+ public override void ViewDestroy(bool viewFinishing = true)
+ {
+ _xrayService.Disconnect();
+ this.SaveInstallLog();
+ base.ViewDestroy(viewFinishing);
+ }
+
+ public override void Prepare(Record parameter)
+ {
+ this._host = parameter.Host;
+ this._settings = parameter.XraySettings;
+ }
+
+ public override Task Initialize()
+ {
+ _xrayService = new XrayService(_host, _settings);
+ _xrayService.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
+ _xrayService.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
+ _xrayService.Connect();
+
+ return base.Initialize();
+ }
+
+ public ProjectProgress Progress
+ {
+ get => _xrayService.Progress;
+ }
+
+ public string Logs
+ {
+ get => _xrayService.Progress.Logs;
+ }
+
+
+
+ #region Command
+
+ public IMvxCommand InstallCommand => new MvxCommand(_xrayService.Install);
+
+ public IMvxCommand UpdateSettingsCommand => new MvxCommand(_xrayService.UpdateSettings);
+
+ public IMvxCommand UpdateXrayCoreCommand => new MvxCommand(_xrayService.UpdateXrayCore);
+
+ public IMvxCommand UninstallCommand => new MvxCommand(_xrayService.Uninstall);
+
+ public IMvxCommand UploadCertCommand => new MvxCommand(_xrayService.UploadCert);
+
+ public IMvxCommand UploadWebCommand => new MvxCommand(_xrayService.UploadWeb);
+
+ public IMvxCommand ApplyForCertCommand => new MvxCommand(_xrayService.ApplyForCert);
+
+ #endregion
+
+ private void SaveInstallLog()
+ {
+ if (!Directory.Exists("Logs"))
+ {
+ Directory.CreateDirectory("Logs");
+ }
+
+ var fileName = Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".xary.txt");
+ File.WriteAllText(fileName, Logs);
+ }
+ }
+}
diff --git a/ProxySuper.Core/app.config b/ProxySuper.Core/app.config
new file mode 100644
index 00000000..0703d682
--- /dev/null
+++ b/ProxySuper.Core/app.config
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.Core/packages.config b/ProxySuper.Core/packages.config
new file mode 100644
index 00000000..a3cfb0cd
--- /dev/null
+++ b/ProxySuper.Core/packages.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/App.config b/ProxySuper.WPF/App.config
new file mode 100644
index 00000000..66da88ef
--- /dev/null
+++ b/ProxySuper.WPF/App.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/App.xaml b/ProxySuper.WPF/App.xaml
new file mode 100644
index 00000000..daea7fd7
--- /dev/null
+++ b/ProxySuper.WPF/App.xaml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/App.xaml.cs b/ProxySuper.WPF/App.xaml.cs
new file mode 100644
index 00000000..1eb4bc6e
--- /dev/null
+++ b/ProxySuper.WPF/App.xaml.cs
@@ -0,0 +1,17 @@
+using MvvmCross.Core;
+using MvvmCross.Platforms.Wpf.Core;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF
+{
+ ///
+ /// App.xaml 的交互逻辑
+ ///
+ public partial class App : MvxApplication
+ {
+ protected override void RegisterSetup()
+ {
+ this.RegisterSetupType();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/AdCarouselControl.xaml b/ProxySuper.WPF/Controls/AdCarouselControl.xaml
new file mode 100644
index 00000000..eb77e541
--- /dev/null
+++ b/ProxySuper.WPF/Controls/AdCarouselControl.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/AdCarouselControl.xaml.cs b/ProxySuper.WPF/Controls/AdCarouselControl.xaml.cs
new file mode 100644
index 00000000..c26d94d6
--- /dev/null
+++ b/ProxySuper.WPF/Controls/AdCarouselControl.xaml.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Animation;
+using System.Windows.Media.Imaging;
+using System.Windows.Threading;
+
+namespace ProxySuper.WPF.Controls
+{
+ public partial class AdCarouselControl : UserControl
+ {
+ private class AdItem
+ {
+ public string ImagePath { get; set; }
+ public string Url { get; set; }
+ }
+
+ private readonly List adsLeft = new List
+ {
+ new AdItem { ImagePath="pack://application:,,,/Images/free/ziyoumeng.png", Url="https://codeload.github.com/freegate-release/website/zip/refs/tags/fglatest" },
+ new AdItem { ImagePath="pack://application:,,,/Images/free/tor.png", Url="https://github.com/proxysu/ProxySU/wiki/%E5%85%8D%E8%B4%B9and%E4%BB%98%E8%B4%B9%E7%BF%BB%E5%A2%99%E8%B5%84%E6%BA%90" },
+ new AdItem { ImagePath="pack://application:,,,/Images/free/wujie.png", Url="https://github.com/wujieliulan/download/raw/master/u.zip" },
+ new AdItem { ImagePath="pack://application:,,,/Images/free/saifeng.png", Url="https://s3.amazonaws.com/0ozb-6kaj-r0p8/zh/index.html" }
+ };
+
+
+ private readonly List adsRight = new List
+ {
+ new AdItem { ImagePath="pack://application:,,,/Images/paid/nordvpn.png", Url="https://github.com/proxysu/ProxySU/wiki/%E5%85%8D%E8%B4%B9and%E4%BB%98%E8%B4%B9%E7%BF%BB%E5%A2%99%E8%B5%84%E6%BA%90" },
+ new AdItem { ImagePath="pack://application:,,,/Images/paid/expressvpn.png", Url="https://github.com/proxysu/ProxySU/wiki/%E5%85%8D%E8%B4%B9and%E4%BB%98%E8%B4%B9%E7%BF%BB%E5%A2%99%E8%B5%84%E6%BA%90" },
+ new AdItem { ImagePath="pack://application:,,,/Images/paid/purevpn.png", Url="https://github.com/proxysu/ProxySU/wiki/%E5%85%8D%E8%B4%B9and%E4%BB%98%E8%B4%B9%E7%BF%BB%E5%A2%99%E8%B5%84%E6%BA%90" },
+ new AdItem { ImagePath="pack://application:,,,/Images/paid/surfshark.png", Url="https://github.com/proxysu/ProxySU/wiki/%E5%85%8D%E8%B4%B9and%E4%BB%98%E8%B4%B9%E7%BF%BB%E5%A2%99%E8%B5%84%E6%BA%90" }
+ };
+
+ private int currentIndex = 0;
+ private readonly DispatcherTimer timer;
+ private readonly Duration fadeDuration = new Duration(TimeSpan.FromSeconds(1));
+
+ private bool isExpanded = true;
+ private double adHeight = 150;
+ private double collapsedHeight = 25; // 收起时只显示按钮栏
+
+ public AdCarouselControl()
+ {
+ InitializeComponent();
+
+ // 广告轮播定时器
+ timer = new DispatcherTimer();
+ timer.Interval = TimeSpan.FromSeconds(5);
+ timer.Tick += (s, e) => NextAd();
+ timer.Start();
+
+ ShowAd();
+
+ // 程序启动后 40 秒自动收起
+ var collapseTimer = new DispatcherTimer();
+ collapseTimer.Interval = TimeSpan.FromSeconds(40);
+ collapseTimer.Tick += (s, e) =>
+ {
+ collapseTimer.Stop();
+ CollapseAd();
+ };
+ collapseTimer.Start();
+ }
+
+ private int currentIndexLeft = 0;
+ private int currentIndexRight = 0;
+
+ private void ShowAd()
+ {
+ var adLeft = adsLeft[currentIndexLeft];
+ AdImage1.Source = new BitmapImage(new Uri(adLeft.ImagePath));
+ AdImage1.Opacity = 0;
+ AdImage1.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(0, 1, fadeDuration));
+
+ var adRight = adsRight[currentIndexRight];
+ AdImage2.Source = new BitmapImage(new Uri(adRight.ImagePath));
+ AdImage2.Opacity = 0;
+ AdImage2.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(0, 1, fadeDuration));
+ }
+
+ private void NextAd()
+ {
+ var fadeOut1 = new DoubleAnimation(1, 0, fadeDuration);
+ var fadeOut2 = new DoubleAnimation(1, 0, fadeDuration);
+
+ fadeOut1.Completed += (s, e) =>
+ {
+ currentIndexLeft = (currentIndexLeft + 1) % adsLeft.Count;
+ currentIndexRight = (currentIndexRight + 1) % adsRight.Count;
+ ShowAd();
+ };
+
+ AdImage1.BeginAnimation(UIElement.OpacityProperty, fadeOut1);
+ AdImage2.BeginAnimation(UIElement.OpacityProperty, fadeOut2);
+ }
+
+ private void AdImage_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ if (sender == AdImage1)
+ {
+ var ad = adsLeft[currentIndexLeft];
+ System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
+ {
+ FileName = ad.Url,
+ UseShellExecute = true
+ });
+ }
+ else if (sender == AdImage2)
+ {
+ var ad = adsRight[currentIndexRight];
+ System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
+ {
+ FileName = ad.Url,
+ UseShellExecute = true
+ });
+ }
+ }
+
+ private void ToggleButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (isExpanded)
+ CollapseAd();
+ else
+ ExpandAd();
+ }
+
+ private void CollapseAd()
+ {
+ var anim = new DoubleAnimation(adHeight, collapsedHeight, TimeSpan.FromSeconds(0.5));
+ this.BeginAnimation(HeightProperty, anim);
+ ToggleButton.Content = "▲"; // 收起后显示向上箭头
+ isExpanded = false;
+ }
+
+ private void ExpandAd()
+ {
+ var anim = new DoubleAnimation(collapsedHeight, adHeight, TimeSpan.FromSeconds(0.5));
+ this.BeginAnimation(HeightProperty, anim);
+ ToggleButton.Content = "▼"; // 展开后显示向下箭头
+ isExpanded = true;
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/HostControl.xaml b/ProxySuper.WPF/Controls/HostControl.xaml
new file mode 100644
index 00000000..4ef74649
--- /dev/null
+++ b/ProxySuper.WPF/Controls/HostControl.xaml
@@ -0,0 +1,373 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/HostControl.xaml.cs b/ProxySuper.WPF/Controls/HostControl.xaml.cs
new file mode 100644
index 00000000..e4a1959f
--- /dev/null
+++ b/ProxySuper.WPF/Controls/HostControl.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// HostControl.xaml 的交互逻辑
+ ///
+ public partial class HostControl : UserControl
+ {
+ public HostControl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/ProgressControl.xaml b/ProxySuper.WPF/Controls/ProgressControl.xaml
new file mode 100644
index 00000000..b45c461b
--- /dev/null
+++ b/ProxySuper.WPF/Controls/ProgressControl.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/ProgressControl.xaml.cs b/ProxySuper.WPF/Controls/ProgressControl.xaml.cs
new file mode 100644
index 00000000..f6fe5646
--- /dev/null
+++ b/ProxySuper.WPF/Controls/ProgressControl.xaml.cs
@@ -0,0 +1,37 @@
+using MvvmCross.ViewModels;
+using ProxySuper.Core.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// ProgressControl.xaml 的交互逻辑
+ ///
+ public partial class ProgressControl : UserControl
+ {
+ public ProgressControl()
+ {
+ InitializeComponent();
+
+ LogsTextBox.TextChanged += LogsTextBox_TextChanged;
+ }
+
+ private void LogsTextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ LogsTextBox.ScrollToEnd();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/ShadowSocksControl.xaml b/ProxySuper.WPF/Controls/ShadowSocksControl.xaml
new file mode 100644
index 00000000..d0e6e755
--- /dev/null
+++ b/ProxySuper.WPF/Controls/ShadowSocksControl.xaml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/ShadowSocksControl.xaml.cs b/ProxySuper.WPF/Controls/ShadowSocksControl.xaml.cs
new file mode 100644
index 00000000..f2e96b38
--- /dev/null
+++ b/ProxySuper.WPF/Controls/ShadowSocksControl.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// ShadowSocksClientInfoControl.xaml 的交互逻辑
+ ///
+ public partial class ShadowSocksControl : UserControl
+ {
+ public ShadowSocksControl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/Trojan_TCP_Control.xaml b/ProxySuper.WPF/Controls/Trojan_TCP_Control.xaml
new file mode 100644
index 00000000..39ae13f3
--- /dev/null
+++ b/ProxySuper.WPF/Controls/Trojan_TCP_Control.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/Trojan_TCP_Control.xaml.cs b/ProxySuper.WPF/Controls/Trojan_TCP_Control.xaml.cs
new file mode 100644
index 00000000..72103e87
--- /dev/null
+++ b/ProxySuper.WPF/Controls/Trojan_TCP_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// Trojan_TCP_Control.xaml 的交互逻辑
+ ///
+ public partial class Trojan_TCP_Control : UserControl
+ {
+ public Trojan_TCP_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/V2raySettingsControl.xaml b/ProxySuper.WPF/Controls/V2raySettingsControl.xaml
new file mode 100644
index 00000000..308fc437
--- /dev/null
+++ b/ProxySuper.WPF/Controls/V2raySettingsControl.xaml
@@ -0,0 +1,470 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/V2raySettingsControl.xaml.cs b/ProxySuper.WPF/Controls/V2raySettingsControl.xaml.cs
new file mode 100644
index 00000000..81dd7140
--- /dev/null
+++ b/ProxySuper.WPF/Controls/V2raySettingsControl.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// V2raySettingsControl.xaml 的交互逻辑
+ ///
+ public partial class V2raySettingsControl : UserControl
+ {
+ public V2raySettingsControl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_KCP_Control.xaml b/ProxySuper.WPF/Controls/VLESS_KCP_Control.xaml
new file mode 100644
index 00000000..de8eb9d2
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_KCP_Control.xaml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_KCP_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_KCP_Control.xaml.cs
new file mode 100644
index 00000000..2173b7d7
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_KCP_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_KCP_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_KCP_Control : UserControl
+ {
+ public VLESS_KCP_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_QUIC_Control.xaml b/ProxySuper.WPF/Controls/VLESS_QUIC_Control.xaml
new file mode 100644
index 00000000..94642b3d
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_QUIC_Control.xaml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_QUIC_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_QUIC_Control.xaml.cs
new file mode 100644
index 00000000..ad59f4fe
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_QUIC_Control.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_QUIC_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_QUIC_Control : UserControl
+ {
+ public VLESS_QUIC_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_RAW_Control.xaml b/ProxySuper.WPF/Controls/VLESS_RAW_Control.xaml
new file mode 100644
index 00000000..e6226507
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_RAW_Control.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_RAW_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_RAW_Control.xaml.cs
new file mode 100644
index 00000000..e49e1c47
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_RAW_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_TCP_TLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_RAW_Control : UserControl
+ {
+ public VLESS_RAW_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_TCP_TLS_Control.xaml b/ProxySuper.WPF/Controls/VLESS_TCP_TLS_Control.xaml
new file mode 100644
index 00000000..2a738b97
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_TCP_TLS_Control.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_TCP_TLS_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_TCP_TLS_Control.xaml.cs
new file mode 100644
index 00000000..fcebaef9
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_TCP_TLS_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_TCP_TLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_TCP_TLS_Control : UserControl
+ {
+ public VLESS_TCP_TLS_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_WS_TLS_Control.xaml b/ProxySuper.WPF/Controls/VLESS_WS_TLS_Control.xaml
new file mode 100644
index 00000000..815c24da
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_WS_TLS_Control.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_WS_TLS_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_WS_TLS_Control.xaml.cs
new file mode 100644
index 00000000..5c434da9
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_WS_TLS_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_WS_TLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_WS_TLS_Control : UserControl
+ {
+ public VLESS_WS_TLS_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_XHTTP_Control.xaml b/ProxySuper.WPF/Controls/VLESS_XHTTP_Control.xaml
new file mode 100644
index 00000000..5fa2e3c3
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_XHTTP_Control.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_XHTTP_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_XHTTP_Control.xaml.cs
new file mode 100644
index 00000000..68153649
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_XHTTP_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_WS_TLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_XHTTP_Control : UserControl
+ {
+ public VLESS_XHTTP_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_XTLS_Control.xaml b/ProxySuper.WPF/Controls/VLESS_XTLS_Control.xaml
new file mode 100644
index 00000000..339b64b9
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_XTLS_Control.xaml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_XTLS_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_XTLS_Control.xaml.cs
new file mode 100644
index 00000000..4ee74c92
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_XTLS_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_XTLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_XTLS_Control : UserControl
+ {
+ public VLESS_XTLS_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_XTLS_RAW_REALITY_Control.xaml b/ProxySuper.WPF/Controls/VLESS_XTLS_RAW_REALITY_Control.xaml
new file mode 100644
index 00000000..fd42827e
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_XTLS_RAW_REALITY_Control.xaml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_XTLS_RAW_REALITY_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_XTLS_RAW_REALITY_Control.xaml.cs
new file mode 100644
index 00000000..1b01f029
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_XTLS_RAW_REALITY_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_XTLS_RAW_REALITY_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_XTLS_RAW_REALITY_Control : UserControl
+ {
+ public VLESS_XTLS_RAW_REALITY_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VLESS_gRPC_Control.xaml b/ProxySuper.WPF/Controls/VLESS_gRPC_Control.xaml
new file mode 100644
index 00000000..b5ee23a6
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_gRPC_Control.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VLESS_gRPC_Control.xaml.cs b/ProxySuper.WPF/Controls/VLESS_gRPC_Control.xaml.cs
new file mode 100644
index 00000000..87ee670b
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VLESS_gRPC_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VLESS_gRPC_Control.xaml 的交互逻辑
+ ///
+ public partial class VLESS_gRPC_Control : UserControl
+ {
+ public VLESS_gRPC_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VMESS_KCP_Control.xaml b/ProxySuper.WPF/Controls/VMESS_KCP_Control.xaml
new file mode 100644
index 00000000..69c09a0a
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_KCP_Control.xaml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VMESS_KCP_Control.xaml.cs b/ProxySuper.WPF/Controls/VMESS_KCP_Control.xaml.cs
new file mode 100644
index 00000000..41837489
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_KCP_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VMESS_KCP_Control.xaml 的交互逻辑
+ ///
+ public partial class VMESS_KCP_Control : UserControl
+ {
+ public VMESS_KCP_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VMESS_QUIC_Control.xaml b/ProxySuper.WPF/Controls/VMESS_QUIC_Control.xaml
new file mode 100644
index 00000000..e031cf96
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_QUIC_Control.xaml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VMESS_QUIC_Control.xaml.cs b/ProxySuper.WPF/Controls/VMESS_QUIC_Control.xaml.cs
new file mode 100644
index 00000000..c0e0fcd2
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_QUIC_Control.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VMESS_QUIC_Control.xaml 的交互逻辑
+ ///
+ public partial class VMESS_QUIC_Control : UserControl
+ {
+ public VMESS_QUIC_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VMESS_TCP_TLS_Control.xaml b/ProxySuper.WPF/Controls/VMESS_TCP_TLS_Control.xaml
new file mode 100644
index 00000000..d58ebac8
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_TCP_TLS_Control.xaml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VMESS_TCP_TLS_Control.xaml.cs b/ProxySuper.WPF/Controls/VMESS_TCP_TLS_Control.xaml.cs
new file mode 100644
index 00000000..fe420546
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_TCP_TLS_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VMESS_TCP_TLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VMESS_TCP_TLS_Control : UserControl
+ {
+ public VMESS_TCP_TLS_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/VMESS_WS_TLS_Control.xaml b/ProxySuper.WPF/Controls/VMESS_WS_TLS_Control.xaml
new file mode 100644
index 00000000..09e11ca9
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_WS_TLS_Control.xaml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/VMESS_WS_TLS_Control.xaml.cs b/ProxySuper.WPF/Controls/VMESS_WS_TLS_Control.xaml.cs
new file mode 100644
index 00000000..79887c20
--- /dev/null
+++ b/ProxySuper.WPF/Controls/VMESS_WS_TLS_Control.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// VMESS_WS_TLS_Control.xaml 的交互逻辑
+ ///
+ public partial class VMESS_WS_TLS_Control : UserControl
+ {
+ public VMESS_WS_TLS_Control()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Controls/XraySettingsControl.xaml b/ProxySuper.WPF/Controls/XraySettingsControl.xaml
new file mode 100644
index 00000000..9d071c02
--- /dev/null
+++ b/ProxySuper.WPF/Controls/XraySettingsControl.xaml
@@ -0,0 +1,467 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Controls/XraySettingsControl.xaml.cs b/ProxySuper.WPF/Controls/XraySettingsControl.xaml.cs
new file mode 100644
index 00000000..f03b7ac6
--- /dev/null
+++ b/ProxySuper.WPF/Controls/XraySettingsControl.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace ProxySuper.WPF.Controls
+{
+ ///
+ /// XraySettingsControl.xaml 的交互逻辑
+ ///
+ public partial class XraySettingsControl : UserControl
+ {
+ public XraySettingsControl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/FodyWeavers.xml b/ProxySuper.WPF/FodyWeavers.xml
new file mode 100644
index 00000000..6ef9a821
--- /dev/null
+++ b/ProxySuper.WPF/FodyWeavers.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/FodyWeavers.xsd b/ProxySuper.WPF/FodyWeavers.xsd
new file mode 100644
index 00000000..f2dbece7
--- /dev/null
+++ b/ProxySuper.WPF/FodyWeavers.xsd
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+ A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
+
+
+
+
+ A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
+
+
+
+
+ A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
+
+
+
+
+ A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
+
+
+
+
+ Obsolete, use UnmanagedWinX86Assemblies instead
+
+
+
+
+ A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks.
+
+
+
+
+ Obsolete, use UnmanagedWinX64Assemblies instead.
+
+
+
+
+ A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks.
+
+
+
+
+ A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks.
+
+
+
+
+ The order of preloaded assemblies, delimited with line breaks.
+
+
+
+
+
+ This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.
+
+
+
+
+ Controls if .pdbs for reference assemblies are also embedded.
+
+
+
+
+ Controls if runtime assemblies are also embedded.
+
+
+
+
+ Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.
+
+
+
+
+ Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.
+
+
+
+
+ As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.
+
+
+
+
+ The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events.
+
+
+
+
+ Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.
+
+
+
+
+ Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.
+
+
+
+
+ A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
+
+
+
+
+ A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.
+
+
+
+
+ A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
+
+
+
+
+ A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.
+
+
+
+
+ Obsolete, use UnmanagedWinX86Assemblies instead
+
+
+
+
+ A list of unmanaged X86 (32 bit) assembly names to include, delimited with |.
+
+
+
+
+ Obsolete, use UnmanagedWinX64Assemblies instead
+
+
+
+
+ A list of unmanaged X64 (64 bit) assembly names to include, delimited with |.
+
+
+
+
+ A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |.
+
+
+
+
+ The order of preloaded assemblies, delimited with |.
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Images/free/saifeng.png b/ProxySuper.WPF/Images/free/saifeng.png
new file mode 100644
index 00000000..d82cb526
Binary files /dev/null and b/ProxySuper.WPF/Images/free/saifeng.png differ
diff --git a/ProxySuper.WPF/Images/free/tor.png b/ProxySuper.WPF/Images/free/tor.png
new file mode 100644
index 00000000..a39a8d25
Binary files /dev/null and b/ProxySuper.WPF/Images/free/tor.png differ
diff --git a/ProxySuper.WPF/Images/free/wujie.png b/ProxySuper.WPF/Images/free/wujie.png
new file mode 100644
index 00000000..6bc7a0b8
Binary files /dev/null and b/ProxySuper.WPF/Images/free/wujie.png differ
diff --git a/ProxySuper.WPF/Images/free/ziyoumeng.png b/ProxySuper.WPF/Images/free/ziyoumeng.png
new file mode 100644
index 00000000..e1f3c1c0
Binary files /dev/null and b/ProxySuper.WPF/Images/free/ziyoumeng.png differ
diff --git a/ProxySuper.WPF/Images/paid/expressvpn.png b/ProxySuper.WPF/Images/paid/expressvpn.png
new file mode 100644
index 00000000..e510cd30
Binary files /dev/null and b/ProxySuper.WPF/Images/paid/expressvpn.png differ
diff --git a/ProxySuper.WPF/Images/paid/nordvpn.png b/ProxySuper.WPF/Images/paid/nordvpn.png
new file mode 100644
index 00000000..68700b02
Binary files /dev/null and b/ProxySuper.WPF/Images/paid/nordvpn.png differ
diff --git a/ProxySuper.WPF/Images/paid/purevpn.png b/ProxySuper.WPF/Images/paid/purevpn.png
new file mode 100644
index 00000000..783dda70
Binary files /dev/null and b/ProxySuper.WPF/Images/paid/purevpn.png differ
diff --git a/ProxySuper.WPF/Images/paid/surfshark.png b/ProxySuper.WPF/Images/paid/surfshark.png
new file mode 100644
index 00000000..1b1d5f51
Binary files /dev/null and b/ProxySuper.WPF/Images/paid/surfshark.png differ
diff --git a/ProxySuper.WPF/MainWindow.xaml b/ProxySuper.WPF/MainWindow.xaml
new file mode 100644
index 00000000..db4b2992
--- /dev/null
+++ b/ProxySuper.WPF/MainWindow.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/ProxySuper.WPF/MainWindow.xaml.cs b/ProxySuper.WPF/MainWindow.xaml.cs
new file mode 100644
index 00000000..3839d2d1
--- /dev/null
+++ b/ProxySuper.WPF/MainWindow.xaml.cs
@@ -0,0 +1,19 @@
+using MvvmCross.Platforms.Wpf.Views;
+
+
+namespace ProxySuper.WPF
+{
+ ///
+ /// MainWindow.xaml 的交互逻辑
+ ///
+ public partial class MainWindow : MvxWindow
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ }
+
+
+ }
+}
diff --git a/ProxySU/Properties/AssemblyInfo.cs b/ProxySuper.WPF/Properties/AssemblyInfo.cs
similarity index 76%
rename from ProxySU/Properties/AssemblyInfo.cs
rename to ProxySuper.WPF/Properties/AssemblyInfo.cs
index dee8b279..db0cac66 100644
--- a/ProxySU/Properties/AssemblyInfo.cs
+++ b/ProxySuper.WPF/Properties/AssemblyInfo.cs
@@ -1,18 +1,16 @@
using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
-[assembly: AssemblyTitle("ProxySU")]
-[assembly: AssemblyDescription("V2ray,Trojan,NaiveProxy,Trojan-Go等一键安装工具")]
+[assembly: AssemblyTitle("ProxySuper.WPF")]
+[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ProxySU")]
-[assembly: AssemblyProduct("ProxySU")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ProxySuper.WPF")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -48,8 +46,8 @@
// 生成号
// 修订号
//
-// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
-// 方法是按如下所示使用“*”: :
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.5.3.0")]
-[assembly: AssemblyFileVersion("2.5.3.0")]
+[assembly: AssemblyVersion("4.3.0")]
+[assembly: AssemblyFileVersion("4.3.0")]
diff --git a/ProxySU/Properties/Resources.Designer.cs b/ProxySuper.WPF/Properties/Resources.Designer.cs
similarity index 63%
rename from ProxySU/Properties/Resources.Designer.cs
rename to ProxySuper.WPF/Properties/Resources.Designer.cs
index 50e11545..e60c15c5 100644
--- a/ProxySU/Properties/Resources.Designer.cs
+++ b/ProxySuper.WPF/Properties/Resources.Designer.cs
@@ -1,69 +1,61 @@
//------------------------------------------------------------------------------
//
// 此代码由工具生成。
-// 运行时版本: 4.0.30319.42000
+// 运行时版本:4.0.30319.42000
//
-// 对此文件的更改可能导致不正确的行为,如果
-// 重新生成代码,则所做更改将丢失。
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
//
//------------------------------------------------------------------------------
-namespace ProxySU.Properties
-{
-
-
+namespace ProxySuper.WPF.Properties {
+ using System;
+
+
///
- /// 强类型资源类,用于查找本地化字符串等。
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
///
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
- // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
+ internal class Resources {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
+ internal Resources() {
}
-
+
///
- /// 返回此类使用的缓存 ResourceManager 实例。
+ /// 返回此类使用的缓存的 ResourceManager 实例。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProxySU.Properties.Resources", typeof(Resources).Assembly);
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProxySuper.WPF.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
- /// 覆盖当前线程的 CurrentUICulture 属性
- /// 使用此强类型的资源类的资源查找。
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
return resourceCulture;
}
- set
- {
+ set {
resourceCulture = value;
}
}
diff --git a/ProxySU/Properties/Resources.resx b/ProxySuper.WPF/Properties/Resources.resx
similarity index 100%
rename from ProxySU/Properties/Resources.resx
rename to ProxySuper.WPF/Properties/Resources.resx
diff --git a/ProxySU/Properties/Settings.Designer.cs b/ProxySuper.WPF/Properties/Settings.Designer.cs
similarity index 63%
rename from ProxySU/Properties/Settings.Designer.cs
rename to ProxySuper.WPF/Properties/Settings.Designer.cs
index 654607b5..1b2e07c5 100644
--- a/ProxySU/Properties/Settings.Designer.cs
+++ b/ProxySuper.WPF/Properties/Settings.Designer.cs
@@ -1,28 +1,24 @@
//------------------------------------------------------------------------------
//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
//
//------------------------------------------------------------------------------
-namespace ProxySU.Properties
-{
-
-
+namespace ProxySuper.WPF.Properties {
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
diff --git a/ProxySU/Properties/Settings.settings b/ProxySuper.WPF/Properties/Settings.settings
similarity index 100%
rename from ProxySU/Properties/Settings.settings
rename to ProxySuper.WPF/Properties/Settings.settings
diff --git a/ProxySuper.WPF/ProxySU.ico b/ProxySuper.WPF/ProxySU.ico
new file mode 100644
index 00000000..955b1e26
Binary files /dev/null and b/ProxySuper.WPF/ProxySU.ico differ
diff --git a/ProxySuper.WPF/ProxySuper.WPF.csproj b/ProxySuper.WPF/ProxySuper.WPF.csproj
new file mode 100644
index 00000000..6e3673ea
--- /dev/null
+++ b/ProxySuper.WPF/ProxySuper.WPF.csproj
@@ -0,0 +1,532 @@
+
+
+
+
+
+
+
+ .allowedextension
+ Debug AnyCPU {B083EBFD-2925-46C9-8B00-E2C1300CEBA1} WinExe ProxySuper.WPF ProxySuper.WPF v4.7.2 latest 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true true false publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false true
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ none
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ ProxySU.ico
+
+
+ ProxySuper.WPF.App
+
+
+
+ ..\packages\Costura.Fody.6.0.0\lib\netstandard2.0\Costura.dll
+
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
+
+
+ ..\packages\MvvmCross.8.0.2\lib\net461\MvvmCross.dll
+
+
+ ..\packages\MvvmCross.Platforms.Wpf.8.0.2\lib\net461\MvvmCross.Platforms.Wpf.dll
+
+
+ ..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll
+
+
+ ..\packages\SSH.NET.2023.0.0\lib\net462\Renci.SshNet.dll
+
+
+
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+
+
+ ..\packages\System.Console.4.3.1\lib\net46\System.Console.dll
+
+
+
+
+ ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ AdCarouselControl.xaml
+
+
+ HostControl.xaml
+
+
+ ProgressControl.xaml
+
+
+ ShadowSocksControl.xaml
+
+
+ Trojan_TCP_Control.xaml
+
+
+ V2raySettingsControl.xaml
+
+
+ VLESS_gRPC_Control.xaml
+
+
+ VLESS_KCP_Control.xaml
+
+
+ VLESS_QUIC_Control.xaml
+
+
+ VLESS_TCP_TLS_Control.xaml
+
+
+ VLESS_RAW_Control.xaml
+
+
+ VLESS_XHTTP_Control.xaml
+
+
+ VLESS_WS_TLS_Control.xaml
+
+
+ VLESS_XTLS_RAW_REALITY_Control.xaml
+
+
+ VLESS_XTLS_Control.xaml
+
+
+ VMESS_KCP_Control.xaml
+
+
+ VMESS_QUIC_Control.xaml
+
+
+ VMESS_TCP_TLS_Control.xaml
+
+
+ VMESS_WS_TLS_Control.xaml
+
+
+ XraySettingsControl.xaml
+
+
+ MainWindow.xaml
+
+
+
+ BrookConfigView.xaml
+
+
+ BrookEditorView.xaml
+
+
+ BrookInstallView.xaml
+
+
+ EnableRootView.xaml
+
+
+ HomeView.xaml
+
+
+ HysteriaConfigView.xaml
+
+
+ HysteriaEditorView.xaml
+
+
+ HysteriaInstallView.xaml
+
+
+ MTProxyGoConfigView.xaml
+
+
+ MTProxyGoEditorView.xaml
+
+
+ MTProxyGoInstallView.xaml
+
+
+ NaiveProxyConfigView.xaml
+
+
+ NaiveProxyEditorView.xaml
+
+
+ NaiveProxyInstallView.xaml
+
+
+ ShareLinkView.xaml
+
+
+ TrojanGoConfigView.xaml
+
+
+ TrojanGoEditorView.xaml
+
+
+ TrojanGoInstallView.xaml
+
+
+ V2rayConfigView.xaml
+
+
+ V2rayEditorView.xaml
+
+
+ V2rayInstallView.xaml
+
+
+ XrayEditorView.xaml
+
+
+ XrayConfigView.xaml
+
+
+ XrayInstallView.xaml
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+ PreserveNewest
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ App.xaml
+ Code
+
+
+ MSBuild:Compile
+ Designer
+ PreserveNewest
+
+
+ MSBuild:Compile
+ Designer
+ PreserveNewest
+
+
+ MSBuild:Compile
+ Designer
+ PreserveNewest
+
+
+ Designer
+ MSBuild:Compile
+ PreserveNewest
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+ {15779ee6-d8ca-44bf-bfe2-941e155eef3f}
+ ProxySuper.Core
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.6.1 %28x86 和 x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Resources/Languages/en.xaml b/ProxySuper.WPF/Resources/Languages/en.xaml
new file mode 100644
index 00000000..0c733161
--- /dev/null
+++ b/ProxySuper.WPF/Resources/Languages/en.xaml
@@ -0,0 +1,179 @@
+
+
+
+ Random
+ Save
+ Save And Install
+ SaveAs
+ Install
+ Settings
+ The following is a static web page connection provided by netizens, please check whether there is an index.html file by yourself
+
+
+ Add Host
+ Actions
+ Export Settings
+ Export Subscribe
+ Get Root
+
+ Language
+ English
+ 中文
+ 正體
+ فارسی
+
+ Helper
+ Github
+ UseRoot
+ CertQuestion
+ PrivateKey
+ Related Resources and Tutorials
+ Free and paid VPN resources
+
+
+ Tag
+ Address
+ Type
+ Action
+ Install
+ Edit
+ ViewConfig
+ Delete
+ Up
+ Down
+
+
+
+ Host
+ Tag
+ Address
+ UserName
+ Password
+ Port
+ SecretType
+ LoadingKey
+ Password
+ PrivateKey
+ PKPassword
+
+ None,Blank
+
+ Proxy
+ Address
+ Port
+ UserName
+ Password
+ Type
+ None
+ Http
+ Socks5
+
+
+ Proxy Type
+ Params
+
+
+ VLESS XTLS(RAW) REALITY
+ VLESS XTLS(RAW)
+ VLESS RAW(TLS)
+ VLESS WS
+ VLESS gRPC
+ VLESS mKCP
+ VLESS QUIC
+ VMESS WS
+ VMESS mKCP
+ VMESS QUIC
+ ShadowSocks
+ Trojan
+
+ Domain/IP
+ Redir Url
+ With TLS
+ Unchecked means upload your own TLS.
+ UUID
+ Flow (Client)
+ uTLS(Client)
+ Multi User
+ Multi Id split with ","
+ REALITY spiderX
+ Crawler initial path and parameters
+ VLESS XHTTP Path
+ VLESS WS Path
+ VLESS KCP Seed
+ VLESS KCP Type
+ VLESS KCP Port
+ VLESS QUIC Port
+ VLESS QUIC Key
+ VLESS QUIC Security
+ VLESS QUIC Type
+ gRPC Service Name
+ gRPC Port
+ VMESS WS Path
+ VMESS KCP Seed
+ VMESS KCP Type
+ VMESS KCP Port
+ VMESS QUIC Key
+ VMESS QUIC Port
+ VMESS QUIC Security
+ VMESS QUIC Type
+ SS Pwd
+ SS Method
+ SS Port
+ Trojan Pwd
+ Trojan Port
+ v2ray Port
+ xray Port
+ default port is 443
+ More Parameters
+
+
+ Install
+ UpdateSettings
+ UpdateCore
+ Uninstall
+ InstallCert
+ UploadWeb
+ UploadCert
+
+
+ With TLS
+ Unchecked means upload your own TLS.
+ Address
+ Port
+ Password
+ GuiseHost
+ WS Path
+ WS Domain
+
+
+ Address
+ Port
+ UserName
+ Password
+ GuiseHost
+
+
+ Address
+ Port
+ Cleantext
+ Secret
+
+
+ Address
+ Port
+ Password
+ Automatically apply for a certificate. If you want to upload your own certificate, uncheck it.
+ Email
+ Automatically apply for certificates, randomly generated, can be replaced with your own email address
+ Use obfuscation, after obfuscation, there is no characteristic UDP packet, otherwise the default traffic is disguised as HTTP3
+ OBFS
+ Brutal congestion control algorithm (default)
+ UpMbps
+ DownMbps
+ 0 - Unlimited (same below), this is the server configuration
+ BBR congestion control algorithm
+ Disguised website URL
+ Manually upload a static cloaking website
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Resources/Languages/fa_IR.xaml b/ProxySuper.WPF/Resources/Languages/fa_IR.xaml
new file mode 100644
index 00000000..fb2d1e05
--- /dev/null
+++ b/ProxySuper.WPF/Resources/Languages/fa_IR.xaml
@@ -0,0 +1,179 @@
+
+
+
+ تصادفی
+ ذخیره
+ ذخیره و نصب
+ ذخیره به عنوان
+ نصب
+ تنظیمات
+ موارد زیر یک اتصال صفحه وب ثابت است که توسط کاربران اینترنتی ارائه شده است، لطفاً بررسی کنید که آیا فایل index.html توسط خودتان وجود دارد یا خیر.
+
+
+ میزبان اضافه کنید
+ عمل کنند
+ پیکربندی صادرات
+ اشتراک صادرات
+ اکانت روت را فعال کنید
+
+ زبان(Language)
+ English
+ 中文
+ 正體
+ فارسی
+
+ یاور
+ Github
+ اکانت روت را فعال کنید
+ در مورد گواهینامه
+ در مورد سوال
+ منابع و آموزش های مرتبط
+ منابع VPN رایگان و پولی
+
+
+ برچسب
+ آدرس
+ نوع
+ عمل کنند
+ نصب
+ ویرایش
+ مشاهده پیکربندی
+ حذف
+ بالاا
+ پایین
+
+
+
+ هاست
+ برچسب
+ آدرس
+ نام کاربری
+ رمز عبور
+ پورت
+ نوع تأیید ورود
+ بارگیری کلید خصوصی
+ رمز عبور
+ کلید خصوصی
+ رمز عبور PK
+
+ اگر هیچ کدام، آن را خالی بگذارید
+
+ پروکسی
+ آدرس
+ پورت
+ نام کاربری
+ رمز عبور
+ نوع
+ None
+ Http
+ Socks5
+
+
+ نوع پروکسی
+ Params
+
+
+ VLESS XTLS(RAW) REALITY
+ VLESS XTLS(RAW)
+ VLESS RAW(TLS)
+ VLESS WS
+ VLESS gRPC
+ VLESS mKCP
+ VLESS QUIC
+ VMESS WS
+ VMESS mKCP
+ VMESS QUIC
+ ShadowSocks
+ Trojan
+
+ Domain/IP
+ Redir Url
+ With TLS
+ Unchecked means upload your own TLS.
+ UUID
+ Flow (Client)
+ uTLS (Client)
+ چند کاربره
+ چند شناسه تقسیم با ","
+ REALITY spiderX
+ مسیر اولیه و پارامترهای خزنده
+ VLESS XHTTP PaT
+ VLESS WS Path
+ VLESS KCP Seed
+ VLESS KCP Type
+ VLESS KCP Port
+ VLESS QUIC Port
+ VLESS QUIC Key
+ VLESS QUIC Security
+ VLESS QUIC Type
+ gRPC Service Name
+ gRPC Port
+ VMESS WS Path
+ VMESS KCP Seed
+ VMESS KCP Type
+ VMESS KCP Port
+ VMESS QUIC Key
+ VMESS QUIC Port
+ VMESS QUIC Security
+ VMESS QUIC Type
+ SS Pwd
+ SS Method
+ SS Port
+ Trojan Pwd
+ پورت تروجان
+ v2ray بندر
+ xray بندر
+ پورت پیش فرض 443 است
+ پارامترهای بیشتر
+
+
+ نصب
+ بروزرسانی تنظیمات
+ بروزرسانی هسته
+ Uninstall
+ InstallCert
+ UploadWeb
+ UploadCert
+
+
+ With TLS
+ Unchecked means upload your own TLS.
+ آدرس
+ پورت
+ رمزعبور
+ GuiseHost
+ WS Path
+ WS Domain
+
+
+ آدرس
+ پورت
+ نام کاربری
+ رمز عبور
+ GuiseHost
+
+
+ آدرس
+ پورت
+ Cleantext
+ رمز
+
+
+ آدرس
+ پورت
+ رمز عبور
+ درخواست خودکار برای گواهی. اگر میخواهید گواهی خودتان را آپلود کنید، تیک آن را بردارید.
+ ایمیل
+ درخواست خودکار برای گواهینامهها، قابل جایگزینی با صندوق پستی خودتان
+ از مبهمسازی استفاده کنید، پس از مبهمسازی، هیچ بسته UDP مشخصی وجود ندارد، در غیر این صورت ترافیک پیشفرض به عنوان HTTP3 پنهان میشود.
+ OBFS
+ الگوریتم کنترل ازدحام وحشیانه (پیشفرض)
+ UpMbps
+ DownMbps
+ 0 - نامحدود (همان زیر)، این پیکربندی سرور است
+ الگوریتم کنترل ازدحام BBR
+ وبسایت مبدل
+ یک وبسایت استاتیک با قابلیت پنهانسازی را به صورت دستی آپلود کنید
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Resources/Languages/tw_cn.xaml b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml
new file mode 100644
index 00000000..7a1c9c23
--- /dev/null
+++ b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml
@@ -0,0 +1,181 @@
+
+
+
+ 隨機
+ 保存
+ 保存并安裝
+ 另存為
+ 安裝
+ 配置
+ 如下是網友提供的靜態網頁連接,請自行檢查是否有index.html文件
+
+
+ 添加主機
+ 操作
+ 導出配置
+ 導出訂閲
+ 啓用Root賬戶
+
+ 語言(Language)
+ English
+ 中文
+ 正體
+ فارسی
+
+ 幫助
+ Github
+ 啓用Root賬戶
+ 證書問題
+ 私鑰問題
+ 相關資源與教程
+ 免費and付費翻牆資源
+
+
+ 名稱
+ 地址
+ 類型
+ 操作
+ 安裝
+ 編輯
+ 查看配置
+ 刪除
+ 上移
+ 下移
+
+
+
+ 主機
+ 名稱
+ IP/地址
+ 用戶名
+ 密碼
+ 端口
+ 登録驗證
+ 載入私鑰
+ 密碼
+ 私鑰
+ 私鑰密碼
+
+ 若無,則留空
+
+ 代理
+ IP/地址
+ 端口
+ 用戶名
+ 密碼
+ 類型
+ 無
+ Http
+ Socks5
+
+
+ 節點類型
+ 節點參數
+
+
+ VLESS XTLS(RAW) REALITY
+ VLESS XTLS(RAW)
+ VLESS RAW(TLS)
+ VLESS WS
+ VLESS gRPC
+ VLESS mKCP
+ VLESS QUIC
+ VMESS WS
+ VMESS mKCP
+ VMESS QUIC
+ ShadowSocks
+ Trojan
+
+
+ 域名/IP
+ 偽裝網址
+ 自動申請證書
+ 如上傳自有證書,則取消對勾。
+ UUID
+ 流控 (客戶端)
+ uTLS (客戶端)
+ 多用戶
+ 多個UUID用“,”分隔
+ REALITY spiderX
+ 爬蟲初始路徑與參數
+ VLESS XHTTP路徑
+ VLESS WS路徑
+ VLESS KCP Seed
+ VLESS KCP偽裝
+ VLESS KCP端口
+ VLESS QUIC Key
+ VLESS QUIC端口
+ VLESS QUIC加密
+ VLESS QUIC僞裝
+ gRPC路徑
+ gRPC端口
+ VMESS WS路徑
+ VMESS KCP Seed
+ VMESS KCP偽裝
+ VMESS KCP端口
+ VMESS QUIC Key
+ VMESS QUIC端口
+ VMESS QUIC加密
+ VMESS QUIC僞裝
+ SS密碼
+ SS加密方式
+ SS端口
+ Trojan密碼
+ Trojan端口
+ V2ray端口
+ XRAY端口
+ 默認端口443,不建議修改
+ 更多參數
+
+
+ 一鍵安裝
+ 更新配置
+ 更新內核
+ 卸載代理
+ 手動續簽證書
+ 上傳偽裝網站
+ 上傳自有證書
+
+
+
+ 自動申請證書
+ 如上傳自有證書,則取消對勾。
+ 域名
+ 端口
+ 密碼
+ 偽裝網址
+ WS 路徑
+ WS 域名
+
+
+ 地址
+ 端口
+ 用戶名
+ 密碼
+ 偽裝網站
+
+
+ 域名/IP
+ 端口
+ 加密前字符
+ 密鑰
+
+
+ 域名
+ 端口
+ 密碼
+ 自動申請證書,如上傳自有證書,則取消對勾。
+ 郵箱
+ 自動申請證書用,隨機生成,可更換為自己的信箱
+ 使用混淆,混淆後是沒有特徵的UDP包,否則預設流量偽裝成HTTP3
+ 混淆密碼
+ Brutal 壅塞控制演算法 (預設)
+ 上傳限速
+ 下載限速
+ 0 - 無限制(下同),此為服務端配置
+ BBR 擁塞控制演算法
+ 偽裝網站
+ 手動上傳靜態偽裝網站
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml
new file mode 100644
index 00000000..7abeb5c0
--- /dev/null
+++ b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml
@@ -0,0 +1,182 @@
+
+
+
+ 随机
+ 保存
+ 保存并安装
+ 另存为
+ 安装
+ 配置
+ 如下是网友提供的静态网页连接,请自行检查是否有index.html文件
+
+
+ 添加主机
+ 操作
+ 导出配置
+ 导出订阅
+ 启用Root账户
+
+ 语言(Language)
+ English
+ 中文
+ 正體
+ فارسی
+
+ 帮助
+ Github
+ 启用Root账户
+ 证书问题
+ 私钥问题
+ 相关资源与教程
+ 免费and付费翻墙资源
+
+
+ 名称
+ 地址
+ 类型
+ 操作
+ 安装
+ 编辑
+ 查看配置
+ 删除
+ 上移
+ 下移
+
+
+
+
+ 主机
+ 名称
+ IP/地址
+ 用户名
+ 密码
+ 端口
+ 登陆验证
+ 载入私钥
+ 密码
+ 私钥
+ 私钥密码
+
+ 若无,则留空
+
+ 代理
+ IP/地址
+ 端口
+ 用户名
+ 密码
+ 类型
+ 无
+ Http
+ Socks5
+
+
+ 节点类型
+ 节点参数
+
+
+ VLESS XTLS(RAW) REALITY
+ VLESS XTLS(RAW)
+ VLESS RAW(TLS)
+ VLESS WS
+ VLESS gRPC
+ VLESS mKCP
+ VLESS QUIC
+ VMESS WS
+ VMESS mKCP
+ VMESS QUIC
+ ShadowSocks
+ Trojan
+
+
+ 域名/IP
+ 伪装网址
+ 自动申请证书
+ 如上传自有证书,则取消对勾。
+ UUID
+ 流控 (客户端)
+ uTLS (客户端)
+ 多用户
+ 多个UUID用“,”分隔
+ REALITY spiderX
+ 爬虫初始路径与参数
+ VLESS XHTTP路径
+ VLESS WS路径
+ VLESS KCP Seed
+ VLESS KCP伪装
+ VLESS KCP端口
+ VLESS QUIC Key
+ VLESS QUIC端口
+ VLESS QUIC加密
+ VLESS QUIC伪装
+ gRPC路径
+ gRPC端口
+ VMESS WS路径
+ VMESS KCP Seed
+ VMESS KCP伪装
+ VMESS KCP端口
+ VMESS QUIC Key
+ VMESS QUIC端口
+ VMESS QUIC加密
+ VMESS QUIC伪装
+ SS密码
+ SS加密方式
+ SS端口
+ Trojan密码
+ Trojan端口
+ V2ray端口
+ XRAY端口
+ 默认端口443,不建议修改
+ 更多参数
+
+
+ 一键安装
+ 更新配置
+ 更新内核
+ 卸载代理
+ 手动续签证书
+ 上传伪装网站
+ 上传自有证书
+
+
+
+ 自动申请证书
+ 如上传自有证书,则取消对勾。
+ 域名
+ 端口
+ 密码
+ 伪装网址
+ WS 路径
+ WS 域名
+
+
+ 地址
+ 端口
+ 用户名
+ 密码
+ 伪装网站
+
+
+ 域名/IP
+ 端口
+ 加密前字符
+ 密钥
+
+
+ 域名
+ 端口
+ 密码
+ 自动申请证书,如上传自有证书,则取消对勾。
+ 邮箱
+ 自动申请证书用,随机生成,可更换为自己的邮箱
+ 使用混淆,混淆后是没有特征的UDP包,否则默认流量伪装成HTTP3
+ 混淆密码
+ Brutal 拥塞控制算法 (默认)
+ 上传限速
+ 下载限速
+ 0 - 无限制(下同),此为服务端配置
+ BBR 拥塞控制算法
+ 伪装网站
+ 手动上传静态伪装网站
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Resources/ProxySU.ico b/ProxySuper.WPF/Resources/ProxySU.ico
new file mode 100644
index 00000000..955b1e26
Binary files /dev/null and b/ProxySuper.WPF/Resources/ProxySU.ico differ
diff --git a/ProxySuper.WPF/Resources/Styles/DataGridStyle.xaml b/ProxySuper.WPF/Resources/Styles/DataGridStyle.xaml
new file mode 100644
index 00000000..d24e0c28
--- /dev/null
+++ b/ProxySuper.WPF/Resources/Styles/DataGridStyle.xaml
@@ -0,0 +1,158 @@
+
+
+ 33
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProxySuper.WPF/Setup.cs b/ProxySuper.WPF/Setup.cs
new file mode 100644
index 00000000..47fc9bc1
--- /dev/null
+++ b/ProxySuper.WPF/Setup.cs
@@ -0,0 +1,23 @@
+using Microsoft.Extensions.Logging;
+using MvvmCross.Platforms.Wpf.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProxySuper.WPF
+{
+ public class Setup : MvxWpfSetup
+ {
+ protected override ILoggerProvider CreateLogProvider()
+ {
+ return null;
+ }
+
+ protected override ILoggerFactory CreateLogFactory()
+ {
+ return null;
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/Brook/BrookConfigView.xaml b/ProxySuper.WPF/Views/Brook/BrookConfigView.xaml
new file mode 100644
index 00000000..184ca1d2
--- /dev/null
+++ b/ProxySuper.WPF/Views/Brook/BrookConfigView.xaml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Brook/BrookConfigView.xaml.cs b/ProxySuper.WPF/Views/Brook/BrookConfigView.xaml.cs
new file mode 100644
index 00000000..7847e258
--- /dev/null
+++ b/ProxySuper.WPF/Views/Brook/BrookConfigView.xaml.cs
@@ -0,0 +1,14 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class BrookConfigView : MvxWindow
+ {
+ public BrookConfigView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/Brook/BrookEditorView.xaml b/ProxySuper.WPF/Views/Brook/BrookEditorView.xaml
new file mode 100644
index 00000000..a8875e84
--- /dev/null
+++ b/ProxySuper.WPF/Views/Brook/BrookEditorView.xaml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Brook/BrookEditorView.xaml.cs b/ProxySuper.WPF/Views/Brook/BrookEditorView.xaml.cs
new file mode 100644
index 00000000..3bbf08ca
--- /dev/null
+++ b/ProxySuper.WPF/Views/Brook/BrookEditorView.xaml.cs
@@ -0,0 +1,14 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class BrookEditorView : MvxWindow
+ {
+ public BrookEditorView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/Brook/BrookInstallView.xaml b/ProxySuper.WPF/Views/Brook/BrookInstallView.xaml
new file mode 100644
index 00000000..4a9cf139
--- /dev/null
+++ b/ProxySuper.WPF/Views/Brook/BrookInstallView.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Brook/BrookInstallView.xaml.cs b/ProxySuper.WPF/Views/Brook/BrookInstallView.xaml.cs
new file mode 100644
index 00000000..8f46ed13
--- /dev/null
+++ b/ProxySuper.WPF/Views/Brook/BrookInstallView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.Brook
+{
+ [MvxWindowPresentation]
+ public partial class BrookInstallView : MvxWindow
+ {
+ public BrookInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/EnableRootView.xaml b/ProxySuper.WPF/Views/EnableRootView.xaml
new file mode 100644
index 00000000..a3c1fe1d
--- /dev/null
+++ b/ProxySuper.WPF/Views/EnableRootView.xaml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/EnableRootView.xaml.cs b/ProxySuper.WPF/Views/EnableRootView.xaml.cs
new file mode 100644
index 00000000..12b3e02f
--- /dev/null
+++ b/ProxySuper.WPF/Views/EnableRootView.xaml.cs
@@ -0,0 +1,19 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class EnableRootView : MvxWindow
+ {
+ public EnableRootView()
+ {
+ InitializeComponent();
+ }
+
+ private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+ {
+ OutputText.ScrollToEnd();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/HomeView.xaml b/ProxySuper.WPF/Views/HomeView.xaml
new file mode 100644
index 00000000..d8d9fb9c
--- /dev/null
+++ b/ProxySuper.WPF/Views/HomeView.xaml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/HomeView.xaml.cs b/ProxySuper.WPF/Views/HomeView.xaml.cs
new file mode 100644
index 00000000..139cea45
--- /dev/null
+++ b/ProxySuper.WPF/Views/HomeView.xaml.cs
@@ -0,0 +1,174 @@
+using MvvmCross;
+using MvvmCross.Navigation;
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using MvvmCross.ViewModels;
+using Newtonsoft.Json.Linq;
+using ProxySuper.Core.Models;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Reflection;
+using System.Threading.Tasks;
+using System.Web.UI;
+using System.Windows;
+using System.Windows.Input;
+
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxContentPresentation]
+ [MvxViewFor(typeof(HomeViewModel))]
+ public partial class HomeView : MvxWpfView
+ {
+
+ public HomeView()
+ {
+ InitializeComponent();
+ CheckGitHubUpdateAsync();
+ UpdateLabel.MouseLeftButtonUp += UpdateLabel_MouseLeftButtonUp;
+ UpdateLabel.Cursor = Cursors.Hand;
+ }
+
+ private IMvxNavigationService _navigationService;
+
+ public IMvxNavigationService NavigationService
+ {
+ get
+ {
+ if (_navigationService == null)
+ {
+ _navigationService = Mvx.IoCProvider.Resolve();
+ }
+ return _navigationService;
+ }
+
+ }
+
+ public new HomeViewModel ViewModel
+ {
+ get { return (HomeViewModel)base.ViewModel; }
+ }
+
+ private void LaunchGitHubSite(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU");
+ }
+
+ private void LaunchUseRootSite(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/%E8%B0%B7%E6%AD%8C%E4%BA%91%E5%BC%80%E5%90%AFroot%E8%B4%A6%E6%88%B7%E4%B8%8E%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95");
+ }
+
+ private void LaunchCertQuestion(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/%E5%B8%B8%E8%A7%81%E8%AF%81%E4%B9%A6%E7%94%B3%E8%AF%B7%E5%A4%B1%E8%B4%A5%E9%97%AE%E9%A2%98");
+ }
+
+ private void LaunchPrivateKeyQuestion(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/PrivateKey%E8%BD%AC%E6%8D%A2");
+ }
+
+ private void LaunchResourcesAndTutorials(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/%E7%9B%B8%E5%85%B3%E8%B5%84%E6%BA%90%E4%B8%8E%E6%95%99%E7%A8%8B");
+ }
+
+ private void LaunchFreeAndPaid(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/%E5%85%8D%E8%B4%B9and%E4%BB%98%E8%B4%B9%E7%BF%BB%E5%A2%99%E8%B5%84%E6%BA%90");
+ }
+
+ ResourceDictionary resource = new ResourceDictionary();
+ private void SetSimpleChinese(object sender, RoutedEventArgs e)
+ {
+ resource.Source = new Uri(@"Resources\Languages\zh_cn.xaml", UriKind.Relative);
+ Application.Current.Resources.MergedDictionaries[0] = resource;
+ }
+ private void SetIrFA(object sender, RoutedEventArgs e)
+ {
+ resource.Source = new Uri(@"Resources\Languages\fa_IR.xaml", UriKind.Relative);
+ Application.Current.Resources.MergedDictionaries[0] = resource;
+ }
+ private void SetEnglish(object sender, RoutedEventArgs e)
+ {
+ resource.Source = new Uri(@"Resources\Languages\en.xaml", UriKind.Relative);
+ Application.Current.Resources.MergedDictionaries[0] = resource;
+ }
+
+ private void SetTwCN(object sender, RoutedEventArgs e)
+ {
+ resource.Source = new Uri(@"Resources\Languages\tw_cn.xaml", UriKind.Relative);
+ Application.Current.Resources.MergedDictionaries[0] = resource;
+ }
+
+
+
+ private void ShowShareLinks(object sender, RoutedEventArgs e)
+ {
+ var checkedRecords = ViewModel.Records.Where(x => x.IsChecked).ToList();
+ if (checkedRecords.Count == 0)
+ {
+ MessageBox.Show("您没有选择任何主机");
+ return;
+ }
+
+ NavigationService.Navigate>(checkedRecords);
+ }
+
+ private void GetRoot(object sender, RoutedEventArgs e)
+ {
+ NavigationService.Navigate();
+ }
+
+ private async Task CheckGitHubUpdateAsync()
+ {
+ try
+ {
+ string currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+
+ using (HttpClient client = new HttpClient())
+ {
+ // GitHub API 需要 User-Agent
+ client.DefaultRequestHeaders.Add("User-Agent", "CSharpApp");
+
+ string url = "https://api.github.com/repos/proxysu/ProxySU/releases/latest";
+
+ string json = await client.GetStringAsync(url);
+ JObject release = JObject.Parse(json);
+ string latestVersion = release["tag_name"]?.ToString().TrimStart('v'); // 去掉 v 前缀
+
+ if (!string.IsNullOrEmpty(latestVersion))
+ {
+ // 尝试把版本字符串转为 Version 类型
+ if (Version.TryParse(latestVersion, out Version latestVer) &&
+ Version.TryParse(currentVersion, out Version currentVer))
+ {
+ // 只有最新版本号 > 当前版本号,才提示更新
+ if (latestVer > currentVer)
+ {
+ UpdateLabel.Content = $"检测到新版本 {latestVersion} 发布!点击下载";
+ UpdateLabel.Visibility = Visibility.Visible;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("检查更新失败:" + ex.Message);
+ }
+ }
+
+ private void UpdateLabel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+ {
+
+ System.Diagnostics.Process.Start(@"https://github.com/proxysu/ProxySU/releases");
+
+ }
+
+ }
+}
diff --git a/ProxySuper.WPF/Views/Hysteria/HysteriaConfigView.xaml b/ProxySuper.WPF/Views/Hysteria/HysteriaConfigView.xaml
new file mode 100644
index 00000000..92858e7f
--- /dev/null
+++ b/ProxySuper.WPF/Views/Hysteria/HysteriaConfigView.xaml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Hysteria/HysteriaConfigView.xaml.cs b/ProxySuper.WPF/Views/Hysteria/HysteriaConfigView.xaml.cs
new file mode 100644
index 00000000..d8039993
--- /dev/null
+++ b/ProxySuper.WPF/Views/Hysteria/HysteriaConfigView.xaml.cs
@@ -0,0 +1,83 @@
+using Microsoft.Win32;
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using ProxySuper.WPF.Properties;
+using QRCoder;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.Hysteria
+{
+ ///
+ /// HysteriaConfigView.xaml 的交互逻辑
+ ///
+ [MvxWindowPresentation]
+ public partial class HysteriaConfigView : MvxWindow
+ {
+ public HysteriaConfigView()
+ {
+ InitializeComponent();
+ BuildQrCode();
+ }
+ /*
+ public HysteriaSettings Settings
+ {
+ get
+ {
+ return ((HysteriaConfigViewModel)ViewModel).Settings;
+ }
+ }
+ */
+
+ private void SaveImage(object sender, RoutedEventArgs e)
+ {
+ SaveFileDialog sfd = new SaveFileDialog();
+ sfd.FileName += QrImage.Tag;
+ sfd.Filter = "Image Files (*.bmp, *.png, *.jpg)|*.bmp;*.png;*.jpg | All Files | *.*";
+ sfd.RestoreDirectory = true;//保存对话框是否记忆上次打开的目录
+ if (sfd.ShowDialog() == true)
+ {
+ var encoder = new PngBitmapEncoder();
+ encoder.Frames.Add(BitmapFrame.Create((BitmapSource)QrImage.Source));
+ using (FileStream stream = new FileStream(sfd.FileName, FileMode.Create))
+ encoder.Save(stream);
+ }
+ }
+
+ private void BuildQrCode()
+ {
+ string shareLink = HysteriaShareLink.Text;
+
+ var qrGenerator = new QRCodeGenerator();
+ var qrCodeData = qrGenerator.CreateQrCode(shareLink, QRCodeGenerator.ECCLevel.Q);
+ var qrCode = new QRCode(qrCodeData);
+
+ var qrCodeImage = qrCode.GetGraphic(20);
+ var ms = new MemoryStream();
+ qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
+ byte[] bytes = ms.GetBuffer();
+ ms.Close();
+ var image = new BitmapImage();
+ image.BeginInit();
+ image.StreamSource = new MemoryStream(bytes);
+ image.EndInit();
+ QrImage.Source = image;
+ QrImage.Tag = "HysteriaShareLink";
+ }
+
+ }
+}
diff --git a/ProxySuper.WPF/Views/Hysteria/HysteriaEditorView.xaml b/ProxySuper.WPF/Views/Hysteria/HysteriaEditorView.xaml
new file mode 100644
index 00000000..8efadc3f
--- /dev/null
+++ b/ProxySuper.WPF/Views/Hysteria/HysteriaEditorView.xaml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Hysteria/HysteriaEditorView.xaml.cs b/ProxySuper.WPF/Views/Hysteria/HysteriaEditorView.xaml.cs
new file mode 100644
index 00000000..ee96efb9
--- /dev/null
+++ b/ProxySuper.WPF/Views/Hysteria/HysteriaEditorView.xaml.cs
@@ -0,0 +1,29 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.Hysteria
+{
+ [MvxWindowPresentation]
+ public partial class HysteriaEditorView : MvxWindow
+ {
+ public HysteriaEditorView()
+ {
+ InitializeComponent();
+ }
+
+
+ }
+}
diff --git a/ProxySuper.WPF/Views/Hysteria/HysteriaInstallView.xaml b/ProxySuper.WPF/Views/Hysteria/HysteriaInstallView.xaml
new file mode 100644
index 00000000..11679cda
--- /dev/null
+++ b/ProxySuper.WPF/Views/Hysteria/HysteriaInstallView.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Hysteria/HysteriaInstallView.xaml.cs b/ProxySuper.WPF/Views/Hysteria/HysteriaInstallView.xaml.cs
new file mode 100644
index 00000000..9e05cc7f
--- /dev/null
+++ b/ProxySuper.WPF/Views/Hysteria/HysteriaInstallView.xaml.cs
@@ -0,0 +1,30 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.Hysteria
+{
+ ///
+ /// HysteriaInstallView.xaml 的交互逻辑
+ ///
+ [MvxWindowPresentation]
+ public partial class HysteriaInstallView : MvxWindow
+ {
+ public HysteriaInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoConfigView.xaml b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoConfigView.xaml
new file mode 100644
index 00000000..238cbf4b
--- /dev/null
+++ b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoConfigView.xaml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoConfigView.xaml.cs b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoConfigView.xaml.cs
new file mode 100644
index 00000000..511a713e
--- /dev/null
+++ b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoConfigView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.MTProtoGo
+{
+ [MvxWindowPresentation]
+ public partial class MTProtoGoConfigView : MvxWindow
+ {
+ public MTProtoGoConfigView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoEditorView.xaml b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoEditorView.xaml
new file mode 100644
index 00000000..720941cf
--- /dev/null
+++ b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoEditorView.xaml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoEditorView.xaml.cs b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoEditorView.xaml.cs
new file mode 100644
index 00000000..b56ca8a2
--- /dev/null
+++ b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoEditorView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.MTProtoGo
+{
+ [MvxWindowPresentation]
+ public partial class MTProtoGoEditorView : MvxWindow
+ {
+ public MTProtoGoEditorView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoInstallView.xaml b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoInstallView.xaml
new file mode 100644
index 00000000..ba763e38
--- /dev/null
+++ b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoInstallView.xaml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoInstallView.xaml.cs b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoInstallView.xaml.cs
new file mode 100644
index 00000000..15374345
--- /dev/null
+++ b/ProxySuper.WPF/Views/MTProxyGo/MTProxyGoInstallView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.MTProtoGo
+{
+ [MvxWindowPresentation]
+ public partial class MTProtoGoInstallView : MvxWindow
+ {
+ public MTProtoGoInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml
new file mode 100644
index 00000000..3603b255
--- /dev/null
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml.cs b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml.cs
new file mode 100644
index 00000000..5981fc38
--- /dev/null
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml.cs
@@ -0,0 +1,14 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class NaiveProxyConfigView : MvxWindow
+ {
+ public NaiveProxyConfigView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyEditorView.xaml b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyEditorView.xaml
new file mode 100644
index 00000000..b9442a17
--- /dev/null
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyEditorView.xaml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyEditorView.xaml.cs b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyEditorView.xaml.cs
new file mode 100644
index 00000000..bf03f4f8
--- /dev/null
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyEditorView.xaml.cs
@@ -0,0 +1,14 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class NaiveProxyEditorView : MvxWindow
+ {
+ public NaiveProxyEditorView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyInstallView.xaml b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyInstallView.xaml
new file mode 100644
index 00000000..a2dfd4ef
--- /dev/null
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyInstallView.xaml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyInstallView.xaml.cs b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyInstallView.xaml.cs
new file mode 100644
index 00000000..b82563b3
--- /dev/null
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyInstallView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.NaiveProxy
+{
+ [MvxWindowPresentation]
+ public partial class NaiveProxyInstallView : MvxWindow
+ {
+ public NaiveProxyInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/ShareLinkView.xaml b/ProxySuper.WPF/Views/ShareLinkView.xaml
new file mode 100644
index 00000000..c854bd73
--- /dev/null
+++ b/ProxySuper.WPF/Views/ShareLinkView.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/ShareLinkView.xaml.cs b/ProxySuper.WPF/Views/ShareLinkView.xaml.cs
new file mode 100644
index 00000000..35d9f0e9
--- /dev/null
+++ b/ProxySuper.WPF/Views/ShareLinkView.xaml.cs
@@ -0,0 +1,14 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class ShareLinkView : MvxWindow
+ {
+ public ShareLinkView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/TrojanGo/TrojanGoConfigView.xaml b/ProxySuper.WPF/Views/TrojanGo/TrojanGoConfigView.xaml
new file mode 100644
index 00000000..fd92812b
--- /dev/null
+++ b/ProxySuper.WPF/Views/TrojanGo/TrojanGoConfigView.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/TrojanGo/TrojanGoConfigView.xaml.cs b/ProxySuper.WPF/Views/TrojanGo/TrojanGoConfigView.xaml.cs
new file mode 100644
index 00000000..f7fcfde0
--- /dev/null
+++ b/ProxySuper.WPF/Views/TrojanGo/TrojanGoConfigView.xaml.cs
@@ -0,0 +1,23 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using ProxySuper.Core.ViewModels;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class TrojanGoConfigView : MvxWindow
+ {
+ public TrojanGoConfigView()
+ {
+ InitializeComponent();
+ }
+
+ public new TrojanGoConfigViewModel ViewModel
+ {
+ get
+ {
+ return (TrojanGoConfigViewModel)base.ViewModel;
+ }
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/TrojanGo/TrojanGoEditorView.xaml b/ProxySuper.WPF/Views/TrojanGo/TrojanGoEditorView.xaml
new file mode 100644
index 00000000..59357b20
--- /dev/null
+++ b/ProxySuper.WPF/Views/TrojanGo/TrojanGoEditorView.xaml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/TrojanGo/TrojanGoEditorView.xaml.cs b/ProxySuper.WPF/Views/TrojanGo/TrojanGoEditorView.xaml.cs
new file mode 100644
index 00000000..9f9932bd
--- /dev/null
+++ b/ProxySuper.WPF/Views/TrojanGo/TrojanGoEditorView.xaml.cs
@@ -0,0 +1,14 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class TrojanGoEditorView : MvxWindow
+ {
+ public TrojanGoEditorView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/TrojanGo/TrojanGoInstallView.xaml b/ProxySuper.WPF/Views/TrojanGo/TrojanGoInstallView.xaml
new file mode 100644
index 00000000..ca8dcc4e
--- /dev/null
+++ b/ProxySuper.WPF/Views/TrojanGo/TrojanGoInstallView.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/TrojanGo/TrojanGoInstallView.xaml.cs b/ProxySuper.WPF/Views/TrojanGo/TrojanGoInstallView.xaml.cs
new file mode 100644
index 00000000..62698f29
--- /dev/null
+++ b/ProxySuper.WPF/Views/TrojanGo/TrojanGoInstallView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.TrojanGo
+{
+ [MvxWindowPresentation]
+ public partial class TrojanGoInstallView : MvxWindow
+ {
+ public TrojanGoInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml b/ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml
new file mode 100644
index 00000000..5546722f
--- /dev/null
+++ b/ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml.cs b/ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml.cs
new file mode 100644
index 00000000..37aa4a20
--- /dev/null
+++ b/ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml.cs
@@ -0,0 +1,143 @@
+using Microsoft.Win32;
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using QRCoder;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.V2ray
+{
+ [MvxWindowPresentation]
+ public partial class V2rayConfigView : MvxWindow
+ {
+ public V2rayConfigView()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ base.OnRender(drawingContext);
+
+ for (int i = 0; i < TabCtrl.Items.Count; i++)
+ {
+ var tabItem = TabCtrl.Items[i] as TabItem;
+
+ if (Settings.Types.Contains((V2RayType)tabItem.Tag))
+ {
+ TabCtrl.SelectedIndex = i;
+ break;
+ }
+ }
+ }
+
+ public V2raySettings Settings
+ {
+ get
+ {
+ return ((V2rayConfigViewModel)ViewModel).Settings;
+ }
+ }
+
+
+
+ private void BuildQrCode(object sender, SelectionChangedEventArgs e)
+ {
+ var tabControl = e.Source as TabControl;
+ var item = (tabControl.SelectedItem as TabItem);
+ if (item == null) return;
+ var type = (V2RayType)item.Tag;
+ BuildQrCode(type);
+ }
+
+ private void SaveImage(object sender, RoutedEventArgs e)
+ {
+ SaveFileDialog sfd = new SaveFileDialog();
+ sfd.FileName += QrImage.Tag;
+ sfd.Filter = "Image Files (*.bmp, *.png, *.jpg)|*.bmp;*.png;*.jpg | All Files | *.*";
+ sfd.RestoreDirectory = true;//保存对话框是否记忆上次打开的目录
+ if (sfd.ShowDialog() == true)
+ {
+ var encoder = new PngBitmapEncoder();
+ encoder.Frames.Add(BitmapFrame.Create((BitmapSource)QrImage.Source));
+ using (FileStream stream = new FileStream(sfd.FileName, FileMode.Create))
+ encoder.Save(stream);
+ }
+ }
+
+ private void BuildQrCode(V2RayType type)
+ {
+ string shareLink = string.Empty;
+ switch (type)
+ {
+ case V2RayType.VLESS_TCP:
+ shareLink = Settings.VLESS_TCP_ShareLink;
+ break;
+ case V2RayType.VLESS_WS:
+ shareLink = Settings.VLESS_WS_ShareLink;
+ break;
+ case V2RayType.VLESS_H2:
+ break;
+ case V2RayType.VLESS_KCP:
+ shareLink = Settings.VLESS_KCP_ShareLink;
+ break;
+ case V2RayType.VLESS_gRPC:
+ shareLink = Settings.VLESS_gRPC_ShareLink;
+ break;
+ case V2RayType.VMESS_TCP:
+ shareLink = Settings.VMESS_TCP_ShareLink;
+ break;
+ case V2RayType.VMESS_WS:
+ shareLink = Settings.VMESS_WS_ShareLink;
+ break;
+ case V2RayType.VMESS_H2:
+ break;
+ case V2RayType.VMESS_KCP:
+ shareLink = Settings.VMESS_KCP_ShareLink;
+ break;
+ case V2RayType.Trojan_TCP:
+ shareLink = Settings.Trojan_TCP_ShareLink;
+ break;
+ case V2RayType.Trojan_WS:
+ break;
+ case V2RayType.ShadowsocksAEAD:
+ shareLink = Settings.ShadowSocksShareLink;
+ break;
+ default:
+ break;
+ }
+
+
+ QRCodeGenerator qrGenerator = new QRCodeGenerator();
+ QRCodeData qrCodeData = qrGenerator.CreateQrCode(shareLink, QRCodeGenerator.ECCLevel.Q);
+ QRCode qrCode = new QRCode(qrCodeData);
+
+ Bitmap qrCodeImage = qrCode.GetGraphic(20);
+ MemoryStream ms = new MemoryStream();
+ qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
+ byte[] bytes = ms.GetBuffer();
+ ms.Close();
+ BitmapImage image = new BitmapImage();
+ image.BeginInit();
+ image.StreamSource = new MemoryStream(bytes);
+ image.EndInit();
+ QrImage.Source = image;
+ QrImage.Tag = type.ToString();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml b/ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml
new file mode 100644
index 00000000..23a3f831
--- /dev/null
+++ b/ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml.cs b/ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml.cs
new file mode 100644
index 00000000..87144e3f
--- /dev/null
+++ b/ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.V2ray
+{
+ [MvxWindowPresentation]
+ public partial class V2rayEditorView : MvxWindow
+ {
+ public V2rayEditorView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml b/ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml
new file mode 100644
index 00000000..38cc14bd
--- /dev/null
+++ b/ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml.cs b/ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml.cs
new file mode 100644
index 00000000..b6906b1b
--- /dev/null
+++ b/ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml.cs
@@ -0,0 +1,27 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views.V2ray
+{
+ [MvxWindowPresentation]
+ public partial class V2rayInstallView : MvxWindow
+ {
+ public V2rayInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/Xray/XrayConfigView.xaml b/ProxySuper.WPF/Views/Xray/XrayConfigView.xaml
new file mode 100644
index 00000000..b74ceb1d
--- /dev/null
+++ b/ProxySuper.WPF/Views/Xray/XrayConfigView.xaml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Xray/XrayConfigView.xaml.cs b/ProxySuper.WPF/Views/Xray/XrayConfigView.xaml.cs
new file mode 100644
index 00000000..64a12706
--- /dev/null
+++ b/ProxySuper.WPF/Views/Xray/XrayConfigView.xaml.cs
@@ -0,0 +1,124 @@
+using Microsoft.Win32;
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using ProxySuper.Core.Models.Projects;
+using ProxySuper.Core.ViewModels;
+using QRCoder;
+using System.Drawing;
+using System.IO;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class XrayConfigView : MvxWindow
+ {
+ public XrayConfigView()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ base.OnRender(drawingContext);
+
+ for (int i = 0; i < TabCtrl.Items.Count; i++)
+ {
+ var tabItem = TabCtrl.Items[i] as TabItem;
+
+ if (Settings.Types.Contains((XrayType)tabItem.Tag))
+ {
+ TabCtrl.SelectedIndex = i;
+ break;
+ }
+ }
+ }
+
+ public XraySettings Settings
+ {
+ get
+ {
+ return ((XrayConfigViewModel)ViewModel).Settings;
+ }
+ }
+
+ private void BuildQrCode(object sender, SelectionChangedEventArgs e)
+ {
+ var tabControl = e.Source as TabControl;
+ var item = (tabControl.SelectedItem as TabItem);
+ if (item == null) return;
+ var type = (XrayType)item.Tag;
+ BuildQrCode(type);
+ }
+
+ private void SaveImage(object sender, RoutedEventArgs e)
+ {
+ SaveFileDialog sfd = new SaveFileDialog();
+ sfd.FileName += QrImage.Tag;
+ sfd.Filter = "Image Files (*.bmp, *.png, *.jpg)|*.bmp;*.png;*.jpg | All Files | *.*";
+ sfd.RestoreDirectory = true;//保存对话框是否记忆上次打开的目录
+ if (sfd.ShowDialog() == true)
+ {
+ var encoder = new PngBitmapEncoder();
+ encoder.Frames.Add(BitmapFrame.Create((BitmapSource)QrImage.Source));
+ using (FileStream stream = new FileStream(sfd.FileName, FileMode.Create))
+ encoder.Save(stream);
+ }
+ }
+
+ private void BuildQrCode(XrayType type)
+ {
+ string shareLink = string.Empty;
+ switch (type)
+ {
+ case XrayType.VLESS_XTLS_RAW_REALITY:
+ shareLink = Settings.VLESS_RAW_XTLS_REALITY_ShareLink;
+ break;
+ case XrayType.VLESS_RAW_XTLS:
+ shareLink = Settings.VLESS_RAW_XTLS_ShareLink;
+ break;
+ case XrayType.VLESS_XHTTP:
+ shareLink = Settings.VLESS_XHTTP_ShareLink;
+ break;
+ case XrayType.VLESS_WS:
+ shareLink = Settings.VLESS_WS_ShareLink;
+ break;
+ case XrayType.VLESS_gRPC:
+ shareLink = Settings.VLESS_gRPC_ShareLink;
+ break;
+ case XrayType.VMESS_KCP:
+ shareLink = Settings.VMESS_KCP_ShareLink;
+ break;
+ case XrayType.Trojan_TCP:
+ shareLink = Settings.Trojan_TCP_ShareLink;
+ break;
+ case XrayType.ShadowsocksAEAD:
+ shareLink = Settings.ShadowSocksShareLink;
+ break;
+ default:
+ break;
+ }
+
+
+ var qrGenerator = new QRCodeGenerator();
+ var qrCodeData = qrGenerator.CreateQrCode(shareLink, QRCodeGenerator.ECCLevel.Q);
+ var qrCode = new QRCode(qrCodeData);
+
+ var qrCodeImage = qrCode.GetGraphic(20);
+ var ms = new MemoryStream();
+ qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
+ byte[] bytes = ms.GetBuffer();
+ ms.Close();
+ var image = new BitmapImage();
+ image.BeginInit();
+ image.StreamSource = new MemoryStream(bytes);
+ image.EndInit();
+ QrImage.Source = image;
+ QrImage.Tag = type.ToString();
+ }
+
+ }
+}
diff --git a/ProxySuper.WPF/Views/Xray/XrayEditorView.xaml b/ProxySuper.WPF/Views/Xray/XrayEditorView.xaml
new file mode 100644
index 00000000..bc897145
--- /dev/null
+++ b/ProxySuper.WPF/Views/Xray/XrayEditorView.xaml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Xray/XrayEditorView.xaml.cs b/ProxySuper.WPF/Views/Xray/XrayEditorView.xaml.cs
new file mode 100644
index 00000000..4cf0387c
--- /dev/null
+++ b/ProxySuper.WPF/Views/Xray/XrayEditorView.xaml.cs
@@ -0,0 +1,15 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using System;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class XrayEditorView : MvxWindow
+ {
+ public XrayEditorView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/Views/Xray/XrayInstallView.xaml b/ProxySuper.WPF/Views/Xray/XrayInstallView.xaml
new file mode 100644
index 00000000..71a90af2
--- /dev/null
+++ b/ProxySuper.WPF/Views/Xray/XrayInstallView.xaml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySuper.WPF/Views/Xray/XrayInstallView.xaml.cs b/ProxySuper.WPF/Views/Xray/XrayInstallView.xaml.cs
new file mode 100644
index 00000000..0077f974
--- /dev/null
+++ b/ProxySuper.WPF/Views/Xray/XrayInstallView.xaml.cs
@@ -0,0 +1,29 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using MvvmCross.Platforms.Wpf.Views;
+using MvvmCross.ViewModels;
+using ProxySuper.Core.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySuper.WPF.Views
+{
+ [MvxWindowPresentation]
+ public partial class XrayInstallView : MvxWindow
+ {
+ public XrayInstallView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProxySuper.WPF/packages.config b/ProxySuper.WPF/packages.config
new file mode 100644
index 00000000..cf6f75af
--- /dev/null
+++ b/ProxySuper.WPF/packages.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 546a7fd7..c43a8aac 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,15 @@
-
# ProxySU
-V2ray, Xray,Trojan, NaiveProxy, Trojan-Go, ShadowsocksR(SSR),Shadowsocks-libev and Plugins,MTProto+TLS,BBR install tools for windows。
-V2ray,Xray,Trojan,NaiveProxy, Trojan-Go, ShadowsocksR(SSR),Shadowsocks-libev及相关插件,MTProto+TLS 一键安装工具。支持纯ipv6主机一键安装代理。
-BBR一键开启(仅支持CentOS8/Debian9/10/Ubuntu18.04及以上),支持语言:English、简体中文、正体(繁体)中文。
+V2ray, Xray, Trojan, NaiveProxy, Trojan-Go, Brook,BBR install tools for windows。
+V2ray,Xray, Trojan,NaiveProxy, Trojan-Go, Brook 及相关插件。支持纯ipv6主机一键安装代理。
+BBR一键开启(仅支持CentOS8/Debian9/10/Ubuntu18.04及以上),支持语言:English、简体中文、正体(繁体)中文,波斯语。
+
+编译环境Visual Studio 2022 使用WPF界面。可一键安装 V2ray/Xray, Shadowsocks, Trojan-Go, NaiveProxy, Brook 后续还会再添加其他。
+
+零基础用户,强烈建议看一下[Xray官网](https://xtls.github.io)的[小小白白话文-自建教程](https://xtls.github.io/document/level-0)。
+更多相关资源与工具请看本项目Wiki[资源和工具](https://github.com/proxysu/ProxySU/wiki/%E8%B5%84%E6%BA%90%E5%92%8C%E5%B7%A5%E5%85%B7)。
-编译环境Visual Studio 2017 使用WPF界面。可一键安装V2ray、Xray,Trojan、NaiveProxy,Trojan-Go,ShadowsocksR(SSR),Shadowsocks-libev and Plugins、MTProto+TLS 后续还会再添加其他。
+
+
@@ -13,79 +18,13 @@ BBR一键开启(仅支持CentOS8/Debian9/10/Ubuntu18.04及以上),支持语
#### 再次声明:
##### ProxySU本着技术中立的原则,没有任何立场,也不持任何见解,更不涉及任何政治因素。ProxySU仅仅主张人的知情权,这是一项天赋人权,也是各国宪法所保障的最基本人权。知情权包含对同一事物正负两方面评价的知情,至于相信哪个,由人自己选择。正如李文亮医生临终所言:一个正常的社会是不应该只有一种声音的。如果真的存在对某一事物只有一种声音的评价,无论其评价是正面还是负面,都是要慎重对待,并需要重新审视的。
-##### Xray可一键安装的模式有:
-当前Xray是V2Ray的超集,未来Xray会有不同的发展方向。
-* VLESS+TCP+XTLS+Web (最新黑科技)
-* Vless+tcp+TLS+Web (新热门协议)
-* VLESS+WebSocket+TLS+Web
-* VLESS+http2+TLS+Web
-* VLESS+mKCP
-* tcp
-* tcp+http伪装
-* tcp+TLS
-* tcp+TLS (自签证书)
-* WebSocket
-* WebSocket+TLS
-* WebSocket+TLS+Web
-* WebSocket+TLS(自签证书)
-* http2
-* http2+TLS+Web
-* http2(自签证书)
-* mKCP及各种伪装
-* QUIC及各种伪装。
-
-##### V2ray可一键安装的模式有:
-
-* Vless+tcp+TLS+Web (新热门协议)
-* VLESS+WebSocket+TLS+Web
-* VLESS+http2+TLS+Web
-* VLESS+mKCP
-* tcp
-* tcp+http伪装
-* tcp+TLS
-* tcp+TLS (自签证书)
-* WebSocket
-* WebSocket+TLS
-* WebSocket+TLS+Web
-* WebSocket+TLS(自签证书)
-* http2
-* http2+TLS+Web
-* http2(自签证书)
-* mKCP及各种伪装
-* QUIC及各种伪装。
-注:mKCP和QUIC模式使用udp协议,可以有效减少网络延时,有加速的作用,但在网络管控严厉时期,会导致端口或IP被封。以上模式最推荐的是WebSocket+TLS+Web 和http2+TLS+Web 需要有一个域名。如果能加上CDN则稳定性更好。加上CDN后,是加速还是减速,与线路有关,也与当前所用的CDN的IP有关,这里是一个筛选CDN最优IP的工具: [better-cloudflare-ip](https://github.com/badafans/better-cloudflare-ip) -----适用于使用 Cloudflare 的CDN。
-
-##### Trojan 可一键安装:
-* Trojan + TLS + Web
-
-##### Trojan-Go 可一键安装:
-* Trojan-Go + TLS + Web
-* Trojan-Go + WebSocket + TLS + Web
-
-##### NaiveProxy一键安装:
-* NaiveProxy + TLS +Web
-
-##### ShadowsocksR(SSR)一键安装:
-* SSR+TLS+Caddy
-
-##### SS (Shadowsocks-libev) 及相关插件一键安装:
-* SS 经典模式
-* SS+WebSocket+TLS+Caddy(Web前置) (推荐)
-* SS+WebSocket
-* SS+QUIC
-* SS+kcptun
-* SS+obfs+http+Web
-* SS+obfs+TLS+Web
-
-##### MTProto+TLS电报代理一键安装:
-* MTProto+TLS
+##### 代理版本的选择
+多数情况下,ProxySU安装代理工具的Latest版。
##### 支持的VPS系统为:
-* CentOS 7/8
-* Debian 8/9/10 (推荐 10)
-* Ubuntu 16.04及以上
-
-(注意:如果系统启用了SELinux且工作在Enforcing模式下时,需要将Enforcing更改为Permissive模式,否则使用WebSocket+TLS+Web时,Caddy的service无法开机启动,这种情形一般出现在Centos7/8中,程序在安装过程中将自动处理。)
+* Debian 9/10/11/12 (推荐 10+)
+* Ubuntu 18及以上
+
##### ProxySU使用教程
[一键搭建科学上网工具ProxySU](https://github.com/Alvin9999/new-pac/wiki/%E4%B8%80%E9%94%AE%E6%90%AD%E5%BB%BA%E7%A7%91%E5%AD%A6%E4%B8%8A%E7%BD%91%E5%B7%A5%E5%85%B7ProxySU)------------网友 [Alvin9999](https://github.com/Alvin9999) 制作。
@@ -108,7 +47,7 @@ Nat类型的vps主机,因为无法独占80,443端口,使用tls模式的代
ProxySU在开发过程中,一般都是在vultr的vps中测试,测试系统版本为:Debian 10。由于同一个版本的Linux系统,不同的VPS商,云服务商也不完全相同。实在没有精力去逐一测试。如果安装失败,可以先尝试以下方法解决:
1.如果以前装过翻墙软件,请重装一下vps系统后,再试。
-2.更换为其他版本的linux发行版,推荐使用 Debian 9与Debian 10系统,再试。
+2.更换为其他版本的linux发行版,推荐使用 Debian 10+ 系统,再试。
以上两种方法不能解决,请各位网友及时发[issues](https://github.com/proxysu/windows/issues),或者到[TG群组](https://t.me/proxysuissues),反馈。
@@ -120,7 +59,14 @@ ProxySU调用[SSH.NET](https://github.com/sshnet/SSH.NET)库登录远程主机
* RSA in OpenSSL PEM and ssh.com format
* DSA in OpenSSL PEM and ssh.com format
* ECDSA 256/384/521 in OpenSSL PEM format
-* ED25519 in OpenSSH key format
+* ECDSA 256/384/521, ED25519 and RSA in OpenSSH key format
+可以使用以下密码方法之一对私钥进行加密:
+* DES-EDE3-CBC
+* DES-EDE3-CFB
+* DES-CBC
+* AES-128-CBC
+* AES-192-CBC
+* AES-256-CBC
见官方说明:
https://github.com/sshnet/SSH.NET#public-key-authentication
如果当前拥有的密钥格式不是以上几种,可以下载[puttygen](https://www.puttygen.com/)工具,将其转换成上面的格式。
@@ -141,116 +87,23 @@ Let's Encrypt证书申请频率的限制
同一IP地址,在短时间内过于频繁的申请证书,也会被限制,此时更换域名也无法申请成功,只能等待一段时间,或者更换Ip.
(网友分享)
-#### 伪装网站使用说明
-伪装网站是网上已经现存的任何网站,没有敏感信息的,没有被墙的国外网站都行,不需要自已搭建。只填域名,不要带 http 或 /,也不要与当前使用的域名相同。
-
-###### Xray模式目前已支持生成用于
-
-* 使用与V2Ray相兼容的客户端
-
-###### V2ray模式目前已支持生成用于
-
-* [v2ray官方程序](https://www.v2ray.com/chapter_00/install.html)配置文件(客户端配置)
-* [v2rayN (windows)](https://github.com/2dust/v2rayN/releases)客户端导入二维码和网址
-* [Qv2ray (windows)](https://github.com/Qv2ray/Qv2ray)客户端导入二维码和网址
-* [Shadowrocket (ios)](https://apps.apple.com/us/app/shadowrocket/id932747118)导入二维码和网址
-* [v2rayNG (Android)](https://github.com/2dust/v2rayNG/releases)导入二维码和网址
-
-(程序中只实现生成v2rayN的,但是Shadowrocket和v2rayNG都可以导入。)
-
-###### Trojan模式目前已支持生成用于
-
-* [Trojan官方程序](https://github.com/trojan-gfw/trojan)配置文件(客户端配置)
-* [Qv2ray (windows)](https://github.com/Qv2ray/Qv2ray)客户端导入二维码和网址
-* [Shadowrocket (ios)](https://apps.apple.com/us/app/shadowrocket/id932747118)导入二维码和网址
-* [igniter(Android)](https://github.com/trojan-gfw/igniter/releases)导入二维码和网址
-注:Trojan官方的Windows客户端,需要安装 [vc_redist.x64.exe](https://aka.ms/vs/16/release/vc_redist.x64.exe)。[官方说明](https://github.com/trojan-gfw/trojan/wiki/Binary-&-Package-Distributions#windows-vista)
-
-###### Trojan-Go模式目前已支持生成用于
-
-* [Trojan-Go官方程序](https://github.com/p4gefau1t/trojan-go/releases)配置文件(客户端配置)
-* [Qv2ray (windows)](https://github.com/Qv2ray/Qv2ray)客户端导入二维码和网址
-* [igniter-go(Android)](https://github.com/p4gefau1t/trojan-go-android/releases)导入二维码和网址
-
-注:分享链接规范使用:https://github.com/p4gefau1t/trojan-go/issues/132
-
-###### NaiveProxy支持生成用于:
-
-* [NaiveProxy官方客户端](https://github.com/klzgrad/naiveproxy/releases)配置文件(windows客户端配置)
-* [NaiveSharp(windows)](https://github.com/KevinZonda/NaiveSharp/releases)(第三方Windows图形客户端)URL导入链接。
-* [Qv2ray (windows)](https://github.com/Qv2ray/Qv2ray)客户端导入二维码和URL
-注:这里多说几句NaiveProxy,现在墙越来越高,翻墙软件需要隐藏访问目标网址和加密数据的同时,还要隐藏自己的流量特征,不被识别出是代理流量。V2ray,Trojan都有其自己的实现。而NaiveProxy是配合Caddy的一个http.forwardproxy插件,插件有防嗅探,转发流量的功能。代理http流量很完美,但是在代理https流量时,会出现长度特征,NaiverProxy则弥补了这一点,消除了代理https时的流量特征,另外还应用 [Chrome's network stack](https://www.chromium.org/developers/design-documents/network-stack).更好的消除TLS的指纹特征。详细介绍请看项目官方介绍:[NaiveProxy官方文档](https://github.com/klzgrad/naiveproxy)。有兴趣的不妨一试。
-
-###### SSR+TLS+Caddy 模式目前已支持生成用于
-
-* [ShadowsocksR (windows)](https://github.com/shadowsocksrr/shadowsocksr-csharp/releases)客户端导入二维码和URL
-* [SSRR(Android)](https://github.com/shadowsocksrr/shadowsocksr-android/releases)导入二维码和URL
-* [Shadowrocket (ios)](https://apps.apple.com/us/app/shadowrocket/id932747118)导入二维码和URL
-
-###### SS (Shadowsocks-libev) 目前已支持生成用于
-
-* [Shadowsocks (windows)](https://github.com/shadowsocks/shadowsocks-windows/releases)客户端导入二维码和URL
-* [shadowsocks(Android)](https://github.com/shadowsocks/shadowsocks-android/releases)导入二维码和URL
-* [Shadowrocket (ios)](https://apps.apple.com/us/app/shadowrocket/id932747118)导入二维码和URL
-
-## 程序工作流程:
-1. 使用[SSH.NET](https://github.com/sshnet/SSH.NET)登录远程主机
-2. 根据选择的代理来调用相应的脚本:
- * 选择Xray,则调用Xray官方安装脚本 `curl -o /tmp/go.sh https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh` `yes | bash /tmp/go.sh -f` ,安装Xray。
- * 选择V2ray,则调用V2ray官方安装脚本 `curl -o /tmp/go.sh https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh` `yes | bash /tmp/go.sh -f` ,安装V2ray。
- * 选择Trojan,则调用Trojan官方安装脚本 `curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh` `yes | bash /tmp/trojan-quickstart.sh` 安装Trojan。
- * 选择Trojan-Go,则调用本项目内的trojan-go.sh安装, `curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh` `yes | bash /tmp/trojan-go.sh -f` 安装Trojan-GO。
- * 选择NaiveProxy,先安装Caddy2,方法源自[Caddy官方文档](https://caddyserver.com/docs/download)。再用自编译的Caddy2(带forward_proxy插件)替换原来的Caddy运行文件。自编译Caddy2文件方法源自[NaiveProxy官方文档](https://github.com/klzgrad/naiveproxy#setup)。
- * 选择SSR+TLS+Caddy模式,则调用本项目内的ssr.sh安装, `curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh` `yes | bash /tmp/ssr.sh -f` 安装SSR。
- * 选择Shadowsocks-libev与插件模式,则调用本项目内的ss-install.sh安装,`curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh` `yes | bash /tmp/install.sh`
- * 先择MTProto+TLS模式,则调用本项目内的mtg_install.sh安装,`curl -o /tmp/mtg_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/MTProto/mtg_install.sh` `yes | bash /tmp/mtg_install.sh`
-3. 根据选择读取相应配置模板,调用[Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)生成相应配置文件,并上传到服务器。所有模板及配置文件 [在这里](https://github.com/proxysu/windows/tree/master/TemplateConfg)
-4. 如果使用WebSocket+TLS+Web/http2+TLS+Web/Trojan+TLS+Web/Trojan-go+TLS+Web/SSR+TLS+Caddy/SS+WebSocket+TLS+Caddy/SS+obfs+http+Web/SS+obfs+TLS+Web 模式,则安装Caddy2,方法源自[Caddy官方文档](https://caddyserver.com/docs/download)。
-5. 如果使用Http2/tcp+TLS/WebSocket+TLS/Trojan+TLS+Web/Trojan-go+TLS+Web/SS+QUIC模式,则调用 `curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh` 安装acme.sh,使用acme.sh申请证书.
-6. 安装成功后,使用[Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)生成兼容于相应客户端的json文件,用C#内置的Base64库将json生成url链接,使用[QRcoder](https://github.com/codebude/QRCoder)生成二维码。
-
-* 注:V2ray安装及配置文件主要参考自:
-[V2ray官网](https://www.v2ray.com "需加代理访问")
-[白话文教程](https://toutyrater.github.io/)
-[新白话文教程(社区版)](https://guide.v2fly.org/)
-
-* 注:Trojan安装及配置文件主要参考自:
-[Trojan官方配置文档](https://trojan-gfw.github.io/trojan/config)
-[Trojan官方安装说明](https://github.com/trojan-gfw/trojan/wiki/Binary-&-Package-Distributions)
-[自建梯子教程-Trojan](https://trojan-tutor.github.io/2019/04/10/p41.html)
-
-* 注:NaiveProxy安装及配置文件主要参考自:
-[NaiveProxy官方说明](https://github.com/klzgrad/naiveproxy)
-[美博园教程-自建最强科学上网4:NaiveProxy + Caddy](https://dafahao.com/naiveproxy-caddy.html "需加代理访问")
-
-* 注:SSR+TLS+Caddy安装及配置文件主要参考自:
-[ShadowsocksR+Caddy+TLS伪装流量科学上网](https://blog.duyuanchao.me/posts/a384749f/)
-[teddysun大佬的SSR一键脚本](https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh)
-
-* 注:Shadowsocks-libev安装及配置文件主要参考自:
-[Shadowsocks官方文档](https://shadowsocks.org/)
-[teddysun大佬的shadowsocks-libev.sh一键脚本](https://github.com/teddysun/shadowsocks_install/blob/master/shadowsocks-libev.sh)
-
-* 注:MTProto+TLS安装与配置文件主要参考自:
-[MTProto go语言版](https://github.com/9seconds/mtg/tree/master)
-
+##### 上传自有证书 #####
+需要将crt和key文件打包成zip,在安装界面选择“上传自有证书”
##### 关于卸载功能
有网友要求,可以卸载其他方法安装的,经过考虑,还是不这样做。1,容易引起争议。2,不容易卸载干净,在用ProxySU安装时可能还会出错。所以第一次使用ProxySU建议使用全新系统,如果以前安装过代理程序,请尽可能将系统重装一下,可以减少很多安装的错误和冲突。
## License
-[(GPL-V3)](https://raw.githubusercontent.com/proxysu/windows/master/LICENSE)
+[(MIT)](https://raw.githubusercontent.com/proxysu/windows/master/LICENSE)
## 运行文件下载
-* Beta版(随代码更新,新添加功能可能有bug或不完善)
-[下载](https://github.com/proxysu/windows/raw/master/ProxySU/bin/Beta/Beta.zip)
* 正式版(正式发布的版本,新功能完善后发布)
-[下载](https://github.com/proxysu/windows/releases)
+[下载](https://github.com/proxysu/ProxySU/releases)
-## Windows系统需要安装net4.0及以上
+## Windows系统需要安装net4.8或以上
-Microsoft [.NET Framework 4.0](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net40-offline-installer) or higher
+Microsoft [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net48-offline-installer) or higher
## 使用的C# 库
[SSH.NET --------------- https://github.com/sshnet/SSH.NET](https://github.com/sshnet/SSH.NET)
@@ -261,14 +114,24 @@ Microsoft [.NET Framework 4.0](https://dotnet.microsoft.com/download/dotnet-fram
为了布署方便,程序使用root账户登录主机,出于慎重,请不要在运行重要程序及用于生产的主机上使用。程序所有源码开源,所使用的库都是github开源项目,可以保障最大的使用安全,程序不夹带任何私货、恶意代码及后门,也不会收集任何个人资料,不是在本项目地址下载的,不做任何保障,请尽可能从本项目地址下载。
## 程序使用问题反馈
-* Telegram群组 https://t.me/proxysuissues
-* Telegram频道 https://t.me/proxysu_channel
* 在线提问 https://github.com/proxysu/windows/issues
在使用遇到问题时,请先看一下[常见问题集锦](https://github.com/proxysu/windows/wiki/CommonError),如果还不能解决,可以到以上平台询问,个人精力有限,尽力解答。
-## v1.0.0发布小记
- 足足用了近两个月的业余时间,终于做成一个功能还算完善的版本。虽是一个简单的小工具,没想到对于我这个初学C#的人,还是有点小吃力,如果不是因为武汉肺炎疫情,被禁足在家,还真没时间。学习C#,为啥编写这样一个小工具软件来练手?现在一键安装脚本多的是,这样的工具还有必要吗?咋说呢?我也不知道有多少人会喜欢这个小工具,只是觉得自己用着方便,也想方便一下别人吧,喜欢用就用,不喜欢,也随意。
- 生意又忙起来了,对于我这个业余的编程爱好者,可能没有多少业余时间继续折腾了,尽力吧。
- (记于2020.4.18)
-## V2.0.0发布小记
- 哎呀吗!增加一个多语言切换,真是麻烦啊,最初就没有想支持多语言(PS:其实是不会`^_^`) 。中途再添加,真的是累啊!整了一个星期才完事。主要代码简单,就是把所有的中文显示信息替换,那真是一个晕!!英文水平太菜,用谷歌翻译做的,凑合着用吧。
+
+[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
+
+[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
+
+[](https://dartnode.com)
+
+[](https://dartnode.com)
+
+[](https://dartnode.com)
+
+
+[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
+
+
+
+
+
diff --git a/TemplateConfg/naive/naive_client_config.json b/TemplateConfg/naive/naive_client_config.json
deleted file mode 100644
index 3592f598..00000000
--- a/TemplateConfg/naive/naive_client_config.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-"listen": "socks://127.0.0.1:1080",
-"proxy": "",
-"log": ""
-}
\ No newline at end of file
diff --git a/TemplateConfg/naive/naive_server.caddyfile b/TemplateConfg/naive/naive_server.caddyfile
deleted file mode 100644
index 188ba333..00000000
--- a/TemplateConfg/naive/naive_server.caddyfile
+++ /dev/null
@@ -1,14 +0,0 @@
-:443, ##domain##
-route {
- forward_proxy {
- ##basicauth##
- #basic_auth ##user## ##pass##
- hide_ip
- hide_via
- probe_resistance
- }
- file_server { root /usr/share/caddy }
-}
-##reverse_Proxy1##
-##reverse_Proxy2##
-##reverse_Proxy3##
\ No newline at end of file
diff --git a/TemplateConfg/naive/naive_server_config.json b/TemplateConfg/naive/naive_server_config.json
deleted file mode 100644
index a53b05d5..00000000
--- a/TemplateConfg/naive/naive_server_config.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "apps": {
- "http": {
- "servers": {
- "srv0": {
- "listen": [
- ":443"
- ],
- "routes": [
- {
- "handle": [
- {
- "handler": "forward_proxy",
- "hide_ip": true,
- "hide_via": true,
- "auth_user": "",
- "auth_pass": "",
- "probe_resistance": {
- "domain": ""
- }
- }
- ]
- },
- {
- "match": [
- {
- "host": [
- ""
- ]
- }
- ],
- "handle": [
- {
- "handler": "file_server",
- "root": "/usr/share/caddy"
- }
- ],
- "terminal": true
- }
- ],
- "tls_connection_policies": [
- {
- "match": {
- "sni": [
- ""
- ]
- }
- }
- ]
- }
- }
- },
- "tls": {
- "automation": {
- "policies": [
- {
- "subjects": [
- ""
- ],
- "issuer": {
- "email": "",
- "module": "acme"
- }
- }
- ]
- }
- }
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/ss/WebSocketTLSWeb.caddyfile b/TemplateConfg/ss/WebSocketTLSWeb.caddyfile
deleted file mode 100644
index 7c97b69a..00000000
--- a/TemplateConfg/ss/WebSocketTLSWeb.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
- @v2ray_websocket {
- path ##path##
- header Connection *Upgrade*
- header Upgrade websocket
- }
- reverse_proxy @v2ray_websocket localhost:10000
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/ss/ss_obfs_http_web_config.caddyfile b/TemplateConfg/ss/ss_obfs_http_web_config.caddyfile
deleted file mode 100644
index 4ace8e06..00000000
--- a/TemplateConfg/ss/ss_obfs_http_web_config.caddyfile
+++ /dev/null
@@ -1,7 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
diff --git a/TemplateConfg/ss/ss_server_config.json b/TemplateConfg/ss/ss_server_config.json
deleted file mode 100644
index cd115b4e..00000000
--- a/TemplateConfg/ss/ss_server_config.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "server": "",
- "server_port": null,
- "password": "",
- "timeout": 300,
- "user": "nobody",
- "method": "",
- "fast_open": false,
- "nameserver": "1.0.0.1",
- "mode": "tcp",
- "plugin": "",
- "plugin_opts": ""
-}
\ No newline at end of file
diff --git a/TemplateConfg/ss/ss_tls_caddy_config.caddyfile b/TemplateConfg/ss/ss_tls_caddy_config.caddyfile
deleted file mode 100644
index d243b830..00000000
--- a/TemplateConfg/ss/ss_tls_caddy_config.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-https://##domain##:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/ssr/ssr_tls.caddyfile b/TemplateConfg/ssr/ssr_tls.caddyfile
deleted file mode 100644
index d243b830..00000000
--- a/TemplateConfg/ssr/ssr_tls.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-https://##domain##:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan-go/trojan-go.caddyfile b/TemplateConfg/trojan-go/trojan-go.caddyfile
deleted file mode 100644
index 0e9f3d22..00000000
--- a/TemplateConfg/trojan-go/trojan-go.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan-go/trojan-go_all_config.json b/TemplateConfg/trojan-go/trojan-go_all_config.json
deleted file mode 100644
index 0ca920c9..00000000
--- a/TemplateConfg/trojan-go/trojan-go_all_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "run_type": "",
- "local_addr": "",
- "local_port": "",
- "remote_addr": "",
- "remote_port": "",
- "password": [
- ""
- ],
- "disable_http_check": true,
- "ssl": {
- "sni": "",
- "cert": "",
- "key": ""
- },
- "websocket": {
- "enabled": false,
- "path": "",
- "host": ""
- },
- "mux": {
- "enabled": false,
- "concurrency": 8,
- "idle_timeout": 60
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan/trojan.caddyfile b/TemplateConfg/trojan/trojan.caddyfile
deleted file mode 100644
index 0e9f3d22..00000000
--- a/TemplateConfg/trojan/trojan.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan/trojan_client_config.json b/TemplateConfg/trojan/trojan_client_config.json
deleted file mode 100644
index cbe244fd..00000000
--- a/TemplateConfg/trojan/trojan_client_config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "run_type": "client",
- "local_addr": "127.0.0.1",
- "local_port": 1080,
- "remote_addr": null,
- "remote_port": 443,
- "password": [
- ""
- ],
- "log_level": 1,
- "ssl": {
- "verify": true,
- "verify_hostname": true,
- "cert": "",
- "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA",
- "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
- "sni": "",
- "alpn": [
- "h2",
- "http/1.1"
- ],
- "reuse_session": true,
- "session_ticket": false,
- "curves": ""
- },
- "tcp": {
- "no_delay": true,
- "keep_alive": true,
- "reuse_port": false,
- "fast_open": false,
- "fast_open_qlen": 20
- }
-}
diff --git a/TemplateConfg/trojan/trojan_server_config.json b/TemplateConfg/trojan/trojan_server_config.json
deleted file mode 100644
index ba5a6fa4..00000000
--- a/TemplateConfg/trojan/trojan_server_config.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "run_type": "server",
- "local_addr": "::",
- "local_port": 443,
- "remote_addr": "127.0.0.1",
- "remote_port": 8800,
- "password": [
- ""
- ],
- "log_level": 1,
- "ssl": {
- "cert": "/usr/local/etc/trojan/trojan_ssl.crt",
- "key": "/usr/local/etc/trojan/trojan_ssl.key",
- "key_password": "",
- "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
- "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
- "prefer_server_cipher": true,
- "alpn": [
- "http/1.1"
- ],
- "alpn_port_override": {
- "h2": 81
- },
- "reuse_session": true,
- "session_ticket": false,
- "session_timeout": 600,
- "plain_http_response": "",
- "curves": "",
- "dhparam": ""
- },
- "tcp": {
- "prefer_ipv4": false,
- "no_delay": true,
- "keep_alive": true,
- "reuse_port": false,
- "fast_open": false,
- "fast_open_qlen": 20
- },
- "mysql": {
- "enabled": false,
- "server_addr": "127.0.0.1",
- "server_port": 3306,
- "database": "trojan",
- "username": "trojan",
- "password": "",
- "key": "",
- "cert": "",
- "ca": ""
- }
-}
diff --git a/TemplateConfg/v2ray/base.json b/TemplateConfg/v2ray/base.json
deleted file mode 100644
index 84a9d1fc..00000000
--- a/TemplateConfg/v2ray/base.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "log": {},
- "api": {},
- "dns": {},
- "routing": {},
- "policy": {},
- "inbounds": [],
- "outbounds": [],
- "transport": {},
- "stats": {},
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/caddy/Http2Web.caddyfile b/TemplateConfg/v2ray/caddy/Http2Web.caddyfile
deleted file mode 100644
index 7e62dbcc..00000000
--- a/TemplateConfg/v2ray/caddy/Http2Web.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
-
- reverse_proxy ##path## http://localhost:10000 {
- transport http {
- versions h2c 2
- }
- }
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/caddy/WebSocketTLSWeb.caddyfile b/TemplateConfg/v2ray/caddy/WebSocketTLSWeb.caddyfile
deleted file mode 100644
index 7c97b69a..00000000
--- a/TemplateConfg/v2ray/caddy/WebSocketTLSWeb.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
- @v2ray_websocket {
- path ##path##
- header Connection *Upgrade*
- header Upgrade websocket
- }
- reverse_proxy @v2ray_websocket localhost:10000
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/caddy/vlessTcpTlsWeb.caddyfile b/TemplateConfg/v2ray/caddy/vlessTcpTlsWeb.caddyfile
deleted file mode 100644
index 0e9f3d22..00000000
--- a/TemplateConfg/v2ray/caddy/vlessTcpTlsWeb.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/00_log/00_log.json b/TemplateConfg/v2ray/client/00_log/00_log.json
deleted file mode 100644
index 6a4cf006..00000000
--- a/TemplateConfg/v2ray/client/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/01_api/01_api.json b/TemplateConfg/v2ray/client/01_api/01_api.json
deleted file mode 100644
index aa1982bc..00000000
--- a/TemplateConfg/v2ray/client/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/02_dns/02_dns.json b/TemplateConfg/v2ray/client/02_dns/02_dns.json
deleted file mode 100644
index 63472d2f..00000000
--- a/TemplateConfg/v2ray/client/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/03_routing/03_routing.json b/TemplateConfg/v2ray/client/03_routing/03_routing.json
deleted file mode 100644
index a187d31e..00000000
--- a/TemplateConfg/v2ray/client/03_routing/03_routing.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "routing": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/04_policy/04_policy.json b/TemplateConfg/v2ray/client/04_policy/04_policy.json
deleted file mode 100644
index 4beed61d..00000000
--- a/TemplateConfg/v2ray/client/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/05_inbounds/05_inbounds.json b/TemplateConfg/v2ray/client/05_inbounds/05_inbounds.json
deleted file mode 100644
index dbce3dd8..00000000
--- a/TemplateConfg/v2ray/client/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "inbounds": [
- {
- "protocol": "http",
- "port": 1081
- },
- {
- "port": 1080,
- "protocol": "socks",
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "settings": {
- "auth": "noauth"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/06_outbounds.json b/TemplateConfg/v2ray/client/06_outbounds/06_outbounds.json
deleted file mode 100644
index 20e2bebd..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "outbounds": []
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/Http2Web_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/Http2Web_client_config.json
deleted file mode 100644
index 849b04cf..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/Http2Web_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/Http2selfSigned_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/Http2selfSigned_client_config.json
deleted file mode 100644
index 7d7153e2..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/Http2selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "httpSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLSWeb_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLSWeb_client_config.json
deleted file mode 100644
index a8eb804f..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLSWeb_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
deleted file mode 100644
index ae02d4e5..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/WebSocket_TLS_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/WebSocket_TLS_client_config.json
deleted file mode 100644
index 32ed43cb..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/WebSocket_TLS_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/http2_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/http2_client_config.json
deleted file mode 100644
index c244f112..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/http2_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/mkcp_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/mkcp_client_config.json
deleted file mode 100644
index 0e0aef26..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/mkcp_client_config.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/quic_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/quic_client_config.json
deleted file mode 100644
index a8639187..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/quic_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcpTLSselfSigned_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcpTLSselfSigned_client_config.json
deleted file mode 100644
index cb6baab5..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcpTLSselfSigned_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcp_TLS_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcp_TLS_client_config.json
deleted file mode 100644
index 7b5f21a2..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcp_TLS_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcp_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcp_client_config.json
deleted file mode 100644
index bb64de14..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcp_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcp_http_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcp_http_client_config.json
deleted file mode 100644
index 2f0ebf21..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcp_http_client_config.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "version": "1.1",
- "method": "GET",
- "path": [
- "/"
- ],
- "headers": {
- "Host": [
- "www.cloudflare.com",
- "www.amazon.com",
- "www.microsoft.com",
- "www.intel.com"
- ],
- "User-Agent": [
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
- ],
- "Accept-Encoding": [
- "gzip, deflate"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/trojan_tcp_tls.json b/TemplateConfg/v2ray/client/06_outbounds/trojan_tcp_tls.json
deleted file mode 100644
index 7eeeaa8b..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/trojan_tcp_tls.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "trojan",
- "settings": {
- "servers": [
- {
- "address": null,
- "port": 443,
- "password": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "serverName": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_http2_tls_server_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 9b3f6406..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_mkcp_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_mkcp_client_config.json
deleted file mode 100644
index ec37bdc4..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_mkcp_client_config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
deleted file mode 100644
index 48bad1f1..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_xtls_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_xtls_client_config.json
deleted file mode 100644
index 8b4a9aab..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_xtls_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "flow": "xtls-rprx-direct",
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_ws_tls_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_ws_tls_client_config.json
deleted file mode 100644
index a3782bef..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_ws_tls_client_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vmess_tcp_tls_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vmess_tcp_tls_client_config.json
deleted file mode 100644
index 126e25cc..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vmess_tcp_tls_client_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "path": [
- ""
- ]
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/webSocket_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/webSocket_client_config.json
deleted file mode 100644
index 5fa0b2a8..00000000
--- a/TemplateConfg/v2ray/client/06_outbounds/webSocket_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/07_transport/07_transport.json b/TemplateConfg/v2ray/client/07_transport/07_transport.json
deleted file mode 100644
index 62691039..00000000
--- a/TemplateConfg/v2ray/client/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/08_stats/08_stats.json b/TemplateConfg/v2ray/client/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0c..00000000
--- a/TemplateConfg/v2ray/client/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/09_reverse/09_reverse.json b/TemplateConfg/v2ray/client/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a45..00000000
--- a/TemplateConfg/v2ray/client/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/00_log/00_log.json b/TemplateConfg/v2ray/server/00_log/00_log.json
deleted file mode 100644
index 6a4cf006..00000000
--- a/TemplateConfg/v2ray/server/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/01_api/01_api.json b/TemplateConfg/v2ray/server/01_api/01_api.json
deleted file mode 100644
index aa1982bc..00000000
--- a/TemplateConfg/v2ray/server/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/02_dns/02_dns.json b/TemplateConfg/v2ray/server/02_dns/02_dns.json
deleted file mode 100644
index 63472d2f..00000000
--- a/TemplateConfg/v2ray/server/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/03_routing/03_routing.json b/TemplateConfg/v2ray/server/03_routing/03_routing.json
deleted file mode 100644
index 0aa49640..00000000
--- a/TemplateConfg/v2ray/server/03_routing/03_routing.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": [
- "geoip:private"
- ],
- "outboundTag": "block"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/04_policy/04_policy.json b/TemplateConfg/v2ray/server/04_policy/04_policy.json
deleted file mode 100644
index 4beed61d..00000000
--- a/TemplateConfg/v2ray/server/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/00_padavan_router.json b/TemplateConfg/v2ray/server/05_inbounds/00_padavan_router.json
deleted file mode 100644
index 2b9d236c..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/00_padavan_router.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/05_inbounds.json b/TemplateConfg/v2ray/server/05_inbounds/05_inbounds.json
deleted file mode 100644
index 9a8d6346..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "inbounds": []
-}
diff --git a/TemplateConfg/v2ray/server/05_inbounds/Http2Web_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/Http2Web_server_config.json
deleted file mode 100644
index 077c7995..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/Http2Web_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/Http2selfSigned_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/Http2selfSigned_server_config.json
deleted file mode 100644
index 5f49a0f2..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/Http2selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLSWeb_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLSWeb_server_config.json
deleted file mode 100644
index 7c5f1a58..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLSWeb_server_config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
deleted file mode 100644
index cd4afba6..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/WebSocket_TLS_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/WebSocket_TLS_server_config.json
deleted file mode 100644
index f1e69f55..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/WebSocket_TLS_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/http2_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/http2_server_config.json
deleted file mode 100644
index 818fb48a..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/http2_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/mkcp_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/mkcp_server_config.json
deleted file mode 100644
index bf8a13c9..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/quic_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/quic_server_config.json
deleted file mode 100644
index 9e289395..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/quic_server_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcpTLSselfSigned_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcpTLSselfSigned_server_config.json
deleted file mode 100644
index 61e7ac8b..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcpTLSselfSigned_server_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcp_TLS_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcp_TLS_server_config.json
deleted file mode 100644
index 9686194d..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcp_TLS_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcp_http_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcp_http_server_config.json
deleted file mode 100644
index 11b896f3..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcp_http_server_config.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "response": {
- "version": "1.1",
- "status": "200",
- "reason": "OK",
- "headers": {
- "Content-Type": [
- "application/octet-stream",
- "application/x-msdownload",
- "text/html",
- "application/x-shockwave-flash"
- ],
- "Transfer-Encoding": [
- "chunked"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcp_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcp_server_config.json
deleted file mode 100644
index 25f5e529..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcp_server_config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_http2_tls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 96bc51fc..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_mkcp_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_mkcp_server_config.json
deleted file mode 100644
index 4c7f4c28..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_tls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_tls_server_config.json
deleted file mode 100644
index 3dc02366..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_tls_server_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_xtls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_xtls_server_config.json
deleted file mode 100644
index 80ab7a86..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_xtls_server_config.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null,
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
deleted file mode 100644
index 4a5b0a6e..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
+++ /dev/null
@@ -1,144 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 1310,
- "xver": 1
- },
- {
- "path": "/websocket",
- "dest": 1234,
- "xver": 1
- },
- {
- "path": "/vmesstcp",
- "dest": 2345,
- "xver": 1
- },
- {
- "path": "/vmessws",
- "dest": 3456,
- "xver": 1
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- }
- }
- },
- {
- "port": 1310,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": null
- }
- ],
- "fallbacks": [
- {
- "dest": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- },
- {
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/websocket"
- }
- }
- },
- {
- "port": 2345,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true,
- "header": {
- "type": "http",
- "request": {
- "path": [
- "/vmesstcp"
- ]
- }
- }
- }
- }
- },
- {
- "port": 3456,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/vmessws"
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_ws_tls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_ws_tls_server_config.json
deleted file mode 100644
index fc398df7..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_ws_tls_server_config.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "path": ""
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/webSocket_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/webSocket_server_config.json
deleted file mode 100644
index 42ffda21..00000000
--- a/TemplateConfg/v2ray/server/05_inbounds/webSocket_server_config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/06_outbounds/06_outbounds.json b/TemplateConfg/v2ray/server/06_outbounds/06_outbounds.json
deleted file mode 100644
index 467a4e10..00000000
--- a/TemplateConfg/v2ray/server/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "freedom",
- "tag": "direct"
- },
- {
- "protocol": "blackhole",
- "tag": "block"
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/07_transport/07_transport.json b/TemplateConfg/v2ray/server/07_transport/07_transport.json
deleted file mode 100644
index 62691039..00000000
--- a/TemplateConfg/v2ray/server/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/08_stats/08_stats.json b/TemplateConfg/v2ray/server/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0c..00000000
--- a/TemplateConfg/v2ray/server/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/09_reverse/09_reverse.json b/TemplateConfg/v2ray/server/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a45..00000000
--- a/TemplateConfg/v2ray/server/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/base.json b/TemplateConfg/xray/base.json
deleted file mode 100644
index 84a9d1fc..00000000
--- a/TemplateConfg/xray/base.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "log": {},
- "api": {},
- "dns": {},
- "routing": {},
- "policy": {},
- "inbounds": [],
- "outbounds": [],
- "transport": {},
- "stats": {},
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/caddy/Http2Web.caddyfile b/TemplateConfg/xray/caddy/Http2Web.caddyfile
deleted file mode 100644
index 7e62dbcc..00000000
--- a/TemplateConfg/xray/caddy/Http2Web.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
-
- reverse_proxy ##path## http://localhost:10000 {
- transport http {
- versions h2c 2
- }
- }
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/caddy/WebSocketTLSWeb.caddyfile b/TemplateConfg/xray/caddy/WebSocketTLSWeb.caddyfile
deleted file mode 100644
index bddb8f61..00000000
--- a/TemplateConfg/xray/caddy/WebSocketTLSWeb.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
- @xray_websocket {
- path ##path##
- header Connection *Upgrade*
- header Upgrade websocket
- }
- reverse_proxy @xray_websocket localhost:10000
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/caddy/vlessTcpTlsWeb.caddyfile b/TemplateConfg/xray/caddy/vlessTcpTlsWeb.caddyfile
deleted file mode 100644
index 0e9f3d22..00000000
--- a/TemplateConfg/xray/caddy/vlessTcpTlsWeb.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/00_log/00_log.json b/TemplateConfg/xray/client/00_log/00_log.json
deleted file mode 100644
index 6a4cf006..00000000
--- a/TemplateConfg/xray/client/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/01_api/01_api.json b/TemplateConfg/xray/client/01_api/01_api.json
deleted file mode 100644
index aa1982bc..00000000
--- a/TemplateConfg/xray/client/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/02_dns/02_dns.json b/TemplateConfg/xray/client/02_dns/02_dns.json
deleted file mode 100644
index 63472d2f..00000000
--- a/TemplateConfg/xray/client/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/03_routing/03_routing.json b/TemplateConfg/xray/client/03_routing/03_routing.json
deleted file mode 100644
index a187d31e..00000000
--- a/TemplateConfg/xray/client/03_routing/03_routing.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "routing": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/04_policy/04_policy.json b/TemplateConfg/xray/client/04_policy/04_policy.json
deleted file mode 100644
index 4beed61d..00000000
--- a/TemplateConfg/xray/client/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/05_inbounds/05_inbounds.json b/TemplateConfg/xray/client/05_inbounds/05_inbounds.json
deleted file mode 100644
index dbce3dd8..00000000
--- a/TemplateConfg/xray/client/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "inbounds": [
- {
- "protocol": "http",
- "port": 1081
- },
- {
- "port": 1080,
- "protocol": "socks",
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "settings": {
- "auth": "noauth"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/06_outbounds.json b/TemplateConfg/xray/client/06_outbounds/06_outbounds.json
deleted file mode 100644
index 20e2bebd..00000000
--- a/TemplateConfg/xray/client/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "outbounds": []
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/Http2Web_client_config.json b/TemplateConfg/xray/client/06_outbounds/Http2Web_client_config.json
deleted file mode 100644
index 849b04cf..00000000
--- a/TemplateConfg/xray/client/06_outbounds/Http2Web_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/Http2selfSigned_client_config.json b/TemplateConfg/xray/client/06_outbounds/Http2selfSigned_client_config.json
deleted file mode 100644
index 7d7153e2..00000000
--- a/TemplateConfg/xray/client/06_outbounds/Http2selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "httpSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/WebSocketTLSWeb_client_config.json b/TemplateConfg/xray/client/06_outbounds/WebSocketTLSWeb_client_config.json
deleted file mode 100644
index a8eb804f..00000000
--- a/TemplateConfg/xray/client/06_outbounds/WebSocketTLSWeb_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json b/TemplateConfg/xray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
deleted file mode 100644
index ae02d4e5..00000000
--- a/TemplateConfg/xray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/WebSocket_TLS_client_config.json b/TemplateConfg/xray/client/06_outbounds/WebSocket_TLS_client_config.json
deleted file mode 100644
index 32ed43cb..00000000
--- a/TemplateConfg/xray/client/06_outbounds/WebSocket_TLS_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/http2_client_config.json b/TemplateConfg/xray/client/06_outbounds/http2_client_config.json
deleted file mode 100644
index c244f112..00000000
--- a/TemplateConfg/xray/client/06_outbounds/http2_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/mkcp_client_config.json b/TemplateConfg/xray/client/06_outbounds/mkcp_client_config.json
deleted file mode 100644
index 0e0aef26..00000000
--- a/TemplateConfg/xray/client/06_outbounds/mkcp_client_config.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/quic_client_config.json b/TemplateConfg/xray/client/06_outbounds/quic_client_config.json
deleted file mode 100644
index a8639187..00000000
--- a/TemplateConfg/xray/client/06_outbounds/quic_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcpTLSselfSigned_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcpTLSselfSigned_client_config.json
deleted file mode 100644
index cb6baab5..00000000
--- a/TemplateConfg/xray/client/06_outbounds/tcpTLSselfSigned_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcp_TLS_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcp_TLS_client_config.json
deleted file mode 100644
index 7b5f21a2..00000000
--- a/TemplateConfg/xray/client/06_outbounds/tcp_TLS_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcp_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcp_client_config.json
deleted file mode 100644
index bb64de14..00000000
--- a/TemplateConfg/xray/client/06_outbounds/tcp_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcp_http_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcp_http_client_config.json
deleted file mode 100644
index 2f0ebf21..00000000
--- a/TemplateConfg/xray/client/06_outbounds/tcp_http_client_config.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "version": "1.1",
- "method": "GET",
- "path": [
- "/"
- ],
- "headers": {
- "Host": [
- "www.cloudflare.com",
- "www.amazon.com",
- "www.microsoft.com",
- "www.intel.com"
- ],
- "User-Agent": [
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
- ],
- "Accept-Encoding": [
- "gzip, deflate"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/trojan_tcp_tls.json b/TemplateConfg/xray/client/06_outbounds/trojan_tcp_tls.json
deleted file mode 100644
index 7eeeaa8b..00000000
--- a/TemplateConfg/xray/client/06_outbounds/trojan_tcp_tls.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "trojan",
- "settings": {
- "servers": [
- {
- "address": null,
- "port": 443,
- "password": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "serverName": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_http2_tls_server_config.json b/TemplateConfg/xray/client/06_outbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 9b3f6406..00000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_mkcp_client_config.json b/TemplateConfg/xray/client/06_outbounds/vless_mkcp_client_config.json
deleted file mode 100644
index ec37bdc4..00000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_mkcp_client_config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json b/TemplateConfg/xray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
deleted file mode 100644
index 48bad1f1..00000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_tcp_xtls_client_config.json b/TemplateConfg/xray/client/06_outbounds/vless_tcp_xtls_client_config.json
deleted file mode 100644
index 8b4a9aab..00000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_tcp_xtls_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "flow": "xtls-rprx-direct",
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_ws_tls_client_config.json b/TemplateConfg/xray/client/06_outbounds/vless_ws_tls_client_config.json
deleted file mode 100644
index a3782bef..00000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_ws_tls_client_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vmess_tcp_tls_client_config.json b/TemplateConfg/xray/client/06_outbounds/vmess_tcp_tls_client_config.json
deleted file mode 100644
index 126e25cc..00000000
--- a/TemplateConfg/xray/client/06_outbounds/vmess_tcp_tls_client_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "path": [
- ""
- ]
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/webSocket_client_config.json b/TemplateConfg/xray/client/06_outbounds/webSocket_client_config.json
deleted file mode 100644
index 5fa0b2a8..00000000
--- a/TemplateConfg/xray/client/06_outbounds/webSocket_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/07_transport/07_transport.json b/TemplateConfg/xray/client/07_transport/07_transport.json
deleted file mode 100644
index 62691039..00000000
--- a/TemplateConfg/xray/client/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/08_stats/08_stats.json b/TemplateConfg/xray/client/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0c..00000000
--- a/TemplateConfg/xray/client/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/09_reverse/09_reverse.json b/TemplateConfg/xray/client/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a45..00000000
--- a/TemplateConfg/xray/client/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/00_log/00_log.json b/TemplateConfg/xray/server/00_log/00_log.json
deleted file mode 100644
index 6a4cf006..00000000
--- a/TemplateConfg/xray/server/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/01_api/01_api.json b/TemplateConfg/xray/server/01_api/01_api.json
deleted file mode 100644
index aa1982bc..00000000
--- a/TemplateConfg/xray/server/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/02_dns/02_dns.json b/TemplateConfg/xray/server/02_dns/02_dns.json
deleted file mode 100644
index 63472d2f..00000000
--- a/TemplateConfg/xray/server/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/03_routing/03_routing.json b/TemplateConfg/xray/server/03_routing/03_routing.json
deleted file mode 100644
index 0aa49640..00000000
--- a/TemplateConfg/xray/server/03_routing/03_routing.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": [
- "geoip:private"
- ],
- "outboundTag": "block"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/04_policy/04_policy.json b/TemplateConfg/xray/server/04_policy/04_policy.json
deleted file mode 100644
index 4beed61d..00000000
--- a/TemplateConfg/xray/server/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/00_padavan_router.json b/TemplateConfg/xray/server/05_inbounds/00_padavan_router.json
deleted file mode 100644
index 2b9d236c..00000000
--- a/TemplateConfg/xray/server/05_inbounds/00_padavan_router.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/05_inbounds.json b/TemplateConfg/xray/server/05_inbounds/05_inbounds.json
deleted file mode 100644
index 9a8d6346..00000000
--- a/TemplateConfg/xray/server/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "inbounds": []
-}
diff --git a/TemplateConfg/xray/server/05_inbounds/Http2Web_server_config.json b/TemplateConfg/xray/server/05_inbounds/Http2Web_server_config.json
deleted file mode 100644
index 077c7995..00000000
--- a/TemplateConfg/xray/server/05_inbounds/Http2Web_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/Http2selfSigned_server_config.json b/TemplateConfg/xray/server/05_inbounds/Http2selfSigned_server_config.json
deleted file mode 100644
index 5f49a0f2..00000000
--- a/TemplateConfg/xray/server/05_inbounds/Http2selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/WebSocketTLSWeb_server_config.json b/TemplateConfg/xray/server/05_inbounds/WebSocketTLSWeb_server_config.json
deleted file mode 100644
index 7c5f1a58..00000000
--- a/TemplateConfg/xray/server/05_inbounds/WebSocketTLSWeb_server_config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json b/TemplateConfg/xray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
deleted file mode 100644
index cd4afba6..00000000
--- a/TemplateConfg/xray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/WebSocket_TLS_server_config.json b/TemplateConfg/xray/server/05_inbounds/WebSocket_TLS_server_config.json
deleted file mode 100644
index 72b3a556..00000000
--- a/TemplateConfg/xray/server/05_inbounds/WebSocket_TLS_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/http2_server_config.json b/TemplateConfg/xray/server/05_inbounds/http2_server_config.json
deleted file mode 100644
index 79dec034..00000000
--- a/TemplateConfg/xray/server/05_inbounds/http2_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/mkcp_server_config.json b/TemplateConfg/xray/server/05_inbounds/mkcp_server_config.json
deleted file mode 100644
index bf8a13c9..00000000
--- a/TemplateConfg/xray/server/05_inbounds/mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/quic_server_config.json b/TemplateConfg/xray/server/05_inbounds/quic_server_config.json
deleted file mode 100644
index 9e289395..00000000
--- a/TemplateConfg/xray/server/05_inbounds/quic_server_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcpTLSselfSigned_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcpTLSselfSigned_server_config.json
deleted file mode 100644
index 61e7ac8b..00000000
--- a/TemplateConfg/xray/server/05_inbounds/tcpTLSselfSigned_server_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcp_TLS_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcp_TLS_server_config.json
deleted file mode 100644
index d92148a4..00000000
--- a/TemplateConfg/xray/server/05_inbounds/tcp_TLS_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcp_http_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcp_http_server_config.json
deleted file mode 100644
index 11b896f3..00000000
--- a/TemplateConfg/xray/server/05_inbounds/tcp_http_server_config.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "response": {
- "version": "1.1",
- "status": "200",
- "reason": "OK",
- "headers": {
- "Content-Type": [
- "application/octet-stream",
- "application/x-msdownload",
- "text/html",
- "application/x-shockwave-flash"
- ],
- "Transfer-Encoding": [
- "chunked"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcp_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcp_server_config.json
deleted file mode 100644
index 25f5e529..00000000
--- a/TemplateConfg/xray/server/05_inbounds/tcp_server_config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_http2_tls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 96bc51fc..00000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_mkcp_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_mkcp_server_config.json
deleted file mode 100644
index 4c7f4c28..00000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_tcp_tls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_tcp_tls_server_config.json
deleted file mode 100644
index dc4e0e68..00000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_tcp_tls_server_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_tcp_xtls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_tcp_xtls_server_config.json
deleted file mode 100644
index 040a74d9..00000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_tcp_xtls_server_config.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null,
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
deleted file mode 100644
index dcf7a4df..00000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null,
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 1310,
- "xver": 1
- },
- {
- "path": "/websocket",
- "dest": 1234,
- "xver": 1
- },
- {
- "path": "/vmesstcp",
- "dest": 2345,
- "xver": 1
- },
- {
- "path": "/vmessws",
- "dest": 3456,
- "xver": 1
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
- },
- {
- "port": 1310,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": null
- }
- ],
- "fallbacks": [
- {
- "dest": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- },
- {
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/websocket"
- }
- }
- },
- {
- "port": 2345,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true,
- "header": {
- "type": "http",
- "request": {
- "path": [
- "/vmesstcp"
- ]
- }
- }
- }
- }
- },
- {
- "port": 3456,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/vmessws"
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_ws_tls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_ws_tls_server_config.json
deleted file mode 100644
index fc398df7..00000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_ws_tls_server_config.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "path": ""
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/webSocket_server_config.json b/TemplateConfg/xray/server/05_inbounds/webSocket_server_config.json
deleted file mode 100644
index 42ffda21..00000000
--- a/TemplateConfg/xray/server/05_inbounds/webSocket_server_config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/06_outbounds/06_outbounds.json b/TemplateConfg/xray/server/06_outbounds/06_outbounds.json
deleted file mode 100644
index 467a4e10..00000000
--- a/TemplateConfg/xray/server/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "freedom",
- "tag": "direct"
- },
- {
- "protocol": "blackhole",
- "tag": "block"
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/07_transport/07_transport.json b/TemplateConfg/xray/server/07_transport/07_transport.json
deleted file mode 100644
index 62691039..00000000
--- a/TemplateConfg/xray/server/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/08_stats/08_stats.json b/TemplateConfg/xray/server/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0c..00000000
--- a/TemplateConfg/xray/server/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/09_reverse/09_reverse.json b/TemplateConfg/xray/server/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a45..00000000
--- a/TemplateConfg/xray/server/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/black_color_full.png b/black_color_full.png
new file mode 100644
index 00000000..7e5cebf8
Binary files /dev/null and b/black_color_full.png differ
diff --git a/json.net/net40/Newtonsoft.Json.dll b/json.net/net40/Newtonsoft.Json.dll
deleted file mode 100644
index c2b16bbe..00000000
Binary files a/json.net/net40/Newtonsoft.Json.dll and /dev/null differ
diff --git a/json.net/net40/Newtonsoft.Json.xml b/json.net/net40/Newtonsoft.Json.xml
deleted file mode 100644
index 0cbf62cd..00000000
--- a/json.net/net40/Newtonsoft.Json.xml
+++ /dev/null
@@ -1,9646 +0,0 @@
-
-
-
- Newtonsoft.Json
-
-
-
-
- Represents a BSON Oid (object id).
-
-
-
-
- Gets or sets the value of the Oid.
-
- The value of the Oid.
-
-
-
- Initializes a new instance of the class.
-
- The Oid value.
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to serialized BSON data.
-
-
-
-
- Gets or sets a value indicating whether binary data reading should be compatible with incorrect Json.NET 3.5 written binary.
-
-
- true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the root object will be read as a JSON array.
-
-
- true if the root object will be read as a JSON array; otherwise, false .
-
-
-
-
- Gets or sets the used when reading values from BSON.
-
- The used when reading values from BSON.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
- if set to true the root object will be read as a JSON array.
- The used when reading values from BSON.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
- if set to true the root object will be read as a JSON array.
- The used when reading values from BSON.
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Changes the reader's state to .
- If is set to true , the underlying is also closed.
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating BSON data.
-
-
-
-
- Gets or sets the used when writing values to BSON.
- When set to no conversion will occur.
-
- The used when writing values to BSON.
-
-
-
- Initializes a new instance of the class.
-
- The to write to.
-
-
-
- Initializes a new instance of the class.
-
- The to write to.
-
-
-
- Flushes whatever is in the buffer to the underlying and also flushes the underlying stream.
-
-
-
-
- Writes the end.
-
- The token.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes raw JSON.
-
- The raw JSON to write.
-
-
-
- Writes raw JSON where a value is expected and updates the writer's state.
-
- The raw JSON to write.
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
-
-
-
- Closes this writer.
- If is set to true , the underlying is also closed.
- If is set to true , the JSON is auto-completed.
-
-
-
-
- Writes a value.
- An error will raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value that represents a BSON object id.
-
- The Object ID value to write.
-
-
-
- Writes a BSON regex.
-
- The regex pattern.
- The regex options.
-
-
-
- Specifies how constructors are used when initializing objects during deserialization by the .
-
-
-
-
- First attempt to use the public default constructor, then fall back to a single parameterized constructor, then to the non-public default constructor.
-
-
-
-
- Json.NET will use a non-public default constructor before falling back to a parameterized constructor.
-
-
-
-
- Converts a binary value to and from a base 64 string value.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a to and from JSON and BSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Creates a custom object.
-
- The object type to convert.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Creates an object which will then be populated by the serializer.
-
- Type of the object.
- The created object.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Gets a value indicating whether this can write JSON.
-
-
- true if this can write JSON; otherwise, false .
-
-
-
-
- Converts a to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified value type.
-
- Type of the value.
-
- true if this instance can convert the specified value type; otherwise, false .
-
-
-
-
- Converts a to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified value type.
-
- Type of the value.
-
- true if this instance can convert the specified value type; otherwise, false .
-
-
-
-
- Provides a base class for converting a to and from JSON.
-
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a F# discriminated union type to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts an Entity Framework to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts an to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Gets a value indicating whether this can write JSON.
-
-
- true if this can write JSON; otherwise, false .
-
-
-
-
- Converts a to and from the ISO 8601 date format (e.g. "2008-04-12T12:53Z" ).
-
-
-
-
- Gets or sets the date time styles used when converting a date to and from JSON.
-
- The date time styles used when converting a date to and from JSON.
-
-
-
- Gets or sets the date time format used when converting a date to and from JSON.
-
- The date time format used when converting a date to and from JSON.
-
-
-
- Gets or sets the culture used when converting a date to and from JSON.
-
- The culture used when converting a date to and from JSON.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Converts a to and from a JavaScript Date constructor (e.g. new Date(52231943) ).
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing property value of the JSON that is being converted.
- The calling serializer.
- The object value.
-
-
-
- Converts a to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a to and from JSON and BSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts an to and from its name string value.
-
-
-
-
- Gets or sets a value indicating whether the written enum text should be camel case.
- The default value is false .
-
- true if the written enum text will be camel case; otherwise, false .
-
-
-
- Gets or sets the naming strategy used to resolve how enum text is written.
-
- The naming strategy used to resolve how enum text is written.
-
-
-
- Gets or sets a value indicating whether integer values are allowed when serializing and deserializing.
- The default value is true .
-
- true if integers are allowed when serializing and deserializing; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- true if the written enum text will be camel case; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The naming strategy used to resolve how enum text is written.
- true if integers are allowed when serializing and deserializing; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The of the used to write enum text.
-
-
-
- Initializes a new instance of the class.
-
- The of the used to write enum text.
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
-
- Initializes a new instance of the class.
-
- The of the used to write enum text.
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
- true if integers are allowed when serializing and deserializing; otherwise, false .
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a to and from Unix epoch time
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing property value of the JSON that is being converted.
- The calling serializer.
- The object value.
-
-
-
- Converts a to and from a string (e.g. "1.2.3.4" ).
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing property value of the JSON that is being converted.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts XML to and from JSON.
-
-
-
-
- Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produced multiple root elements.
-
- The name of the deserialized root element.
-
-
-
- Gets or sets a value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
- true if the array attribute is written to the XML; otherwise, false .
-
-
-
- Gets or sets a value indicating whether to write the root JSON object.
-
- true if the JSON root object is omitted; otherwise, false .
-
-
-
- Gets or sets a value indicating whether to encode special characters when converting JSON to XML.
- If true , special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify
- XML namespaces, attributes or processing directives. Instead special characters are encoded and written
- as part of the XML element name.
-
- true if special characters are encoded; otherwise, false .
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The calling serializer.
- The value.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Checks if the is a namespace attribute.
-
- Attribute name to test.
- The attribute name prefix if it has one, otherwise an empty string.
- true if attribute name is for a namespace attribute, otherwise false .
-
-
-
- Determines whether this instance can convert the specified value type.
-
- Type of the value.
-
- true if this instance can convert the specified value type; otherwise, false .
-
-
-
-
- Specifies how dates are formatted when writing JSON text.
-
-
-
-
- Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z" .
-
-
-
-
- Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/" .
-
-
-
-
- Specifies how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed when reading JSON text.
-
-
-
-
- Date formatted strings are not parsed to a date type and are read as strings.
-
-
-
-
- Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed to .
-
-
-
-
- Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed to .
-
-
-
-
- Specifies how to treat the time value when converting between string and .
-
-
-
-
- Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time.
-
-
-
-
- Treat as a UTC. If the object represents a local time, it is converted to a UTC.
-
-
-
-
- Treat as a local time if a is being converted to a string.
- If a string is being converted to , convert to a local time if a time zone is specified.
-
-
-
-
- Time zone information should be preserved when converting.
-
-
-
-
- The default JSON name table implementation.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets a string containing the same characters as the specified range of characters in the given array.
-
- The character array containing the name to find.
- The zero-based index into the array specifying the first character of the name.
- The number of characters in the name.
- A string containing the same characters as the specified range of characters in the given array.
-
-
-
- Adds the specified string into name table.
-
- The string to add.
- This method is not thread-safe.
- The resolved string.
-
-
-
- Specifies default value handling options for the .
-
-
-
-
-
-
-
-
- Include members where the member value is the same as the member's default value when serializing objects.
- Included members are written to JSON. Has no effect when deserializing.
-
-
-
-
- Ignore members where the member value is the same as the member's default value when serializing objects
- so that it is not written to JSON.
- This option will ignore all default values (e.g. null for objects and nullable types; 0 for integers,
- decimals and floating point numbers; and false for booleans). The default value ignored can be changed by
- placing the on the property.
-
-
-
-
- Members with a default value but no JSON will be set to their default value when deserializing.
-
-
-
-
- Ignore members where the member value is the same as the member's default value when serializing objects
- and set members to their default value when deserializing.
-
-
-
-
- Specifies float format handling options when writing special floating point numbers, e.g. ,
- and with .
-
-
-
-
- Write special floating point values as strings in JSON, e.g. "NaN" , "Infinity" , "-Infinity" .
-
-
-
-
- Write special floating point values as symbols in JSON, e.g. NaN , Infinity , -Infinity .
- Note that this will produce non-valid JSON.
-
-
-
-
- Write special floating point values as the property's default value in JSON, e.g. 0.0 for a property, null for a of property.
-
-
-
-
- Specifies how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
-
-
-
-
- Floating point numbers are parsed to .
-
-
-
-
- Floating point numbers are parsed to .
-
-
-
-
- Specifies formatting options for the .
-
-
-
-
- No special formatting is applied. This is the default.
-
-
-
-
- Causes child objects to be indented according to the and settings.
-
-
-
-
- Provides an interface for using pooled arrays.
-
- The array type content.
-
-
-
- Rent an array from the pool. This array must be returned when it is no longer needed.
-
- The minimum required length of the array. The returned array may be longer.
- The rented array from the pool. This array must be returned when it is no longer needed.
-
-
-
- Return an array to the pool.
-
- The array that is being returned.
-
-
-
- Provides an interface to enable a class to return line and position information.
-
-
-
-
- Gets a value indicating whether the class can return line information.
-
-
- true if and can be provided; otherwise, false .
-
-
-
-
- Gets the current line number.
-
- The current line number or 0 if no line information is available (for example, when returns false ).
-
-
-
- Gets the current line position.
-
- The current line position or 0 if no line information is available (for example, when returns false ).
-
-
-
- Instructs the how to serialize the collection.
-
-
-
-
- Gets or sets a value indicating whether null items are allowed in the collection.
-
- true if null items are allowed in the collection; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with a flag indicating whether the array can contain null items.
-
- A flag indicating whether the array can contain null items.
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- Instructs the to use the specified constructor when deserializing that object.
-
-
-
-
- Instructs the how to serialize the object.
-
-
-
-
- Gets or sets the id.
-
- The id.
-
-
-
- Gets or sets the title.
-
- The title.
-
-
-
- Gets or sets the description.
-
- The description.
-
-
-
- Gets or sets the collection's items converter.
-
- The collection's items converter.
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonContainer(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets the of the .
-
- The of the .
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonContainer(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets a value that indicates whether to preserve object references.
-
-
- true to keep object reference; otherwise, false . The default is false .
-
-
-
-
- Gets or sets a value that indicates whether to preserve collection's items references.
-
-
- true to keep collection's items object references; otherwise, false . The default is false .
-
-
-
-
- Gets or sets the reference loop handling used when serializing the collection's items.
-
- The reference loop handling.
-
-
-
- Gets or sets the type name handling used when serializing the collection's items.
-
- The type name handling.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- Provides methods for converting between .NET types and JSON types.
-
-
-
-
-
-
-
- Gets or sets a function that creates default .
- Default settings are automatically used by serialization methods on ,
- and and on .
- To serialize without using any default settings create a with
- .
-
-
-
-
- Represents JavaScript's boolean value true as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's boolean value false as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's null as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's undefined as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's positive infinity as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's negative infinity as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's NaN as a string. This field is read-only.
-
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation using the specified.
-
- The value to convert.
- The format the date will be converted to.
- The time zone handling when the date is converted to a string.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation using the specified.
-
- The value to convert.
- The format the date will be converted to.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- The string delimiter character.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- The string delimiter character.
- The string escape handling.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Serializes the specified object to a JSON string.
-
- The object to serialize.
- A JSON string representation of the object.
-
-
-
- Serializes the specified object to a JSON string using formatting.
-
- The object to serialize.
- Indicates how the output should be formatted.
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using a collection of .
-
- The object to serialize.
- A collection of converters used while serializing.
- A JSON string representation of the object.
-
-
-
- Serializes the specified object to a JSON string using formatting and a collection of .
-
- The object to serialize.
- Indicates how the output should be formatted.
- A collection of converters used while serializing.
- A JSON string representation of the object.
-
-
-
- Serializes the specified object to a JSON string using .
-
- The object to serialize.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using a type, formatting and .
-
- The object to serialize.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- The type of the value being serialized.
- This parameter is used when is to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using formatting and .
-
- The object to serialize.
- Indicates how the output should be formatted.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using a type, formatting and .
-
- The object to serialize.
- Indicates how the output should be formatted.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- The type of the value being serialized.
- This parameter is used when is to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
- A JSON string representation of the object.
-
-
-
-
- Deserializes the JSON to a .NET object.
-
- The JSON to deserialize.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to a .NET object using .
-
- The JSON to deserialize.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type.
-
- The JSON to deserialize.
- The of object being deserialized.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type.
-
- The type of the object to deserialize to.
- The JSON to deserialize.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the given anonymous type.
-
-
- The anonymous type to deserialize to. This can't be specified
- traditionally and must be inferred from the anonymous type passed
- as a parameter.
-
- The JSON to deserialize.
- The anonymous type object.
- The deserialized anonymous type from the JSON string.
-
-
-
- Deserializes the JSON to the given anonymous type using .
-
-
- The anonymous type to deserialize to. This can't be specified
- traditionally and must be inferred from the anonymous type passed
- as a parameter.
-
- The JSON to deserialize.
- The anonymous type object.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized anonymous type from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using a collection of .
-
- The type of the object to deserialize to.
- The JSON to deserialize.
- Converters to use while deserializing.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using .
-
- The type of the object to deserialize to.
- The object to deserialize.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using a collection of .
-
- The JSON to deserialize.
- The type of the object to deserialize.
- Converters to use while deserializing.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using .
-
- The JSON to deserialize.
- The type of the object to deserialize to.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized object from the JSON string.
-
-
-
- Populates the object with values from the JSON string.
-
- The JSON to populate values from.
- The target object to populate values onto.
-
-
-
- Populates the object with values from the JSON string using .
-
- The JSON to populate values from.
- The target object to populate values onto.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
-
-
-
- Serializes the to a JSON string.
-
- The node to serialize.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting.
-
- The node to serialize.
- Indicates how the output should be formatted.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting and omits the root object if is true .
-
- The node to serialize.
- Indicates how the output should be formatted.
- Omits writing the root object.
- A JSON string of the .
-
-
-
- Deserializes the from a JSON string.
-
- The JSON string.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by .
-
- The JSON string.
- The name of the root element to append when deserializing.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by
- and writes a Json.NET array attribute for collections.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by ,
- writes a Json.NET array attribute for collections, and encodes special characters.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
-
- A value to indicate whether to encode special characters when converting JSON to XML.
- If true , special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify
- XML namespaces, attributes or processing directives. Instead special characters are encoded and written
- as part of the XML element name.
-
- The deserialized .
-
-
-
- Serializes the to a JSON string.
-
- The node to convert to JSON.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting.
-
- The node to convert to JSON.
- Indicates how the output should be formatted.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting and omits the root object if is true .
-
- The node to serialize.
- Indicates how the output should be formatted.
- Omits writing the root object.
- A JSON string of the .
-
-
-
- Deserializes the from a JSON string.
-
- The JSON string.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by .
-
- The JSON string.
- The name of the root element to append when deserializing.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by
- and writes a Json.NET array attribute for collections.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by ,
- writes a Json.NET array attribute for collections, and encodes special characters.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
-
- A value to indicate whether to encode special characters when converting JSON to XML.
- If true , special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify
- XML namespaces, attributes or processing directives. Instead special characters are encoded and written
- as part of the XML element name.
-
- The deserialized .
-
-
-
- Converts an object to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Gets a value indicating whether this can read JSON.
-
- true if this can read JSON; otherwise, false .
-
-
-
- Gets a value indicating whether this can write JSON.
-
- true if this can write JSON; otherwise, false .
-
-
-
- Converts an object to and from JSON.
-
- The object type to convert.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read. If there is no existing value then null will be used.
- The existing value has a value.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Instructs the to use the specified when serializing the member or class.
-
-
-
-
- Gets the of the .
-
- The of the .
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
-
-
-
-
- Initializes a new instance of the class.
-
- Type of the .
-
-
-
- Initializes a new instance of the class.
-
- Type of the .
- Parameter list to use when constructing the . Can be null .
-
-
-
- Represents a collection of .
-
-
-
-
- Instructs the how to serialize the collection.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- The exception thrown when an error occurs during JSON serialization or deserialization.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Instructs the to deserialize properties with no matching class member into the specified collection
- and write values during serialization.
-
-
-
-
- Gets or sets a value that indicates whether to write extension data when serializing the object.
-
-
- true to write extension data when serializing the object; otherwise, false . The default is true .
-
-
-
-
- Gets or sets a value that indicates whether to read extension data when deserializing the object.
-
-
- true to read extension data when deserializing the object; otherwise, false . The default is true .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Instructs the not to serialize the public field or public read/write property value.
-
-
-
-
- Base class for a table of atomized string objects.
-
-
-
-
- Gets a string containing the same characters as the specified range of characters in the given array.
-
- The character array containing the name to find.
- The zero-based index into the array specifying the first character of the name.
- The number of characters in the name.
- A string containing the same characters as the specified range of characters in the given array.
-
-
-
- Instructs the how to serialize the object.
-
-
-
-
- Gets or sets the member serialization.
-
- The member serialization.
-
-
-
- Gets or sets the missing member handling used when deserializing this object.
-
- The missing member handling.
-
-
-
- Gets or sets how the object's properties with null values are handled during serialization and deserialization.
-
- How the object's properties with null values are handled during serialization and deserialization.
-
-
-
- Gets or sets a value that indicates whether the object's properties are required.
-
-
- A value indicating whether the object's properties are required.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified member serialization.
-
- The member serialization.
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- Instructs the to always serialize the member with the specified name.
-
-
-
-
- Gets or sets the type used when serializing the property's collection items.
-
- The collection's items type.
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonProperty(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets the of the .
-
- The of the .
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonProperty(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets the null value handling used when serializing this property.
-
- The null value handling.
-
-
-
- Gets or sets the default value handling used when serializing this property.
-
- The default value handling.
-
-
-
- Gets or sets the reference loop handling used when serializing this property.
-
- The reference loop handling.
-
-
-
- Gets or sets the object creation handling used when deserializing this property.
-
- The object creation handling.
-
-
-
- Gets or sets the type name handling used when serializing this property.
-
- The type name handling.
-
-
-
- Gets or sets whether this property's value is serialized as a reference.
-
- Whether this property's value is serialized as a reference.
-
-
-
- Gets or sets the order of serialization of a member.
-
- The numeric order of serialization.
-
-
-
- Gets or sets a value indicating whether this property is required.
-
-
- A value indicating whether this property is required.
-
-
-
-
- Gets or sets the name of the property.
-
- The name of the property.
-
-
-
- Gets or sets the reference loop handling used when serializing the property's collection items.
-
- The collection's items reference loop handling.
-
-
-
- Gets or sets the type name handling used when serializing the property's collection items.
-
- The collection's items type name handling.
-
-
-
- Gets or sets whether this property's collection items are serialized as a reference.
-
- Whether this property's collection items are serialized as a reference.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified name.
-
- Name of the property.
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.
-
-
-
-
- Specifies the state of the reader.
-
-
-
-
- A read method has not been called.
-
-
-
-
- The end of the file has been reached successfully.
-
-
-
-
- Reader is at a property.
-
-
-
-
- Reader is at the start of an object.
-
-
-
-
- Reader is in an object.
-
-
-
-
- Reader is at the start of an array.
-
-
-
-
- Reader is in an array.
-
-
-
-
- The method has been called.
-
-
-
-
- Reader has just read a value.
-
-
-
-
- Reader is at the start of a constructor.
-
-
-
-
- Reader is in a constructor.
-
-
-
-
- An error occurred that prevents the read operation from continuing.
-
-
-
-
- The end of the file has been reached successfully.
-
-
-
-
- Gets the current reader state.
-
- The current reader state.
-
-
-
- Gets or sets a value indicating whether the source should be closed when this reader is closed.
-
-
- true to close the source when this reader is closed; otherwise false . The default is true .
-
-
-
-
- Gets or sets a value indicating whether multiple pieces of JSON content can
- be read from a continuous stream without erroring.
-
-
- true to support reading multiple pieces of JSON content; otherwise false .
- The default is false .
-
-
-
-
- Gets the quotation mark character used to enclose the value of a string.
-
-
-
-
- Gets or sets how time zones are handled when reading JSON.
-
-
-
-
- Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON.
-
-
-
-
- Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
-
-
-
-
- Gets or sets how custom date formatted strings are parsed when reading JSON.
-
-
-
-
- Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a .
-
-
-
-
- Gets the type of the current JSON token.
-
-
-
-
- Gets the text value of the current JSON token.
-
-
-
-
- Gets the .NET type for the current JSON token.
-
-
-
-
- Gets the depth of the current token in the JSON document.
-
- The depth of the current token in the JSON document.
-
-
-
- Gets the path of the current JSON token.
-
-
-
-
- Gets or sets the culture used when reading JSON. Defaults to .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Reads the next JSON token from the source.
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a .
-
- A . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a [].
-
- A [] or null if the next JSON token is null. This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Skips the children of the current token.
-
-
-
-
- Sets the current token.
-
- The new token.
-
-
-
- Sets the current token and value.
-
- The new token.
- The value.
-
-
-
- Sets the current token and value.
-
- The new token.
- The value.
- A flag indicating whether the position index inside an array should be updated.
-
-
-
- Sets the state based on current token type.
-
-
-
-
- Releases unmanaged and - optionally - managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Changes the reader's state to .
- If is set to true , the source is also closed.
-
-
-
-
- The exception thrown when an error occurs while reading JSON text.
-
-
-
-
- Gets the line number indicating where the error occurred.
-
- The line number indicating where the error occurred.
-
-
-
- Gets the line position indicating where the error occurred.
-
- The line position indicating where the error occurred.
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Initializes a new instance of the class
- with a specified error message, JSON path, line number, line position, and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The path to the JSON where the error occurred.
- The line number indicating where the error occurred.
- The line position indicating where the error occurred.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Instructs the to always serialize the member, and to require that the member has a value.
-
-
-
-
- The exception thrown when an error occurs during JSON serialization or deserialization.
-
-
-
-
- Gets the line number indicating where the error occurred.
-
- The line number indicating where the error occurred.
-
-
-
- Gets the line position indicating where the error occurred.
-
- The line position indicating where the error occurred.
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Initializes a new instance of the class
- with a specified error message, JSON path, line number, line position, and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The path to the JSON where the error occurred.
- The line number indicating where the error occurred.
- The line position indicating where the error occurred.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Serializes and deserializes objects into and from the JSON format.
- The enables you to control how objects are encoded into JSON.
-
-
-
-
- Occurs when the errors during serialization and deserialization.
-
-
-
-
- Gets or sets the used by the serializer when resolving references.
-
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
-
-
-
- Gets or sets the used by the serializer when writing trace messages.
-
- The trace writer.
-
-
-
- Gets or sets the equality comparer used by the serializer when comparing references.
-
- The equality comparer.
-
-
-
- Gets or sets how type name writing and reading is handled by the serializer.
- The default value is .
-
-
- should be used with caution when your application deserializes JSON from an external source.
- Incoming types should be validated with a custom
- when deserializing with a value other than .
-
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how object references are preserved by the serializer.
- The default value is .
-
-
-
-
- Gets or sets how reference loops (e.g. a class referencing itself) is handled.
- The default value is .
-
-
-
-
- Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization.
- The default value is .
-
-
-
-
- Gets or sets how null values are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how default values are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how objects are created during deserialization.
- The default value is .
-
- The object creation handling.
-
-
-
- Gets or sets how constructors are used during deserialization.
- The default value is .
-
- The constructor handling.
-
-
-
- Gets or sets how metadata properties are used during deserialization.
- The default value is .
-
- The metadata properties handling.
-
-
-
- Gets a collection that will be used during serialization.
-
- Collection that will be used during serialization.
-
-
-
- Gets or sets the contract resolver used by the serializer when
- serializing .NET objects to JSON and vice versa.
-
-
-
-
- Gets or sets the used by the serializer when invoking serialization callback methods.
-
- The context.
-
-
-
- Indicates how JSON text output is formatted.
- The default value is .
-
-
-
-
- Gets or sets how dates are written to JSON text.
- The default value is .
-
-
-
-
- Gets or sets how time zones are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed when reading JSON.
- The default value is .
-
-
-
-
- Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
- The default value is .
-
-
-
-
- Gets or sets how special floating point numbers, e.g. ,
- and ,
- are written as JSON text.
- The default value is .
-
-
-
-
- Gets or sets how strings are escaped when writing JSON text.
- The default value is .
-
-
-
-
- Gets or sets how and values are formatted when writing JSON text,
- and the expected date format when reading JSON text.
- The default value is "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK" .
-
-
-
-
- Gets or sets the culture used when reading JSON.
- The default value is .
-
-
-
-
- Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a .
- A null value means there is no maximum.
- The default value is null .
-
-
-
-
- Gets a value indicating whether there will be a check for additional JSON content after deserializing an object.
- The default value is false .
-
-
- true if there will be a check for additional JSON content after deserializing an object; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates a new instance.
- The will not use default settings
- from .
-
-
- A new instance.
- The will not use default settings
- from .
-
-
-
-
- Creates a new instance using the specified .
- The will not use default settings
- from .
-
- The settings to be applied to the .
-
- A new instance using the specified .
- The will not use default settings
- from .
-
-
-
-
- Creates a new instance.
- The will use default settings
- from .
-
-
- A new instance.
- The will use default settings
- from .
-
-
-
-
- Creates a new instance using the specified .
- The will use default settings
- from as well as the specified .
-
- The settings to be applied to the .
-
- A new instance using the specified .
- The will use default settings
- from as well as the specified .
-
-
-
-
- Populates the JSON values onto the target object.
-
- The that contains the JSON structure to read values from.
- The target object to populate values onto.
-
-
-
- Populates the JSON values onto the target object.
-
- The that contains the JSON structure to read values from.
- The target object to populate values onto.
-
-
-
- Deserializes the JSON structure contained by the specified .
-
- The that contains the JSON structure to deserialize.
- The being deserialized.
-
-
-
- Deserializes the JSON structure contained by the specified
- into an instance of the specified type.
-
- The containing the object.
- The of object being deserialized.
- The instance of being deserialized.
-
-
-
- Deserializes the JSON structure contained by the specified
- into an instance of the specified type.
-
- The containing the object.
- The type of the object to deserialize.
- The instance of being deserialized.
-
-
-
- Deserializes the JSON structure contained by the specified
- into an instance of the specified type.
-
- The containing the object.
- The of object being deserialized.
- The instance of being deserialized.
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
- The type of the value being serialized.
- This parameter is used when is to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
- The type of the value being serialized.
- This parameter is used when is Auto to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
-
-
- Specifies the settings on a object.
-
-
-
-
- Gets or sets how reference loops (e.g. a class referencing itself) are handled.
- The default value is .
-
- Reference loop handling.
-
-
-
- Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization.
- The default value is .
-
- Missing member handling.
-
-
-
- Gets or sets how objects are created during deserialization.
- The default value is .
-
- The object creation handling.
-
-
-
- Gets or sets how null values are handled during serialization and deserialization.
- The default value is .
-
- Null value handling.
-
-
-
- Gets or sets how default values are handled during serialization and deserialization.
- The default value is .
-
- The default value handling.
-
-
-
- Gets or sets a collection that will be used during serialization.
-
- The converters.
-
-
-
- Gets or sets how object references are preserved by the serializer.
- The default value is .
-
- The preserve references handling.
-
-
-
- Gets or sets how type name writing and reading is handled by the serializer.
- The default value is .
-
-
- should be used with caution when your application deserializes JSON from an external source.
- Incoming types should be validated with a custom
- when deserializing with a value other than .
-
- The type name handling.
-
-
-
- Gets or sets how metadata properties are used during deserialization.
- The default value is .
-
- The metadata properties handling.
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how constructors are used during deserialization.
- The default value is .
-
- The constructor handling.
-
-
-
- Gets or sets the contract resolver used by the serializer when
- serializing .NET objects to JSON and vice versa.
-
- The contract resolver.
-
-
-
- Gets or sets the equality comparer used by the serializer when comparing references.
-
- The equality comparer.
-
-
-
- Gets or sets the used by the serializer when resolving references.
-
- The reference resolver.
-
-
-
- Gets or sets a function that creates the used by the serializer when resolving references.
-
- A function that creates the used by the serializer when resolving references.
-
-
-
- Gets or sets the used by the serializer when writing trace messages.
-
- The trace writer.
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
- The binder.
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
- The binder.
-
-
-
- Gets or sets the error handler called during serialization and deserialization.
-
- The error handler called during serialization and deserialization.
-
-
-
- Gets or sets the used by the serializer when invoking serialization callback methods.
-
- The context.
-
-
-
- Gets or sets how and values are formatted when writing JSON text,
- and the expected date format when reading JSON text.
- The default value is "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK" .
-
-
-
-
- Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a .
- A null value means there is no maximum.
- The default value is null .
-
-
-
-
- Indicates how JSON text output is formatted.
- The default value is .
-
-
-
-
- Gets or sets how dates are written to JSON text.
- The default value is .
-
-
-
-
- Gets or sets how time zones are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed when reading JSON.
- The default value is .
-
-
-
-
- Gets or sets how special floating point numbers, e.g. ,
- and ,
- are written as JSON.
- The default value is .
-
-
-
-
- Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
- The default value is .
-
-
-
-
- Gets or sets how strings are escaped when writing JSON text.
- The default value is .
-
-
-
-
- Gets or sets the culture used when reading JSON.
- The default value is .
-
-
-
-
- Gets a value indicating whether there will be a check for additional content after deserializing an object.
- The default value is false .
-
-
- true if there will be a check for additional content after deserializing an object; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to JSON text data.
-
-
-
-
- Initializes a new instance of the class with the specified .
-
- The containing the JSON data to read.
-
-
-
- Gets or sets the reader's property name table.
-
-
-
-
- Gets or sets the reader's character buffer pool.
-
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a .
-
- A . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a [].
-
- A [] or null if the next JSON token is null. This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Changes the reader's state to .
- If is set to true , the underlying is also closed.
-
-
-
-
- Gets a value indicating whether the class can return line information.
-
-
- true if and can be provided; otherwise, false .
-
-
-
-
- Gets the current line number.
-
-
- The current line number or 0 if no line information is available (for example, returns false ).
-
-
-
-
- Gets the current line position.
-
-
- The current line position or 0 if no line information is available (for example, returns false ).
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
-
-
-
-
- Gets or sets the writer's character array pool.
-
-
-
-
- Gets or sets how many s to write for each level in the hierarchy when is set to .
-
-
-
-
- Gets or sets which character to use to quote attribute values.
-
-
-
-
- Gets or sets which character to use for indenting when is set to .
-
-
-
-
- Gets or sets a value indicating whether object names will be surrounded with quotes.
-
-
-
-
- Initializes a new instance of the class using the specified .
-
- The to write to.
-
-
-
- Flushes whatever is in the buffer to the underlying and also flushes the underlying .
-
-
-
-
- Closes this writer.
- If is set to true , the underlying is also closed.
- If is set to true , the JSON is auto-completed.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes the specified end token.
-
- The end token to write.
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
- A flag to indicate whether the text should be escaped when it is written as a JSON property name.
-
-
-
- Writes indent characters.
-
-
-
-
- Writes the JSON value delimiter.
-
-
-
-
- Writes an indent space.
-
-
-
-
- Writes a value.
- An error will raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes raw JSON.
-
- The raw JSON to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes the given white space.
-
- The string of white space characters.
-
-
-
- Specifies the type of JSON token.
-
-
-
-
- This is returned by the if a read method has not been called.
-
-
-
-
- An object start token.
-
-
-
-
- An array start token.
-
-
-
-
- A constructor start token.
-
-
-
-
- An object property name.
-
-
-
-
- A comment.
-
-
-
-
- Raw JSON.
-
-
-
-
- An integer.
-
-
-
-
- A float.
-
-
-
-
- A string.
-
-
-
-
- A boolean.
-
-
-
-
- A null token.
-
-
-
-
- An undefined token.
-
-
-
-
- An object end token.
-
-
-
-
- An array end token.
-
-
-
-
- A constructor end token.
-
-
-
-
- A Date.
-
-
-
-
- Byte data.
-
-
-
-
-
- Represents a reader that provides validation.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Sets an event handler for receiving schema validation errors.
-
-
-
-
- Gets the text value of the current JSON token.
-
-
-
-
-
- Gets the depth of the current token in the JSON document.
-
- The depth of the current token in the JSON document.
-
-
-
- Gets the path of the current JSON token.
-
-
-
-
- Gets the quotation mark character used to enclose the value of a string.
-
-
-
-
-
- Gets the type of the current JSON token.
-
-
-
-
-
- Gets the .NET type for the current JSON token.
-
-
-
-
-
- Initializes a new instance of the class that
- validates the content returned from the given .
-
- The to read from while validating.
-
-
-
- Gets or sets the schema.
-
- The schema.
-
-
-
- Gets the used to construct this .
-
- The specified in the constructor.
-
-
-
- Changes the reader's state to .
- If is set to true , the underlying is also closed.
-
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a [].
-
-
- A [] or null if the next JSON token is null.
-
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a .
-
- A . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
-
-
-
-
- Gets or sets a value indicating whether the destination should be closed when this writer is closed.
-
-
- true to close the destination when this writer is closed; otherwise false . The default is true .
-
-
-
-
- Gets or sets a value indicating whether the JSON should be auto-completed when this writer is closed.
-
-
- true to auto-complete the JSON when this writer is closed; otherwise false . The default is true .
-
-
-
-
- Gets the top.
-
- The top.
-
-
-
- Gets the state of the writer.
-
-
-
-
- Gets the path of the writer.
-
-
-
-
- Gets or sets a value indicating how JSON text output should be formatted.
-
-
-
-
- Gets or sets how dates are written to JSON text.
-
-
-
-
- Gets or sets how time zones are handled when writing JSON text.
-
-
-
-
- Gets or sets how strings are escaped when writing JSON text.
-
-
-
-
- Gets or sets how special floating point numbers, e.g. ,
- and ,
- are written to JSON text.
-
-
-
-
- Gets or sets how and values are formatted when writing JSON text.
-
-
-
-
- Gets or sets the culture used when writing JSON. Defaults to .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Flushes whatever is in the buffer to the destination and also flushes the destination.
-
-
-
-
- Closes this writer.
- If is set to true , the destination is also closed.
- If is set to true , the JSON is auto-completed.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the end of a JSON object.
-
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the end of an array.
-
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes the end constructor.
-
-
-
-
- Writes the property name of a name/value pair of a JSON object.
-
- The name of the property.
-
-
-
- Writes the property name of a name/value pair of a JSON object.
-
- The name of the property.
- A flag to indicate whether the text should be escaped when it is written as a JSON property name.
-
-
-
- Writes the end of the current JSON object or array.
-
-
-
-
- Writes the current token and its children.
-
- The to read the token from.
-
-
-
- Writes the current token.
-
- The to read the token from.
- A flag indicating whether the current token's children should be written.
-
-
-
- Writes the token and its value.
-
- The to write.
-
- The value to write.
- A value is only required for tokens that have an associated value, e.g. the property name for .
- null can be passed to the method for tokens that don't have a value, e.g. .
-
-
-
-
- Writes the token.
-
- The to write.
-
-
-
- Writes the specified end token.
-
- The end token to write.
-
-
-
- Writes indent characters.
-
-
-
-
- Writes the JSON value delimiter.
-
-
-
-
- Writes an indent space.
-
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes raw JSON without changing the writer's state.
-
- The raw JSON to write.
-
-
-
- Writes raw JSON where a value is expected and updates the writer's state.
-
- The raw JSON to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
- An error will raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes the given white space.
-
- The string of white space characters.
-
-
-
- Releases unmanaged and - optionally - managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Sets the state of the .
-
- The being written.
- The value being written.
-
-
-
- The exception thrown when an error occurs while writing JSON text.
-
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Initializes a new instance of the class
- with a specified error message, JSON path and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The path to the JSON where the error occurred.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Specifies how JSON comments are handled when loading JSON.
-
-
-
-
- Ignore comments.
-
-
-
-
- Load comments as a with type .
-
-
-
-
- Specifies how duplicate property names are handled when loading JSON.
-
-
-
-
- Replace the existing value when there is a duplicate property. The value of the last property in the JSON object will be used.
-
-
-
-
- Ignore the new value when there is a duplicate property. The value of the first property in the JSON object will be used.
-
-
-
-
- Throw a when a duplicate property is encountered.
-
-
-
-
- Contains the LINQ to JSON extension methods.
-
-
-
-
- Returns a collection of tokens that contains the ancestors of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains the ancestors of every token in the source collection.
-
-
-
- Returns a collection of tokens that contains every token in the source collection, and the ancestors of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains every token in the source collection, the ancestors of every token in the source collection.
-
-
-
- Returns a collection of tokens that contains the descendants of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains the descendants of every token in the source collection.
-
-
-
- Returns a collection of tokens that contains every token in the source collection, and the descendants of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains every token in the source collection, and the descendants of every token in the source collection.
-
-
-
- Returns a collection of child properties of every object in the source collection.
-
- An of that contains the source collection.
- An of that contains the properties of every object in the source collection.
-
-
-
- Returns a collection of child values of every object in the source collection with the given key.
-
- An of that contains the source collection.
- The token key.
- An of that contains the values of every token in the source collection with the given key.
-
-
-
- Returns a collection of child values of every object in the source collection.
-
- An of that contains the source collection.
- An of that contains the values of every token in the source collection.
-
-
-
- Returns a collection of converted child values of every object in the source collection with the given key.
-
- The type to convert the values to.
- An of that contains the source collection.
- The token key.
- An that contains the converted values of every token in the source collection with the given key.
-
-
-
- Returns a collection of converted child values of every object in the source collection.
-
- The type to convert the values to.
- An of that contains the source collection.
- An that contains the converted values of every token in the source collection.
-
-
-
- Converts the value.
-
- The type to convert the value to.
- A cast as a of .
- A converted value.
-
-
-
- Converts the value.
-
- The source collection type.
- The type to convert the value to.
- A cast as a of .
- A converted value.
-
-
-
- Returns a collection of child tokens of every array in the source collection.
-
- The source collection type.
- An of that contains the source collection.
- An of that contains the values of every token in the source collection.
-
-
-
- Returns a collection of converted child tokens of every array in the source collection.
-
- An of that contains the source collection.
- The type to convert the values to.
- The source collection type.
- An that contains the converted values of every token in the source collection.
-
-
-
- Returns the input typed as .
-
- An of that contains the source collection.
- The input typed as .
-
-
-
- Returns the input typed as .
-
- The source collection type.
- An of that contains the source collection.
- The input typed as .
-
-
-
- Represents a collection of objects.
-
- The type of token.
-
-
-
- Gets the of with the specified key.
-
-
-
-
-
- Represents a JSON array.
-
-
-
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the array.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the array.
-
-
-
- Loads an from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
-
-
- Loads an from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- A populated from the string that contains JSON.
-
-
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- The used to load the JSON.
- If this is null , default load settings will be used.
- A populated from the string that contains JSON.
-
-
-
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- A with the values of the specified object.
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- The that will be used to read the object.
- A with the values of the specified object.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Gets or sets the at the specified index.
-
-
-
-
-
- Determines the index of a specific item in the .
-
- The object to locate in the .
-
- The index of if found in the list; otherwise, -1.
-
-
-
-
- Inserts an item to the at the specified index.
-
- The zero-based index at which should be inserted.
- The object to insert into the .
-
- is not a valid index in the .
-
-
-
-
- Removes the item at the specified index.
-
- The zero-based index of the item to remove.
-
- is not a valid index in the .
-
-
-
-
- Returns an enumerator that iterates through the collection.
-
-
- A of that can be used to iterate through the collection.
-
-
-
-
- Adds an item to the .
-
- The object to add to the .
-
-
-
- Removes all items from the .
-
-
-
-
- Determines whether the contains a specific value.
-
- The object to locate in the .
-
- true if is found in the ; otherwise, false .
-
-
-
-
- Copies the elements of the to an array, starting at a particular array index.
-
- The array.
- Index of the array.
-
-
-
- Gets a value indicating whether the is read-only.
-
- true if the is read-only; otherwise, false .
-
-
-
- Removes the first occurrence of a specific object from the .
-
- The object to remove from the .
-
- true if was successfully removed from the ; otherwise, false . This method also returns false if is not found in the original .
-
-
-
-
- Represents a JSON constructor.
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Gets or sets the name of this constructor.
-
- The constructor name.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the specified name and content.
-
- The constructor name.
- The contents of the constructor.
-
-
-
- Initializes a new instance of the class with the specified name and content.
-
- The constructor name.
- The contents of the constructor.
-
-
-
- Initializes a new instance of the class with the specified name.
-
- The constructor name.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
-
-
- Represents a token that can contain other tokens.
-
-
-
-
- Occurs when the list changes or an item in the list changes.
-
-
-
-
- Occurs before an item is added to the collection.
-
-
-
-
- Occurs when the items list of the collection has changed, or the collection is reset.
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Raises the event.
-
- The instance containing the event data.
-
-
-
- Raises the event.
-
- The instance containing the event data.
-
-
-
- Raises the event.
-
- The instance containing the event data.
-
-
-
- Gets a value indicating whether this token has child tokens.
-
-
- true if this token has child values; otherwise, false .
-
-
-
-
- Get the first child token of this token.
-
-
- A containing the first child token of the .
-
-
-
-
- Get the last child token of this token.
-
-
- A containing the last child token of the .
-
-
-
-
- Returns a collection of the child tokens of this token, in document order.
-
-
- An of containing the child tokens of this , in document order.
-
-
-
-
- Returns a collection of the child values of this token, in document order.
-
- The type to convert the values to.
-
- A containing the child values of this , in document order.
-
-
-
-
- Returns a collection of the descendant tokens for this token in document order.
-
- An of containing the descendant tokens of the .
-
-
-
- Returns a collection of the tokens that contain this token, and all descendant tokens of this token, in document order.
-
- An of containing this token, and all the descendant tokens of the .
-
-
-
- Adds the specified content as children of this .
-
- The content to be added.
-
-
-
- Adds the specified content as the first children of this .
-
- The content to be added.
-
-
-
- Creates a that can be used to add tokens to the .
-
- A that is ready to have content written to it.
-
-
-
- Replaces the child nodes of this token with the specified content.
-
- The content.
-
-
-
- Removes the child nodes from this token.
-
-
-
-
- Merge the specified content into this .
-
- The content to be merged.
-
-
-
- Merge the specified content into this using .
-
- The content to be merged.
- The used to merge the content.
-
-
-
- Gets the count of child JSON tokens.
-
- The count of child JSON tokens.
-
-
-
- Represents a collection of objects.
-
- The type of token.
-
-
-
- An empty collection of objects.
-
-
-
-
- Initializes a new instance of the struct.
-
- The enumerable.
-
-
-
- Returns an enumerator that can be used to iterate through the collection.
-
-
- A that can be used to iterate through the collection.
-
-
-
-
- Gets the of with the specified key.
-
-
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false .
-
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false .
-
-
-
-
- Returns a hash code for this instance.
-
-
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-
-
-
- Represents a JSON object.
-
-
-
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Occurs when a property value changes.
-
-
-
-
- Occurs when a property value is changing.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the object.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the object.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Gets an of of this object's properties.
-
- An of of this object's properties.
-
-
-
- Gets a with the specified name.
-
- The property name.
- A with the specified name or null .
-
-
-
- Gets the with the specified name.
- The exact name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- The property name.
- One of the enumeration values that specifies how the strings will be compared.
- A matched with the specified name or null .
-
-
-
- Gets a of of this object's property values.
-
- A of of this object's property values.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Gets or sets the with the specified property name.
-
-
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
- is not valid JSON.
-
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
- is not valid JSON.
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- A populated from the string that contains JSON.
-
- is not valid JSON.
-
-
-
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- The used to load the JSON.
- If this is null , default load settings will be used.
- A populated from the string that contains JSON.
-
- is not valid JSON.
-
-
-
-
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- A with the values of the specified object.
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- The that will be used to read the object.
- A with the values of the specified object.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Gets the with the specified property name.
-
- Name of the property.
- The with the specified property name.
-
-
-
- Gets the with the specified property name.
- The exact property name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- Name of the property.
- One of the enumeration values that specifies how the strings will be compared.
- The with the specified property name.
-
-
-
- Tries to get the with the specified property name.
- The exact property name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- Name of the property.
- The value.
- One of the enumeration values that specifies how the strings will be compared.
- true if a value was successfully retrieved; otherwise, false .
-
-
-
- Adds the specified property name.
-
- Name of the property.
- The value.
-
-
-
- Determines whether the JSON object has the specified property name.
-
- Name of the property.
- true if the JSON object has the specified property name; otherwise, false .
-
-
-
- Removes the property with the specified name.
-
- Name of the property.
- true if item was successfully removed; otherwise, false .
-
-
-
- Tries to get the with the specified property name.
-
- Name of the property.
- The value.
- true if a value was successfully retrieved; otherwise, false .
-
-
-
- Returns an enumerator that can be used to iterate through the collection.
-
-
- A that can be used to iterate through the collection.
-
-
-
-
- Raises the event with the provided arguments.
-
- Name of the property.
-
-
-
- Raises the event with the provided arguments.
-
- Name of the property.
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Represents a JSON property.
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Gets the property name.
-
- The property name.
-
-
-
- Gets or sets the property value.
-
- The property value.
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Initializes a new instance of the class.
-
- The property name.
- The property content.
-
-
-
- Initializes a new instance of the class.
-
- The property name.
- The property content.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
-
-
- Represents a view of a .
-
-
-
-
- Initializes a new instance of the class.
-
- The name.
-
-
-
- When overridden in a derived class, returns whether resetting an object changes its value.
-
-
- true if resetting the component changes its value; otherwise, false .
-
- The component to test for reset capability.
-
-
-
- When overridden in a derived class, gets the current value of the property on a component.
-
-
- The value of a property for a given component.
-
- The component with the property for which to retrieve the value.
-
-
-
- When overridden in a derived class, resets the value for this property of the component to the default value.
-
- The component with the property value that is to be reset to the default value.
-
-
-
- When overridden in a derived class, sets the value of the component to a different value.
-
- The component with the property value that is to be set.
- The new value.
-
-
-
- When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted.
-
-
- true if the property should be persisted; otherwise, false .
-
- The component with the property to be examined for persistence.
-
-
-
- When overridden in a derived class, gets the type of the component this property is bound to.
-
-
- A that represents the type of component this property is bound to.
- When the or
-
- methods are invoked, the object specified might be an instance of this type.
-
-
-
-
- When overridden in a derived class, gets a value indicating whether this property is read-only.
-
-
- true if the property is read-only; otherwise, false .
-
-
-
-
- When overridden in a derived class, gets the type of the property.
-
-
- A that represents the type of the property.
-
-
-
-
- Gets the hash code for the name of the member.
-
-
-
- The hash code for the name of the member.
-
-
-
-
- Represents a raw JSON string.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class.
-
- The raw json.
-
-
-
- Creates an instance of with the content of the reader's current token.
-
- The reader.
- An instance of with the content of the reader's current token.
-
-
-
- Specifies the settings used when loading JSON.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets or sets how JSON comments are handled when loading JSON.
- The default value is .
-
- The JSON comment handling.
-
-
-
- Gets or sets how JSON line info is handled when loading JSON.
- The default value is .
-
- The JSON line info handling.
-
-
-
- Gets or sets how duplicate property names in JSON objects are handled when loading JSON.
- The default value is .
-
- The JSON duplicate property name handling.
-
-
-
- Specifies the settings used when merging JSON.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets or sets the method used when merging JSON arrays.
-
- The method used when merging JSON arrays.
-
-
-
- Gets or sets how null value properties are merged.
-
- How null value properties are merged.
-
-
-
- Gets or sets the comparison used to match property names while merging.
- The exact property name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- The comparison used to match property names while merging.
-
-
-
- Represents an abstract JSON token.
-
-
-
-
- Gets a comparer that can compare two tokens for value equality.
-
- A that can compare two nodes for value equality.
-
-
-
- Gets or sets the parent.
-
- The parent.
-
-
-
- Gets the root of this .
-
- The root of this .
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Gets a value indicating whether this token has child tokens.
-
-
- true if this token has child values; otherwise, false .
-
-
-
-
- Compares the values of two tokens, including the values of all descendant tokens.
-
- The first to compare.
- The second to compare.
- true if the tokens are equal; otherwise false .
-
-
-
- Gets the next sibling token of this node.
-
- The that contains the next sibling token.
-
-
-
- Gets the previous sibling token of this node.
-
- The that contains the previous sibling token.
-
-
-
- Gets the path of the JSON token.
-
-
-
-
- Adds the specified content immediately after this token.
-
- A content object that contains simple content or a collection of content objects to be added after this token.
-
-
-
- Adds the specified content immediately before this token.
-
- A content object that contains simple content or a collection of content objects to be added before this token.
-
-
-
- Returns a collection of the ancestor tokens of this token.
-
- A collection of the ancestor tokens of this token.
-
-
-
- Returns a collection of tokens that contain this token, and the ancestors of this token.
-
- A collection of tokens that contain this token, and the ancestors of this token.
-
-
-
- Returns a collection of the sibling tokens after this token, in document order.
-
- A collection of the sibling tokens after this tokens, in document order.
-
-
-
- Returns a collection of the sibling tokens before this token, in document order.
-
- A collection of the sibling tokens before this token, in document order.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Gets the with the specified key converted to the specified type.
-
- The type to convert the token to.
- The token key.
- The converted token value.
-
-
-
- Get the first child token of this token.
-
- A containing the first child token of the .
-
-
-
- Get the last child token of this token.
-
- A containing the last child token of the .
-
-
-
- Returns a collection of the child tokens of this token, in document order.
-
- An of containing the child tokens of this , in document order.
-
-
-
- Returns a collection of the child tokens of this token, in document order, filtered by the specified type.
-
- The type to filter the child tokens on.
- A containing the child tokens of this , in document order.
-
-
-
- Returns a collection of the child values of this token, in document order.
-
- The type to convert the values to.
- A containing the child values of this , in document order.
-
-
-
- Removes this token from its parent.
-
-
-
-
- Replaces this token with the specified token.
-
- The value.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Returns the indented JSON for this token.
-
-
- ToString() returns a non-JSON string value for tokens with a type of .
- If you want the JSON for all token types then you should use .
-
-
- The indented JSON for this token.
-
-
-
-
- Returns the JSON for this token using the given formatting and converters.
-
- Indicates how the output should be formatted.
- A collection of s which will be used when writing the token.
- The JSON for this token using the given formatting and converters.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to [].
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from [] to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Creates a for this token.
-
- A that can be used to read this token and its descendants.
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- A with the value of the specified object.
-
-
-
- Creates a from an object using the specified .
-
- The object that will be used to create .
- The that will be used when reading the object.
- A with the value of the specified object.
-
-
-
- Creates an instance of the specified .NET type from the .
-
- The object type that the token will be deserialized to.
- The new object created from the JSON value.
-
-
-
- Creates an instance of the specified .NET type from the .
-
- The object type that the token will be deserialized to.
- The new object created from the JSON value.
-
-
-
- Creates an instance of the specified .NET type from the using the specified .
-
- The object type that the token will be deserialized to.
- The that will be used when creating the object.
- The new object created from the JSON value.
-
-
-
- Creates an instance of the specified .NET type from the using the specified .
-
- The object type that the token will be deserialized to.
- The that will be used when creating the object.
- The new object created from the JSON value.
-
-
-
- Creates a from a .
-
- A positioned at the token to read into this .
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Creates a from a .
-
- An positioned at the token to read into this .
- The used to load the JSON.
- If this is null , default load settings will be used.
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- A populated from the string that contains JSON.
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- The used to load the JSON.
- If this is null , default load settings will be used.
- A populated from the string that contains JSON.
-
-
-
- Creates a from a .
-
- A positioned at the token to read into this .
- The used to load the JSON.
- If this is null , default load settings will be used.
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Creates a from a .
-
- A positioned at the token to read into this .
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Selects a using a JSONPath expression. Selects the token that matches the object path.
-
-
- A that contains a JSONPath expression.
-
- A , or null .
-
-
-
- Selects a using a JSONPath expression. Selects the token that matches the object path.
-
-
- A that contains a JSONPath expression.
-
- A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.
- A .
-
-
-
- Selects a collection of elements using a JSONPath expression.
-
-
- A that contains a JSONPath expression.
-
- An of that contains the selected elements.
-
-
-
- Selects a collection of elements using a JSONPath expression.
-
-
- A that contains a JSONPath expression.
-
- A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.
- An of that contains the selected elements.
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Creates a new instance of the . All child tokens are recursively cloned.
-
- A new instance of the .
-
-
-
- Adds an object to the annotation list of this .
-
- The annotation to add.
-
-
-
- Get the first annotation object of the specified type from this .
-
- The type of the annotation to retrieve.
- The first annotation object that matches the specified type, or null if no annotation is of the specified type.
-
-
-
- Gets the first annotation object of the specified type from this .
-
- The of the annotation to retrieve.
- The first annotation object that matches the specified type, or null if no annotation is of the specified type.
-
-
-
- Gets a collection of annotations of the specified type for this .
-
- The type of the annotations to retrieve.
- An that contains the annotations for this .
-
-
-
- Gets a collection of annotations of the specified type for this .
-
- The of the annotations to retrieve.
- An of that contains the annotations that match the specified type for this .
-
-
-
- Removes the annotations of the specified type from this .
-
- The type of annotations to remove.
-
-
-
- Removes the annotations of the specified type from this .
-
- The of annotations to remove.
-
-
-
- Compares tokens to determine whether they are equal.
-
-
-
-
- Determines whether the specified objects are equal.
-
- The first object of type to compare.
- The second object of type to compare.
-
- true if the specified objects are equal; otherwise, false .
-
-
-
-
- Returns a hash code for the specified object.
-
- The for which a hash code is to be returned.
- A hash code for the specified object.
- The type of is a reference type and is null .
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.
-
-
-
-
- Gets the at the reader's current position.
-
-
-
-
- Initializes a new instance of the class.
-
- The token to read from.
-
-
-
- Initializes a new instance of the class.
-
- The token to read from.
- The initial path of the token. It is prepended to the returned .
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Gets the path of the current JSON token.
-
-
-
-
- Specifies the type of token.
-
-
-
-
- No token type has been set.
-
-
-
-
- A JSON object.
-
-
-
-
- A JSON array.
-
-
-
-
- A JSON constructor.
-
-
-
-
- A JSON object property.
-
-
-
-
- A comment.
-
-
-
-
- An integer value.
-
-
-
-
- A float value.
-
-
-
-
- A string value.
-
-
-
-
- A boolean value.
-
-
-
-
- A null value.
-
-
-
-
- An undefined value.
-
-
-
-
- A date value.
-
-
-
-
- A raw JSON value.
-
-
-
-
- A collection of bytes value.
-
-
-
-
- A Guid value.
-
-
-
-
- A Uri value.
-
-
-
-
- A TimeSpan value.
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
-
-
-
-
- Gets the at the writer's current position.
-
-
-
-
- Gets the token being written.
-
- The token being written.
-
-
-
- Initializes a new instance of the class writing to the given .
-
- The container being written to.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Flushes whatever is in the buffer to the underlying .
-
-
-
-
- Closes this writer.
- If is set to true , the JSON is auto-completed.
-
-
- Setting to true has no additional effect, since the underlying is a type that cannot be closed.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes the end.
-
- The token.
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
-
-
-
- Writes a value.
- An error will be raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes raw JSON.
-
- The raw JSON to write.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Represents a value in JSON (string, integer, date, etc).
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Gets a value indicating whether this token has child tokens.
-
-
- true if this token has child values; otherwise, false .
-
-
-
-
- Creates a comment with the given value.
-
- The value.
- A comment with the given value.
-
-
-
- Creates a string with the given value.
-
- The value.
- A string with the given value.
-
-
-
- Creates a null value.
-
- A null value.
-
-
-
- Creates a undefined value.
-
- A undefined value.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Gets or sets the underlying token value.
-
- The underlying token value.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of s which will be used when writing the token.
-
-
-
- Indicates whether the current object is equal to another object of the same type.
-
-
- true if the current object is equal to the parameter; otherwise, false .
-
- An object to compare with this object.
-
-
-
- Determines whether the specified is equal to the current .
-
- The to compare with the current .
-
- true if the specified is equal to the current ; otherwise, false .
-
-
-
-
- Serves as a hash function for a particular type.
-
-
- A hash code for the current .
-
-
-
-
- Returns a that represents this instance.
-
-
- ToString() returns a non-JSON string value for tokens with a type of .
- If you want the JSON for all token types then you should use .
-
-
- A that represents this instance.
-
-
-
-
- Returns a that represents this instance.
-
- The format.
-
- A that represents this instance.
-
-
-
-
- Returns a that represents this instance.
-
- The format provider.
-
- A that represents this instance.
-
-
-
-
- Returns a that represents this instance.
-
- The format.
- The format provider.
-
- A that represents this instance.
-
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
-
- An object to compare with this instance.
-
- A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
- Value
- Meaning
- Less than zero
- This instance is less than .
- Zero
- This instance is equal to .
- Greater than zero
- This instance is greater than .
-
-
- is not of the same type as this instance.
-
-
-
-
- Specifies how line information is handled when loading JSON.
-
-
-
-
- Ignore line information.
-
-
-
-
- Load line information.
-
-
-
-
- Specifies how JSON arrays are merged together.
-
-
-
- Concatenate arrays.
-
-
- Union arrays, skipping items that already exist.
-
-
- Replace all array items.
-
-
- Merge array items together, matched by index.
-
-
-
- Specifies how null value properties are merged.
-
-
-
-
- The content's null value properties will be ignored during merging.
-
-
-
-
- The content's null value properties will be merged.
-
-
-
-
- Specifies the member serialization options for the .
-
-
-
-
- All public members are serialized by default. Members can be excluded using or .
- This is the default member serialization mode.
-
-
-
-
- Only members marked with or are serialized.
- This member serialization mode can also be set by marking the class with .
-
-
-
-
- All public and private fields are serialized. Members can be excluded using or .
- This member serialization mode can also be set by marking the class with
- and setting IgnoreSerializableAttribute on to false .
-
-
-
-
- Specifies metadata property handling options for the .
-
-
-
-
- Read metadata properties located at the start of a JSON object.
-
-
-
-
- Read metadata properties located anywhere in a JSON object. Note that this setting will impact performance.
-
-
-
-
- Do not try to read metadata properties.
-
-
-
-
- Specifies missing member handling options for the .
-
-
-
-
- Ignore a missing member and do not attempt to deserialize it.
-
-
-
-
- Throw a when a missing member is encountered during deserialization.
-
-
-
-
- Specifies null value handling options for the .
-
-
-
-
-
-
-
-
- Include null values when serializing and deserializing objects.
-
-
-
-
- Ignore null values when serializing and deserializing objects.
-
-
-
-
- Specifies how object creation is handled by the .
-
-
-
-
- Reuse existing objects, create new objects when needed.
-
-
-
-
- Only reuse existing objects.
-
-
-
-
- Always create new objects.
-
-
-
-
- Specifies reference handling options for the .
- Note that references cannot be preserved when a value is set via a non-default constructor such as types that implement .
-
-
-
-
-
-
-
- Do not preserve references when serializing types.
-
-
-
-
- Preserve references when serializing into a JSON object structure.
-
-
-
-
- Preserve references when serializing into a JSON array structure.
-
-
-
-
- Preserve references when serializing.
-
-
-
-
- Specifies reference loop handling options for the .
-
-
-
-
- Throw a when a loop is encountered.
-
-
-
-
- Ignore loop references and do not serialize.
-
-
-
-
- Serialize loop references.
-
-
-
-
- Indicating whether a property is required.
-
-
-
-
- The property is not required. The default state.
-
-
-
-
- The property must be defined in JSON but can be a null value.
-
-
-
-
- The property must be defined in JSON and cannot be a null value.
-
-
-
-
- The property is not required but it cannot be a null value.
-
-
-
-
-
- Contains the JSON schema extension methods.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
-
- Determines whether the is valid.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
-
- true if the specified is valid; otherwise, false .
-
-
-
-
-
- Determines whether the is valid.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
- When this method returns, contains any error messages generated while validating.
-
- true if the specified is valid; otherwise, false .
-
-
-
-
-
- Validates the specified .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
-
-
-
-
- Validates the specified .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
- The validation event handler.
-
-
-
-
- An in-memory representation of a JSON Schema.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets or sets the id.
-
-
-
-
- Gets or sets the title.
-
-
-
-
- Gets or sets whether the object is required.
-
-
-
-
- Gets or sets whether the object is read-only.
-
-
-
-
- Gets or sets whether the object is visible to users.
-
-
-
-
- Gets or sets whether the object is transient.
-
-
-
-
- Gets or sets the description of the object.
-
-
-
-
- Gets or sets the types of values allowed by the object.
-
- The type.
-
-
-
- Gets or sets the pattern.
-
- The pattern.
-
-
-
- Gets or sets the minimum length.
-
- The minimum length.
-
-
-
- Gets or sets the maximum length.
-
- The maximum length.
-
-
-
- Gets or sets a number that the value should be divisible by.
-
- A number that the value should be divisible by.
-
-
-
- Gets or sets the minimum.
-
- The minimum.
-
-
-
- Gets or sets the maximum.
-
- The maximum.
-
-
-
- Gets or sets a flag indicating whether the value can not equal the number defined by the minimum attribute ( ).
-
- A flag indicating whether the value can not equal the number defined by the minimum attribute ( ).
-
-
-
- Gets or sets a flag indicating whether the value can not equal the number defined by the maximum attribute ( ).
-
- A flag indicating whether the value can not equal the number defined by the maximum attribute ( ).
-
-
-
- Gets or sets the minimum number of items.
-
- The minimum number of items.
-
-
-
- Gets or sets the maximum number of items.
-
- The maximum number of items.
-
-
-
- Gets or sets the of items.
-
- The of items.
-
-
-
- Gets or sets a value indicating whether items in an array are validated using the instance at their array position from .
-
-
- true if items are validated using their array position; otherwise, false .
-
-
-
-
- Gets or sets the of additional items.
-
- The of additional items.
-
-
-
- Gets or sets a value indicating whether additional items are allowed.
-
-
- true if additional items are allowed; otherwise, false .
-
-
-
-
- Gets or sets whether the array items must be unique.
-
-
-
-
- Gets or sets the of properties.
-
- The of properties.
-
-
-
- Gets or sets the of additional properties.
-
- The of additional properties.
-
-
-
- Gets or sets the pattern properties.
-
- The pattern properties.
-
-
-
- Gets or sets a value indicating whether additional properties are allowed.
-
-
- true if additional properties are allowed; otherwise, false .
-
-
-
-
- Gets or sets the required property if this property is present.
-
- The required property if this property is present.
-
-
-
- Gets or sets the a collection of valid enum values allowed.
-
- A collection of valid enum values allowed.
-
-
-
- Gets or sets disallowed types.
-
- The disallowed types.
-
-
-
- Gets or sets the default value.
-
- The default value.
-
-
-
- Gets or sets the collection of that this schema extends.
-
- The collection of that this schema extends.
-
-
-
- Gets or sets the format.
-
- The format.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Reads a from the specified .
-
- The containing the JSON Schema to read.
- The object representing the JSON Schema.
-
-
-
- Reads a from the specified .
-
- The containing the JSON Schema to read.
- The to use when resolving schema references.
- The object representing the JSON Schema.
-
-
-
- Load a from a string that contains JSON Schema.
-
- A that contains JSON Schema.
- A populated from the string that contains JSON Schema.
-
-
-
- Load a from a string that contains JSON Schema using the specified .
-
- A that contains JSON Schema.
- The resolver.
- A populated from the string that contains JSON Schema.
-
-
-
- Writes this schema to a .
-
- A into which this method will write.
-
-
-
- Writes this schema to a using the specified .
-
- A into which this method will write.
- The resolver used.
-
-
-
- Returns a that represents the current .
-
-
- A that represents the current .
-
-
-
-
-
- Returns detailed information about the schema exception.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets the line number indicating where the error occurred.
-
- The line number indicating where the error occurred.
-
-
-
- Gets the line position indicating where the error occurred.
-
- The line position indicating where the error occurred.
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
-
- Generates a from a specified .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets or sets how undefined schemas are handled by the serializer.
-
-
-
-
- Gets or sets the contract resolver.
-
- The contract resolver.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- A generated from the specified type.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- The used to resolve schema references.
- A generated from the specified type.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- Specify whether the generated root will be nullable.
- A generated from the specified type.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- The used to resolve schema references.
- Specify whether the generated root will be nullable.
- A generated from the specified type.
-
-
-
-
- Resolves from an id.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets or sets the loaded schemas.
-
- The loaded schemas.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets a for the specified reference.
-
- The id.
- A for the specified reference.
-
-
-
-
- The value types allowed by the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- No type specified.
-
-
-
-
- String type.
-
-
-
-
- Float type.
-
-
-
-
- Integer type.
-
-
-
-
- Boolean type.
-
-
-
-
- Object type.
-
-
-
-
- Array type.
-
-
-
-
- Null type.
-
-
-
-
- Any type.
-
-
-
-
-
- Specifies undefined schema Id handling options for the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Do not infer a schema Id.
-
-
-
-
- Use the .NET type name as the schema Id.
-
-
-
-
- Use the assembly qualified .NET type name as the schema Id.
-
-
-
-
-
- Returns detailed information related to the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets the associated with the validation error.
-
- The JsonSchemaException associated with the validation error.
-
-
-
- Gets the path of the JSON location where the validation error occurred.
-
- The path of the JSON location where the validation error occurred.
-
-
-
- Gets the text description corresponding to the validation error.
-
- The text description.
-
-
-
-
- Represents the callback method that will handle JSON schema validation events and the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- A camel case naming strategy.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
- A flag indicating whether extension data names should be processed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Resolves member mappings for a type, camel casing property names.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the contract for a given type.
-
- The type to resolve a contract for.
- The contract for a given type.
-
-
-
- Used by to resolve a for a given .
-
-
-
-
- Gets a value indicating whether members are being get and set using dynamic code generation.
- This value is determined by the runtime permissions available.
-
-
- true if using dynamic code generation; otherwise, false .
-
-
-
-
- Gets or sets the default members search flags.
-
- The default members search flags.
-
-
-
- Gets or sets a value indicating whether compiler generated members should be serialized.
-
-
- true if serialized compiler generated members; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types.
-
-
- true if the interface will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types.
-
-
- true if the attribute will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore IsSpecified members when serializing and deserializing types.
-
-
- true if the IsSpecified members will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore ShouldSerialize members when serializing and deserializing types.
-
-
- true if the ShouldSerialize members will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets the naming strategy used to resolve how property names and dictionary keys are serialized.
-
- The naming strategy used to resolve how property names and dictionary keys are serialized.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the contract for a given type.
-
- The type to resolve a contract for.
- The contract for a given type.
-
-
-
- Gets the serializable members for the type.
-
- The type to get serializable members for.
- The serializable members for the type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates the constructor parameters.
-
- The constructor to create properties for.
- The type's member properties.
- Properties for the given .
-
-
-
- Creates a for the given .
-
- The matching member property.
- The constructor parameter.
- A created for the given .
-
-
-
- Resolves the default for the contract.
-
- Type of the object.
- The contract's default .
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Determines which contract type is created for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates properties for the given .
-
- The type to create properties for.
- /// The member serialization mode for the type.
- Properties for the given .
-
-
-
- Creates the used by the serializer to get and set values from a member.
-
- The member.
- The used by the serializer to get and set values from a member.
-
-
-
- Creates a for the given .
-
- The member's parent .
- The member to create a for.
- A created for the given .
-
-
-
- Resolves the name of the property.
-
- Name of the property.
- Resolved name of the property.
-
-
-
- Resolves the name of the extension data. By default no changes are made to extension data names.
-
- Name of the extension data.
- Resolved name of the extension data.
-
-
-
- Resolves the key of the dictionary. By default is used to resolve dictionary keys.
-
- Key of the dictionary.
- Resolved key of the dictionary.
-
-
-
- Gets the resolved name of the property.
-
- Name of the property.
- Name of the property.
-
-
-
- The default naming strategy. Property names and dictionary keys are unchanged.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- The default serialization binder used when resolving and loading classes from type names.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- When overridden in a derived class, controls the binding of a serialized object to a type.
-
- Specifies the name of the serialized object.
- Specifies the name of the serialized object.
-
- The type of the object the formatter creates a new instance of.
-
-
-
-
- When overridden in a derived class, controls the binding of a serialized object to a type.
-
- The type of the object the formatter creates a new instance of.
- Specifies the name of the serialized object.
- Specifies the name of the serialized object.
-
-
-
- Represents a trace writer that writes to the application's instances.
-
-
-
-
- Gets the that will be used to filter the trace messages passed to the writer.
- For example a filter level of will exclude messages and include ,
- and messages.
-
-
- The that will be used to filter the trace messages passed to the writer.
-
-
-
-
- Writes the specified trace level, message and optional exception.
-
- The at which to write this trace.
- The trace message.
- The trace exception. This parameter is optional.
-
-
-
- Get and set values for a using dynamic methods.
-
-
-
-
- Initializes a new instance of the class.
-
- The member info.
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- Provides information surrounding an error.
-
-
-
-
- Gets the error.
-
- The error.
-
-
-
- Gets the original object that caused the error.
-
- The original object that caused the error.
-
-
-
- Gets the member that caused the error.
-
- The member that caused the error.
-
-
-
- Gets the path of the JSON location where the error occurred.
-
- The path of the JSON location where the error occurred.
-
-
-
- Gets or sets a value indicating whether this is handled.
-
- true if handled; otherwise, false .
-
-
-
- Provides data for the Error event.
-
-
-
-
- Gets the current object the error event is being raised against.
-
- The current object the error event is being raised against.
-
-
-
- Gets the error context.
-
- The error context.
-
-
-
- Initializes a new instance of the class.
-
- The current object.
- The error context.
-
-
-
- Get and set values for a using dynamic methods.
-
-
-
-
- Initializes a new instance of the class.
-
- The member info.
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- Provides methods to get attributes.
-
-
-
-
- Returns a collection of all of the attributes, or an empty collection if there are no attributes.
-
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Returns a collection of attributes, identified by type, or an empty collection if there are no attributes.
-
- The type of the attributes.
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Used by to resolve a for a given .
-
-
-
-
-
-
-
-
- Resolves the contract for a given type.
-
- The type to resolve a contract for.
- The contract for a given type.
-
-
-
- Used to resolve references when serializing and deserializing JSON by the .
-
-
-
-
- Resolves a reference to its object.
-
- The serialization context.
- The reference to resolve.
- The object that was resolved from the reference.
-
-
-
- Gets the reference for the specified object.
-
- The serialization context.
- The object to get a reference for.
- The reference to the object.
-
-
-
- Determines whether the specified object is referenced.
-
- The serialization context.
- The object to test for a reference.
-
- true if the specified object is referenced; otherwise, false .
-
-
-
-
- Adds a reference to the specified object.
-
- The serialization context.
- The reference.
- The object to reference.
-
-
-
- Allows users to control class loading and mandate what class to load.
-
-
-
-
- When implemented, controls the binding of a serialized object to a type.
-
- Specifies the name of the serialized object.
- Specifies the name of the serialized object
- The type of the object the formatter creates a new instance of.
-
-
-
- When implemented, controls the binding of a serialized object to a type.
-
- The type of the object the formatter creates a new instance of.
- Specifies the name of the serialized object.
- Specifies the name of the serialized object.
-
-
-
- Represents a trace writer.
-
-
-
-
- Gets the that will be used to filter the trace messages passed to the writer.
- For example a filter level of will exclude messages and include ,
- and messages.
-
- The that will be used to filter the trace messages passed to the writer.
-
-
-
- Writes the specified trace level, message and optional exception.
-
- The at which to write this trace.
- The trace message.
- The trace exception. This parameter is optional.
-
-
-
- Provides methods to get and set values.
-
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets the of the collection items.
-
- The of the collection items.
-
-
-
- Gets a value indicating whether the collection type is a multidimensional array.
-
- true if the collection type is a multidimensional array; otherwise, false .
-
-
-
- Gets or sets the function used to create the object. When set this function will override .
-
- The function used to create the object.
-
-
-
- Gets a value indicating whether the creator has a parameter with the collection values.
-
- true if the creator has a parameter with the collection values; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the default collection items .
-
- The converter.
-
-
-
- Gets or sets a value indicating whether the collection items preserve object references.
-
- true if collection items preserve object references; otherwise, false .
-
-
-
- Gets or sets the collection item reference loop handling.
-
- The reference loop handling.
-
-
-
- Gets or sets the collection item type name handling.
-
- The type name handling.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Handles serialization callback events.
-
- The object that raised the callback event.
- The streaming context.
-
-
-
- Handles serialization error callback events.
-
- The object that raised the callback event.
- The streaming context.
- The error context.
-
-
-
- Sets extension data for an object during deserialization.
-
- The object to set extension data on.
- The extension data key.
- The extension data value.
-
-
-
- Gets extension data for an object during serialization.
-
- The object to set extension data on.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets the underlying type for the contract.
-
- The underlying type for the contract.
-
-
-
- Gets or sets the type created during deserialization.
-
- The type created during deserialization.
-
-
-
- Gets or sets whether this type contract is serialized as a reference.
-
- Whether this type contract is serialized as a reference.
-
-
-
- Gets or sets the default for this contract.
-
- The converter.
-
-
-
- Gets the internally resolved for the contract's type.
- This converter is used as a fallback converter when no other converter is resolved.
- Setting will always override this converter.
-
-
-
-
- Gets or sets all methods called immediately after deserialization of the object.
-
- The methods called immediately after deserialization of the object.
-
-
-
- Gets or sets all methods called during deserialization of the object.
-
- The methods called during deserialization of the object.
-
-
-
- Gets or sets all methods called after serialization of the object graph.
-
- The methods called after serialization of the object graph.
-
-
-
- Gets or sets all methods called before serialization of the object.
-
- The methods called before serialization of the object.
-
-
-
- Gets or sets all method called when an error is thrown during the serialization of the object.
-
- The methods called when an error is thrown during the serialization of the object.
-
-
-
- Gets or sets the default creator method used to create the object.
-
- The default creator method used to create the object.
-
-
-
- Gets or sets a value indicating whether the default creator is non-public.
-
- true if the default object creator is non-public; otherwise, false .
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the dictionary key resolver.
-
- The dictionary key resolver.
-
-
-
- Gets the of the dictionary keys.
-
- The of the dictionary keys.
-
-
-
- Gets the of the dictionary values.
-
- The of the dictionary values.
-
-
-
- Gets or sets the function used to create the object. When set this function will override .
-
- The function used to create the object.
-
-
-
- Gets a value indicating whether the creator has a parameter with the dictionary values.
-
- true if the creator has a parameter with the dictionary values; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets the object's properties.
-
- The object's properties.
-
-
-
- Gets or sets the property name resolver.
-
- The property name resolver.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the object constructor.
-
- The object constructor.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the object member serialization.
-
- The member object serialization.
-
-
-
- Gets or sets the missing member handling used when deserializing this object.
-
- The missing member handling.
-
-
-
- Gets or sets a value that indicates whether the object's properties are required.
-
-
- A value indicating whether the object's properties are required.
-
-
-
-
- Gets or sets how the object's properties with null values are handled during serialization and deserialization.
-
- How the object's properties with null values are handled during serialization and deserialization.
-
-
-
- Gets the object's properties.
-
- The object's properties.
-
-
-
- Gets a collection of instances that define the parameters used with .
-
-
-
-
- Gets or sets the function used to create the object. When set this function will override .
- This function is called with a collection of arguments which are defined by the collection.
-
- The function used to create the object.
-
-
-
- Gets or sets the extension data setter.
-
-
-
-
- Gets or sets the extension data getter.
-
-
-
-
- Gets or sets the extension data value type.
-
-
-
-
- Gets or sets the extension data name resolver.
-
- The extension data name resolver.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Maps a JSON property to a .NET member or constructor parameter.
-
-
-
-
- Gets or sets the name of the property.
-
- The name of the property.
-
-
-
- Gets or sets the type that declared this property.
-
- The type that declared this property.
-
-
-
- Gets or sets the order of serialization of a member.
-
- The numeric order of serialization.
-
-
-
- Gets or sets the name of the underlying member or parameter.
-
- The name of the underlying member or parameter.
-
-
-
- Gets the that will get and set the during serialization.
-
- The that will get and set the during serialization.
-
-
-
- Gets or sets the for this property.
-
- The for this property.
-
-
-
- Gets or sets the type of the property.
-
- The type of the property.
-
-
-
- Gets or sets the for the property.
- If set this converter takes precedence over the contract converter for the property type.
-
- The converter.
-
-
-
- Gets or sets the member converter.
-
- The member converter.
-
-
-
- Gets or sets a value indicating whether this is ignored.
-
- true if ignored; otherwise, false .
-
-
-
- Gets or sets a value indicating whether this is readable.
-
- true if readable; otherwise, false .
-
-
-
- Gets or sets a value indicating whether this is writable.
-
- true if writable; otherwise, false .
-
-
-
- Gets or sets a value indicating whether this has a member attribute.
-
- true if has a member attribute; otherwise, false .
-
-
-
- Gets the default value.
-
- The default value.
-
-
-
- Gets or sets a value indicating whether this is required.
-
- A value indicating whether this is required.
-
-
-
- Gets a value indicating whether has a value specified.
-
-
-
-
- Gets or sets a value indicating whether this property preserves object references.
-
-
- true if this instance is reference; otherwise, false .
-
-
-
-
- Gets or sets the property null value handling.
-
- The null value handling.
-
-
-
- Gets or sets the property default value handling.
-
- The default value handling.
-
-
-
- Gets or sets the property reference loop handling.
-
- The reference loop handling.
-
-
-
- Gets or sets the property object creation handling.
-
- The object creation handling.
-
-
-
- Gets or sets or sets the type name handling.
-
- The type name handling.
-
-
-
- Gets or sets a predicate used to determine whether the property should be serialized.
-
- A predicate used to determine whether the property should be serialized.
-
-
-
- Gets or sets a predicate used to determine whether the property should be deserialized.
-
- A predicate used to determine whether the property should be deserialized.
-
-
-
- Gets or sets a predicate used to determine whether the property should be serialized.
-
- A predicate used to determine whether the property should be serialized.
-
-
-
- Gets or sets an action used to set whether the property has been deserialized.
-
- An action used to set whether the property has been deserialized.
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Gets or sets the converter used when serializing the property's collection items.
-
- The collection's items converter.
-
-
-
- Gets or sets whether this property's collection items are serialized as a reference.
-
- Whether this property's collection items are serialized as a reference.
-
-
-
- Gets or sets the type name handling used when serializing the property's collection items.
-
- The collection's items type name handling.
-
-
-
- Gets or sets the reference loop handling used when serializing the property's collection items.
-
- The collection's items reference loop handling.
-
-
-
- A collection of objects.
-
-
-
-
- Initializes a new instance of the class.
-
- The type.
-
-
-
- When implemented in a derived class, extracts the key from the specified element.
-
- The element from which to extract the key.
- The key for the specified element.
-
-
-
- Adds a object.
-
- The property to add to the collection.
-
-
-
- Gets the closest matching object.
- First attempts to get an exact case match of and then
- a case insensitive match.
-
- Name of the property.
- A matching property if found.
-
-
-
- Gets a property by property name.
-
- The name of the property to get.
- Type property name string comparison.
- A matching property if found.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Lookup and create an instance of the type described by the argument.
-
- The type to create.
- Optional arguments to pass to an initializing constructor of the JsonConverter.
- If null , the default constructor is used.
-
-
-
- A kebab case naming strategy.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
- A flag indicating whether extension data names should be processed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Represents a trace writer that writes to memory. When the trace message limit is
- reached then old trace messages will be removed as new messages are added.
-
-
-
-
- Gets the that will be used to filter the trace messages passed to the writer.
- For example a filter level of will exclude messages and include ,
- and messages.
-
-
- The that will be used to filter the trace messages passed to the writer.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Writes the specified trace level, message and optional exception.
-
- The at which to write this trace.
- The trace message.
- The trace exception. This parameter is optional.
-
-
-
- Returns an enumeration of the most recent trace messages.
-
- An enumeration of the most recent trace messages.
-
-
-
- Returns a of the most recent trace messages.
-
-
- A of the most recent trace messages.
-
-
-
-
- A base class for resolving how property names and dictionary keys are serialized.
-
-
-
-
- A flag indicating whether dictionary keys should be processed.
- Defaults to false .
-
-
-
-
- A flag indicating whether extension data names should be processed.
- Defaults to false .
-
-
-
-
- A flag indicating whether explicitly specified property names,
- e.g. a property name customized with a , should be processed.
- Defaults to false .
-
-
-
-
- Gets the serialized name for a given property name.
-
- The initial property name.
- A flag indicating whether the property has had a name explicitly specified.
- The serialized property name.
-
-
-
- Gets the serialized name for a given extension data name.
-
- The initial extension data name.
- The serialized extension data name.
-
-
-
- Gets the serialized key for a given dictionary key.
-
- The initial dictionary key.
- The serialized dictionary key.
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Hash code calculation
-
-
-
-
-
- Object equality implementation
-
-
-
-
-
-
- Compare to another NamingStrategy
-
-
-
-
-
-
- Represents a method that constructs an object.
-
- The object type to create.
-
-
-
- When applied to a method, specifies that the method is called when an error occurs serializing an object.
-
-
-
-
- Provides methods to get attributes from a , , or .
-
-
-
-
- Initializes a new instance of the class.
-
- The instance to get attributes for. This parameter should be a , , or .
-
-
-
- Returns a collection of all of the attributes, or an empty collection if there are no attributes.
-
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Returns a collection of attributes, identified by type, or an empty collection if there are no attributes.
-
- The type of the attributes.
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Get and set values for a using reflection.
-
-
-
-
- Initializes a new instance of the class.
-
- The member info.
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- A snake case naming strategy.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
- A flag indicating whether extension data names should be processed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Specifies how strings are escaped when writing JSON text.
-
-
-
-
- Only control characters (e.g. newline) are escaped.
-
-
-
-
- All non-ASCII and control characters (e.g. newline) are escaped.
-
-
-
-
- HTML (<, >, &, ', ") and control characters (e.g. newline) are escaped.
-
-
-
-
- Indicates the method that will be used during deserialization for locating and loading assemblies.
-
-
-
-
- In simple mode, the assembly used during deserialization need not match exactly the assembly used during serialization. Specifically, the version numbers need not match as the LoadWithPartialName method of the class is used to load the assembly.
-
-
-
-
- In full mode, the assembly used during deserialization must match exactly the assembly used during serialization. The Load method of the class is used to load the assembly.
-
-
-
-
- Specifies type name handling options for the .
-
-
- should be used with caution when your application deserializes JSON from an external source.
- Incoming types should be validated with a custom
- when deserializing with a value other than .
-
-
-
-
- Do not include the .NET type name when serializing types.
-
-
-
-
- Include the .NET type name when serializing into a JSON object structure.
-
-
-
-
- Include the .NET type name when serializing into a JSON array structure.
-
-
-
-
- Always include the .NET type name when serializing.
-
-
-
-
- Include the .NET type name when the type of the object being serialized is not the same as its declared type.
- Note that this doesn't include the root serialized object by default. To include the root object's type name in JSON
- you must specify a root type object with
- or .
-
-
-
-
- Determines whether the collection is null or empty.
-
- The collection.
-
- true if the collection is null or empty; otherwise, false .
-
-
-
-
- Adds the elements of the specified collection to the specified generic .
-
- The list to add to.
- The collection of elements to add.
-
-
-
- Converts the value to the specified type. If the value is unable to be converted, the
- value is checked whether it assignable to the specified type.
-
- The value to convert.
- The culture to use when converting.
- The type to convert or cast the value to.
-
- The converted type. If conversion was unsuccessful, the initial value
- is returned if assignable to the target type.
-
-
-
-
- Helper method for generating a MetaObject which calls a
- specific method on Dynamic that returns a result
-
-
-
-
- Helper method for generating a MetaObject which calls a
- specific method on Dynamic, but uses one of the arguments for
- the result.
-
-
-
-
- Helper method for generating a MetaObject which calls a
- specific method on Dynamic, but uses one of the arguments for
- the result.
-
-
-
-
- Returns a Restrictions object which includes our current restrictions merged
- with a restriction limiting our type
-
-
-
-
- Helper class for serializing immutable collections.
- Note that this is used by all builds, even those that don't support immutable collections, in case the DLL is GACed
- https://github.com/JamesNK/Newtonsoft.Json/issues/652
-
-
-
-
- Gets the type of the typed collection's items.
-
- The type.
- The type of the typed collection's items.
-
-
-
- Gets the member's underlying type.
-
- The member.
- The underlying type of the member.
-
-
-
- Determines whether the property is an indexed property.
-
- The property.
-
- true if the property is an indexed property; otherwise, false .
-
-
-
-
- Gets the member's value on the object.
-
- The member.
- The target object.
- The member's value on the object.
-
-
-
- Sets the member's value on the target object.
-
- The member.
- The target.
- The value.
-
-
-
- Determines whether the specified MemberInfo can be read.
-
- The MemberInfo to determine whether can be read.
- /// if set to true then allow the member to be gotten non-publicly.
-
- true if the specified MemberInfo can be read; otherwise, false .
-
-
-
-
- Determines whether the specified MemberInfo can be set.
-
- The MemberInfo to determine whether can be set.
- if set to true then allow the member to be set non-publicly.
- if set to true then allow the member to be set if read-only.
-
- true if the specified MemberInfo can be set; otherwise, false .
-
-
-
-
- Builds a string. Unlike this class lets you reuse its internal buffer.
-
-
-
-
- Determines whether the string is all white space. Empty string will return false .
-
- The string to test whether it is all white space.
-
- true if the string is all white space; otherwise, false .
-
-
-
-
- Specifies the state of the .
-
-
-
-
- An exception has been thrown, which has left the in an invalid state.
- You may call the method to put the in the Closed state.
- Any other method calls result in an being thrown.
-
-
-
-
- The method has been called.
-
-
-
-
- An object is being written.
-
-
-
-
- An array is being written.
-
-
-
-
- A constructor is being written.
-
-
-
-
- A property is being written.
-
-
-
-
- A write method has not been called.
-
-
-
- Specifies that an output will not be null even if the corresponding type allows it.
-
-
- Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it.
-
-
- Initializes the attribute with the specified return value condition.
-
- The return value condition. If the method returns this value, the associated parameter will not be null.
-
-
-
- Gets the return value condition.
-
-
- Specifies that an output may be null even if the corresponding type disallows it.
-
-
- Specifies that null is allowed as an input even if the corresponding type disallows it.
-
-
-
- Specifies that the method will not return if the associated Boolean parameter is passed the specified value.
-
-
-
-
- Initializes a new instance of the class.
-
-
- The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
- the associated parameter matches this value.
-
-
-
- Gets the condition parameter value.
-
-
-
diff --git a/json.net/net40/README.md b/json.net/net40/README.md
deleted file mode 100644
index 21c4c484..00000000
--- a/json.net/net40/README.md
+++ /dev/null
@@ -1 +0,0 @@
-forked from https://github.com/JamesNK/Newtonsoft.Json
\ No newline at end of file
diff --git a/qrcoder/net40/QRCoder.dll b/qrcoder/net40/QRCoder.dll
deleted file mode 100644
index ffe773ed..00000000
Binary files a/qrcoder/net40/QRCoder.dll and /dev/null differ
diff --git a/qrcoder/net40/readme.md b/qrcoder/net40/readme.md
deleted file mode 100644
index 4cfdda31..00000000
--- a/qrcoder/net40/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-forked from https://github.com/codebude/QRCoder
diff --git a/ssh.net/net40/Renci.SshNet.dll b/ssh.net/net40/Renci.SshNet.dll
deleted file mode 100644
index dbfbb95d..00000000
Binary files a/ssh.net/net40/Renci.SshNet.dll and /dev/null differ
diff --git a/ssh.net/net40/Renci.SshNet.xml b/ssh.net/net40/Renci.SshNet.xml
deleted file mode 100644
index a60b08d9..00000000
--- a/ssh.net/net40/Renci.SshNet.xml
+++ /dev/null
@@ -1,21682 +0,0 @@
-
-
-
- Renci.SshNet
-
-
-
-
- Generates a array of the specified length, and fills it with a
- cryptographically strong random sequence of values.
-
- The length of the array generate.
-
-
-
- Fills an array of bytes with a cryptographically strong random sequence of values.
-
- The array to fill with cryptographically strong random bytes.
- is null .
-
- The length of the byte array determines how many random bytes are produced.
-
-
-
-
- Returns the Internet Protocol (IP) addresses for the specified host.
-
- The host name or IP address to resolve
-
- An array of type that holds the IP addresses for the host that
- is specified by the parameter.
-
- is null .
- An error is encountered when resolving .
-
-
-
- Returns an enumerable collection of file information that matches a search pattern.
-
-
- The search string to match against the names of files.
-
- An enumerable collection of files that matches .
-
- is null .
- is null .
- The path represented by does not exist or is not valid.
-
-
-
- Returns a value indicating whether the specified can be used
- to send data.
-
- The to check.
-
- true if can be written to; otherwise, false .
-
-
-
-
- Reads a byte from the specified .
-
- The to read from.
- Specifies the amount of time after which the call will time out.
-
- The byte read, or -1 if the socket was closed.
-
- The read operation timed out.
- The read failed.
-
-
-
- Sends a byte using the specified .
-
- The to write to.
- The value to send.
- The write failed.
-
-
-
- Receives data from a bound .
-
-
- The number of bytes to receive.
- Specifies the amount of time after which the call will time out.
-
- The bytes received.
-
-
- If no data is available for reading, the method will
- block until data is available or the time-out value is exceeded. If the time-out value is exceeded, the
- call will throw a .
- If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the
- method will complete immediately and throw a .
-
-
-
-
- Receives data from a bound into a receive buffer.
-
-
- An array of type that is the storage location for the received data.
- The position in parameter to store the received data.
- The number of bytes to receive.
- Specifies the amount of time after which the call will time out.
-
- The number of bytes received.
-
-
- If no data is available for reading, the method will
- block until data is available or the time-out value is exceeded. If the time-out value is exceeded, the
- call will throw a .
- If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the
- method will complete immediately and throw a .
-
-
-
-
- Suspends the current thread for the specified number of milliseconds.
-
- The number of milliseconds for which the thread is suspended.
-
-
-
- Executes the specified action in a separate thread.
-
- The action to execute.
-
-
-
- Base class for all supported authentication methods
-
-
-
-
- Gets the name of the authentication method.
-
-
- The name of the authentication method.
-
-
-
-
- Gets connection username.
-
-
-
-
- Gets list of allowed authentications.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- The result of the authentication process.
-
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- The result of the authentication process.
-
-
-
-
- Represents possible authentication methods results
-
-
-
-
- Authentication was successful.
-
-
-
-
- Authentication completed with partial success.
-
-
-
-
- Authentication failed.
-
-
-
-
- Serves as base class for client implementations, provides common client functionality.
-
-
-
-
- Holds value indicating whether the connection info is owned by this client.
-
-
-
-
- Gets the current session.
-
-
- The current session.
-
-
-
-
- Gets the factory for creating new services.
-
-
- The factory for creating new services.
-
-
-
-
- Gets the connection info.
-
-
- The connection info.
-
- The method was called after the client was disposed.
-
-
-
- Gets a value indicating whether this client is connected to the server.
-
-
- true if this client is connected; otherwise, false .
-
- The method was called after the client was disposed.
-
-
-
- Gets or sets the keep-alive interval.
-
-
- The keep-alive interval. Specify negative one (-1) milliseconds to disable the
- keep-alive. This is the default value.
-
- The method was called after the client was disposed.
-
-
-
- Occurs when an error occurred.
-
-
-
-
-
-
-
- Occurs when host key received.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Connects client to the server.
-
- The client is already connected.
- The method was called after the client was disposed.
- Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.
- SSH session could not be established.
- Authentication of SSH session failed.
- Failed to establish proxy connection.
-
-
-
- Disconnects client from the server.
-
- The method was called after the client was disposed.
-
-
-
- Sends a keep-alive message to the server.
-
-
- Use to configure the client to send a keep-alive at regular
- intervals.
-
- The method was called after the client was disposed.
-
-
-
- Called when client is connecting to the server.
-
-
-
-
- Called when client is connected to the server.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Called when client is disconnected from the server.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Check if the current instance is disposed.
-
- THe current instance is disposed.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Stops the keep-alive timer, and waits until all timer callbacks have been
- executed.
-
-
-
-
- Starts the keep-alive timer.
-
-
- When is negative one (-1) milliseconds, then
- the timer will not be started.
-
-
-
-
- Creates a with the specified due time and interval.
-
- The amount of time to delay before the keep-alive message is first sent. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately.
- The time interval between attempts to send a keep-alive message. Specify negative one (-1) milliseconds to disable periodic signaling.
-
- A with the specified due time and interval.
-
-
-
-
- Disposes the SSH session, and assigns null to .
-
-
-
-
- Returns a value indicating whether the SSH session is established.
-
-
- true if the SSH session is established; otherwise, false .
-
-
-
-
- Represents base class for SSH channel implementations.
-
-
-
-
- Holds a value indicating whether the SSH_MSG_CHANNEL_CLOSE has been sent to the remote party.
-
-
- true when a SSH_MSG_CHANNEL_CLOSE message has been sent to the other party;
- otherwise, false .
-
-
-
-
- Holds a value indicating whether a SSH_MSG_CHANNEL_CLOSE has been received from the other
- party.
-
-
- true when a SSH_MSG_CHANNEL_CLOSE message has been received from the other party;
- otherwise, false .
-
-
-
-
- Holds a value indicating whether the SSH_MSG_CHANNEL_EOF has been received from the other party.
-
-
- true when a SSH_MSG_CHANNEL_EOF message has been received from the other party;
- otherwise, false .
-
-
-
-
- Holds a value indicating whether the SSH_MSG_CHANNEL_EOF has been sent to the remote party.
-
-
- true when a SSH_MSG_CHANNEL_EOF message has been sent to the remote party;
- otherwise, false .
-
-
-
-
- Occurs when an exception is thrown when processing channel messages.
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Gets the session.
-
-
- Thhe session.
-
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Gets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the maximum size of a data packet that we can receive using the channel.
-
-
- The maximum size of a packet.
-
-
-
- This is the maximum size (in bytes) we support for the data (payload) of a
- SSH_MSG_CHANNEL_DATA message we receive.
-
-
- We currently do not enforce this limit.
-
-
-
-
-
- Gets the size of the local window.
-
-
- The size of the local window.
-
-
-
-
- Gets the remote channel number.
-
-
- The remote channel number.
-
-
-
-
- Gets the maximum size of a data packet that we can send using the channel.
-
-
- The maximum size of data that can be sent using a
- on the current channel.
-
- The channel has not been opened, or the open has not yet been confirmed.
-
-
-
- Gets the window size of the remote server.
-
-
- The size of the server window.
-
-
-
-
- Gets a value indicating whether this channel is open.
-
-
- true if this channel is open; otherwise, false .
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Gets a value indicating whether the session is connected.
-
-
- true if the session is connected; otherwise, false .
-
-
-
-
- Gets the connection info.
-
- The connection info.
-
-
-
- Gets the session semaphore to control number of session channels.
-
- The session semaphore.
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- The payload to send.
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- An array of containing the payload to send.
- The zero-based offset in at which to begin taking data from.
- The number of bytes of to send.
-
-
- When the size of the data to send exceeds the maximum packet size or the remote window
- size does not allow the full data to be sent, then this method will send the data in
- multiple chunks and will wait for the remote window size to be adjusted when it's zero.
-
-
- This is done to support SSH servers will a small window size that do not agressively
- increase their window size. We need to take into account that there may be SSH servers
- that only increase their window size when it has reached zero.
-
-
-
-
-
- Called when channel window need to be adjust.
-
- The bytes to add.
-
-
-
- Called when channel data is received.
-
- The data.
-
-
-
- Called when channel extended data is received.
-
- The data.
- The data type code.
-
-
-
- Called when channel has no more data to receive.
-
-
-
-
- Called when channel is closed by the server.
-
-
-
-
- Called when channel request received.
-
- Channel request information.
-
-
-
- Called when channel request was successful
-
-
-
-
- Called when channel request failed.
-
-
-
-
- Raises event.
-
- The exception.
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Sends SSH message to the server.
-
- The message.
-
-
-
- Sends a SSH_MSG_CHANNEL_EOF message to the remote server.
-
- The channel is closed.
-
-
-
- Waits for the handle to be signaled or for an error to occurs.
-
- The wait handle.
-
-
-
- Closes the channel, waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
-
-
-
-
- Called when an occurs while processing a channel message.
-
- The .
-
- This method will in turn invoke , and
- raise the event.
-
-
-
-
- Determines the length of data that currently can be sent in a single message.
-
- The length of the message that must be sent.
-
- The actual data length that currently can be sent.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Implements "direct-tcpip" SSH channel.
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Occurs as the forwarded port is being stopped.
-
-
-
-
- Binds channel to remote host.
-
-
-
-
- Closes the socket, hereby interrupting the blocking receive in .
-
-
-
-
- Shuts down the socket.
-
- One of the values that specifies the operation that will no longer be allowed.
-
-
-
- Closes the channel, waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
-
-
-
-
- Called when channel data is received.
-
- The data.
-
-
-
- Called when channel is opened by the server.
-
- The remote channel number.
- Initial size of the window.
- Maximum size of the packet.
-
-
-
- Called when channel has no more data to receive.
-
-
-
-
- Called whenever an unhandled occurs in causing
- the message loop to be interrupted, or when an exception occurred processing a channel message.
-
-
-
-
- Called when the server wants to terminate the connection immmediately.
-
-
- The sender MUST NOT send or receive any data after this message, and
- the recipient MUST NOT accept any data after receiving this message.
-
-
-
-
- Implements "forwarded-tcpip" SSH channel.
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
- The remote channel number.
- The window size of the remote party.
- The maximum size of a data packet that we can send to the remote party.
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Binds the channel to the specified endpoint.
-
- The endpoint to connect to.
- The forwarded port for which the channel is opened.
-
-
-
- Occurs as the forwarded port is being stopped.
-
-
-
-
- Shuts down the socket.
-
- One of the values that specifies the operation that will no longer be allowed.
-
-
-
- Closes the socket, hereby interrupting the blocking receive in .
-
-
-
-
- Closes the channel waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
-
-
-
-
- Called when channel data is received.
-
- The data.
-
-
-
- Implements Session SSH channel.
-
-
-
-
- Counts failed channel open attempts
-
-
-
-
- Holds a value indicating whether the session semaphore has been obtained by the current
- channel.
-
-
- 0 when the session semaphore has not been obtained or has already been released,
- and 1 when the session has been obtained and still needs to be released.
-
-
-
-
- Wait handle to signal when response was received to open the channel
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Opens the channel.
-
-
-
-
- Called when channel is opened by the server.
-
- The remote channel number.
- Initial size of the window.
- Maximum size of the packet.
-
-
-
- Called when channel failed to open.
-
- The reason code.
- The description.
- The language.
-
-
-
- Sends the pseudo terminal request.
-
- The environment variable.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode values.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the X11 forwarding request.
-
- if set to true the it is single connection.
- The protocol.
- The cookie.
- The screen number.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the environment variable request.
-
- Name of the variable.
- The variable value.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the shell request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- The command.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- Length of the break.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the subsystem request.
-
- The subsystem.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the window change request.
-
- The columns.
- The rows.
- The width.
- The height.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the local flow request.
-
- if set to true [client can do].
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the signal request.
-
- Name of the signal.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit status request.
-
- The exit status.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit signal request.
-
- Name of the signal.
- if set to true [core dumped].
- The error message.
- The language.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends eow@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends keepalive@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Called when channel request was successful
-
-
-
-
- Called when channel request failed.
-
-
-
-
- Sends the channel open message.
-
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
- When a session semaphore for this instance has not yet been obtained by this or any other thread,
- the thread will block until such a semaphore is available and send a
- to the remote host.
-
-
- Note that the session semaphore is released in any of the following cases:
-
- -
-
A is received for the channel being opened.
-
- -
-
The remote host does not respond to the within the configured .
-
- -
-
The remote host closes the channel.
-
- -
-
The is disposed.
-
- -
-
A socket error occurs sending a message to the remote host.
-
-
-
-
- If the session semaphore was already obtained for this instance (and not released), then this method
- immediately returns control to the caller. This should only happen when another thread has obtain the
- session semaphore and already sent the , but the remote host did not
- confirmed or rejected attempt to open the channel.
-
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases the session semaphore.
-
-
- When the session semaphore has already been released, or was never obtained by
- this instance, then this method does nothing.
-
-
-
-
- Lists channel types as defined by the protocol.
-
-
-
-
- session
-
-
-
-
- x11
-
-
-
-
- forwarded-tcpip
-
-
-
-
- direct-tcpip
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Called when channel is opened by the server.
-
- The remote channel number.
- Initial size of the window.
- Maximum size of the packet.
-
-
-
- Send message to open a channel.
-
- Message to send
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Called when channel failed to open.
-
- The reason code.
- The description.
- The language.
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Represents SSH channel.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when an exception is thrown when processing channel messages.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Gets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the maximum size of a data packet that we can receive using the channel.
-
-
- The maximum size of a packet.
-
-
-
- This is the maximum size (in bytes) we support for the data (payload) of a
- SSH_MSG_CHANNEL_DATA message we receive.
-
-
- We currently do not enforce this limit.
-
-
-
-
-
- Gets the maximum size of a data packet that can be sent using the channel.
-
-
- The maximum size of data that can be sent using a
- on the current channel.
-
- The channel has not been opened, or the open has not yet been confirmed.
-
-
-
- Gets a value indicating whether this channel is open.
-
-
- true if this channel is open; otherwise, false .
-
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- The payload to send.
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- An array of containing the payload to send.
- The zero-based offset in at which to begin taking data from.
- The number of bytes of to send.
-
-
- When the size of the data to send exceeds the maximum packet size or the remote window
- size does not allow the full data to be sent, then this method will send the data in
- multiple chunks and will wait for the remote window size to be adjusted when it's zero.
-
-
- This is done to support SSH servers will a small window size that do not agressively
- increase their window size. We need to take into account that there may be SSH servers
- that only increase their window size when it has reached zero.
-
-
-
-
-
- Sends a SSH_MSG_CHANNEL_EOF message to the remote server.
-
- The channel is closed.
-
-
-
- A "direct-tcpip" SSH channel.
-
-
-
-
- Occurs when an exception is thrown while processing channel messages.
-
-
-
-
- Gets a value indicating whether this channel is open.
-
-
- true if this channel is open; otherwise, false .
-
-
-
-
- Gets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Opens a channel for a locally forwarded TCP/IP port.
-
- The name of the remote host to forward to.
- The port of the remote hosts to forward to.
- The forwarded port for which the channel is opened.
- The socket to receive requests from, and send responses from the remote host to.
-
-
-
- Binds the channel to the remote host.
-
-
-
-
- A "forwarded-tcpip" SSH channel.
-
-
-
-
- Occurs when an exception is thrown while processing channel messages.
-
-
-
-
- Binds the channel to the specified endpoint.
-
- The endpoint to connect to.
- The forwarded port for which the channel is opened.
-
-
-
- Session SSH channel.
-
-
-
-
- Opens the channel.
-
-
-
-
- Sends the pseudo terminal request.
-
- The environment variable.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode values.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the X11 forwarding request.
-
- if set to true the it is single connection.
- The protocol.
- The cookie.
- The screen number.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the environment variable request.
-
- Name of the variable.
- The variable value.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the shell request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- The command.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- Length of the break.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the subsystem request.
-
- The subsystem.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the window change request.
-
- The columns.
- The rows.
- The width.
- The height.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the local flow request.
-
- if set to true [client can do].
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the signal request.
-
- Name of the signal.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit status request.
-
- The exit status.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit signal request.
-
- Name of the signal.
- if set to true [core dumped].
- The error message.
- The language.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends eow@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends keepalive@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
- The remote channel number.
- The window size of the remote party.
- The maximum size of a data packet that we can send to the remote party.
-
-
-
- Holds information about key size and cipher to use
-
-
-
-
- Gets the size of the key.
-
-
- The size of the key.
-
-
-
-
- Gets the cipher.
-
-
-
-
- Initializes a new instance of the class.
-
- Size of the key.
- The cipher.
-
-
-
- Initializes a new instance.
-
- The number of times an authentication attempt with any given can result in before it is disregarded.
- is less than one.
-
-
-
- Gets the number of times an authentication attempt with any given can
- result in before it is disregarded.
-
-
- The number of times an authentication attempt with any given can result
- in before it is disregarded.
-
-
-
-
- Attempts to authentication for a given using the
- of the specified .
-
- A to use for authenticating.
- The for which to perform authentication.
-
-
-
- Records if a given has been tried, and how many times this resulted
- in .
-
-
- When there's no entry for a given , then it was never tried.
-
-
-
-
- Holds the list of authentications methods that failed.
-
-
-
-
- Records a authentication attempt for the specified
- .
-
- An for which to record the result of an authentication attempt.
-
-
-
- Records a authentication attempt for the specified
- .
-
- An for which to record the result of an authentication attempt.
-
-
-
- Returns the number of times an authentication attempt with the specified
- has resulted in .
-
- An .
-
- The number of times an authentication attempt with the specified
- has resulted in .
-
-
-
-
- Returns a list of supported authentication methods that match one of the specified allowed authentication
- methods.
-
- A list of allowed authentication methods.
-
- A list of supported authentication methods that match one of the specified allowed authentication methods.
-
-
- The authentication methods are returned in the order in which they were specified in the list that was
- used to initialize the current instance.
-
-
-
-
- Returns the authentication methods from the specified list that have not yet failed.
-
- A list of authentication methods.
-
- The authentication methods from that have not yet failed.
-
-
-
- This method first returns the authentication methods that have not yet been executed, and only then
- returns those for which an authentication attempt resulted in a .
-
-
- Any that has failed is skipped.
-
-
-
-
-
- Provides additional information for asynchronous command execution
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets or sets the bytes received. If SFTP only file bytes are counted.
-
- Total bytes received.
-
-
-
- Gets or sets the bytes sent by SFTP.
-
- Total bytes sent.
-
-
-
- Gets a user-defined object that qualifies or contains information about an asynchronous operation.
-
- A user-defined object that qualifies or contains information about an asynchronous operation.
-
-
-
- Gets a that is used to wait for an asynchronous operation to complete.
-
- A that is used to wait for an asynchronous operation to complete.
-
-
-
- Gets a value that indicates whether the asynchronous operation completed synchronously.
-
- true if the asynchronous operation completed synchronously; otherwise, false.
-
-
-
- Gets a value that indicates whether the asynchronous operation has completed.
-
- true if the operation is complete; otherwise, false.
-
-
-
- Gets a value indicating whether was already called for this
- .
-
-
- true if was already called for this ;
- otherwise, false .
-
-
-
-
- Base class to encapsulates the results of an asynchronous operation.
-
-
-
-
- Gets or sets a value indicating whether has been called on the current
- .
-
-
- true if has been called on the current ;
- otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Marks asynchronous operation as completed.
-
- The exception.
- if set to true [completed synchronously].
-
-
-
- Waits until the asynchronous operation completes, and then returns.
-
-
-
-
- Gets a user-defined object that qualifies or contains information about an asynchronous operation.
-
- A user-defined object that qualifies or contains information about an asynchronous operation.
-
-
-
- Gets a value that indicates whether the asynchronous operation completed synchronously.
-
- true if the asynchronous operation completed synchronously; otherwise, false.
-
-
-
- Gets a that is used to wait for an asynchronous operation to complete.
-
- A that is used to wait for an asynchronous operation to complete.
-
-
-
- Gets a value that indicates whether the asynchronous operation has completed.
-
-
- true if the operation is complete; otherwise, false .
-
-
-
- Base class to encapsulates the results of an asynchronous operation that returns result.
-
- The type of the result.
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Marks asynchronous operation as completed.
-
- The result.
- if set to true [completed synchronously].
-
-
-
- Waits until the asynchronous operation completes, and then returns the value generated by the asynchronous operation.
-
-
- The invocation result.
-
-
-
-
- Provides data for event.
-
-
-
-
- Gets banner message.
-
-
-
-
- Gets banner language.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- Banner message.
- Banner language.
-
-
-
- Base class for authentication events.
-
-
-
-
- Gets the username.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
-
-
-
- Provides data for event.
-
-
-
-
- Gets or sets the new password.
-
-
- The new password.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
-
-
-
- Provides prompt information when is raised
-
-
-
-
- Gets the prompt sequence id.
-
-
-
-
- Gets or sets a value indicating whether the user input should be echoed as characters are typed.
-
-
- true if the user input should be echoed as characters are typed; otherwise, false .
-
-
-
-
- Gets server information request.
-
-
-
-
- Gets or sets server information response.
-
-
- The response.
-
-
-
-
- Initializes a new instance of the class.
-
- The sequence id.
- if set to true the user input should be echoed.
- The request.
-
-
-
- Provides data for event.
-
-
-
-
- Gets prompt language.
-
-
-
-
- Gets prompt instruction.
-
-
-
-
- Gets server information request prompts.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The instruction.
- The language.
- The information request prompts.
-
-
-
- Represents an arbitrarily large signed integer.
-
-
-
-
- Gets number of bits used by the number.
-
-
- The number of the bit used.
-
-
-
-
- Mods the inverse.
-
- The bi.
- The modulus.
-
- Modulus inverted number.
-
-
-
-
- Returns positive remainder that results from division with two specified values.
-
- The value to be divided.
- The value to divide by.
-
- Positive remainder that results from the division.
-
-
-
-
- Generates a new, random of the specified length.
-
- The number of bits for the new number.
- A random number of the specified length.
-
-
-
- Initializes a new instance of the structure using a 32-bit signed integer value.
-
- A 32-bit signed integer.
-
-
-
- Initializes a new instance of the structure using an unsigned 32-bit integer value.
-
- An unsigned 32-bit integer value.
-
-
-
- Initializes a new instance of the structure using a 64-bit signed integer value.
-
- A 64-bit signed integer.
-
-
-
- Initializes a new instance of the structure with an unsigned 64-bit integer value.
-
- An unsigned 64-bit integer.
-
-
-
- Initializes a new instance of the structure using a double-precision floating-point value.
-
- A double-precision floating-point value.
-
-
-
- Initializes a new instance of the structure using a single-precision floating-point value.
-
- A single-precision floating-point value.
-
-
-
- Initializes a new instance of the structure using a value.
-
- A decimal number.
-
-
-
- Initializes a new instance of the structure using the values in a byte array.
-
- An array of values in little-endian order.
- is null .
-
-
-
- Indicates whether the value of the current object is an even number.
-
-
- true if the value of the BigInteger object is an even number; otherwise, false .
-
-
-
-
- Indicates whether the value of the current object is .
-
-
- true if the value of the object is ;
- otherwise, false .
-
-
-
-
- Indicates whether the value of the current object is a power of two.
-
-
- true if the value of the object is a power of two;
- otherwise, false .
-
-
-
-
- Indicates whether the value of the current object is .
-
-
- true if the value of the object is ;
- otherwise, false .
-
-
-
-
- Gets a number that indicates the sign (negative, positive, or zero) of the current object.
-
-
- A number that indicates the sign of the object.
-
-
-
-
- Gets a value that represents the number negative one (-1).
-
-
- An integer whose value is negative one (-1).
-
-
-
-
- Gets a value that represents the number one (1).
-
-
- An object whose value is one (1).
-
-
-
-
- Gets a value that represents the number 0 (zero).
-
-
- An integer whose value is 0 (zero).
-
-
-
-
- Defines an explicit conversion of a object to a 32-bit signed integer value.
-
- The value to convert to a 32-bit signed integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to an unsigned 32-bit integer value.
-
- The value to convert to an unsigned 32-bit integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a 16-bit signed integer value.
-
- The value to convert to a 16-bit signed integer.
-
- An object that contains the value of the parameter.
-
-
-
-
-
-
-
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to an unsigned byte value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a signed 8-bit value.
-
- The value to convert to a signed 8-bit value.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a 64-bit signed integer value.
-
- The value to convert to a 64-bit signed integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to an unsigned 64-bit integer value.
-
- The value to convert to an unsigned 64-bit integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a single-precision floating-point value.
-
- The value to convert to a single-precision floating-point value.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a signed 32-bit integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a 32-bit unsigned integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a signed 16-bit integer to a BigInteger value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a 16-bit unsigned integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of an unsigned byte to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
-
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a signed 64-bit integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a 64-bit unsigned integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a value to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Adds the values of two specified objects.
-
- The first value to add.
- The second value to add.
-
- The sum of and .
-
-
-
-
- Subtracts a value from another value.
-
- The value to subtract from (the minuend).
- The value to subtract (the subtrahend).
-
- The result of subtracting from .
-
-
-
-
- Multiplies two specified values.
-
- The first value to multiply.
- The second value to multiply.
-
- The product of left and right.
-
-
-
-
- Divides a specified value by another specified value by using
- integer division.
-
- The value to be divided.
- The value to divide by.
-
- The integral result of the division.
-
-
-
-
- Returns the remainder that results from division with two specified values.
-
- The value to be divided.
- The value to divide by.
-
- The remainder that results from the division.
-
-
-
-
- Negates a specified value.
-
- The value to negate.
-
- The result of the parameter multiplied by negative one (-1).
-
-
-
-
- Returns the value of the operand.
-
- An integer value.
-
- The value of the operand.
-
-
- The sign of the operand is unchanged.
-
-
-
-
- Increments a value by 1.
-
- The value to increment.
-
- The value of the parameter incremented by 1.
-
-
-
-
- Decrements a value by 1.
-
- The value to decrement.
-
- The value of the parameter decremented by 1.
-
-
-
-
- Performs a bitwise And operation on two values.
-
- The first value.
- The second value.
-
- The result of the bitwise And operation.
-
-
-
-
- Performs a bitwise Or operation on two values.
-
- The first value.
- The second value.
-
- The result of the bitwise Or operation.
-
-
-
-
- Performs a bitwise exclusive Or (XOr ) operation on two values.
-
- The first value.
- The second value.
-
- The result of the bitwise Or operation.
-
-
-
-
- Returns the bitwise one's complement of a value.
-
- An integer value.
-
- The bitwise one's complement of .
-
-
-
-
- Shifts a value a specified number of bits to the left.
-
- The value whose bits are to be shifted.
- The number of bits to shift value to the left.
-
- A value that has been shifted to the left by the specified number of bits.
-
-
-
-
- Shifts a value a specified number of bits to the right.
-
- The value whose bits are to be shifted.
- The number of bits to shift value to the right.
-
- A value that has been shifted to the right by the specified number of bits.
-
-
-
-
- Returns a value that indicates whether a value is less than another
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than a 64-bit signed integer.
-
- The first value to compare.
- The second value to compare.
-
- true if left is than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is less than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is less than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is less than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than or equal
- to another value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than or equal
- to a 64-bit signed integer.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is less than or equal to a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than or equal to
- a 64-bit unsigned integer.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is less than or equal to a
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than another
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a is greater than a 64-bit signed integer value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is greater than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than a 64-bit unsigned integer.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is greater than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than or equal
- to another value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than or equal
- to a 64-bit signed integer value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is greater than or equal to a
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than or equal to a
- 64-bit unsigned integer value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is greater than or equal to a
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether the values of two objects are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and a signed long integer value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a signed long integer value and a value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and an unsigned long integer value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether an unsigned long integer value and a value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether two objects have different values.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and a 64-bit signed integer are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer and a value are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and a 64-bit unsigned integer are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer and a value are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether the current instance and a specified object have the same value.
-
- The object to compare.
-
- true if the parameter is a object or a type capable
- of implicit conversion to a value, and its value is equal to the value of the
- current object; otherwise, false .
-
-
-
-
- Returns a value that indicates whether the current instance and a specified object
- have the same value.
-
- The object to compare.
-
- true if this object and have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether the current instance and a signed 64-bit integer have the same value.
-
- The signed 64-bit integer value to compare.
-
- true if the signed 64-bit integer and the current instance have the same value; otherwise, false .
-
-
-
-
- Converts the numeric value of the current object to its equivalent string representation.
-
-
- The string representation of the current value.
-
-
-
-
- Converts the numeric value of the current object to its equivalent string representation
- by using the specified format.
-
- A standard or custom numeric format string.
-
- The string representation of the current value in the format specified by the
- parameter.
-
- is not a valid format string.
-
-
-
- Converts the numeric value of the current object to its equivalent string representation
- by using the specified culture-specific formatting information.
-
- An object that supplies culture-specific formatting information.
-
- The string representation of the current value in the format specified by the
- parameter.
-
-
-
-
- Converts the numeric value of the current object to its equivalent string representation
- by using the specified format and culture-specific format information.
-
- A standard or custom numeric format string.
- An object that supplies culture-specific formatting information.
-
- The string representation of the current value as specified by the
- and parameters.
-
-
-
-
- Converts the string representation of a number to its equivalent.
-
- A string that contains the number to convert.
-
- A value that is equivalent to the number specified in the parameter.
-
- is null .
- is not in the correct format.
-
-
-
- Converts the string representation of a number in a specified style to its equivalent.
-
- A string that contains a number to convert.
- A bitwise combination of the enumeration values that specify the permitted format of .
-
- A value that is equivalent to the number specified in the parameter.
-
-
- is not a value.
- -or-
- includes the or flag along with another value.
-
- is null .
- does not comply with the input pattern specified by .
-
-
-
- Converts the string representation of a number in a specified style to its equivalent.
-
- A string that contains a number to convert.
- An object that provides culture-specific formatting information about .
-
- A value that is equivalent to the number specified in the parameter.
-
- is null .
- is not in the correct format.
-
-
-
- Converts the string representation of a number in a specified style and culture-specific format to its equivalent.
-
- A string that contains a number to convert.
- A bitwise combination of the enumeration values that specify the permitted format of .
- An object that provides culture-specific formatting information about .
-
- A value that is equivalent to the number specified in the parameter.
-
-
- is not a value.
- -or-
- includes the or flag along with another value.
-
- is null .
- does not comply with the input pattern specified by .
-
-
-
- Tries to convert the string representation of a number to its equivalent, and
- returns a value that indicates whether the conversion succeeded.
-
- The string representation of a number.
- When this method returns, contains the equivalent to the number that is contained in value, or zero (0) if the conversion fails. The conversion fails if the parameter is null or is not of the correct format. This parameter is passed uninitialized.
-
- true if was converted successfully; otherwise, false .
-
- is null .
-
-
-
- Tries to convert the string representation of a number in a specified style and culture-specific format to its
- equivalent, and returns a value that indicates whether the conversion succeeded.
-
- The string representation of a number.
- A bitwise combination of enumeration values that indicates the style elements that can be present in .
- An object that supplies culture-specific formatting information about .
- When this method returns, contains the equivalent to the number that is contained in value, or if the conversion fails. The conversion fails if the parameter is null or is not of the correct format. This parameter is passed uninitialized.
-
- true if was converted successfully; otherwise, false .
-
-
- is not a value.
- -or-
- includes the or flag along with another value.
-
-
-
-
- Returns the smaller of two values.
-
- The first value to compare.
- The second value to compare.
-
- The or parameter, whichever is smaller.
-
-
-
-
- Returns the larger of two values.
-
- The first value to compare.
- The second value to compare.
-
- The or parameter, whichever is larger.
-
-
-
-
- Gets the absolute value of a object.
-
- A number.
-
- The absolute value of .
-
-
-
-
- Divides one value by another, returns the result, and returns the remainder in
- an output parameter.
-
- The value to be divided.
- The value to divide by.
- When this method returns, contains a value that represents the remainder from the division. This parameter is passed uninitialized.
-
- The quotient of the division.
-
-
-
-
- Raises a value to the power of a specified value.
-
- The number to raise to the power.
- The exponent to raise by.
-
- The result of raising to the power.
-
-
-
-
- Performs modulus division on a number raised to the power of another number.
-
- The number to raise to the power.
- The exponent to raise by.
- The number by which to divide raised to the power.
-
- The remainder after dividing raised by by
- .
-
- is negative.
-
-
-
- Finds the greatest common divisor of two values.
-
- The first value.
- The second value.
-
- The greatest common divisor of and .
-
-
-
-
- Returns the logarithm of a specified number in a specified base.
-
- A number whose logarithm is to be found.
- The base of the logarithm.
-
- The base logarithm of value,
-
- The log of is out of range of the data type.
-
-
-
- Returns the natural (base e ) logarithm of a specified number.
-
- The number whose logarithm is to be found.
-
- The natural (base e ) logarithm of .
-
- The base 10 log of value is out of range of the data type.
-
-
-
- Returns the base 10 logarithm of a specified number.
-
- A number whose logarithm is to be found.
-
- The base 10 logarithm of .
-
- The base 10 log of value is out of range of the data type.
-
-
-
- Returns a value that indicates whether the current instance and an unsigned 64-bit integer have the same value.
-
- The unsigned 64-bit integer to compare.
-
- true if the current instance and the unsigned 64-bit integer have the same value; otherwise, false .
-
-
-
-
- Returns the hash code for the current object.
-
-
- A 32-bit signed integer hash code.
-
-
-
-
- Adds two values and returns the result.
-
- The first value to add.
- The second value to add.
-
- The sum of and .
-
-
-
-
- Subtracts one value from another and returns the result.
-
- The value to subtract from (the minuend).
- The value to subtract (the subtrahend).
-
- The result of subtracting from .
-
-
-
-
- Returns the product of two values.
-
- The first number to multiply.
- The second number to multiply.
-
- The product of the and parameters.
-
-
-
-
- Divides one value by another and returns the result.
-
- The value to be divided.
- The value to divide by.
-
- The quotient of the division.
-
-
-
-
- Performs integer division on two values and returns the remainder.
-
- The value to be divided.
- The value to divide by.
-
- The remainder after dividing by .
-
-
-
-
- Negates a specified value.
-
- The value to negate.
-
- The result of the parameter multiplied by negative one (-1).
-
-
-
-
- Compares this instance to a specified object and returns an integer that indicates whether the value of
- this instance is less than, equal to, or greater than the value of the specified object.
-
- The object to compare.
-
- A signed integer that indicates the relationship of the current instance to the parameter,
- as shown in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
- is not a .
-
-
-
- Compares this instance to a second and returns an integer that indicates whether the
- value of this instance is less than, equal to, or greater than the value of the specified object.
-
- The object to compare.
-
- A signed integer value that indicates the relationship of this instance to , as
- shown in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
-
-
-
- Compares this instance to an unsigned 64-bit integer and returns an integer that indicates whether the value of this
- instance is less than, equal to, or greater than the value of the unsigned 64-bit integer.
-
- The unsigned 64-bit integer to compare.
-
- A signed integer that indicates the relative value of this instance and , as shown
- in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
-
-
-
- Compares this instance to a signed 64-bit integer and returns an integer that indicates whether the value of this
- instance is less than, equal to, or greater than the value of the signed 64-bit integer.
-
- The signed 64-bit integer to compare.
-
- A signed integer that indicates the relative value of this instance and , as shown
- in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
-
-
-
- Compares two values and returns an integer that indicates whether the first value is less than, equal to, or greater than the second value.
-
- The first value to compare.
- The second value to compare.
-
- A signed integer that indicates the relative values of left and right, as shown in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- is less than .
-
- -
-
Zero
- equals .
-
- -
-
Greater than zero
- is greater than .
-
-
-
-
-
-
- Converts a value to a byte array.
-
-
- The value of the current object converted to an array of bytes.
-
-
-
-
- Provides data for event.
-
-
-
-
- Gets channel data.
-
-
-
-
- Initializes a new instance of the class.
-
- Channel number.
- Channel data.
-
-
-
- Base class for all channel related events.
-
-
-
-
- Gets the channel number.
-
-
-
-
- Initializes a new instance of the class.
-
- The channel number.
-
-
-
- Provides data for events.
-
-
-
-
- Initializes a new instance of the class.
-
- Channel number.
- Channel data.
- Channel data type code.
-
-
-
- Gets the data type code.
-
-
-
-
- Provides data for event.
-
-
-
-
- Initializes a new instance of the class.
-
- The remote channel number.
- The initial window size.
- The maximum packet size.
-
-
-
- Gets the initial size of the window.
-
-
- The initial size of the window.
-
-
-
-
- Gets the maximum size of the packet.
-
-
- The maximum size of the packet.
-
-
-
-
- Provides data for event.
-
-
-
-
- Gets failure reason code.
-
-
-
-
- Gets failure description.
-
-
-
-
- Gets failure language.
-
-
-
-
- Initializes a new instance of the class.
-
- Channel number.
- Failure reason code.
- Failure description.
- Failure language.
-
-
-
- Provides data for event.
-
-
-
-
- Gets request information.
-
-
-
-
- Initializes a new instance of the class.
-
- Request information.
-
-
-
- Base class for DER encoded data.
-
-
-
-
- Gets a value indicating whether end of data is reached.
-
-
- true if end of data is reached; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded data.
- its a construct
-
-
-
- Encodes written data as DER byte array.
-
- DER Encoded array.
-
-
-
- Reads next mpint data type from internal buffer.
-
- mpint read.
-
-
-
- Reads next int data type from internal buffer.
-
- int read.
-
-
-
- Reads next octetstring data type from internal buffer.
-
- data read.
-
-
-
- Reads next bitstring data type from internal buffer.
-
- data read.
-
-
-
- Reads next object data type from internal buffer.
-
- data read.
-
-
-
- Writes BOOLEAN data into internal buffer.
-
- UInt32 data to write.
-
-
-
- Writes UInt32 data into internal buffer.
-
- UInt32 data to write.
-
-
-
- Writes INTEGER data into internal buffer.
-
- BigInteger data to write.
-
-
-
- Writes OCTETSTRING data into internal buffer.
-
- The data.
-
-
-
- Writes BITSTRING data into internal buffer.
-
- The data.
-
-
-
- Writes OBJECTIDENTIFIER data into internal buffer.
-
- The identifier.
-
-
-
- Writes OBJECTIDENTIFIER data into internal buffer.
-
- The bytes.
-
-
-
- Writes NULL data into internal buffer.
-
-
-
-
- Writes DerData data into internal buffer.
-
- DerData data to write.
-
-
-
- Gets Data Length
-
- length
-
-
-
- Write Byte data into internal buffer.
-
-
-
-
- Reads Byte data into internal buffer.
-
- data read
-
-
-
- Reads lengths Bytes data into internal buffer.
-
- data read
- amount of data to read.
-
-
-
- Provides data for the ErrorOccured events.
-
-
-
-
- Gets the System.Exception that represents the error that occurred.
-
-
-
-
- Initializes a new instance of the class.
-
- An System.Exception that represents the error that occurred.
-
-
-
- Collection of different extension method
-
-
-
-
- Determines whether the specified value is null or white space.
-
- The value.
-
- true if is null or white space; otherwise, false .
-
-
-
-
- Initializes a new instance of the structure using the SSH BigNum2 Format
-
-
-
-
- Reverses the sequence of the elements in the entire one-dimensional .
-
- The one-dimensional to reverse.
-
- The with its elements reversed.
-
-
-
-
- Prints out
-
- The bytes.
-
-
-
- Creates an instance of the specified type using that type's default constructor.
-
- The type to create.
- Type of the instance to create.
- A reference to the newly created object.
-
-
-
- Returns a specified number of contiguous bytes from a given offset.
-
- The array to return a number of bytes from.
- The zero-based offset in at which to begin taking bytes.
- The number of bytes to take from .
-
- A array that contains the specified number of bytes at the specified offset
- of the input array.
-
- is null .
-
- When is zero and equals the length of ,
- then is returned.
-
-
-
-
- Returns a specified number of contiguous bytes from the start of the specified byte array.
-
- The array to return a number of bytes from.
- The number of bytes to take from .
-
- A array that contains the specified number of bytes at the start of the input array.
-
- is null .
-
- When equals the length of , then
- is returned.
-
-
-
-
- Trims the leading zero from a byte array.
-
- The value.
-
- without leading zeros.
-
-
-
-
- Pads with leading zeros if needed.
-
- The data.
- The length to pad to.
-
-
-
- Provides data for the HostKeyReceived event.
-
-
-
-
- Gets or sets a value indicating whether host key can be trusted.
-
-
- true if host key can be trusted; otherwise, false .
-
-
-
-
- Gets the host key.
-
-
-
-
- Gets the host key name.
-
-
-
-
- Gets the finger print.
-
-
-
-
- Gets the length of the key in bits.
-
-
- The length of the key in bits.
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
-
-
-
- The exception that is thrown when there is something wrong with the server capabilities.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Describes object identifier for DER encoding
-
-
-
-
- Gets the object identifier.
-
-
-
-
- Initializes a new instance of the class.
-
- The identifiers.
-
-
-
- Provides convenience methods for conversion to and from both Big Endian and Little Endian.
-
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- The buffer offset.
- Converted .
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
- The buffer offset.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
-
-
-
- Returns the specified 64-bit unsigned integer value as an array of bytes.
-
- The number to convert.
- An array of bytes with length 8.
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- The buffer offset.
- Converted .
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- PipeStream is a thread-safe read/write data stream for use between two threads in a
- single-producer/single-consumer type problem.
-
- 2006/10/13 1.0
- Update on 2008/10/9 1.1 - uses Monitor instead of Manual Reset events for more elegant synchronicity.
-
- Copyright (c) 2006 James Kolpack (james dot kolpack at google mail)
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
- associated documentation files (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge, publish, distribute,
- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or
- substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
- OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-
- Queue of bytes provides the datastructure for transmitting from an
- input stream to an output stream.
-
- Possible more effecient ways to accomplish this.
-
-
-
- Indicates that the input stream has been flushed and that
- all remaining data should be written to the output stream.
-
-
-
-
- Maximum number of bytes to store in the buffer.
-
-
-
-
- Setting this to true will cause Read() to block if it appears
- that it will run out of data.
-
-
-
-
- Indicates whether the current is disposed.
-
-
-
-
- Gets or sets the maximum number of bytes to store in the buffer.
-
- The length of the max buffer.
-
-
-
- Gets or sets a value indicating whether to block last read method before the buffer is empty.
- When true, Read() will block until it can fill the passed in buffer and count.
- When false, Read() will not block, returning all the available buffer data.
-
-
- Setting to true will remove the possibility of ending a stream reader prematurely.
-
-
- true if block last read method before the buffer is empty; otherwise, false .
-
- Methods were called after the stream was closed.
-
-
-
- When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
-
- An I/O error occurs.
- Methods were called after the stream was closed.
-
- Once flushed, any subsequent read operations no longer block until requested bytes are available. Any write operation reactivates blocking
- reads.
-
-
-
-
- When overridden in a derived class, sets the position within the current stream.
-
-
- The new position within the current stream.
-
- A byte offset relative to the origin parameter.
- A value of type indicating the reference point used to obtain the new position.
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
-
-
-
- When overridden in a derived class, sets the length of the current stream.
-
- The desired length of the current stream in bytes.
- The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.
-
-
-
- When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
-
-
- The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the stream is closed or end of the stream has been reached.
-
- The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- The sum of offset and count is larger than the buffer length.
- Methods were called after the stream was closed.
- The stream does not support reading.
- is null .
- An I/O error occurs.
- offset or count is negative.
-
-
-
- Returns true if there are
-
- The count.
- True if data available; otherwisefalse .
-
-
-
- When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
- An array of bytes. This method copies count bytes from buffer to the current stream.
- An I/O error occurs.
- The stream does not support writing.
- Methods were called after the stream was closed.
- is null .
- The sum of offset and count is greater than the buffer length.
- offset or count is negative.
-
-
-
- Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
- Disposing a will interrupt blocking read and write operations.
-
-
-
-
- When overridden in a derived class, gets a value indicating whether the current stream supports reading.
-
-
- true if the stream supports reading; otherwise, false.
-
-
-
-
- When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
-
-
- true if the stream supports seeking; otherwise, false .
-
-
-
-
- When overridden in a derived class, gets a value indicating whether the current stream supports writing.
-
-
- true if the stream supports writing; otherwise, false .
-
-
-
-
- When overridden in a derived class, gets the length in bytes of the stream.
-
-
- A long value representing the length of the stream in bytes.
-
- A class derived from Stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- When overridden in a derived class, gets or sets the position within the current stream.
-
-
- The current position within the stream.
-
- The stream does not support seeking.
-
-
-
- Provides data for event.
-
-
-
-
- Gets request originator host.
-
-
-
-
- Gets request originator port.
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
- is null .
- is not within and .
-
-
-
- Gets the file name part of a given POSIX path.
-
- The POSIX path to get the file name for.
-
- The file name part of .
-
- is null .
-
-
- If contains no forward slash, then
- is returned.
-
-
- If path has a trailing slash, return a zero-length string.
-
-
-
-
-
- Gets the directory name part of a given POSIX path.
-
- The POSIX path to get the directory name for.
-
- The directory part of the specified , or . if
- does not contain any directory information.
-
- is null .
-
-
-
- The exception that is thrown when a proxy connection cannot be established.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Provides data for the Downloading event.
-
-
-
-
- Gets the downloaded filename.
-
-
-
-
- Gets the downloaded file size.
-
-
-
-
- Gets number of downloaded bytes so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The downloaded filename.
- The downloaded file size.
- The number of downloaded bytes so far.
-
-
-
- The exception that is thrown when SCP error occurred.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Provides data for the Uploading event.
-
-
-
-
- Gets the uploaded filename.
-
-
-
-
- Gets the uploaded file size.
-
-
-
-
- Gets number of uploaded bytes so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The uploaded filename.
- The uploaded file size.
- The number of uploaded bytes so far.
-
-
-
- Light implementation of SemaphoreSlim.
-
-
-
-
- Initializes a new instance of the class, specifying
- the initial number of requests that can be granted concurrently.
-
- The initial number of requests for the semaphore that can be granted concurrently.
- is a negative number.
-
-
-
- Gets the current count of the .
-
-
-
-
- Returns a that can be used to wait on the semaphore.
-
-
- A that can be used to wait on the semaphore.
-
-
- A successful wait on the does not imply a successful
- wait on the itself. It should be followed by a true wait
- on the semaphore.
-
-
-
-
- Exits the once.
-
- The previous count of the .
-
-
-
- Exits the a specified number of times.
-
- The number of times to exit the semaphore.
-
- The previous count of the .
-
-
-
-
- Blocks the current thread until it can enter the .
-
-
-
-
- Blocks the current thread until it can enter the , using a 32-bit signed
- integer that specifies the timeout.
-
- The number of milliseconds to wait, or Infinite(-1) to wait indefinitely.
-
- true if the current thread successfully entered the ; otherwise, false .
-
-
-
-
- Blocks the current thread until it can enter the , using a
- to specify the timeout.
-
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
-
- true if the current thread successfully entered the ; otherwise, false .
-
-
-
-
- Finalizes the current .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- The exception that is thrown when file or directory is not found.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when operation permission is denied.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Provides data for Shell DataReceived event
-
-
-
-
- Gets the data.
-
-
-
-
- Gets the line data.
-
-
-
-
- Initializes a new instance of the class.
-
- The data.
-
-
-
- Initializes a new instance of the class.
-
- The line.
-
-
-
- The exception that is thrown when authentication failed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when connection was terminated.
-
-
-
-
- Gets the disconnect reason if provided by the server or client. Otherwise None.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The disconnect reason code.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The disconnect reason code.
- The inner.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Base ssh data serialization type
-
-
-
-
- Gets the underlying that is used for reading and writing SSH data.
-
-
- The underlying that is used for reading and writing SSH data.
-
-
-
-
- Gets a value indicating whether all data from the buffer has been read.
-
-
- true if this instance is end of data; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets data bytes array.
-
-
- A array representation of data structure.
-
-
-
-
- Writes the current message to the specified .
-
- The to write the message to.
-
-
-
- Loads data from specified bytes.
-
- Bytes array.
- is null .
-
-
-
- Loads data from the specified buffer.
-
- Bytes array.
- The zero-based offset in at which to begin reading SSH data.
- The number of bytes to load.
- is null .
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Reads all data left in internal buffer at current position.
-
- An array of bytes containing the remaining data in the internal buffer.
-
-
-
- Reads next specified number of bytes data type from internal buffer.
-
- Number of bytes to read.
- An array of bytes that was read from the internal buffer.
- is greater than the internal buffer size.
-
-
-
- Reads next byte data type from internal buffer.
-
- Byte read.
-
-
-
- Reads next boolean data type from internal buffer.
-
- Boolean read.
-
-
-
- Reads next uint16 data type from internal buffer.
-
- uint16 read
-
-
-
- Reads next uint32 data type from internal buffer.
-
- uint32 read
-
-
-
- Reads next uint64 data type from internal buffer.
-
- uint64 read
-
-
-
- Reads next string data type from internal buffer using the specific encoding.
-
-
- The read.
-
-
-
-
- Reads next data type as byte array from internal buffer.
-
-
- The bytes read.
-
-
-
-
- Reads next name-list data type from internal buffer.
-
-
- String array or read data.
-
-
-
-
- Reads next extension-pair data type from internal buffer.
-
- Extensions pair dictionary.
-
-
-
- Writes bytes array data into internal buffer.
-
- Byte array data to write.
- is null .
-
-
-
- Writes a sequence of bytes to the current SSH data stream and advances the current position
- within this stream by the number of bytes written.
-
- An array of bytes. This method write bytes from buffer to the current SSH data stream.
- The zero-based offset in at which to begin writing bytes to the SSH data stream.
- The number of bytes to be written to the current SSH data stream.
- is null .
- The sum of and is greater than the buffer length.
- or is negative.
-
-
-
- Writes data into internal buffer.
-
- data to write.
-
-
-
- Writes into internal buffer.
-
- data to write.
-
-
-
- Writes data into internal buffer.
-
- data to write.
-
-
-
- Writes data into internal buffer.
-
- data to write.
-
-
-
- Writes data into internal buffer using default encoding.
-
- data to write.
- is null .
-
-
-
- Writes data into internal buffer using the specified encoding.
-
- data to write.
- The character encoding to use.
- is null .
- is null .
-
-
-
- Writes data into internal buffer.
-
- The data to write.
- is null .
-
-
-
- Writes data into internal buffer.
-
- An array of bytes. This method write bytes from buffer to the current SSH data stream.
- The zero-based byte offset in at which to begin writing bytes to the SSH data stream.
- The number of bytes to be written to the current SSH data stream.
- is null .
- The sum of and is greater than the buffer length.
- or is negative.
-
-
-
- Writes mpint data into internal buffer.
-
- mpint data to write.
-
-
-
- Writes name-list data into internal buffer.
-
- name-list data to write.
-
-
-
- Writes extension-pair data into internal buffer.
-
- extension-pair data to write.
-
-
-
- Specialized for reading and writing data SSH data.
-
-
-
-
- Initializes a new instance of the class with an expandable capacity initialized
- as specified.
-
- The initial size of the internal array in bytes.
-
-
-
- Initializes a new non-resizable instance of the class based on the specified byte array.
-
- The array of unsigned bytes from which to create the current stream.
- is null .
-
-
-
- Initializes a new non-resizable instance of the class based on the specified byte array.
-
- The array of unsigned bytes from which to create the current stream.
- The zero-based offset in at which to begin reading SSH data.
- The number of bytes to load.
- is null .
-
-
-
- Gets a value indicating whether all data from the SSH data stream has been read.
-
-
- true if this instance is end of data; otherwise, false .
-
-
-
-
- Writes an to the SSH data stream.
-
- data to write.
-
-
-
- Writes an to the SSH data stream.
-
- data to write.
-
-
-
- Writes a into the SSH data stream.
-
- The to write.
-
-
-
- Writes bytes array data into the SSH data stream.
-
- Byte array data to write.
- is null .
-
-
-
- Reads a byte array from the SSH data stream.
-
-
- The byte array read from the SSH data stream.
-
-
-
-
- Writes a buffer preceded by its length into the SSH data stream.
-
- The data to write.
- is null .
-
-
-
- Writes a buffer preceded by its length into the SSH data stream.
-
- An array of bytes. This method write bytes from buffer to the current SSH data stream.
- The zero-based byte offset in at which to begin writing bytes to the SSH data stream.
- The number of bytes to be written to the current SSH data stream.
- is null .
- The sum of and is greater than the buffer length.
- or is negative.
-
-
-
- Writes string data to the SSH data stream using the specified encoding.
-
- The string data to write.
- The character encoding to use.
- is null .
- is null .
-
-
-
- Reads a from the SSH datastream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads the next data type from the SSH data stream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads the next data type from the SSH data stream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads the next data type from the SSH data stream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads next specified number of bytes data type from internal buffer.
-
- Number of bytes to read.
-
- An array of bytes that was read from the internal buffer.
-
- is greater than the internal buffer size.
-
-
-
- Writes the stream contents to a byte array, regardless of the .
-
-
- This method returns the contents of the as a byte array.
-
-
- If the current instance was constructed on a provided byte array, a copy of the section of the array
- to which this instance has access is returned.
-
-
-
-
- The exception that is thrown when SSH exception occurs.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when operation is timed out.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when pass phrase for key file is empty or null
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Specifies the initial assignments of the opcode values that are used in the 'encoded terminal modes' valu
-
-
-
-
- Indicates end of options.
-
-
-
-
- Interrupt character; 255 if none. Similarly for the other characters. Not all of these characters are supported on all systems.
-
-
-
-
- The quit character (sends SIGQUIT signal on POSIX systems).
-
-
-
-
- Erase the character to left of the cursor.
-
-
-
-
- Kill the current input line.
-
-
-
-
- End-of-file character (sends EOF from the terminal).
-
-
-
-
- End-of-line character in addition to carriage return and/or linefeed.
-
-
-
-
- Additional end-of-line character.
-
-
-
-
- Continues paused output (normally control-Q).
-
-
-
-
- Pauses output (normally control-S).
-
-
-
-
- Suspends the current program.
-
-
-
-
- Another suspend character.
-
-
-
-
- Reprints the current input line.
-
-
-
-
- Erases a word left of cursor.
-
-
-
-
- Enter the next character typed literally, even if it is a special character
-
-
-
-
- Character to flush output.
-
-
-
-
- Switch to a different shell layer.
-
-
-
-
- Prints system status line (load, command, pid, etc).
-
-
-
-
- Toggles the flushing of terminal output.
-
-
-
-
- The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE, and 1 if it is TRUE.
-
-
-
-
- Mark parity and framing errors.
-
-
-
-
- Enable checking of parity errors.
-
-
-
-
- Strip 8th bit off characters.
-
-
-
-
- Map NL into CR on input.
-
-
-
-
- Ignore CR on input.
-
-
-
-
- Map CR to NL on input.
-
-
-
-
- Translate uppercase characters to lowercase.
-
-
-
-
- Enable output flow control.
-
-
-
-
- Any char will restart after stop.
-
-
-
-
- Enable input flow control.
-
-
-
-
- Ring bell on input queue full.
-
-
-
-
- Terminal input and output is assumed to be encoded in UTF-8.
-
-
-
-
- Enable signals INTR, QUIT, [D]SUSP.
-
-
-
-
- Canonicalize input lines.
-
-
-
-
- Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".
-
-
-
-
- Enable echoing.
-
-
-
-
- Visually erase chars.
-
-
-
-
- Kill character discards current line.
-
-
-
-
- Echo NL even if ECHO is off.
-
-
-
-
- Don't flush after interrupt.
-
-
-
-
- Stop background jobs from output.
-
-
-
-
- Enable extensions.
-
-
-
-
- Echo control characters as ^(Char).
-
-
-
-
- Visual erase for line kill.
-
-
-
-
- Retype pending input.
-
-
-
-
- Enable output processing.
-
-
-
-
- Convert lowercase to uppercase.
-
-
-
-
- Map NL to CR-NL.
-
-
-
-
- Translate carriage return to newline (output).
-
-
-
-
- Translate newline to carriage return-newline (output).
-
-
-
-
- Newline performs a carriage return (output).
-
-
-
-
- 7 bit mode.
-
-
-
-
- 8 bit mode.
-
-
-
-
- Parity enable.
-
-
-
-
- Odd parity, else even.
-
-
-
-
- Specifies the input baud rate in bits per second.
-
-
-
-
- Specifies the output baud rate in bits per second.
-
-
-
-
- Specifies compression modes
-
-
-
-
- Specifies that content should be compressed.
-
-
-
-
- Specifies that content should be decompressed.
-
-
-
-
- Represents base class for compression algorithm implementation
-
-
-
-
- Gets or sets a value indicating whether compression is active.
-
-
- true if compression is active; otherwise, false .
-
-
-
-
- Gets the session.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes the algorithm
-
- The session.
-
-
-
- Compresses the specified data.
-
- Data to compress.
- Compressed data
-
-
-
- Compresses the specified data.
-
- Data to compress.
- The zero-based byte offset in at which to begin reading the data to compress.
- The number of bytes to be compressed.
-
- The compressed data.
-
-
-
-
- Decompresses the specified data.
-
- Compressed data.
-
- The decompressed data.
-
-
-
-
- Decompresses the specified data.
-
- Compressed data.
- The zero-based byte offset in at which to begin reading the data to decompress.
- The number of bytes to be read from the compressed data.
-
- The decompressed data.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the is reclaimed
- by garbage collection.
-
-
-
-
- Represents "zlib" compression implementation
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Initializes the algorithm
-
- The session.
-
-
-
- Represents "zlib@openssh.org" compression implementation
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Initializes the algorithm
-
- The session.
-
-
-
- Implements Zlib compression algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The stream.
- The mode.
-
-
-
- Writes the specified buffer.
-
- The buffer.
- The offset.
- The count.
-
-
-
- Represents remote connection information class.
-
-
- This class is NOT thread-safe. Do not use the same with multiple
- client instances.
-
-
-
-
- The default connection timeout.
-
-
- 30 seconds.
-
-
-
-
- The default channel close timeout.
-
-
- 1 second.
-
-
-
-
- Gets supported key exchange algorithms for this connection.
-
-
-
-
- Gets supported encryptions for this connection.
-
-
-
-
- Gets supported hash algorithms for this connection.
-
-
-
-
- Gets supported host key algorithms for this connection.
-
-
-
-
- Gets supported authentication methods for this connection.
-
-
-
-
- Gets supported compression algorithms for this connection.
-
-
-
-
- Gets the supported channel requests for this connection.
-
-
- The supported channel requests for this connection.
-
-
-
-
- Gets a value indicating whether connection is authenticated.
-
-
- true if connection is authenticated; otherwise, false .
-
-
-
-
- Gets connection host.
-
-
-
-
- Gets connection port.
-
-
- The connection port. The default value is 22.
-
-
-
-
- Gets connection username.
-
-
-
-
- Gets proxy type.
-
-
- The type of the proxy.
-
-
-
-
- Gets proxy connection host.
-
-
-
-
- Gets proxy connection port.
-
-
-
-
- Gets proxy connection username.
-
-
-
-
- Gets proxy connection password.
-
-
-
-
- Gets or sets connection timeout.
-
-
- The connection timeout. The default value is 30 seconds.
-
-
-
-
-
-
-
- Gets or sets the timeout to use when waiting for a server to acknowledge closing a channel.
-
-
- The channel close timeout. The default value is 1 second.
-
-
- If a server does not send a SSH_MSG_CHANNEL_CLOSE message before the specified timeout
- elapses, the channel will be closed immediately.
-
-
-
-
- Gets or sets the character encoding.
-
-
- The character encoding. The default is .
-
-
-
-
- Gets or sets number of retry attempts when session channel creation failed.
-
-
- The number of retry attempts when session channel creation failed. The default
- value is 10.
-
-
-
-
- Gets or sets maximum number of session channels to be open simultaneously.
-
-
- The maximum number of session channels to be open simultaneously. The default
- value is 10.
-
-
-
-
- Occurs when authentication banner is sent by the server.
-
-
-
-
-
-
-
- Gets the current key exchange algorithm.
-
-
-
-
- Gets the current server encryption.
-
-
-
-
- Gets the current client encryption.
-
-
-
-
- Gets the current server hash algorithm.
-
-
-
-
- Gets the current client hash algorithm.
-
-
-
-
- Gets the current host key algorithm.
-
-
-
-
- Gets the current server compression algorithm.
-
-
-
-
- Gets the server version.
-
-
-
-
- Get the client version.
-
-
-
-
- Gets the current client compression algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The username.
- The authentication methods.
- is null .
- is a zero-length string.
- is null , a zero-length string or contains only whitespace characters.
- is null .
- No specified.
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
- The username.
- The authentication methods.
- is null .
- is null , a zero-length string or contains only whitespace characters.
- is not within and .
- is null .
- No specified.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
- The authentication methods.
- is null .
- is null , a zero-length string or contains only whitespace characters.
- is not within and .
- is not and is null .
- is not and is not within and .
- is null .
- No specified.
-
-
-
- Authenticates the specified session.
-
- The session to be authenticated.
- The factory to use for creating new services.
- is null .
- is null .
- No suitable authentication method found to complete authentication, or permission denied.
-
-
-
- Signals that an authentication banner message was received from the server.
-
- The session in which the banner message was received.
- The banner message.{
-
-
-
- Specifies behavior for expected expression
-
-
-
-
- Gets the expected regular expression.
-
-
-
-
- Gets the action to perform when expected expression is found.
-
-
-
-
- Initializes a new instance of the class.
-
- The expect regular expression.
- The action to perform.
- or is null .
-
-
-
- Initializes a new instance of the class.
-
- The expect expression.
- The action to perform.
- or is null .
-
-
-
- Provides additional information for asynchronous command execution
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Base class for port forwarding functionality.
-
-
-
-
- Gets or sets the session.
-
-
- The session.
-
-
-
-
- The event occurs as the forwarded port is being stopped.
-
-
-
-
- The event occurs as the forwarded port is being stopped.
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Occurs when an exception is thrown.
-
-
-
-
- Occurs when a port forwarding request is received.
-
-
-
-
- Starts port forwarding.
-
-
-
-
- Stops port forwarding.
-
-
-
-
- Starts port forwarding.
-
-
-
-
- Stops port forwarding, and waits for the specified timeout until all pending
- requests are processed.
-
- The maximum amount of time to wait for pending requests to finish processing.
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Raises event.
-
- The exception.
-
-
-
- Raises event.
-
- Request originator host.
- Request originator port.
-
-
-
- Raises the event.
-
-
-
-
- Handles session ErrorOccured event.
-
- The source of the event.
- The instance containing the event data.
-
-
-
- Provides functionality for forwarding connections from the client to destination servers via the SSH server,
- also known as dynamic port forwarding.
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
- The port.
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
-
-
-
- Starts local port forwarding.
-
-
-
-
- Stops local port forwarding, and waits for the specified timeout until all pending
- requests are processed.
-
- The maximum amount of time to wait for pending requests to finish processing.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Interrupts the listener, and unsubscribes from events.
-
-
-
-
- Waits for pending channels to close.
-
- The maximum time to wait for the pending channels to close.
-
-
-
- Holds a value indicating whether the current instance is disposed.
-
-
- true if the current instance is disposed; otherwise, false .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Initializes the .
-
-
-
- When the port is started for the first time, a is created with an initial count
- of 1 .
-
-
- On subsequent (re)starts, we'll dispose the current and create a new one with
- initial count of 1 .
-
-
-
-
-
- Reads a null terminated string from a socket.
-
- The to read from.
- The timeout to apply to individual reads.
-
- The read, or null when the socket was closed.
-
-
-
-
- Provides functionality for local port forwarding
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets the forwarded host.
-
-
-
-
- Gets the forwarded port.
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
- The bound port.
- The host.
- The port.
- is greater than .
- is null .
- is greater than .
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The bound host.
- The host.
- The port.
- is null .
- is null .
- is greater than .
-
-
-
- Initializes a new instance of the class.
-
- The bound host.
- The bound port.
- The host.
- The port.
- is null .
- is null .
- is greater than .
- is greater than .
-
-
-
- Starts local port forwarding.
-
-
-
-
- Stops local port forwarding, and waits for the specified timeout until all pending
- requests are processed.
-
- The maximum amount of time to wait for pending requests to finish processing.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Interrupts the listener, and unsubscribes from events.
-
-
-
-
- Waits for pending channels to close.
-
- The maximum time to wait for the pending channels to close.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Initializes the .
-
-
-
- When the port is started for the first time, a is created with an initial count
- of 1 .
-
-
- On subsequent (re)starts, we'll dispose the current and create a new one with
- initial count of 1 .
-
-
-
-
-
- Provides functionality for remote port forwarding
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets the forwarded host.
-
-
-
-
- Gets the forwarded host.
-
-
-
-
- Gets the forwarded port.
-
-
-
-
- Initializes a new instance of the class.
-
- The bound host address.
- The bound port.
- The host address.
- The port.
- is null .
- is null .
- is greater than .
- is greater than .
-
-
-
- Initializes a new instance of the class.
-
- The bound port.
- The host.
- The port.
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The bound host.
- The bound port.
- The host.
- The port.
-
-
-
- Starts remote port forwarding.
-
-
-
-
- Stops remote port forwarding.
-
- The maximum amount of time to wait for the port to stop.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Initializes the .
-
-
-
- When the port is started for the first time, a is created with an initial count
- of 1 .
-
-
- On subsequent (re)starts, we'll dispose the current and create a new one with
- initial count of 1 .
-
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Returns a value indicating whether has been changed to .
-
- The status to transition from.
-
- true if has been changed to ; otherwise, false .
-
- Cannot transition to .
-
- While a transition from to is not possible, this method will
- return false for any such attempts. This is related to concurrency.
-
-
-
-
- Returns a value indicating whether has been changed to .
-
- The status to transition from.
-
- true if has been changed to ; otherwise, false .
-
- Cannot transition to .
-
- While a transition from to is not possible, this method will
- return false for any such attempts. This is related to concurrency.
-
-
-
-
- Holds information about key size and cipher to use
-
-
-
-
- Gets the size of the key.
-
-
- The size of the key.
-
-
-
-
- Gets the cipher.
-
-
-
-
- Initializes a new instance of the class.
-
- Size of the key.
- The hash algorithm to use for a given key.
-
-
-
- Base interface for authentication of a session using a given method.
-
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- The result of the authentication process.
-
-
-
-
- Gets the list of allowed authentications.
-
-
- The list of allowed authentications.
-
-
-
-
- Gets the name of the authentication method.
-
-
- The name of the authentication method.
-
-
-
-
- Signals that an authentication banner message was received from the server.
-
- The session in which the banner message was received.
- The banner message.{
-
-
-
- Gets the supported authentication methods for this connection.
-
-
- The supported authentication methods for this connection.
-
-
-
-
- Creates a for the credentials represented
- by the current .
-
-
- A for the credentials represented by the
- current .
-
-
-
-
- Represents remote connection information.
-
-
-
-
- Gets or sets the timeout to used when waiting for a server to acknowledge closing a channel.
-
-
- The channel close timeout. The default value is 1 second.
-
-
- If a server does not send a SSH2_MSG_CHANNEL_CLOSE message before the specified timeout
- elapses, the channel will be closed immediately.
-
-
-
-
- Gets the supported channel requests for this connection.
-
-
- The supported channel requests for this connection.
-
-
-
-
- Gets the character encoding.
-
-
- The character encoding.
-
-
-
-
- Gets the number of retry attempts when session channel creation failed.
-
-
- The number of retry attempts when session channel creation failed.
-
-
-
-
- Gets or sets connection timeout.
-
-
- The connection timeout. The default value is 30 seconds.
-
-
-
-
-
-
-
- Occurs when authentication banner is sent by the server.
-
-
-
-
- Supports port forwarding functionality.
-
-
-
-
- The event occurs as the forwarded port is being stopped.
-
-
-
-
- Represents a transformation that can be applied to a remote path.
-
-
-
-
- Transforms the specified remote path.
-
- The path to transform.
-
- The transformed path.
-
-
-
-
- Factory for creating new services.
-
-
-
-
- Creates a new with the specified .
-
- The to use for creating a new session.
-
- An for the specified .
-
- is null .
-
-
-
- Creates a new in a given and with
- the specified operation timeout and encoding.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
- The encoding.
- The factory to use for creating SFTP messages.
-
- An .
-
-
-
-
- Create a new .
-
-
- A .
-
-
-
-
- Negotiates a key exchange algorithm, and creates a for the negotiated
- algorithm.
-
- A of the key exchange algorithms supported by the client where the key is the name of the algorithm, and the value is the type implementing this algorithm.
- The names of the key exchange algorithms supported by the SSH server.
-
- A that was negotiated between client and server.
-
- is null .
- is null .
- No key exchange algorithm is supported by both client and server.
-
-
-
- Creates a shell stream.
-
- The SSH session.
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- Size of the buffer.
- The terminal mode values.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Creates an that encloses a path in double quotes, and escapes
- any embedded double quote with a backslash.
-
-
- An that encloses a path in double quotes, and escapes any
- embedded double quote with a backslash.
- with a shell.
-
-
-
-
- Creates a new in a given
- and with the specified operation timeout.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
-
- An .
-
-
-
-
- Provides functionality to connect and interact with SSH server.
-
-
-
-
- Gets or sets the connection info.
-
- The connection info.
-
-
-
- Gets a value indicating whether the session is connected.
-
-
- true if the session is connected; otherwise, false .
-
-
-
-
- Gets the session semaphore that controls session channels.
-
-
- The session semaphore.
-
-
-
-
- Gets a that can be used to wait for the message listener loop to complete.
-
-
- A that can be used to wait for the message listener loop to complete, or
- null when the session has not been connected.
-
-
-
-
- Connects to the server.
-
- Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.
- SSH session could not be established.
- Authentication of SSH session failed.
- Failed to establish proxy connection.
-
-
-
- Create a new SSH session channel.
-
-
- A new SSH session channel.
-
-
-
-
- Create a new channel for a locally forwarded TCP/IP port.
-
-
- A new channel for a locally forwarded TCP/IP port.
-
-
-
-
- Creates a "forwarded-tcpip" SSH channel.
-
-
- A new "forwarded-tcpip" SSH channel.
-
-
-
-
- Disconnects from the server.
-
-
- This sends a SSH_MSG_DISCONNECT message to the server, waits for the
- server to close the socket on its end and subsequently closes the client socket.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Registers SSH message with the session.
-
- The name of the message to register with the session.
-
-
-
- Sends a message to the server.
-
- The message to send.
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Unregister SSH message from the session.
-
- The name of the message to unregister with the session.
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the connection timeout.
-
- The wait handle.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the specified timeout.
-
- The wait handle.
- The time to wait for any of the handles to become signaled.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
- When this method returns , contains the .
-
- A .
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
-
- A .
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when session has been disconnected from the server.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Occurs when host key received.
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Base interface for SSH subsystem implementations.
-
-
-
-
- Gets or set the number of seconds to wait for an operation to complete.
-
-
- The number of seconds to wait for an operation to complete, or -1 to wait indefinitely.
-
-
-
-
- Gets a value indicating whether this session is open.
-
-
- true if this session is open; otherwise, false .
-
-
-
-
- Connects the subsystem using a new SSH channel session.
-
- The session is already connected.
- The method was called after the session was disposed.
-
-
-
- Disconnects the subsystem channel.
-
-
-
-
- Waits a specified time for a given to get signaled.
-
- The handle to wait for.
- The number of millieseconds wait for to get signaled, or -1 to wait indefinitely.
- The connection was closed by the server.
- The channel was closed.
- The handle did not get signaled within the specified timeout.
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The handle to wait for.
- To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
-
- true if received a signal within the specified timeout;
- otherwise, false .
-
- The connection was closed by the server.
- The channel was closed.
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The first handle to wait for.
- The second handle to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- 0 if received a signal within the specified timeout and 1
- if received a signal within the specified timeout, or
- if no object satisfied the wait.
-
- The connection was closed by the server.
- The channel was closed.
-
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
- When both and are signaled during the call,
- then 0 is returned.
-
-
-
-
-
- Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed
- integer to specify the time interval.
-
- A array - constructed using - containing the objects to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- The array index of the first non-system object that satisfied the wait.
-
- The connection was closed by the server.
- The channel was closed.
- No object satified the wait and a time interval equivalent to has passed.
-
- For the return value, the index of the first non-system object is considered to be zero.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- A array containing the objects to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- The first to wait for.
- The second to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Provides functionality to perform keyboard interactive authentication.
-
-
-
-
- Gets authentication method name
-
-
-
-
- Occurs when server prompts for more authentication information.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
- Result of authentication process.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides connection information when keyboard interactive authentication method is used
-
-
-
-
-
-
-
- Occurs when server prompts for more authentication information.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The username.
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
- The username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides data for message events.
-
- Message type
-
-
-
- Gets the message.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
- is null .
-
-
-
- Represents SSH_MSG_USERAUTH_BANNER message.
-
-
-
-
- Gets banner message.
-
-
-
-
- Gets banner language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_FAILURE message.
-
-
-
-
- Gets or sets the allowed authentications if available.
-
-
- The allowed authentications.
-
-
-
-
- Gets failure message.
-
-
-
-
- Gets a value indicating whether authentication is partially successful.
-
-
- true if partially successful; otherwise, false .
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_INFO_REQUEST message.
-
-
-
-
- Gets information request name.
-
-
-
-
- Gets information request instruction.
-
-
-
-
- Gets information request language.
-
-
-
-
- Gets information request prompts.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_INFO_RESPONSE message.
-
-
-
-
- Gets authentication responses.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- -1 to indicate that the size of the message cannot be determined,
- or is too costly to calculate.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_PASSWD_CHANGEREQ message.
-
-
-
-
- Gets password change request message as UTF-8 encoded byte array.
-
-
-
-
- Gets message language as UTF-8 encoded byte array.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_PK_OK message.
-
-
-
-
- Gets the name of the public key algorithm as ASCII encoded byte array.
-
-
- The name of the public key algorithm.
-
-
-
-
- Gets the public key data.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_REQUEST message. Server as a base message for other user authentication requests.
-
-
-
-
- Returns the authentication message code for SSH_MSG_USERAUTH_REQUEST .
-
-
-
-
- Gets authentication username as UTF-8 encoded byte array.
-
-
-
-
- Gets the name of the service as ASCII encoded byte array.
-
-
- The name of the service.
-
-
-
-
- Gets the name of the authentication method.
-
-
- The name of the method.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- The name of the authentication method.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "hostbased" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets the public key algorithm for host key as ASCII encoded byte array.
-
-
-
-
- Gets or sets the public host key and certificates for client host.
-
-
- The public host key.
-
-
-
-
- Gets or sets the name of the client host as ASCII encoded byte array.
-
-
- The name of the client host.
-
-
-
-
- Gets or sets the client username on the client host as UTF-8 encoded byte array.
-
-
- The client username.
-
-
-
-
- Gets or sets the signature.
-
-
- The signature.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- The public key algorithm.
- The public host key.
- Name of the client host.
- The client username.
- The signature.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "keyboard-interactive" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets authentication sub methods.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "none" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
-
-
-
- Represents "password" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets authentication password.
-
-
-
-
- Gets new authentication password.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Authentication password.
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Authentication password.
- New authentication password.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "publickey" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets the name of the public key algorithm as ASCII encoded byte array.
-
-
- The name of the public key algorithm.
-
-
-
-
- Gets the public key data.
-
-
-
-
- Gets or sets public key signature.
-
-
- The signature.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Name of private key algorithm.
- Private key data.
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Name of private key algorithm.
- Private key data.
- Private key signature.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_SUCCESS message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Gets the address to bind to.
-
-
-
-
- Gets port number to bind to.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_CLOSE message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Represents SSH_MSG_CHANNEL_DATA message.
-
-
-
-
- Gets or sets message data.
-
-
- The data.
-
-
- The actual data to read or write depends on the and .
-
-
-
-
- Gets the zero-based offset in at which the data begins.
-
-
- The zero-based offset in at which the data begins.
-
-
-
-
- Gets the number of bytes of to read or write.
-
-
- The number of bytes of to read or write.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- Message data.
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The message data.
- The zero-based byte offset in at which to begin reading or writing data from.
- The number of bytes of to read or write.
-
-
-
- Loads the data.
-
-
-
-
- Saves the data.
-
-
-
-
- Represents SSH_MSG_CHANNEL_EOF message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Represents SSH_MSG_CHANNEL_EXTENDED_DATA message.
-
-
-
-
- Gets message data type code.
-
-
-
-
- Gets message data.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The message data type code.
- The message data.
-
-
-
- Loads the data.
-
-
-
-
- Saves the data.
-
-
-
-
- Represents SSH_MSG_CHANNEL_FAILURE message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Base class for all channel specific SSH messages.
-
-
-
-
- Gets or sets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new .
-
-
-
-
- Initializes a new with the specified local channel number.
-
- The local channel number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Represents SSH_MSG_CHANNEL_OPEN_CONFIRMATION message.
-
-
-
-
- Gets the remote channel number.
-
-
-
-
- Gets the initial size of the window.
-
-
- The initial size of the window.
-
-
-
-
- Gets the maximum size of the packet.
-
-
- The maximum size of the packet.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- Initial size of the window.
- Maximum size of the packet.
- The remote channel number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_OPEN_FAILURE message.
-
-
-
-
- Gets failure reason code.
-
-
-
-
- Gets description for failure.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The description.
- The reason code.
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The description.
- The reason code.
- The language (RFC3066).
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- List channel open failure reasons defined by the protocol.
-
-
-
-
- SSH_OPEN_ADMINISTRATIVELY_PROHIBITED
-
-
-
-
- SSH_OPEN_CONNECT_FAILED
-
-
-
-
- SSH_OPEN_UNKNOWN_CHANNEL_TYPE
-
-
-
-
- SSH_OPEN_RESOURCE_SHORTAGE
-
-
-
-
- Base class for open channel messages
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_OPEN message.
-
-
-
-
- Gets the type of the channel as ASCII encoded byte array.
-
-
- The type of the channel.
-
-
-
-
- Gets or sets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the initial size of the window.
-
-
- The initial size of the window.
-
-
-
-
- Gets the maximum size of the packet.
-
-
- The maximum size of the packet.
-
-
-
-
- Gets channel specific open information.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The channel number.
- Initial size of the window.
- Maximum size of the packet.
- Information specific to the type of the channel to open.
- is null .
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Used to open "direct-tcpip" channel type
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Gets the host to connect.
-
-
-
-
- Gets the port to connect.
-
-
-
-
- Gets the originator address.
-
-
-
-
- Gets the originator port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Initializes a new instance of the class.
-
- The host to connect.
- The port to connect.
- The originator address.
- The originator port.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Used to open "forwarded-tcpip" channel type
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Initializes a new instance with the specified connector
- address and port, and originator address and port.
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Gets the connected address.
-
-
-
-
- Gets the connected port.
-
-
-
-
- Gets the originator address.
-
-
-
-
- Gets the originator port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Used to open "session" channel type
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Used to open "x11" channel type
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Gets the originator address.
-
-
-
-
- Gets the originator port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Initializes a new instance of the class with the
- specified originator address and port.
-
- The originator address.
- The originator port.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "break" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets break length in milliseconds.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Length of the break.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_REQUEST message.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets channel request data.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The info.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "eow@openssh.com" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents "env" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets the name of the variable.
-
-
- The name of the variable.
-
-
-
-
- Gets or sets the variable value.
-
-
- The variable value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the variable.
- The variable value.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "exec" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets command to execute.
-
-
- The command.
-
-
-
-
- Gets the encoding.
-
-
- The encoding.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The command.
- The character encoding to use.
- or is null .
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "exit-signal" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the name of the signal.
-
-
- The name of the signal.
-
-
-
-
- Gets a value indicating whether core is dumped.
-
-
- true if core is dumped; otherwise, false .
-
-
-
-
- Gets the error message.
-
-
-
-
- Gets message language.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the signal.
- if set to true then core is dumped.
- The error message.
- The language.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "exit-status" type channel request information
-
-
-
-
- Channel request name.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the exit status number.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The exit status number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "keepalive@openssh.com" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents "pty-req" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets the value of the TERM environment variable (e.g., vt100).
-
-
- The value of the TERM environment variable.
-
-
-
-
- Gets or sets the terminal width in columns (e.g., 80).
-
-
- The terminal width in columns.
-
-
-
-
- Gets or sets the terminal width in rows (e.g., 24).
-
-
- The terminal width in rows.
-
-
-
-
- Gets or sets the terminal width in pixels (e.g., 640).
-
-
- The terminal width in pixels.
-
-
-
-
- Gets or sets the terminal height in pixels (e.g., 480).
-
-
- The terminal height in pixels.
-
-
-
-
- Gets or sets the terminal mode.
-
-
- The terminal mode.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- -1 to indicate that the size of the message cannot be determined,
- or is too costly to calculate.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The TERM environment variable which a identifier for the text window’s capabilities.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The terminal mode values.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents type specific information for channel request.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets a value indicating whether reply message is needed.
-
-
- true if reply message is needed; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "shell" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents "signal" type channel request information
-
-
-
-
- Channel request name.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the name of the signal.
-
-
- The name of the signal.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the signal.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "subsystem" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the name of the subsystem.
-
-
- The name of the subsystem.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The subsystem.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "window-change" type channel request information
-
-
-
-
- Channe request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the columns.
-
-
-
-
- Gets the rows.
-
-
-
-
- Gets the width.
-
-
-
-
- Gets the height.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The columns.
- The rows.
- The width.
- The height.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "x11-req" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets a value indicating whether it is a single connection.
-
-
- true if it is a single connection; otherwise, false .
-
-
-
-
- Gets or sets the authentication protocol.
-
-
- The authentication protocol.
-
-
-
-
- Gets or sets the authentication cookie.
-
-
- The authentication cookie.
-
-
-
-
- Gets or sets the screen number.
-
-
- The screen number.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- if set to true it is a single connection.
- The protocol.
- The cookie.
- The screen number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "xon-xoff" type channel request information
-
-
-
-
- Channel request type
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets a value indicating whether client can do.
-
-
- true if client can do; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- if set to true [client can do].
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_SUCCESS message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Represents SSH_MSG_CHANNEL_SUCCESS message.
-
-
-
-
- Gets number of bytes to add to the window.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The bytes to add.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_GLOBAL_REQUEST message.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets a value indicating whether message reply should be sent..
-
-
- true if message reply should be sent; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the request.
- if set to true [want reply].
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Specifies supported request names.
-
-
-
-
- tcpip-forward
-
-
-
-
- cancel-tcpip-forward
-
-
-
-
- Represents SSH_MSG_REQUEST_FAILURE message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_REQUEST_SUCCESS message.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The bound port.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Gets the address to bind to.
-
-
-
-
- Gets port number to bind to.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Base class for all SSH protocol messages
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Writes the message to the specified .
-
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Process the current message for the specified .
-
- The for which to process the current message.
-
-
-
- Indicates that a class represents SSH message. This class cannot be inherited.
-
-
-
-
- Gets or sets message name as defined in RFC 4250.
-
-
- The name.
-
-
-
-
- Gets or sets message number as defined in RFC 4250.
-
-
- The number.
-
-
-
-
- Initializes a new instance of the class.
-
- The name.
- The number.
-
-
-
- Specifies list of supported services
-
-
-
-
- ssh-userauth
-
-
-
-
- ssh-connection
-
-
-
-
- Represents SSH_MSG_DEBUG message.
-
-
-
-
- Gets a value indicating whether the message to be always displayed.
-
-
- true if the message always to be displayed; otherwise, false .
-
-
-
-
- Gets debug message.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_DISCONNECT message.
-
-
-
-
- Gets disconnect reason code.
-
-
-
-
- Gets disconnect description.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The reason code.
- The message.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Provides list of disconnect reason as specified by the protocol.
-
-
-
-
- Disconnect reason is not provided.
-
-
-
-
- SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT
-
-
-
-
- SSH_DISCONNECT_PROTOCOL_ERROR
-
-
-
-
- SSH_DISCONNECT_KEY_EXCHANGE_FAILED
-
-
-
-
- SSH_DISCONNECT_RESERVED
-
-
-
-
- SSH_DISCONNECT_MAC_ERROR
-
-
-
-
- SSH_DISCONNECT_COMPRESSION_ERROR
-
-
-
-
- SSH_DISCONNECT_SERVICE_NOT_AVAILABLE
-
-
-
-
- SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED
-
-
-
-
- SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE
-
-
-
-
- SSH_DISCONNECT_CONNECTION_LOST
-
-
-
-
- SSH_DISCONNECT_BY_APPLICATION
-
-
-
-
- SSH_DISCONNECT_TOO_MANY_CONNECTIONS
-
-
-
-
- SSH_DISCONNECT_AUTH_CANCELLED_BY_USER
-
-
-
-
- SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE
-
-
-
-
- SSH_DISCONNECT_ILLEGAL_USER_NAME
-
-
-
-
- Represents SSH_MSG_IGNORE message.
-
-
-
-
- Gets ignore message data if any.
-
-
-
-
- Initializes a new instance of the class
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The data.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Indicates that message that implement this interface is allowed during key exchange phase
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_GROUP message.
-
-
-
-
- Gets or sets the safe prime.
-
-
- The safe prime.
-
-
-
-
- Gets or sets the generator for subgroup in GF(p).
-
-
- The sub group.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_INIT message.
-
-
-
-
- Gets the E value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The client exchange value.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_REPLY message.
-
-
-
-
- Gets server public host key and certificates
-
- The host key.
-
-
-
- Gets the F value.
-
-
-
-
- Gets the signature of H.
-
- The signature.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_REQUEST message.
-
-
-
-
- Gets or sets the minimal size in bits of an acceptable group.
-
-
- The minimum.
-
-
-
-
- Gets or sets the preferred size in bits of the group the server will send.
-
-
- The preferred.
-
-
-
-
- Gets or sets the maximal size in bits of an acceptable group.
-
-
- The maximum.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The minimum.
- The preferred.
- The maximum.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXDH_INIT message.
-
-
-
-
- Gets the E value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The client exchange value.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXDH_REPLY message.
-
-
-
-
- Gets server public host key and certificates
-
- The host key.
-
-
-
- Gets the F value.
-
-
-
-
- Gets the signature of H.
-
- The signature.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXECDH_INIT message.
-
-
-
-
- Gets the client's ephemeral contribution to the ECDH exchange, encoded as an octet string
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXECDH_REPLY message.
-
-
-
-
- Gets a string encoding an X.509v3 certificate containing the server's ECDSA public host key
-
- The host key.
-
-
-
- Gets the server's ephemeral contribution to the ECDH exchange, encoded as an octet string.
-
-
-
-
- Gets an octet string containing the server's signature of the newly established exchange hash value.
-
- The signature.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXINIT message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets session cookie.
-
-
-
-
- Gets or sets supported key exchange algorithms.
-
-
- Supported key exchange algorithms.
-
-
-
-
- Gets or sets supported server host key algorithms.
-
-
- Supported server host key algorithms.
-
-
-
-
- Gets or sets supported encryption algorithms client to server.
-
-
- Supported encryption algorithms client to server.
-
-
-
-
- Gets or sets supported encryption algorithms server to client.
-
-
- Supported encryption algorithms server to client.
-
-
-
-
- Gets or sets supported hash algorithms client to server.
-
-
- Supported hash algorithms client to server.
-
-
-
-
- Gets or sets supported hash algorithms server to client.
-
-
- Supported hash algorithms server to client.
-
-
-
-
- Gets or sets supported compression algorithms client to server.
-
-
- Supported compression algorithms client to server.
-
-
-
-
- Gets or sets supported compression algorithms server to client.
-
-
- Supported compression algorithms server to client.
-
-
-
-
- Gets or sets supported languages client to server.
-
-
- Supported languages client to server.
-
-
-
-
- Gets or sets supported languages server to client.
-
-
- The languages server to client.
-
-
-
-
- Gets or sets a value indicating whether first key exchange packet follows.
-
-
- true if first key exchange packet follows; otherwise, false .
-
-
-
-
- Gets or sets the reserved value.
-
-
- The reserved value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- -1 to indicate that the size of the message cannot be determined,
- or is too costly to calculate.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_NEWKEYS message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_SERVICE_ACCEPT message.
-
-
-
-
- Gets the name of the service.
-
-
- The name of the service.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_SERVICE_REQUEST message.
-
-
-
-
- Gets the name of the service.
-
-
- The name of the service.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_UNIMPLEMENTED message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Contains operation for working with NetConf server.
-
-
-
-
- Holds instance that used to communicate to the server
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout to wait until an operation completes. The default value is negative
- one (-1) milliseconds, which indicates an infinite time-out period.
-
- represents a value that is less than -1 or greater than milliseconds.
-
-
-
- Gets the current NetConf session.
-
-
- The current NetConf session.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Gets the NetConf server capabilities.
-
-
- The NetConf server capabilities.
-
-
-
-
- Gets the NetConf client capabilities.
-
-
- The NetConf client capabilities.
-
-
-
-
- Gets or sets a value indicating whether automatic message id handling is
- enabled.
-
-
- true if automatic message id handling is enabled; otherwise, false .
- The default value is true .
-
-
-
-
- Sends the receive RPC.
-
- The RPC.
- Reply message to RPC request
- Client is not connected.
-
-
-
- Sends the receive RPC.
-
- The XML.
- Reply message to RPC request
-
-
-
- Sends the close RPC.
-
- Reply message to closing RPC request
- Client is not connected.
-
-
-
- Called when client is connected to the server.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Gets the NetConf server capabilities.
-
-
- The NetConf server capabilities.
-
-
-
-
- Gets the NetConf client capabilities.
-
-
- The NetConf client capabilities.
-
-
-
-
- Gets NetConf server capabilities.
-
-
-
-
- Gets NetConf client capabilities.
-
-
-
-
- Initializes a new instance of the class.
-
- The session.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
-
-
-
- Provides functionality for "none" authentication method
-
-
-
-
- Gets connection name
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session.
-
- Result of authentication process.
-
- is null .
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides functionality to perform password authentication.
-
-
-
-
- Gets authentication method name
-
-
-
-
- Gets the password as a sequence of bytes.
-
-
- The password as a sequence of bytes.
-
-
-
-
- Occurs when user's password has expired and needs to be changed.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The password.
- is whitespace or null .
- is null .
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The password.
- is whitespace or null .
- is null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- Result of authentication process.
-
- is null .
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides connection information when password authentication method is used
-
-
-
-
-
-
-
-
-
- Occurs when user's password has expired and needs to be changed.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
-
-
-
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Connection password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Connection password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides functionality to perform private key authentication.
-
-
-
-
- Gets authentication method name
-
-
-
-
- Gets the key files used for authentication.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The key files.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- Result of authentication process.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides connection information when private key authentication method is used
-
-
-
-
-
-
-
- Gets the key files used for authentication.
-
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection key files.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Connection key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
- The key files.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Represents private key information.
-
-
-
-
-
-
- The following private keys are supported:
-
- -
-
RSA in OpenSSL PEM and ssh.com format
-
- -
-
DSA in OpenSSL PEM and ssh.com format
-
- -
-
ECDSA 256/384/521 in OpenSSL PEM format
-
- -
-
ED25519 in OpenSSH key format
-
-
-
-
- The following encryption algorithms are supported:
-
- -
-
DES-EDE3-CBC
-
- -
-
DES-EDE3-CFB
-
- -
-
DES-CBC
-
- -
-
AES-128-CBC
-
- -
-
AES-192-CBC
-
- -
-
AES-256-CBC
-
-
-
-
-
-
-
- Gets the host key.
-
-
-
-
- Initializes a new instance of the class.
-
- The private key.
-
-
-
- Initializes a new instance of the class.
-
- Name of the file.
- is null or empty.
- This method calls internally, this method does not catch exceptions from .
-
-
-
- Initializes a new instance of the class.
-
- Name of the file.
- The pass phrase.
- is null or empty, or is null .
- This method calls internally, this method does not catch exceptions from .
-
-
-
- Initializes a new instance of the class.
-
- The private key.
- The pass phrase.
- or is null .
-
-
-
- Opens the specified private key.
-
- The private key.
- The pass phrase.
-
-
-
- Decrypts encrypted private key file data.
-
- The cipher info.
- Encrypted data.
- Decryption pass phrase.
- Decryption binary salt.
- Decrypted byte array.
- , , or is null .
-
-
-
- Parses an OpenSSH V1 key file (i.e. ED25519 key) according to the the key spec:
- https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key.
-
- the key file data (i.e. base64 encoded data between the header/footer)
- passphrase or null if there isn't one
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Reads next mpint data type from internal buffer where length specified in bits.
-
- mpint read.
-
-
-
- Specifies the type of proxy client will use to connect to server.
-
-
-
- No proxy server.
-
-
- A SOCKS4 proxy server.
-
-
- A SOCKS5 proxy server.
-
-
- A HTTP proxy server.
-
-
-
- Encloses a path in double quotes, and escapes any embedded double quote with a backslash.
-
-
-
-
- Encloses a path in double quotes, and escapes any embedded double quote with a backslash.
-
- The path to transform.
-
- The transformed path.
-
- is null .
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- "/var/log/auth.log"
-
- -
-
/var/mp3/Guns N' Roses
- "/var/mp3/Guns N' Roses"
-
- -
-
/var/garbage!/temp
- "/var/garbage!/temp"
-
- -
-
/var/would be 'kewl'!/not?
- "/var/would be 'kewl'!, not?"
-
- -
-
- ""
-
- -
-
Hello "World"
- "Hello \"World"
-
-
-
-
-
-
- Performs no transformation.
-
-
-
-
- Returns the specified path without applying a transformation.
-
- The path to transform.
-
- The specified path as is.
-
- is null .
-
- This transformation is recommended for servers that do not require any quoting to preserve the
- literal value of metacharacters, or when paths are guaranteed to never contain any such characters.
-
-
-
-
- Quotes a path in a way to be suitable to be used with a shell-based server.
-
-
-
-
- Quotes a path in a way to be suitable to be used with a shell-based server.
-
- The path to transform.
-
- A quoted path.
-
- is null .
-
-
- If contains a single-quote, that character is embedded
- in quotation marks (eg. "'"). Sequences of single-quotes are grouped in a single
- pair of quotation marks.
-
-
- An exclamation mark in is escaped with a backslash. This is
- necessary because C Shell interprets it as a meta-character for history substitution
- even when enclosed in single quotes or quotation marks.
-
-
- All other characters are enclosed in single quotes. Sequences of such characters are grouped
- in a single pair of single quotes.
-
-
- References:
-
- -
-
Shell Command Language
-
- -
-
Unix C-Shell special characters and their uses
-
- -
-
Differences Between Bourne and C Shell Quoting
-
-
-
-
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- '/var/log/auth.log'
-
- -
-
/var/mp3/Guns N' Roses
- '/var/mp3/Guns N'"'"' Roses'
-
- -
-
/var/garbage!/temp
- '/var/garbage'\!'/temp'
-
- -
-
/var/would be 'kewl'!, not?
- '/var/would be '"'"'kewl'"'"\!', not?'
-
- -
-
- ''
-
- -
-
Hello "World"
- 'Hello "World"'
-
-
-
-
-
-
- Provides access to built-in remote path transformations.
-
-
- References:
-
- -
-
Shell Command Language
-
- -
-
Unix C-Shell special characters and their uses
-
- -
-
Differences Between Bourne and C Shell Quoting
-
- -
-
Everyone quotes command line arguments the wrong way
-
-
-
-
-
-
- Quotes a path in a way to be suitable to be used with a shell-based server.
-
-
- A quoted path.
-
-
-
- If a path contains a single-quote, that character is embedded in quotation marks (eg. "'").
- Sequences of single-quotes are grouped in a single pair of quotation marks.
-
-
- An exclamation mark in a path is escaped with a backslash. This is necessary because C Shell
- interprets it as a meta-character for history substitution even when enclosed in single quotes
- or quotation marks.
-
-
- All other characters are enclosed in single quotes. Sequences of such characters are grouped
- in a single pair of single quotes.
-
-
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- '/var/log/auth.log'
-
- -
-
/var/mp3/Guns N' Roses
- '/var/mp3/Guns N'"'"' Roses'
-
- -
-
/var/garbage!/temp
- '/var/garbage'\!'/temp'
-
- -
-
/var/would be 'kewl'!, not?
- '/var/would be '"'"'kewl'"'"\!', not?'
-
- -
-
- ''
-
- -
-
Hello "World"
- 'Hello "World"'
-
-
-
-
-
-
- Performs no transformation.
-
-
- Recommended for servers that do not require any character to be escaped or enclosed in quotes,
- or when paths are guaranteed to never contain any special characters (such as #, ", ', $, ...).
-
-
-
-
- Encloses a path in double quotes, and escapes any embedded double quote with a backslash.
-
-
- A transformation that encloses a path in double quotes, and escapes any embedded double quote with
- a backslash.
-
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- "/var/log/auth.log"
-
- -
-
/var/mp3/Guns N' Roses
- "/var/mp3/Guns N' Roses"
-
- -
-
/var/garbage!/temp
- "/var/garbage!/temp"
-
- -
-
/var/would be 'kewl'!, not?
- "/var/would be 'kewl'!, not?"
-
- -
-
- ""
-
- -
-
Hello "World"
- "Hello \"World"
-
-
-
-
-
-
- Provides SCP client functionality.
-
-
-
- More information on the SCP protocol is available here:
- https://github.com/net-ssh/net-scp/blob/master/lib/net/scp.rb
-
-
- Known issues in OpenSSH:
-
- -
-
Recursive download (-prf) does not deal well with specific UTF-8 and newline characters.
- Recursive update does not support empty path for uploading to home directory.
-
-
-
-
-
- Provides SCP client functionality.
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout to wait until an operation completes. The default value is negative
- one (-1) milliseconds, which indicates an infinite time-out period.
-
-
-
-
- Gets or sets the size of the buffer.
-
-
- The size of the buffer. The default buffer size is 16384 bytes.
-
-
-
-
- Gets or sets the transformation to apply to remote paths.
-
-
- The transformation to apply to remote paths. The default is .
-
- is null .
-
-
- This transformation is applied to the remote file or directory path that is passed to the
- scp command.
-
-
- See for the transformations that are supplied
- out-of-the-box with SSH.NET.
-
-
-
-
-
- Occurs when downloading file.
-
-
-
-
- Occurs when uploading file.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Uploads the specified stream to the remote host.
-
- The to upload.
- A relative or absolute path for the remote file.
- is null .
- is a zero-length .
- A directory with the specified path exists on the remote host.
- The secure copy execution request was rejected by the server.
-
-
-
- Downloads the specified file from the remote host to the stream.
-
- A relative or absolute path for the remote file.
- The to download the remote file to.
- is null or contains only whitespace characters.
- is null .
- exists on the remote host, and is not a regular file.
- The secure copy execution request was rejected by the server.
-
-
-
- Sets mode, size and name of file being upload.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The size of the content to upload.
- The name of the file, without path, to which the content is to be uploaded.
-
-
- When the SCP transfer is already initiated for a file, a zero-length should
- be specified for . This prevents the server from uploading the
- content to a file with path <file path>/ if there's
- already a directory with this path, and allows us to receive an error response.
-
-
-
-
-
- Uploads the content of a file.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The content to upload.
- The name of the remote file, without path, to which the content is uploaded.
-
- is only used for raising the event.
-
-
-
-
- Checks the return code.
-
- The output stream.
-
-
-
- Read a LF-terminated string from the .
-
- The to read from.
-
- The string without trailing LF.
-
-
-
-
- Uploads the specified file to the remote host.
-
- The file system info.
- A relative or absolute path for the remote file.
- is null .
- is null .
- is a zero-length .
- A directory with the specified path exists on the remote host.
- The secure copy execution request was rejected by the server.
-
-
-
- Uploads the specified directory to the remote host.
-
- The directory info.
- A relative or absolute path for the remote directory.
- is null .
- is null .
- is a zero-length string.
- does not exist on the remote host, is not a directory or the user does not have the required permission.
- The secure copy execution request was rejected by the server.
-
-
-
- Downloads the specified file from the remote host to local file.
-
- Remote host file name.
- Local file information.
- is null .
- is null or empty.
- exists on the remote host, and is not a regular file.
- The secure copy execution request was rejected by the server.
-
-
-
- Downloads the specified directory from the remote host to local directory.
-
- Remote host directory name.
- Local directory information.
- is null or empty.
- is null .
- File or directory with the specified path does not exist on the remote host.
- The secure copy execution request was rejected by the server.
-
-
-
- Uploads the and
- of the next file or directory to upload.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The file or directory to upload.
-
-
-
- Upload the files and subdirectories in the specified directory.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The directory to upload.
-
-
-
- Sets mode and name of the directory being upload.
-
-
-
-
- Return a value indicating whether the specified path is a valid SCP file path.
-
- The path to verify.
-
- if is a valid SCP file path; otherwise, .
-
-
- To match OpenSSH behavior (introduced as a result of CVE-2018-20685), a file path is considered
- invalid in any of the following conditions:
-
- -
-
is a zero-length string.
-
- -
-
is ". ".
-
- -
-
is ".. ".
-
- -
-
contains a forward slash (/).
-
-
-
-
-
-
- Represents the abstract base class from which all implementations of algorithms must inherit.
-
-
-
-
- Gets algorithm name.
-
-
-
- Copy constructor. This will copy the state of the provided
- message digest.
-
-
- interface that a message digest conforms to.
-
-
- return the algorithm name
-
- @return the algorithm name
-
-
- return the size, in bytes, of the digest produced by this message digest.
-
- @return the size, in bytes, of the digest produced by this message digest.
-
-
- return the size, in bytes, of the internal buffer used by this digest.
-
- @return the size, in bytes, of the internal buffer used by this digest.
-
-
- update the message digest with a single byte.
-
- @param inByte the input byte to be entered.
-
-
- update the message digest with a block of bytes.
-
- @param input the byte array containing the data.
- @param inOff the offset into the byte array where the data starts.
- @param len the length of the data.
-
-
- Close the digest, producing the final digest value. The doFinal
- call leaves the digest reset.
-
- @param output the array the digest is to be copied into.
- @param outOff the offset into the out array the digest is to start at.
-
-
- reset the digest back to it's initial state.
-
-
- The base class for parameters to key generators.
-
-
- initialise the generator with a source of randomness
- and a strength (in bits).
-
- @param random the random byte source.
- @param strength the size, in bits, of the keys we want to produce.
-
-
- return the random source associated with this
- generator.
-
- @return the generators random source.
-
-
- return the bit strength for keys produced by this generator,
-
- @return the strength of the keys this generator produces (in bits).
-
-
- Generic interface for objects generating random bytes.
-
-
- Add more seed material to the generator.
- A byte array to be mixed into the generator's state.
-
-
- Add more seed material to the generator.
- A long value to be mixed into the generator's state.
-
-
- Fill byte array with random values.
- Array to be filled.
-
-
- Fill byte array with random values.
- Array to receive bytes.
- Index to start filling at.
- Length of segment to fill.
-
-
- return a = a + b - b preserved.
-
-
- unsigned comparison on two arrays - note the arrays may
- start with leading zeros.
-
-
- return z = x / y - done in place (z value preserved, x contains the
- remainder)
-
-
- return whether or not a BigInteger is probably prime with a
- probability of 1 - (1/2)**certainty.
- From Knuth Vol 2, pg 395.
-
-
- Calculate the numbers u1, u2, and u3 such that:
-
- u1 * a + u2 * b = u3
-
- where u3 is the greatest common divider of a and b.
- a and b using the extended Euclid algorithm (refer p. 323
- of The Art of Computer Programming vol 2, 2nd ed).
- This also seems to have the side effect of calculating
- some form of multiplicative inverse.
-
- @param a First number to calculate gcd for
- @param b Second number to calculate gcd for
- @param u1Out the return object for the u1 value
- @return The greatest common divisor of a and b
-
-
- return w with w = x * x - w is assumed to have enough space.
-
-
- return x with x = y * z - x is assumed to have enough space.
-
-
- Calculate mQuote = -m^(-1) mod b with b = 2^32 (32 = word size)
-
-
- Montgomery multiplication: a = x * y * R^(-1) mod m
-
- Based algorithm 14.36 of Handbook of Applied Cryptography.
-
- m, x, y should have length n
- a should have length (n + 1)
- b = 2^32, R = b^n
-
- The result is put in x
-
- NOTE: the indices of x, y, m, a different in HAC and in Java
-
-
- return x = x % y - done in place (y value preserved)
-
-
- do a left shift - this returns a new array.
-
-
- do a right shift - this does it in place.
-
-
- do a right shift by one - this does it in place.
-
-
- returns x = x - y - we assume x is >= y
-
-
- Class representing a simple version of a big decimal. A
- SimpleBigDecimal is basically a
- {@link java.math.BigInteger BigInteger} with a few digits on the right of
- the decimal point. The number of (binary) digits on the right of the decimal
- point is called the scale of the SimpleBigDecimal.
- Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted
- automatically, but must be set manually. All SimpleBigDecimals
- taking part in the same arithmetic operation must have equal scale. The
- result of a multiplication of two SimpleBigDecimals returns a
- SimpleBigDecimal with double scale.
-
-
- Returns a SimpleBigDecimal representing the same numerical
- value as value.
- @param value The value of the SimpleBigDecimal to be
- created.
- @param scale The scale of the SimpleBigDecimal to be
- created.
- @return The such created SimpleBigDecimal.
-
-
- Constructor for SimpleBigDecimal. The value of the
- constructed SimpleBigDecimal Equals bigInt /
- 2scale .
- @param bigInt The bigInt value parameter.
- @param scale The scale of the constructed SimpleBigDecimal.
-
-
- Class holding methods for point multiplication based on the window
- τ-adic nonadjacent form (WTNAF). The algorithms are based on the
- paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves"
- by Jerome A. Solinas. The paper first appeared in the Proceedings of
- Crypto 1997.
-
-
- The window width of WTNAF. The standard value of 4 is slightly less
- than optimal for running time, but keeps space requirements for
- precomputation low. For typical curves, a value of 5 or 6 results in
- a better running time. When changing this value, the
- αu 's must be computed differently, see
- e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson,
- Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004,
- p. 121-122
-
-
- 24
-
-
- The αu 's for a=0 as an array
- of ZTauElements.
-
-
- The αu 's for a=0 as an array
- of TNAFs.
-
-
- The αu 's for a=1 as an array
- of ZTauElements.
-
-
- The αu 's for a=1 as an array
- of TNAFs.
-
-
- Computes the norm of an element λ of
- Z [τ].
- @param mu The parameter μ of the elliptic curve.
- @param lambda The element λ of
- Z [τ].
- @return The norm of λ.
-
-
- Computes the norm of an element λ of
- R [τ], where λ = u + vτ
- and u and u are real numbers (elements of
- R ).
- @param mu The parameter μ of the elliptic curve.
- @param u The real part of the element λ of
- R [τ].
- @param v The τ-adic part of the element
- λ of R [τ].
- @return The norm of λ.
-
-
- Rounds an element λ of R [τ]
- to an element of Z [τ], such that their difference
- has minimal norm. λ is given as
- λ = λ0 + λ1 τ.
- @param lambda0 The component λ0 .
- @param lambda1 The component λ1 .
- @param mu The parameter μ of the elliptic curve. Must
- equal 1 or -1.
- @return The rounded element of Z [τ].
- @throws ArgumentException if lambda0 and
- lambda1 do not have same scale.
-
-
- Approximate division by n. For an integer
- k, the value λ = s k / n is
- computed to c bits of accuracy.
- @param k The parameter k.
- @param s The curve parameter s0 or
- s1 .
- @param vm The Lucas Sequence element Vm .
- @param a The parameter a of the elliptic curve.
- @param m The bit length of the finite field
- F m .
- @param c The number of bits of accuracy, i.e. the scale of the returned
- SimpleBigDecimal.
- @return The value λ = s k / n computed to
- c bits of accuracy.
-
-
- Computes the τ-adic NAF (non-adjacent form) of an
- element λ of Z [τ].
- @param mu The parameter μ of the elliptic curve.
- @param lambda The element λ of
- Z [τ].
- @return The τ-adic NAF of λ.
-
-
- Applies the operation τ() to an
- AbstractF2mPoint.
- @param p The AbstractF2mPoint to which τ() is applied.
- @return τ(p)
-
-
- Returns the parameter μ of the elliptic curve.
- @param curve The elliptic curve from which to obtain μ.
- The curve must be a Koblitz curve, i.e. a Equals
- 0 or 1 and b Equals
- 1.
- @return μ of the elliptic curve.
- @throws ArgumentException if the given ECCurve is not a Koblitz
- curve.
-
-
- Calculates the Lucas Sequence elements Uk-1 and
- Uk or Vk-1 and
- Vk .
- @param mu The parameter μ of the elliptic curve.
- @param k The index of the second element of the Lucas Sequence to be
- returned.
- @param doV If set to true, computes Vk-1 and
- Vk , otherwise Uk-1 and
- Uk .
- @return An array with 2 elements, containing Uk-1
- and Uk or Vk-1
- and Vk .
-
-
- Computes the auxiliary value tw . If the width is
- 4, then for mu = 1, tw = 6 and for
- mu = -1, tw = 10
- @param mu The parameter μ of the elliptic curve.
- @param w The window width of the WTNAF.
- @return the auxiliary value tw
-
-
- Computes the auxiliary values s0 and
- s1 used for partial modular reduction.
- @param curve The elliptic curve for which to compute
- s0 and s1 .
- @throws ArgumentException if curve is not a
- Koblitz curve (Anomalous Binary Curve, ABC).
-
-
- Partial modular reduction modulo
- (τm - 1)/(τ - 1).
- @param k The integer to be reduced.
- @param m The bitlength of the underlying finite field.
- @param a The parameter a of the elliptic curve.
- @param s The auxiliary values s0 and
- s1 .
- @param mu The parameter μ of the elliptic curve.
- @param c The precision (number of bits of accuracy) of the partial
- modular reduction.
- @return ρ := k partmod (τm - 1)/(τ - 1)
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by a BigInteger using the reduced τ-adic
- NAF (RTNAF) method.
- @param p The AbstractF2mPoint to Multiply.
- @param k The BigInteger by which to Multiply p.
- @return k * p
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ of Z [τ]
- using the τ-adic NAF (TNAF) method.
- @param p The AbstractF2mPoint to Multiply.
- @param lambda The element λ of
- Z [τ].
- @return λ * p
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ of Z [τ]
- using the τ-adic NAF (TNAF) method, given the TNAF
- of λ.
- @param p The AbstractF2mPoint to Multiply.
- @param u The the TNAF of λ..
- @return λ * p
-
-
- Computes the [τ]-adic window NAF of an element
- λ of Z [τ].
- @param mu The parameter μ of the elliptic curve.
- @param lambda The element λ of
- Z [τ] of which to compute the
- [τ]-adic NAF.
- @param width The window width of the resulting WNAF.
- @param pow2w 2width .
- @param tw The auxiliary value tw .
- @param alpha The αu 's for the window width.
- @return The [τ]-adic window NAF of
- λ.
-
-
- Does the precomputation for WTNAF multiplication.
- @param p The ECPoint for which to do the precomputation.
- @param a The parameter a of the elliptic curve.
- @return The precomputation array for p.
-
-
- Class representing an element of Z [τ]. Let
- λ be an element of Z [τ]. Then
- λ is given as λ = u + vτ. The
- components u and v may be used directly, there
- are no accessor methods.
- Immutable class.
-
-
- The "real" part of λ.
-
-
- The "τ-adic" part of λ.
-
-
- Constructor for an element λ of
- Z [τ].
- @param u The "real" part of λ.
- @param v The "τ-adic" part of
- λ.
-
-
- Simple shift-and-add multiplication. Serves as reference implementation
- to verify (possibly faster) implementations, and for very small scalars.
-
- @param p
- The point to multiply.
- @param k
- The multiplier.
- @return The result of the point multiplication kP.
-
-
- Base class for an elliptic curve.
-
-
- Compute a PreCompInfo for a point on this curve, under a given name. Used by
- ECMultipliers to save the precomputation for this ECPoint for use
- by subsequent multiplication.
-
- @param point
- The ECPoint to store precomputations for.
- @param name
- A String used to index precomputations of different types.
- @param callback
- Called to calculate the PreCompInfo.
-
-
- Normalization ensures that any projective coordinate is 1, and therefore that the x, y
- coordinates reflect those of the equivalent point in an affine coordinate system. Where more
- than one point is to be normalized, this method will generally be more efficient than
- normalizing each point separately.
-
- @param points
- An array of points that will be updated in place with their normalized versions,
- where necessary
-
-
- Normalization ensures that any projective coordinate is 1, and therefore that the x, y
- coordinates reflect those of the equivalent point in an affine coordinate system. Where more
- than one point is to be normalized, this method will generally be more efficient than
- normalizing each point separately. An (optional) z-scaling factor can be applied; effectively
- each z coordinate is scaled by this value prior to normalization (but only one
- actual multiplication is needed).
-
- @param points
- An array of points that will be updated in place with their normalized versions,
- where necessary
- @param off
- The start of the range of points to normalize
- @param len
- The length of the range of points to normalize
- @param iso
- The (optional) z-scaling factor - can be null
-
-
- Create a cache-safe lookup table for the specified sequence of points. All the points MUST
- belong to this ECCurve instance, and MUST already be normalized.
-
-
- Sets the default ECMultiplier, unless already set.
-
-
- Decode a point on this curve from its ASN.1 encoding. The different
- encodings are taken account of, including point compression for
- Fp (X9.62 s 4.2.1 pg 17).
- @return The decoded point.
-
-
- Elliptic curve over Fp
-
-
- The auxiliary values s0 and
- s1 used for partial modular reduction for
- Koblitz curves.
-
-
- Solves a quadratic equation z2 + z = beta(X9.62
- D.1.6) The other solution is z + 1.
-
- @param beta
- The value to solve the quadratic equation for.
- @return the solution for z2 + z = beta or
- null if no solution exists.
-
-
- @return the auxiliary values s0 and
- s1 used for partial modular reduction for
- Koblitz curves.
-
-
- Returns true if this is a Koblitz curve (ABC curve).
- @return true if this is a Koblitz curve (ABC curve), false otherwise
-
-
- Elliptic curves over F2m. The Weierstrass equation is given by
- y2 + xy = x3 + ax2 + b.
-
-
- The exponent m of F2m .
-
-
- TPB: The integer k where xm +
- xk + 1 represents the reduction polynomial
- f(z).
- PPB: The integer k1 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
-
-
- TPB: Always set to 0
- PPB: The integer k2 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
-
-
- TPB: Always set to 0
- PPB: The integer k3 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
-
-
- The point at infinity on this curve.
-
-
- Constructor for Trinomial Polynomial Basis (TPB).
- @param m The exponent m of
- F2m .
- @param k The integer k where xm +
- xk + 1 represents the reduction
- polynomial f(z).
- @param a The coefficient a in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
- @param b The coefficient b in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
-
-
- Constructor for Trinomial Polynomial Basis (TPB).
- @param m The exponent m of
- F2m .
- @param k The integer k where xm +
- xk + 1 represents the reduction
- polynomial f(z).
- @param a The coefficient a in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
- @param b The coefficient b in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
- @param order The order of the main subgroup of the elliptic curve.
- @param cofactor The cofactor of the elliptic curve, i.e.
- #Ea (F2m ) = h * n.
-
-
- Constructor for Pentanomial Polynomial Basis (PPB).
- @param m The exponent m of
- F2m .
- @param k1 The integer k1 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param k2 The integer k2 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param k3 The integer k3 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param a The coefficient a in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
- @param b The coefficient b in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
-
-
- Constructor for Pentanomial Polynomial Basis (PPB).
- @param m The exponent m of
- F2m .
- @param k1 The integer k1 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param k2 The integer k2 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param k3 The integer k3 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param a The coefficient a in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
- @param b The coefficient b in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m .
- @param order The order of the main subgroup of the elliptic curve.
- @param cofactor The cofactor of the elliptic curve, i.e.
- #Ea (F2m ) = h * n.
-
-
- Return true if curve uses a Trinomial basis.
-
- @return true if curve Trinomial, false otherwise.
-
-
- return the field name for this field.
-
- @return the string "Fp".
-
-
- return a sqrt root - the routine verifies that the calculation
- returns the right value - if none exists it returns null.
-
-
- Class representing the Elements of the finite field
- F2m in polynomial basis (PB)
- representation. Both trinomial (Tpb) and pentanomial (Ppb) polynomial
- basis representations are supported. Gaussian normal basis (GNB)
- representation is not supported.
-
-
- Indicates gaussian normal basis representation (GNB). Number chosen
- according to X9.62. GNB is not implemented at present.
-
-
- Indicates trinomial basis representation (Tpb). Number chosen
- according to X9.62.
-
-
- Indicates pentanomial basis representation (Ppb). Number chosen
- according to X9.62.
-
-
- Tpb or Ppb.
-
-
- The exponent m of F2m .
-
-
- The LongArray holding the bits.
-
-
- Constructor for Ppb.
- @param m The exponent m of
- F2m .
- @param k1 The integer k1 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param k2 The integer k2 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param k3 The integer k3 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
- @param x The BigInteger representing the value of the field element.
-
-
- Constructor for Tpb.
- @param m The exponent m of
- F2m .
- @param k The integer k where xm +
- xk + 1 represents the reduction
- polynomial f(z).
- @param x The BigInteger representing the value of the field element.
-
-
- Checks, if the ECFieldElements a and b
- are elements of the same field F2m
- (having the same representation).
- @param a field element.
- @param b field element to be compared.
- @throws ArgumentException if a and b
- are not elements of the same field
- F2m (having the same
- representation).
-
-
- @return the representation of the field
- F2m , either of
- {@link F2mFieldElement.Tpb} (trinomial
- basis representation) or
- {@link F2mFieldElement.Ppb} (pentanomial
- basis representation).
-
-
- @return the degree m of the reduction polynomial
- f(z).
-
-
- @return Tpb: The integer k where xm +
- xk + 1 represents the reduction polynomial
- f(z).
- Ppb: The integer k1 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
-
-
- @return Tpb: Always returns 0
- Ppb: The integer k2 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
-
-
- @return Tpb: Always set to 0
- Ppb: The integer k3 where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z).
-
-
- base class for points on elliptic curves.
-
-
- Returns the affine x-coordinate after checking that this point is normalized.
-
- @return The affine x-coordinate of this point
- @throws IllegalStateException if the point is not normalized
-
-
- Returns the affine y-coordinate after checking that this point is normalized
-
- @return The affine y-coordinate of this point
- @throws IllegalStateException if the point is not normalized
-
-
- Returns the x-coordinate.
-
- Caution: depending on the curve's coordinate system, this may not be the same value as in an
- affine coordinate system; use Normalize() to get a point where the coordinates have their
- affine values, or use AffineXCoord if you expect the point to already have been normalized.
-
- @return the x-coordinate of this point
-
-
- Returns the y-coordinate.
-
- Caution: depending on the curve's coordinate system, this may not be the same value as in an
- affine coordinate system; use Normalize() to get a point where the coordinates have their
- affine values, or use AffineYCoord if you expect the point to already have been normalized.
-
- @return the y-coordinate of this point
-
-
- Normalization ensures that any projective coordinate is 1, and therefore that the x, y
- coordinates reflect those of the equivalent point in an affine coordinate system.
-
- @return a new ECPoint instance representing the same point, but with normalized coordinates
-
-
- return the field element encoded with point compression. (S 4.3.6)
-
-
- Multiplies this ECPoint by the given number.
- @param k The multiplicator.
- @return k * this.
-
-
- Elliptic curve points over Fp
-
-
- Create a point which encodes without point compression.
-
- @param curve the curve to use
- @param x affine x co-ordinate
- @param y affine y co-ordinate
-
-
- Create a point that encodes with or without point compression.
-
- @param curve the curve to use
- @param x affine x co-ordinate
- @param y affine y co-ordinate
- @param withCompression if true encode with point compression
-
-
- Elliptic curve points over F2m
-
-
- @param curve base curve
- @param x x point
- @param y y point
-
-
- @param curve base curve
- @param x x point
- @param y y point
- @param withCompression true if encode with point compression.
-
-
- Interface for classes encapsulating a point multiplication algorithm
- for ECPoints.
-
-
- Multiplies the ECPoint p by k, i.e.
- p is added k times to itself.
- @param p The ECPoint to be multiplied.
- @param k The factor by which p is multiplied.
- @return p multiplied by k.
-
-
- Class holding precomputation data for fixed-point multiplications.
-
-
- Lookup table for the precomputed ECPoints used for a fixed point multiplication.
-
-
- The width used for the precomputation. If a larger width precomputation
- is already available this may be larger than was requested, so calling
- code should refer to the actual width.
-
-
- Interface for classes storing precomputation data for multiplication
- algorithms. Used as a Memento (see GOF patterns) for
- WNafMultiplier.
-
-
- Class implementing the WNAF (Window Non-Adjacent Form) multiplication
- algorithm.
-
-
- Multiplies this by an integer k using the
- Window NAF method.
- @param k The integer by which this is multiplied.
- @return A new ECPoint which equals this
- multiplied by k.
-
-
- Determine window width to use for a scalar multiplication of the given size.
-
- @param bits the bit-length of the scalar to multiply by
- @return the window size to use
-
-
- Class holding precomputation data for the WNAF (Window Non-Adjacent Form)
- algorithm.
-
-
- Array holding the precomputed ECPoints used for a Window
- NAF multiplication.
-
-
- Array holding the negations of the precomputed ECPoints used
- for a Window NAF multiplication.
-
-
- Holds an ECPoint representing Twice(this). Used for the
- Window NAF multiplication to create or extend the precomputed values.
-
-
- Computes the Window NAF (non-adjacent Form) of an integer.
- @param width The width w of the Window NAF. The width is
- defined as the minimal number w, such that for any
- w consecutive digits in the resulting representation, at
- most one is non-zero.
- @param k The integer of which the Window NAF is computed.
- @return The Window NAF of the given width, such that the following holds:
- k = ∑i=0 l-1 ki 2i
- , where the ki denote the elements of the
- returned byte[].
-
-
- Determine window width to use for a scalar multiplication of the given size.
-
- @param bits the bit-length of the scalar to multiply by
- @return the window size to use
-
-
- Determine window width to use for a scalar multiplication of the given size.
-
- @param bits the bit-length of the scalar to multiply by
- @param windowSizeCutoffs a monotonically increasing list of bit sizes at which to increment the window width
- @return the window size to use
-
-
- Class implementing the WTNAF (Window
- τ-adic Non-Adjacent Form) algorithm.
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by k using the reduced τ-adic NAF (RTNAF)
- method.
- @param p The AbstractF2mPoint to multiply.
- @param k The integer by which to multiply k.
- @return p multiplied by k.
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ of Z [τ] using
- the τ-adic NAF (TNAF) method.
- @param p The AbstractF2mPoint to multiply.
- @param lambda The element λ of
- Z [τ] of which to compute the
- [τ]-adic NAF.
- @return p multiplied by λ.
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ of Z [τ]
- using the window τ-adic NAF (TNAF) method, given the
- WTNAF of λ.
- @param p The AbstractF2mPoint to multiply.
- @param u The the WTNAF of λ..
- @return λ * p
-
-
- Class holding precomputation data for the WTNAF (Window
- τ-adic Non-Adjacent Form) algorithm.
-
-
- Array holding the precomputed AbstractF2mPoints used for the
- WTNAF multiplication in
- {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply()
- WTauNafMultiplier.multiply()}.
-
-
-
- Utility class for creating IDigest objects from their names/Oids
-
-
-
- Use the specified instance of IRandomGenerator as random source.
-
- This constructor performs no seeding of either the IRandomGenerator or the
- constructed SecureRandom . It is the responsibility of the client to provide
- proper seed material as necessary/appropriate for the given IRandomGenerator
- implementation.
-
- The source to generate all random bytes from.
-
-
- base constructor.
-
-
- create a SecurityUtilityException with the given message.
-
- @param message the message to be carried with the exception.
-
-
- General array utilities.
-
-
-
- Are two arrays equal.
-
- Left side.
- Right side.
- True if equal.
-
-
-
- A constant time equals comparison - does not terminate early if
- test will fail.
-
- first array
- second array
- true if arrays equal, false otherwise.
-
-
- Make a copy of a range of bytes from the passed in data array. The range can
- extend beyond the end of the input array, in which case the return array will
- be padded with zeroes.
-
- @param data the array from which the data is to be copied.
- @param from the start index at which the copying should take place.
- @param to the final index of the range (exclusive).
-
- @return a new byte array containing the range given.
-
-
- BigInteger utilities.
-
-
- Return the passed in value as an unsigned byte array.
-
- @param value value to be converted.
- @return a byte array without a leading zero byte if present in the signed encoding.
-
-
- Return the passed in value as an unsigned byte array of specified length, zero-extended as necessary.
-
- @param length desired length of result array.
- @param n value to be converted.
- @return a byte array of specified length, with leading zeroes as necessary given the size of n.
-
-
- Return a random BigInteger not less than 'min' and not greater than 'max'
-
- @param min the least value that may be generated
- @param max the greatest value that may be generated
- @param random the source of randomness
- @return a random BigInteger value in the range [min,max]
-
-
-
- Class to decode and encode Hex.
-
-
-
- encode the input data producing a Hex encoded byte array.
-
- @return a byte array containing the Hex encoded data.
-
-
- encode the input data producing a Hex encoded byte array.
-
- @return a byte array containing the Hex encoded data.
-
-
- Hex encode the byte data writing it to the given output stream.
-
- @return the number of bytes produced.
-
-
- Hex encode the byte data writing it to the given output stream.
-
- @return the number of bytes produced.
-
-
- decode the Hex encoded input data. It is assumed the input data is valid.
-
- @return a byte array representing the decoded data.
-
-
- decode the Hex encoded string data - whitespace will be ignored.
-
- @return a byte array representing the decoded data.
-
-
- decode the Hex encoded string data writing it to the given output stream,
- whitespace characters will be ignored.
-
- @return the number of bytes produced.
-
-
- encode the input data producing a Hex output stream.
-
- @return the number of bytes produced.
-
-
- decode the Hex encoded byte data writing it to the given output stream,
- whitespace characters will be ignored.
-
- @return the number of bytes produced.
-
-
- decode the Hex encoded string data writing it to the given output stream,
- whitespace characters will be ignored.
-
- @return the number of bytes produced.
-
-
-
- Produce a copy of this object with its configuration and in its current state.
-
-
- The returned object may be used simply to store the state, or may be used as a similar object
- starting from the copied state.
-
-
-
-
- Restore a copied object state into this object.
-
-
- Implementations of this method should try to avoid or minimise memory allocation to perform the reset.
-
- an object originally {@link #copy() copied} from an object of the same type as this instance.
- if the provided object is not of the correct type.
- if the other parameter is in some other way invalid.
-
-
- Exception to be thrown on a failure to reset an object implementing Memoable.
-
- The exception extends InvalidCastException to enable users to have a single handling case,
- only introducing specific handling of this one if required.
-
-
-
- Basic Constructor.
-
- @param msg message to be associated with this exception.
-
-
-
- Implements certificate support for host algorithm.
-
-
-
-
- Gets the host key data.
-
-
-
-
- Initializes a new instance of the class.
-
- The host key name.
-
-
-
- Signs the specified data.
-
- The data.
- Signed data.
-
-
-
-
- Verifies the signature.
-
- The data.
- The signature.
- true if signature was successfully verified; otherwise false .
-
-
-
-
- Base class for asymmetric cipher implementations.
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
- BCrypt implementation.
-
-
- BCrypt implements OpenBSD-style Blowfish password hashing using the scheme described in
- "A Future-
- Adaptable Password Scheme" by Niels Provos and David Mazieres.
-
-
- This password hashing system tries to thwart off-line password cracking using a
- computationally-intensive hashing algorithm, based on Bruce Schneier's Blowfish cipher.
- The work factor of the algorithm is parameterised, so it can be increased as computers
- get faster.
-
-
- Usage is really simple. To hash a password for the first time, call the method with a random salt, like this:
-
- string pw_hash = BCrypt.HashPassword(plain_password);
-
- To check whether a plaintext password matches one that has been hashed previously,
- use the method:
-
-
- if (BCrypt.Verify(candidate_password, stored_hash))
- Console.WriteLine("It matches");
- else
- Console.WriteLine("It does not match");
-
-
- The method takes an optional parameter (workFactor) that
- determines the computational complexity of the hashing:
-
-
- string strong_salt = BCrypt.GenerateSalt(10);
- string stronger_salt = BCrypt.GenerateSalt(12);
-
-
- The amount of work increases exponentially (2^workFactor), so each increment is twice
- as much work. The default workFactor is 10, and the valid range is 4 to 31.
-
-
-
-
-
- Hash a string using the OpenBSD bcrypt scheme and a salt generated by .
-
- Just an alias for HashPassword.
- The string to hash.
- The hashed string.
-
-
-
- Hash a string using the OpenBSD bcrypt scheme and a salt generated by .
-
- Just an alias for HashPassword.
- The string to hash.
- The log2 of the number of rounds of hashing to apply - the work
- factor therefore increases as 2^workFactor.
- The hashed string.
-
-
-
- Hash a password using the OpenBSD bcrypt scheme and a salt generated by .
-
- The password to hash.
- The hashed password.
-
-
-
- Hash a password using the OpenBSD bcrypt scheme and a salt generated by using the given .
-
- The password to hash.
- The log2 of the number of rounds of hashing to apply - the work
- factor therefore increases as 2^workFactor.
- The hashed password.
-
-
- Hash a password using the OpenBSD bcrypt scheme.
- Thrown when one or more arguments have unsupported or
- illegal values.
- The password to hash.
- the salt to hash with (perhaps generated using BCrypt.gensalt).
- The hashed password
-
-
-
- Generate a salt for use with the method.
-
- The log2 of the number of rounds of hashing to apply - the work
- factor therefore increases as 2**workFactor.
- A base64 encoded salt value.
-
-
-
- Generate a salt for use with the method
- selecting a reasonable default for the number of hashing rounds to apply.
-
- A base64 encoded salt value.
-
-
-
- Verifies that the hash of the given matches the provided
-
-
- The text to verify.
- The previously-hashed password.
- true if the passwords match, false otherwise.
-
-
-
- Encode a byte array using bcrypt's slightly-modified base64 encoding scheme. Note that this
- is *not* compatible with the standard MIME-base64 encoding.
-
- Thrown when one or more arguments have unsupported or
- illegal values.
- The byte array to encode.
- The number of bytes to encode.
- Base64-encoded string.
-
-
-
- Decode a string encoded using bcrypt's base64 scheme to a byte array. Note that this is *not*
- compatible with the standard MIME-base64 encoding.
-
- Thrown when one or more arguments have unsupported or
- illegal values.
- The string to decode.
- The maximum bytes to decode.
- The decoded byte array.
-
-
-
- Look up the 3 bits base64-encoded by the specified character, range-checking against
- conversion table.
-
- The base64-encoded value.
- The decoded value of x.
-
-
- Blowfish encipher a single 64-bit block encoded as two 32-bit halves.
- An array containing the two 32-bit half blocks.
- The position in the array of the blocks.
-
-
- Cycically extract a word of key material.
- The string to extract the data from.
- [in,out] The current offset.
- The next word of material from data.
-
-
- Initializes the Blowfish key schedule.
-
-
- Key the Blowfish cipher.
- The key byte array.
-
-
-
- Perform the "enhanced key schedule" step described by Provos and Mazieres in "A Future-
- Adaptable Password Scheme" http://www.openbsd.org/papers/bcrypt-paper.ps.
-
- Salt byte array.
- Input byte array.
-
-
- Perform the central hashing step in the bcrypt scheme.
- Thrown when one or more arguments have unsupported or
- illegal values.
- The input byte array to hash.
- The salt byte array to hash with.
- The binary logarithm of the number of rounds of hashing to apply.
- A byte array containing the hashed result.
-
-
- Compatibility with new OpenBSD function.
- Ported from SSHJ library (https://github.com/hierynomus/sshj)
-
-
-
- Applies the Bcrypt kdf to derive a key and iv from the passphrase,
- the key/iv are returned in the output variable.
- Ported from the SSHJ library. https://github.com/hierynomus/sshj
-
-
-
-
-
-
-
-
- Appends multiple byte arrays into one array.
-
-
-
-
-
-
- Exception for signalling parse errors.
-
-
- Default constructor.
-
-
- Initializes a new instance of .
- The message.
-
-
- Initializes a new instance of .
- The message.
- The inner exception.
-
-
-
- Base class for block cipher implementations.
-
-
-
-
- Gets the size of the block in bytes.
-
-
- The size of the block in bytes.
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
-
- Gets the size of the block.
-
-
- The size of the block.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- Size of the block.
- Cipher mode.
- Cipher padding.
- is null .
-
-
-
- Encrypts the specified data.
-
- The data.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
- Encrypted data
-
-
-
- Decrypts the specified data.
-
- The data.
- Decrypted data
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
-
-
-
- Base class for cipher implementation.
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
-
- Encrypts the specified input.
-
- The input.
- Encrypted data.
-
-
-
- Encrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
-
- The encrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
-
- The decrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
-
-
-
- Implements digital signature where where asymmetric cipher is used,
-
-
-
-
- Initializes a new instance of the class.
-
- The object identifier.
- The cipher.
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- True if signature was successfully verified; otherwise false .
-
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
-
-
-
- Hashes the specified input.
-
- The input.
- Hashed data.
-
-
-
- Encodes hash using DER.
-
- The hash data.
- DER Encoded byte array
-
-
-
- AES cipher implementation.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
- or is null .
- or is too short.
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
- or is null .
- or is too short.
-
-
-
- Implements ARCH4 cipher algorithm
-
-
-
-
- Holds the state of the RC4 engine
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- if set to true will disharged first 1536 bytes.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Encrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
-
- Encrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
-
- The decrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
-
-
-
- Blowfish cipher implementation.
-
-
-
-
- The s-boxes
-
-
-
-
- The s-boxes
-
-
-
-
- The s-boxes
-
-
-
-
- The s-boxes
-
-
-
-
- The p-array
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- apply the encryption cycle to each value pair in the table.
-
- The xl.
- The xr.
- The table.
-
-
-
- Implements CAST cipher algorithm
-
-
-
-
- The rotating round key
-
-
-
-
- The masking round key
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Sets the subkeys using the same nomenclatureas described in RFC2144.
-
- The key.
-
-
-
- The first of the three processing functions for the encryption and decryption.
-
- The input to be processed.
- The mask to be used from Km[n].
- The rotation value to be used.
-
-
-
-
- The second of the three processing functions for the encryption and decryption.
-
- The input to be processed.
- The mask to be used from Km[n].
- The rotation value to be used.
-
-
-
-
- The third of the three processing functions for the encryption and decryption.
-
- The input to be processed.
- The mask to be used from Km[n].
- The rotation value to be used.
-
-
-
-
- Does the 16 rounds to encrypt the block.
-
- The LH-32bits of the plaintext block.
- The RH-32bits of the plaintext block.
- The result.
-
-
-
- Base class for cipher mode implementations
-
-
-
-
- Gets the cipher.
-
-
-
-
- Gets the IV vector.
-
-
-
-
- Holds block size of the cipher.
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Initializes the specified cipher mode.
-
- The cipher.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Base class for cipher padding implementations
-
-
-
-
- Pads the specified input to match the block size.
-
- Size of the block.
- The input.
-
- Padded data array.
-
-
-
-
- Pads the specified input to match the block size.
-
- Size of the block.
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Implements DES cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Generates the working key.
-
- if set to true [encrypting].
- The key.
- Generated working key.
-
-
-
- Validates the key.
-
-
-
-
- Performs DES function.
-
- The w key.
- The input.
- The in off.
- The out bytes.
- The out off.
-
-
-
- Implements CBC cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements CFB cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements CTR cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements OFB cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements PKCS5 cipher padding
-
-
-
-
- Pads the specified input to match the block size.
-
- The size of the block.
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Implements PKCS7 cipher padding
-
-
-
-
- Pads the specified input to match the block size.
-
- The size of the block.
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Implements RSA cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The RSA key.
-
-
-
- Encrypts the specified data.
-
- The data.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
- Encrypted data.
-
-
-
- Decrypts the specified data.
-
- The data.
-
- The decrypted data.
-
- Only block type 01 or 02 are supported.
- Thrown when decrypted block type is not supported.
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
- Only block type 01 or 02 are supported.
- Thrown when decrypted block type is not supported.
-
-
-
- Implements Serpent cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Expand a user-supplied key material into a session key.
-
- The user-key bytes to use.
-
- A session key.
-
- is not multiple of 4 bytes.
-
-
-
- S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- Apply the linear transformation to the register set.
-
-
-
-
- Apply the inverse of the linear transformation to the register set.
-
-
-
-
- Implements 3DES cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Validates the key.
-
-
-
-
- Implements Twofish cipher algorithm
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
- Define the fixed p0/p1 permutations used in keyed S-box lookup.
- By changing the following constant definitions, the S-boxes will
- automatically Get changed in the Twofish engine.
-
-
- gSubKeys[] and gSBox[] are eventually used in the
- encryption and decryption methods.
-
-
- Use (12, 8) Reed-Solomon code over GF(256) to produce
- a key S-box 32-bit entity from 2 key material 32-bit
- entities.
-
- @param k0 first 32-bit entity
- @param k1 second 32-bit entity
- @return Remainder polynomial Generated using RS code
-
-
- Reed-Solomon code parameters: (12,8) reversible code:
-
-
- G(x) = x^4 + (a+1/a)x^3 + ax^2 + (a+1/a)x + 1
-
- where a = primitive root of field generator 0x14D
-
-
-
-
- Base class for signature implementations
-
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
- True if signature was successfully verified; otherwise false .
-
-
-
- Creates the signature.
-
- The input.
- Signed input data.
-
-
-
- Implements DSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The DSA key.
- is null .
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- true if signature was successfully verified; otherwise false .
-
- Invalid signature.
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
- Invalid DSA key.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Implements ECDSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The ECDSA key.
- is null .
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- true if signature was successfully verified; otherwise false .
-
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Implements ECDSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The ED25519Key key.
- is null .
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- true if signature was successfully verified; otherwise false .
-
- Invalid signature.
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
- Invalid ED25519Key key.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Implements RSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The RSA key.
-
-
-
- Hashes the specified input.
-
- The input.
-
- Hashed data.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Base class of stream cipher algorithms.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- is null .
-
-
-
- Base class for symmetric cipher implementations.
-
-
-
-
- Gets the key.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Contains DSA private and public key
-
-
-
-
- Gets the P.
-
-
-
-
- Gets the Q.
-
-
-
-
- Gets the G.
-
-
-
-
- Gets public key Y.
-
-
-
-
- Gets private key X.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Initializes a new instance of the class.
-
- The p.
- The q.
- The g.
- The y.
- The x.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Contains ECDSA (ecdsa-sha2-nistp{256,384,521}) private and public key
-
-
-
-
- Gets the SSH name of the ECDSA Key
-
-
-
-
- Gets the HashAlgorithm to use
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Gets ECDsa Object
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The curve name
- Value of publickey
- Value of privatekey
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Contains ED25519 private and public key
-
-
-
-
- Gets the Key String.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets the PublicKey Bytes
-
-
-
-
- Gets the PrivateKey Bytes
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- pk data.
- sk data.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Base class for asymmetric cipher algorithms
-
-
-
-
- Specifies array of big integers that represent private key
-
-
-
-
- Gets the key specific digital signature.
-
-
-
-
- Gets or sets the public key.
-
-
- The public.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Signs the specified data with the key.
-
- The data to sign.
-
- Signed data.
-
-
-
-
- Verifies the signature.
-
- The data to verify.
- The signature to verify against.
- True is signature was successfully verifies; otherwise false .
-
-
-
- Contains RSA private and public key
-
-
-
-
- Gets the modulus.
-
-
-
-
- Gets the exponent.
-
-
-
-
- Gets the D.
-
-
-
-
- Gets the P.
-
-
-
-
- Gets the Q.
-
-
-
-
- Gets the DP.
-
-
-
-
- Gets the DQ.
-
-
-
-
- Gets the inverse Q.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Initializes a new instance of the class.
-
- The modulus.
- The exponent.
- The d.
- The p.
- The q.
- The inverse Q.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Base class for SSH host algorithms.
-
-
-
-
- Gets the host key name.
-
-
-
-
- Gets the host key data.
-
-
-
-
- Initializes a new instance of the class.
-
- The host key name.
-
-
-
- Signs the specified data.
-
- The data.
- Signed data.
-
-
-
- Verifies the signature.
-
- The data.
- The signature.
- True is signature was successfully verifies; otherwise false .
-
-
-
- Represents a key exchange algorithm.
-
-
-
-
- Occurs when the host key is received.
-
-
-
-
- Gets the name of the algorithm.
-
-
- The name of the algorithm.
-
-
-
-
- Gets the exchange hash.
-
-
- The exchange hash.
-
-
-
-
- Starts the key exchange algorithm.
-
- The session.
- Key exchange init message.
-
-
-
- Finishes the key exchange algorithm.
-
-
-
-
- Creates the client-side cipher to use.
-
-
- The client cipher.
-
-
-
-
- Creates the server-side cipher to use.
-
-
- The server cipher.
-
-
-
-
- Creates the server-side hash algorithm to use.
-
-
- The server hash algorithm.
-
-
-
-
- Creates the client-side hash algorithm to use.
-
-
- The client hash algorithm.
-
-
-
-
- Creates the compression algorithm to use to deflate data.
-
-
- The compression method to deflate data.
-
-
-
-
- Creates the compression algorithm to use to inflate data.
-
-
- The compression method to inflate data.
-
-
-
-
- Represents base class for different key exchange algorithm implementations
-
-
-
-
- Gets or sets the session.
-
-
- The session.
-
-
-
-
- Gets or sets key exchange shared key.
-
-
- The shared key.
-
-
-
-
- Gets the exchange hash.
-
- The exchange hash.
-
-
-
- Occurs when host key received.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Creates the server side cipher to use.
-
- Server cipher.
-
-
-
- Creates the client side cipher to use.
-
- Client cipher.
-
-
-
- Creates the server side hash algorithm to use.
-
- Hash algorithm
-
-
-
- Creates the client side hash algorithm to use.
-
- Hash algorithm
-
-
-
- Creates the compression algorithm to use to deflate data.
-
- Compression method.
-
-
-
- Creates the compression algorithm to use to inflate data.
-
- Compression method.
-
-
-
- Determines whether the specified host key can be trusted.
-
- The host algorithm.
-
- true if the specified host can be trusted; otherwise, false .
-
-
-
-
- Validates the exchange hash.
-
- true if exchange hash is valid; otherwise false.
-
-
-
- Calculates key exchange hash value.
-
- Key exchange hash.
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Sends SSH message to the server
-
- The message.
-
-
-
- Generates the session key.
-
- The shared key.
- The exchange hash.
- The key.
- The size.
-
-
-
-
- Generates the session key.
-
- The shared key.
- The exchange hash.
- The p.
- The session id.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Represents base class for Diffie Hellman key exchange algorithm
-
-
-
-
- Specifies key exchange group number.
-
-
-
-
- Specifies key exchange prime number.
-
-
-
-
- Specifies client payload
-
-
-
-
- Specifies server payload
-
-
-
-
- Specifies client exchange number.
-
-
-
-
- Specifies server exchange number.
-
-
-
-
- Specifies random generated number.
-
-
-
-
- Specifies host key data.
-
-
-
-
- Specifies signature data.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Validates the exchange hash.
-
-
- true if exchange hash is valid; otherwise false.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Populates the client exchange value.
-
-
-
-
- Handles the server DH reply message.
-
- The host key.
- The server exchange value.
- The signature.
-
-
-
- Represents "diffie-hellman-group14-sha1" algorithm implementation.
-
-
-
-
- https://tools.ietf.org/html/rfc2409#section-6.2
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Represents "diffie-hellman-group14-sha256" algorithm implementation.
-
-
-
-
- https://tools.ietf.org/html/rfc2409#section-6.2
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Represents "diffie-hellman-group16-sha512" algorithm implementation.
-
-
-
-
- https://tools.ietf.org/html/rfc3526#section-5
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Represents "diffie-hellman-group1-sha1" algorithm implementation.
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Represents "diffie-hellman-group-exchange-sha1" algorithm implementation.
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Represents "diffie-hellman-group-exchange-sha256" algorithm implementation.
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- Data to hash.
-
- Hashed bytes
-
-
-
-
- Base class for "diffie-hellman-group-exchange" algorithms.
-
-
-
-
- Calculates key exchange hash value.
-
-
- Key exchange hash.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Represents "diffie-hellman-group1-sha1" algorithm implementation.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Base class for "diffie-hellman" SHA-256 group algorithm implementations.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Base class for "diffie-hellman" SHA-512 group algorithm implementations.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Calculates key exchange hash value.
-
-
- Key exchange hash.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Specifies client payload
-
-
-
-
- Specifies server payload
-
-
-
-
- Specifies client exchange.
-
-
-
-
- Specifies server exchange.
-
-
-
-
- Specifies host key data.
-
-
-
-
- Specifies signature data.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Calculates key exchange hash value.
-
-
- Key exchange hash.
-
-
-
-
- Validates the exchange hash.
-
-
- true if exchange hash is valid; otherwise false.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Handles the server DH reply message.
-
- The host key.
- The server exchange value.
- The signature.
-
-
-
- Gets the parameter of the curve.
-
-
- The parameter of the curve.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Handles the server DH reply message.
-
- The host key.
- The server exchange value.
- The signature.
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets Curve Parameter.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets Curve Parameter.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets Curve Parameter.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Implements key support for host algorithm.
-
-
-
-
- Gets the key.
-
-
-
-
- Gets the public key data.
-
-
-
-
- Initializes a new instance of the class.
-
- Host key name.
- Host key.
-
-
-
- Initializes a new instance of the class.
-
- Host key name.
- Host key.
- Host key encoded data.
-
-
-
- Signs the specified data.
-
- The data.
-
- Signed data.
-
-
-
-
- Verifies the signature.
-
- The data.
- The signature.
-
- True is signature was successfully verifies; otherwise false .
-
-
-
-
- Gets or sets the name of the algorithm as UTF-8 encoded byte array.
-
-
- The name of the algorithm.
-
-
-
-
- Gets or sets the signature.
-
-
- The signature.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Basic factory for creating new services.
-
-
-
-
- Defines the number of times an authentication attempt with any given
- can result in before it is disregarded.
-
-
-
-
- Creates a .
-
-
- A .
-
-
-
-
- Creates a new with the specified .
-
- The to use for creating a new session.
-
- An for the specified .
-
- is null .
-
-
-
- Creates a new in a given and with
- the specified operation timeout and encoding.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
- The encoding.
- The factory to use for creating SFTP messages.
-
- An .
-
-
-
-
- Create a new .
-
-
- A .
-
-
-
-
- Negotiates a key exchange algorithm, and creates a for the negotiated
- algorithm.
-
- A of the key exchange algorithms supported by the client where key is the name of the algorithm, and value is the type implementing this algorithm.
- The names of the key exchange algorithms supported by the SSH server.
-
- A that was negotiated between client and server.
-
- is null .
- is null .
- No key exchange algorithms are supported by both client and server.
-
-
-
- Creates a shell stream.
-
- The SSH session.
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The terminal mode values.
- The size of the buffer.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Creates an that encloses a path in double quotes, and escapes
- any embedded double quote with a backslash.
-
-
- An that encloses a path in double quotes, and escapes any
- embedded double quote with a backslash.
- with a shell.
-
-
-
-
- Creates a new in a given
- and with the specified operation timeout.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
-
- An .
-
-
-
-
- Provides functionality to connect and interact with SSH server.
-
-
-
-
- Specifies an infinite waiting period.
-
-
- The value of this field is -1 millisecond.
-
-
-
-
- Specifies an infinite waiting period.
-
-
- The value of this field is -1 .
-
-
-
-
- Specifies maximum packet size defined by the protocol.
-
-
- 68536 (64 KB + 3000 bytes).
-
-
-
-
- Holds the initial local window size for the channels.
-
-
- 2147483647 (2^31 - 1) bytes.
-
-
- We currently do not define a maximum (remote) window size.
-
-
-
-
- Holds the maximum size of channel data packets that we receive.
-
-
- 64 KB.
-
-
-
- This is the maximum size (in bytes) we support for the data (payload) of a
- SSH_MSG_CHANNEL_DATA message we receive.
-
-
- We currently do not enforce this limit.
-
-
-
-
-
- Controls how many authentication attempts can take place at the same time.
-
-
- Some server may restrict number to prevent authentication attacks
-
-
-
-
- Holds metada about session messages
-
-
-
-
- Holds a that is signaled when the message listener loop has completed.
-
-
-
-
- Specifies outbound packet number
-
-
-
-
- Specifies incoming packet number
-
-
-
-
- WaitHandle to signal that last service request was accepted
-
-
-
-
- WaitHandle to signal that exception was thrown by another thread.
-
-
-
-
- WaitHandle to signal that key exchange was completed.
-
-
-
-
- WaitHandle to signal that key exchange is in progress.
-
-
-
-
- Exception that need to be thrown by waiting thread
-
-
-
-
- Specifies whether connection is authenticated
-
-
-
-
- Specifies whether user issued Disconnect command or not
-
-
-
-
- Holds the factory to use for creating new services.
-
-
-
-
- Holds connection socket.
-
-
-
-
- Holds an object that is used to ensure only a single thread can read from
- at any given time.
-
-
-
-
- Holds an object that is used to ensure only a single thread can write to
- at any given time.
-
-
- This is also used to ensure that is
- incremented atomatically.
-
-
-
-
- Holds an object that is used to ensure only a single thread can dispose
- at any given time.
-
-
- This is also used to ensure that will not be disposed
- while performing a given operation or set of operations on .
-
-
-
-
- Gets the session semaphore that controls session channels.
-
-
- The session semaphore.
-
-
-
-
- Gets the next channel number.
-
-
- The next channel number.
-
-
-
-
- Gets a value indicating whether the session is connected.
-
-
- true if the session is connected; otherwise, false .
-
-
- This methods returns true in all but the following cases:
-
- -
-
The is disposed.
-
- -
-
The SSH_MSG_DISCONNECT message - which is used to disconnect from the server - has been sent.
-
- -
-
The client has not been authenticated successfully.
-
- -
-
The listener thread - which is used to receive messages from the server - has stopped.
-
- -
-
The socket used to communicate with the server is no longer connected.
-
-
-
-
-
-
- Gets the session id.
-
-
- The session id, or null if the client has not been authenticated.
-
-
-
-
- Gets the client init message.
-
- The client init message.
-
-
-
- Gets or sets the server version string.
-
- The server version.
-
-
-
- Gets or sets the client version string.
-
- The client version.
-
-
-
- Gets or sets the connection info.
-
- The connection info.
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Occurs when session has been disconnected from the server.
-
-
-
-
- Occurs when host key received.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when a message is received from the SSH server.
-
-
-
-
- Occurs when a message is received from the SSH server.
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
-
-
- Connects to the server.
-
- Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.
- SSH session could not be established.
- Authentication of SSH session failed.
- Failed to establish proxy connection.
-
-
-
- Disconnects from the server.
-
-
- This sends a SSH_MSG_DISCONNECT message to the server, waits for the
- server to close the socket on its end and subsequently closes the client socket.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the connection timeout.
-
- The wait handle.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the specified timeout.
-
- The wait handle.
- The time to wait for any of the handles to become signaled.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the connection timeout.
-
- The wait handle.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
-
- A .
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
- When this method returns , contains the .
-
- A .
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
- When this method returns , contains the .
-
- A .
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the specified timeout.
-
- The wait handle.
- The time to wait for any of the handles to become signaled.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
-
-
- Sends a message to the server.
-
- The message to send.
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Sends an SSH packet to the server.
-
- A byte array containing the packet to send.
- The offset of the packet.
- The length of the packet.
- Client is not connected to the server.
-
-
- The send is performed in a dispose lock to avoid
- and/or when sending the packet.
-
-
- This method is only to be used when the connection is established, as the locking
- overhead is not required while establising the connection.
-
-
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Receives the message from the server.
-
-
- The incoming SSH message, or null if the connection with the SSH server was closed.
-
-
- We need no locking here since all messages are read by a single thread.
-
-
-
-
- Called when received.
-
- message.
-
-
-
- Called when received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Registers SSH message with the session.
-
- The name of the message to register with the session.
-
-
-
- Unregister SSH message from the session.
-
- The name of the message to unregister with the session.
-
-
-
- Loads a message from a given buffer.
-
- An array of bytes from which to construct the message.
- The zero-based byte offset in at which to begin reading.
- The number of bytes to load.
-
- A message constructed from .
-
- The type of the message is not supported.
-
-
-
- Establishes a socket connection to the specified host and port.
-
- The host name of the server to connect to.
- The port to connect to.
- The connection failed to establish within the configured .
- An error occurred trying to establish the connection.
-
-
-
- Performs a blocking read on the socket until bytes are received.
-
- The to read from.
- An array of type that is the storage location for the received data.
- The position in parameter to store the received data.
- The number of bytes to read.
-
- The number of bytes read.
-
- The socket is closed.
- The read has timed-out.
- The read failed.
-
-
-
- Gets a value indicating whether the socket is connected.
-
-
- true if the socket is connected; otherwise, false .
-
-
-
- As a first check we verify whether is
- true . However, this only returns the state of the socket as of
- the last I/O operation.
-
-
- Therefore we use the combination of with mode
- and to verify if the socket is still connected.
-
-
- The MSDN doc mention the following on the return value of
- with mode :
-
- -
-
true if data is available for reading;
-
- -
-
true if the connection has been closed, reset, or terminated; otherwise, returns false .
-
-
-
-
- Conclusion: when the return value is true - but no data is available for reading - then
- the socket is no longer connected.
-
-
- When a is used from multiple threads, there's a race condition
- between the invocation of and the moment
- when the value of is obtained. To workaround this issue
- we synchronize reads from the .
-
-
-
-
-
- Performs a blocking read on the socket until bytes are received.
-
- The to read from.
- An array of type that is the storage location for the received data.
- The position in parameter to store the received data.
- The number of bytes to read.
-
- The number of bytes read.
-
- The read has timed-out.
- The read failed.
-
-
-
- Performs a blocking read on the socket until a line is read.
-
- The to read from.
- A that represents the time to wait until a line is read.
- The read has timed-out.
- An error occurred when trying to access the socket.
-
- The line read from the socket, or null when the remote server has shutdown and all data has been received.
-
-
-
-
- Shuts down and disposes the socket.
-
-
-
-
- Listens for incoming message from the server and handles them. This method run as a task on separate thread.
-
-
-
-
- https://tools.ietf.org/html/rfc1929
-
-
-
-
- Raises the event.
-
- The .
-
-
-
- Resets connection-specific information to ensure state of a previous connection
- does not affect new connections.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Gets or sets the connection info.
-
- The connection info.
-
-
-
- Create a new SSH session channel.
-
-
- A new SSH session channel.
-
-
-
-
- Create a new channel for a locally forwarded TCP/IP port.
-
-
- A new channel for a locally forwarded TCP/IP port.
-
-
-
-
- Creates a "forwarded-tcpip" SSH channel.
-
-
- A new "forwarded-tcpip" SSH channel.
-
-
-
-
- Sends a message to the server.
-
- The message to send.
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Represents the result of a wait operations.
-
-
-
-
- The was signaled within the specified interval.
-
-
-
-
- The was not signaled within the specified interval.
-
-
-
-
- The session is in a disconnected state.
-
-
-
-
- The session is in a failed state.
-
-
-
-
- Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
-
-
-
-
- Holds the instance that is used to communicate to the
- SFTP server.
-
-
-
-
- Holds the operation timeout.
-
-
-
-
- Holds the size of the buffer.
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout to wait until an operation completes. The default value is negative
- one (-1) milliseconds, which indicates an infinite timeout period.
-
- The method was called after the client was disposed.
- represents a value that is less than -1 or greater than milliseconds.
-
-
-
- Gets or sets the maximum size of the buffer in bytes.
-
-
- The size of the buffer. The default buffer size is 32768 bytes (32 KB).
-
-
-
- For write operations, this limits the size of the payload for
- individual SSH_FXP_WRITE messages. The actual size is always
- capped at the maximum packet size supported by the peer
- (minus the size of protocol fields).
-
-
- For read operations, this controls the size of the payload which
- is requested from the peer in a SSH_FXP_READ message. The peer
- will send the requested number of bytes in a SSH_FXP_DATA message,
- possibly split over multiple SSH_MSG_CHANNEL_DATA messages.
-
-
- To optimize the size of the SSH packets sent by the peer,
- the actual requested size will take into account the size of the
- SSH_FXP_DATA protocol fields.
-
-
- The size of the each indivual SSH_FXP_DATA message is limited to the
- local maximum packet size of the channel, which is set to 64 KB
- for SSH.NET. However, the peer can limit this even further.
-
-
- The method was called after the client was disposed.
-
-
-
- Gets remote working directory.
-
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Gets sftp protocol version.
-
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Gets the current SFTP session.
-
-
- The current SFTP session.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid. -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
- is null .
- is invalid. -or- is null contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid. -or- is nunull ll or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid. -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , the connection info will be disposed when this
- instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , the connection info will be disposed when this
- instance is disposed.
-
-
-
-
- Changes remote directory to path.
-
- New directory path.
- is null .
- Client is not connected.
- Permission to change directory denied by remote host. -or- A SSH command was denied by the server.
- was not found on the remote host.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Changes permissions of file(s) to specified mode.
-
- File(s) path, may match multiple files.
- The mode.
- is null .
- Client is not connected.
- Permission to change permission on the path(s) was denied by the remote host. -or- A SSH command was denied by the server.
- was not found on the remote host.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates remote directory specified by path.
-
- Directory path to create.
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to create the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Deletes remote directory specified by path.
-
- Directory to be deleted path.
- is null or contains only whitespace characters.
- Client is not connected.
- was not found on the remote host.
- Permission to delete the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Deletes remote file specified by path.
-
- File to be deleted path.
- is null or contains only whitespace characters.
- Client is not connected.
- was not found on the remote host.
- Permission to delete the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Renames remote file from old path to new path.
-
- Path to the old file location.
- Path to the new file location.
- is null . -or- or is null .
- Client is not connected.
- Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Renames remote file from old path to new path.
-
- Path to the old file location.
- Path to the new file location.
- if set to true then perform a posix rename.
- is null . -or- or is null .
- Client is not connected.
- Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates a symbolic link from old path to new path.
-
- The old path.
- The new path.
- is null . -or- is null or contains only whitespace characters.
- Client is not connected.
- Permission to create the symbolic link was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Retrieves list of files in remote directory.
-
- The path.
- The list callback.
-
- A list of files.
-
- is null .
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Begins an asynchronous operation of retrieving list of files in remote directory.
-
- The path.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The list callback.
-
- An that references the asynchronous operation.
-
- The method was called after the client was disposed.
-
-
-
- Ends an asynchronous operation of retrieving list of files in remote directory.
-
- The pending asynchronous SFTP request.
-
- A list of files.
-
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
-
-
-
- Gets reference to remote file or directory.
-
- The path.
-
- A reference to file object.
-
- Client is not connected.
- was not found on the remote host.
- is null .
- The method was called after the client was disposed.
-
-
-
- Checks whether file or directory exists;
-
- The path.
-
- true if directory or file exists; otherwise false .
-
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Downloads remote file specified by the path into the stream.
-
- File to download.
- Stream to write the file into.
- The download callback.
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- was not found on the remote host. ///
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous file downloading into the stream.
-
- The path.
- The output.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous file downloading into the stream.
-
- The path.
- The output.
- The method to be called when the asynchronous write operation is completed.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous file downloading into the stream.
-
- The path.
- The output.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The download callback.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Ends an asynchronous file downloading into the stream.
-
- The pending asynchronous SFTP request.
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- The path was not found on the remote host.
- A SSH error where is the message from the remote host.
-
-
-
- Uploads stream into remote file.
-
- Data input stream.
- Remote file path.
- The upload callback.
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Uploads stream into remote file.
-
- Data input stream.
- Remote file path.
- if set to true then existing file will be overwritten.
- The upload callback.
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- If the remote file already exists, it is overwritten and truncated.
-
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
- The method to be called when the asynchronous write operation is completed.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- If the remote file already exists, it is overwritten and truncated.
-
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The upload callback.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- If the remote file already exists, it is overwritten and truncated.
-
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
- Specified whether an existing file can be overwritten.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The upload callback.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- When refers to an existing file, set to true to overwrite and truncate that file.
- If is false , the upload will fail and will throw an
- .
-
-
-
-
-
- Ends an asynchronous uploading the stream into remote file.
-
- The pending asynchronous SFTP request.
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
- Client is not connected.
- The directory of the file was not found on the remote host.
- Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
-
-
-
- Gets status using statvfs@openssh.com request.
-
- The path.
-
- A instance that contains file status information.
-
- Client is not connected.
- is null .
- The method was called after the client was disposed.
-
-
-
- Appends lines to a file, creating the file if it does not already exist.
-
- The file to append the lines to. The file is created if it does not already exist.
- The lines to append to the file.
- isnull -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM)
-
-
-
-
- Appends lines to a file by using a specified encoding, creating the file if it does not already exist.
-
- The file to append the lines to. The file is created if it does not already exist.
- The lines to append to the file.
- The character encoding to use.
- is null . -or- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Appends the specified string to the file, creating the file if it does not already exist.
-
- The file to append the specified string to.
- The string to append to the file.
- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
-
-
- Appends the specified string to the file, creating the file if it does not already exist.
-
- The file to append the specified string to.
- The string to append to the file.
- The character encoding to use.
- is null . -or- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates a that appends UTF-8 encoded text to the specified file,
- creating the file if it does not already exist.
-
- The path to the file to append to.
-
- A that appends text to a file using UTF-8 encoding without a
- Byte-Order Mark (BOM).
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates a that appends text to a file using the specified
- encoding, creating the file if it does not already exist.
-
- The path to the file to append to.
- The character encoding to use.
-
- A that appends text to a file using the specified encoding.
-
- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates or overwrites a file in the specified path.
-
- The path and name of the file to create.
-
- A that provides read/write access to the file specified in path.
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- If the target file already exists, it is first truncated to zero bytes.
-
-
-
-
- Creates or overwrites the specified file.
-
- The path and name of the file to create.
- The maximum number of bytes buffered for reads and writes to the file.
-
- A that provides read/write access to the file specified in path.
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- If the target file already exists, it is first truncated to zero bytes.
-
-
-
-
- Creates or opens a file for writing UTF-8 encoded text.
-
- The file to be opened for writing.
-
- A that writes text to a file using UTF-8 encoding without
- a Byte-Order Mark (BOM).
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Creates or opens a file for writing text using the specified encoding.
-
- The file to be opened for writing.
- The character encoding to use.
-
- A that writes to a file using the specified encoding.
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Deletes the specified file or directory.
-
- The name of the file or directory to be deleted. Wildcard characters are not supported.
- is null .
- Client is not connected.
- was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time the specified file or directory was last accessed.
-
- The file or directory for which to obtain access date and time information.
-
- A structure set to the date and time that the specified file or directory was last accessed.
- This value is expressed in local time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.
-
- The file or directory for which to obtain access date and time information.
-
- A structure set to the date and time that the specified file or directory was last accessed.
- This value is expressed in UTC time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time the specified file or directory was last written to.
-
- The file or directory for which to obtain write date and time information.
-
- A structure set to the date and time that the specified file or directory was last written to.
- This value is expressed in local time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.
-
- The file or directory for which to obtain write date and time information.
-
- A structure set to the date and time that the specified file or directory was last written to.
- This value is expressed in UTC time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a on the specified path with read/write access.
-
- The file to open.
- A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
-
- An unshared that provides access to the specified file, with the specified mode and read/write access.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a on the specified path, with the specified mode and access.
-
- The file to open.
- A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
- A value that specifies the operations that can be performed on the file.
-
- An unshared that provides access to the specified file, with the specified mode and access.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens an existing file for reading.
-
- The file to be opened for reading.
-
- A read-only on the specified path.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens an existing UTF-8 encoded text file for reading.
-
- The file to be opened for reading.
-
- A on the specified path.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a file for writing.
-
- The file to be opened for writing.
-
- An unshared object on the specified path with access.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
- If the file does not exist, it is created.
-
-
-
-
- Opens a binary file, reads the contents of the file into a byte array, and closes the file.
-
- The file to open for reading.
-
- A byte array containing the contents of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a text file, reads all lines of the file using UTF-8 encoding, and closes the file.
-
- The file to open for reading.
-
- A string array containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a file, reads all lines of the file with the specified encoding, and closes the file.
-
- The file to open for reading.
- The encoding applied to the contents of the file.
-
- A string array containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a text file, reads all lines of the file with the UTF-8 encoding, and closes the file.
-
- The file to open for reading.
-
- A string containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a file, reads all lines of the file with the specified encoding, and closes the file.
-
- The file to open for reading.
- The encoding applied to the contents of the file.
-
- A string containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Reads the lines of a file with the UTF-8 encoding.
-
- The file to read.
-
- The lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Read the lines of a file that has a specified encoding.
-
- The file to read.
- The encoding that is applied to the contents of the file.
-
- The lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Sets the date and time the specified file was last accessed.
-
- The file for which to set the access date and time information.
- A containing the value to set for the last access date and time of path. This value is expressed in local time.
-
-
-
- Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.
-
- The file for which to set the access date and time information.
- A containing the value to set for the last access date and time of path. This value is expressed in UTC time.
-
-
-
- Sets the date and time that the specified file was last written to.
-
- The file for which to set the date and time information.
- A containing the value to set for the last write date and time of path. This value is expressed in local time.
-
-
-
- Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.
-
- The file for which to set the date and time information.
- A containing the value to set for the last write date and time of path. This value is expressed in UTC time.
-
-
-
- Writes the specified byte array to the specified file, and closes the file.
-
- The file to write to.
- The bytes to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes a collection of strings to the file using the UTF-8 encoding, and closes the file.
-
- The file to write to.
- The lines to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Write the specified string array to the file using the UTF-8 encoding, and closes the file.
-
- The file to write to.
- The string array to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes a collection of strings to the file using the specified encoding, and closes the file.
-
- The file to write to.
- The lines to write to the file.
- The character encoding to use.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes the specified string array to the file by using the specified encoding, and closes the file.
-
- The file to write to.
- The string array to write to the file.
- An object that represents the character encoding applied to the string array.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes the specified string to the file using the UTF-8 encoding, and closes the file.
-
- The file to write to.
- The string to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes the specified string to the file using the specified encoding, and closes the file.
-
- The file to write to.
- The string to write to the file.
- The encoding to apply to the string.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Gets the of the file on the path.
-
- The path to the file.
-
- The of the file on the path.
-
- is null .
- Client is not connected.
- was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Sets the specified of the file on the specified path.
-
- The path to the file.
- The desired .
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Synchronizes the directories.
-
- The source path.
- The destination path.
- The search pattern.
-
- A list of uploaded files.
-
- is null .
- is null or contains only whitespace.
- was not found on the remote host.
-
-
-
- Begins the synchronize directories.
-
- The source path.
- The destination path.
- The search pattern.
- The async callback.
- The state.
-
- An that represents the asynchronous directory synchronization.
-
- is null .
- is null or contains only whitespace.
-
-
-
- Ends the synchronize directories.
-
- The async result.
-
- A list of uploaded files.
-
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
- The destination path was not found on the remote host.
-
-
-
- Internals the list directory.
-
- The path.
- The list callback.
-
- A list of files in the specfied directory.
-
- is null .
- Client not connected.
-
-
-
- Internals the download file.
-
- The path.
- The output.
- An that references the asynchronous request.
- The download callback.
- is null .
- is null or contains whitespace.
- Client not connected.
-
-
-
- Internals the upload file.
-
- The input.
- The path.
- The flags.
- An that references the asynchronous request.
- The upload callback.
- is null .
- is null or contains whitespace.
- Client not connected.
-
-
-
- Called when client is connected to the server.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- SSH_FXF_READ
-
-
-
-
- SSH_FXF_WRITE
-
-
-
-
- SSH_FXF_APPEND
-
-
-
-
- SSH_FXF_CREAT
-
-
-
-
- SSH_FXF_TRUNC
-
-
-
-
- SSH_FXF_EXCL
-
-
-
-
- Gets the SFTP protocol version.
-
-
- The SFTP protocol version.
-
-
-
-
- Gets the remote working directory.
-
-
- The remote working directory.
-
-
-
-
- Changes the current working directory to the specified path.
-
- The new working directory.
-
-
-
- Resolves a given path into an absolute path on the server.
-
- The path to resolve.
-
- The absolute path.
-
-
-
-
- Performs SSH_FXP_FSTAT request.
-
- The handle.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_STAT request.
-
- The path.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_STAT request
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_LSTAT request.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_MKDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- A array representing a file handle.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_OPENDIR request
-
- The path.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs posix-rename@openssh.com extended request.
-
- The old path.
- The new path.
-
-
-
- Performs SSH_FXP_READ request.
-
- The handle.
- The offset.
- The length.
- data array; null if EOF
-
-
-
- Begins an asynchronous read using a SSH_FXP_READ request.
-
- The handle to the file to read from.
- The offset in the file to start reading from.
- The number of bytes to read.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- A array representing the data read.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_READDIR request
-
- The handle.
-
-
-
-
- Performs SSH_FXP_REALPATH request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_REALPATH request.
-
- An that represents an asynchronous call.
-
- The absolute path.
-
- is null .
-
-
-
- Performs SSH_FXP_REMOVE request.
-
- The path.
-
-
-
- Performs SSH_FXP_RENAME request.
-
- The old path.
- The new path.
-
-
-
- Performs SSH_FXP_RMDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_SETSTAT request.
-
- The path.
- The attributes.
-
-
-
- Performs statvfs@openssh.com extended request.
-
- The path.
- if set to true [null on error].
-
-
-
-
- Performs SSH_FXP_SYMLINK request.
-
- The linkpath.
- The targetpath.
-
-
-
- Performs SSH_FXP_FSETSTAT request.
-
- The handle.
- The attributes.
-
-
-
- Performs SSH_FXP_WRITE request.
-
- The handle.
- The the zero-based offset (in bytes) relative to the beginning of the file that the write must start at.
- The buffer holding the data to write.
- the zero-based offset in at which to begin taking bytes to write.
- The length (in bytes) of the data to write.
- The wait event handle if needed.
- The callback to invoke when the write has completed.
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous close.
-
- An that represents an asynchronous call.
- is null .
-
-
-
- Calculates the optimal size of the buffer to read data from the channel.
-
- The buffer size configured on the client.
-
- The optimal size of the buffer to read data from the channel.
-
-
-
-
- Calculates the optimal size of the buffer to write data on the channel.
-
- The buffer size configured on the client.
- The file handle.
-
- The optimal size of the buffer to write data on the channel.
-
-
- Currently, we do not take the remote window size into account.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The protocol version.
- The request id.
- Specifies the path name of the new link to create.
- Specifies the path of a target object to which the newly created link will refer. In the case of a symbolic link, this path may not exist.
- if set to false the link should be a hard link, or a second directory entry referring to the same file or directory object.
- The status action.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the zero-based offset (in bytes) relative to the beginning of the file that the write
- must start at.
-
-
- The zero-based offset (in bytes) relative to the beginning of the file that the write must
- start at.
-
-
-
-
- Gets the buffer holding the data to write.
-
-
- The buffer holding the data to write.
-
-
-
-
- Gets the zero-based offset in at which to begin taking bytes to
- write.
-
-
- The zero-based offset in at which to begin taking bytes to write.
-
-
-
-
- Gets the length (in bytes) of the data to write.
-
-
- The length (in bytes) of the data to write.
-
-
-
-
- Encapsulates the results of an asynchronous download operation.
-
-
-
-
- Gets or sets a value indicating whether to cancel asynchronous download operation.
-
-
- true if download operation to be canceled; otherwise, false .
-
-
- Download operation will be canceled after finishing uploading current buffer.
-
-
-
-
- Gets the number of downloaded bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- Number of downloaded bytes.
-
-
-
- Represents SFTP file information
-
-
-
-
- Gets the file attributes.
-
-
-
-
- Initializes a new instance of the class.
-
- The SFTP session.
- Full path of the directory or file.
- Attributes of the directory or file.
- or is null .
-
-
-
- Gets the full path of the directory or file.
-
-
-
-
- For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists.
- Otherwise, the Name property gets the name of the directory.
-
-
-
-
- Gets or sets the time the current file or directory was last accessed.
-
-
- The time that the current file or directory was last accessed.
-
-
-
-
- Gets or sets the time when the current file or directory was last written to.
-
-
- The time the current file was last written.
-
-
-
-
- Gets or sets the time, in coordinated universal time (UTC), the current file or directory was last accessed.
-
-
- The time that the current file or directory was last accessed.
-
-
-
-
- Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.
-
-
- The time the current file was last written.
-
-
-
-
- Gets or sets the size, in bytes, of the current file.
-
-
- The size of the current file in bytes.
-
-
-
-
- Gets or sets file user id.
-
-
- File user id.
-
-
-
-
- Gets or sets file group id.
-
-
- File group id.
-
-
-
-
- Gets a value indicating whether file represents a socket.
-
-
- true if file represents a socket; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a symbolic link.
-
-
- true if file represents a symbolic link; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a regular file.
-
-
- true if file represents a regular file; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a block device.
-
-
- true if file represents a block device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a directory.
-
-
- true if file represents a directory; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a character device.
-
-
- true if file represents a character device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a named pipe.
-
-
- true if file represents a named pipe; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the owner can read from this file.
-
-
- true if owner can read from this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the owner can write into this file.
-
-
- true if owner can write into this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the owner can execute this file.
-
-
- true if owner can execute this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the group members can read from this file.
-
-
- true if group members can read from this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the group members can write into this file.
-
-
- true if group members can write into this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the group members can execute this file.
-
-
- true if group members can execute this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the others can read from this file.
-
-
- true if others can read from this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the others can write into this file.
-
-
- true if others can write into this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the others can execute this file.
-
-
- true if others can execute this file; otherwise, false .
-
-
-
-
- Sets file permissions.
-
- The mode.
-
-
-
- Permanently deletes a file on remote machine.
-
-
-
-
- Moves a specified file to a new location on remote machine, providing the option to specify a new file name.
-
- The path to move the file to, which can specify a different file name.
- is null .
-
-
-
- Updates file status on the server.
-
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Contains SFTP file attributes.
-
-
-
-
- Gets or sets the time the current file or directory was last accessed.
-
-
- The time that the current file or directory was last accessed.
-
-
-
-
- Gets or sets the time when the current file or directory was last written to.
-
-
- The time the current file was last written.
-
-
-
-
- Gets or sets the size, in bytes, of the current file.
-
-
- The size of the current file in bytes.
-
-
-
-
- Gets or sets file user id.
-
-
- File user id.
-
-
-
-
- Gets or sets file group id.
-
-
- File group id.
-
-
-
-
- Gets a value indicating whether file represents a socket.
-
-
- true if file represents a socket; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a symbolic link.
-
-
- true if file represents a symbolic link; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a regular file.
-
-
- true if file represents a regular file; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a block device.
-
-
- true if file represents a block device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a directory.
-
-
- true if file represents a directory; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a character device.
-
-
- true if file represents a character device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a named pipe.
-
-
- true if file represents a named pipe; otherwise, false .
-
-
-
-
- Gets a value indicating whether the owner can read from this file.
-
-
- true if owner can read from this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the owner can write into this file.
-
-
- true if owner can write into this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the owner can execute this file.
-
-
- true if owner can execute this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the group members can read from this file.
-
-
- true if group members can read from this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the group members can write into this file.
-
-
- true if group members can write into this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the group members can execute this file.
-
-
- true if group members can execute this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the others can read from this file.
-
-
- true if others can read from this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the others can write into this file.
-
-
- true if others can write into this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the others can execute this file.
-
-
- true if others can execute this file; otherwise, false .
-
-
-
-
- Gets or sets the extensions.
-
-
- The extensions.
-
-
-
-
- Sets the permissions.
-
- The mode.
-
-
-
- Returns a byte array representing the current .
-
-
- A byte array representing the current .
-
-
-
-
- Holds the size of the file, when available.
-
-
-
-
- Holds a value indicating whether EOF has already been signaled by the SSH server.
-
-
-
-
- Holds a value indicating whether the client has read up to the end of the file.
-
-
-
-
- Initializes a new instance with the specified handle,
- and the maximum number of pending reads.
-
-
-
- The size of a individual read-ahead chunk.
- The maximum number of pending reads.
- The size of the file, if known; otherwise, null .
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Returns a value indicating whether the read-ahead loop should be continued.
-
-
- true if the read-ahead loop should be continued; otherwise, false .
-
-
-
-
- Exposes a around a remote SFTP file, supporting both synchronous and asynchronous read and write operations.
-
-
-
-
- Gets a value indicating whether the current stream supports reading.
-
-
- true if the stream supports reading; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports seeking.
-
-
- true if the stream supports seeking; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports writing.
-
-
- true if the stream supports writing; otherwise, false .
-
-
-
-
- Indicates whether timeout properties are usable for .
-
-
- true in all cases.
-
-
-
-
- Gets the length in bytes of the stream.
-
- A long value representing the length of the stream in bytes.
- A class derived from Stream does not support seeking.
- Methods were called after the stream was closed.
- IO operation failed.
-
-
-
- Gets or sets the position within the current stream.
-
- The current position within the stream.
- An I/O error occurs.
- The stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- Gets the name of the path that was used to construct the current .
-
-
- The name of the path that was used to construct the current .
-
-
-
-
- Gets the operating system file handle for the file that the current encapsulates.
-
-
- The operating system file handle for the file that the current encapsulates.
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout.
-
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Clears all buffers for this stream and causes any buffered data to be written to the file.
-
- An I/O error occurs.
- Stream is closed.
-
-
-
- Reads a sequence of bytes from the current stream and advances the position within the stream by the
- number of bytes read.
-
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
- The zero-based byte offset in at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
-
- The total number of bytes read into the buffer. This can be less than the number of bytes requested
- if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
-
- The sum of and is larger than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support reading.
- Methods were called after the stream was closed.
-
-
- This method attempts to read up to bytes. This either from the buffer, from the
- server (using one or more SSH_FXP_READ requests) or using a combination of both.
-
-
- The read loop is interrupted when either bytes are read, the server returns zero
- bytes (EOF) or less bytes than the read buffer size.
-
-
- When a server returns less number of bytes than the read buffer size, this may indicate that EOF has
- been reached. A subsequent (SSH_FXP_READ ) server request is necessary to make sure EOF has effectively
- been reached. Breaking out of the read loop avoids reading from the server twice to determine EOF: once in
- the read loop, and once upon the next or invocation.
-
-
-
-
-
- Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
-
-
- The unsigned byte cast to an , or -1 if at the end of the stream.
-
- The stream does not support reading.
- Methods were called after the stream was closed.
- Read operation failed.
-
-
-
- Sets the position within the current stream.
-
- A byte offset relative to the parameter.
- A value of type indicating the reference point used to obtain the new position.
-
- The new position within the current stream.
-
- An I/O error occurs.
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
- Methods were called after the stream was closed.
-
-
-
- Sets the length of the current stream.
-
- The desired length of the current stream in bytes.
- An I/O error occurs.
- The stream does not support both writing and seeking.
- Methods were called after the stream was closed.
- must be greater than zero.
-
-
- Buffers are first flushed.
-
-
- If the specified value is less than the current length of the stream, the stream is truncated and - if the
- current position is greater than the new length - the current position is moved to the last byte of the stream.
-
-
- If the given value is greater than the current length of the stream, the stream is expanded and the current
- position remains the same.
-
-
-
-
-
- Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- An array of bytes. This method copies bytes from to the current stream.
- The zero-based byte offset in at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
- The sum of and is greater than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support writing.
- Methods were called after the stream was closed.
-
-
-
- Writes a byte to the current position in the stream and advances the position within the stream by one byte.
-
- The byte to write to the stream.
- An I/O error occurs.
- The stream does not support writing, or the stream is already closed.
- Methods were called after the stream was closed.
-
-
-
- Releases the unmanaged resources used by the and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Flushes the read data from the buffer.
-
-
-
-
- Flush any buffered write data to the file.
-
-
-
-
- Setups the read.
-
-
-
-
- Setups the write.
-
-
-
-
- Contains File system information exposed by statvfs@openssh.com request.
-
-
-
-
- Gets the file system block size.
-
-
- The file system block size.
-
-
-
-
- Gets the fundamental file system size of the block.
-
-
- The fundamental file system block size.
-
-
-
-
- Gets the total blocks.
-
-
- The total blocks.
-
-
-
-
- Gets the free blocks.
-
-
- The free blocks.
-
-
-
-
- Gets the available blocks.
-
-
- The available blocks.
-
-
-
-
- Gets the total nodes.
-
-
- The total nodes.
-
-
-
-
- Gets the free nodes.
-
-
- The free nodes.
-
-
-
-
- Gets the available nodes.
-
-
- The available nodes.
-
-
-
-
- Gets the sid.
-
-
- The sid.
-
-
-
-
- Gets a value indicating whether this instance is read only.
-
-
- true if this instance is read only; otherwise, false .
-
-
-
-
- Gets a value indicating whether [supports set uid].
-
-
- true if [supports set uid]; otherwise, false .
-
-
-
-
- Gets the max name lenght.
-
-
- The max name lenght.
-
-
-
-
- Initializes a new instance of the class.
-
- The bsize.
- The frsize.
- The blocks.
- The bfree.
- The bavail.
- The files.
- The ffree.
- The favail.
- The sid.
- The flag.
- The namemax.
-
-
-
- Encapsulates the results of an asynchronous directory list operation.
-
-
-
-
- Gets the number of files read so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- The files read.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Writes the current message to the specified .
-
- The to write the message to.
-
-
-
- SSH_FXP_INIT
-
-
-
-
- SSH_FXP_VERSION
-
-
-
-
- SSH_FXP_OPEN
-
-
-
-
- SSH_FXP_CLOSE
-
-
-
-
- SSH_FXP_READ
-
-
-
-
- SSH_FXP_WRITE
-
-
-
-
- SSH_FXP_LSTAT
-
-
-
-
- SSH_FXP_FSTAT
-
-
-
-
- SSH_FXP_SETSTAT
-
-
-
-
- SSH_FXP_FSETSTAT
-
-
-
-
- SSH_FXP_OPENDIR
-
-
-
-
- SSH_FXP_READDIR
-
-
-
-
- SSH_FXP_REMOVE
-
-
-
-
- SSH_FXP_MKDIR
-
-
-
-
- SSH_FXP_RMDIR
-
-
-
-
- SSH_FXP_REALPATH
-
-
-
-
- SSH_FXP_STAT
-
-
-
-
- SSH_FXP_RENAME
-
-
-
-
- SSH_FXP_READLINK
-
-
-
-
- SSH_FXP_SYMLINK
-
-
-
-
- SSH_FXP_LINK
-
-
-
-
- SSH_FXP_BLOCK
-
-
-
-
- SSH_FXP_UNBLOCK
-
-
-
-
- SSH_FXP_STATUS
-
-
-
-
- SSH_FXP_HANDLE
-
-
-
-
- SSH_FXP_DATA
-
-
-
-
- SSH_FXP_NAME
-
-
-
-
- SSH_FXP_ATTRS
-
-
-
-
- SSH_FXP_EXTENDED
-
-
-
-
- SSH_FXP_EXTENDED_REPLY
-
-
-
-
- Gets the character encoding to use.
-
-
-
-
- Gets the remote working directory.
-
-
- The remote working directory.
-
-
-
-
- Gets the SFTP protocol version.
-
-
- The SFTP protocol version.
-
-
-
-
- Gets the next request id for sftp session.
-
-
-
-
- Changes the current working directory to the specified path.
-
- The new working directory.
-
-
-
- Resolves a given path into an absolute path on the server.
-
- The path to resolve.
-
- The absolute path.
-
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous open.
-
- An that represents an asynchronous call.
-
- A array representing a file handle.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous close.
-
- An that represents an asynchronous call.
- is null .
-
-
-
- Begins an asynchronous read using a SSH_FXP_READ request.
-
- The handle to the file to read from.
- The offset in the file to start reading from.
- The number of bytes to read.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- A array representing the data read.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_READ request.
-
- The handle.
- The offset.
- The length.
- data array; null if EOF
-
-
-
- Performs SSH_FXP_WRITE request.
-
- The handle.
- The the zero-based offset (in bytes) relative to the beginning of the file that the write must start at.
- The buffer holding the data to write.
- the zero-based offset in at which to begin taking bytes to write.
- The length (in bytes) of the data to write.
- The wait event handle if needed.
- The callback to invoke when the write has completed.
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_LSTAT request.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_FSTAT request.
-
- The handle.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_SETSTAT request.
-
- The path.
- The attributes.
-
-
-
- Performs SSH_FXP_FSETSTAT request.
-
- The handle.
- The attributes.
-
-
-
- Performs SSH_FXP_OPENDIR request
-
- The path.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs SSH_FXP_READDIR request
-
- The handle.
-
-
-
-
- Performs SSH_FXP_REMOVE request.
-
- The path.
-
-
-
- Performs SSH_FXP_MKDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_RMDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_REALPATH request
-
- The path.
- if set to true returns null instead of throwing an exception.
-
- The absolute path.
-
-
-
-
- Performs SSH_FXP_REALPATH request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_REALPATH request.
-
- An that represents an asynchronous call.
-
- The absolute path.
-
- is null .
-
-
-
- Performs SSH_FXP_STAT request.
-
- The path.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_STAT request
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous stat.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_RENAME request.
-
- The old path.
- The new path.
-
-
-
- Performs SSH_FXP_READLINK request.
-
- The path.
- if set to true returns null instead of throwing an exception.
-
-
-
-
- Performs SSH_FXP_SYMLINK request.
-
- The linkpath.
- The targetpath.
-
-
-
- Performs posix-rename@openssh.com extended request.
-
- The old path.
- The new path.
-
-
-
- Performs statvfs@openssh.com extended request.
-
- The path.
- if set to true [null on error].
-
-
-
-
- Performs fstatvfs@openssh.com extended request.
-
- The file handle.
- if set to true [null on error].
-
-
-
-
-
- Performs hardlink@openssh.com extended request.
-
- The old path.
- The new path.
-
-
-
- Calculates the optimal size of the buffer to read data from the channel.
-
- The buffer size configured on the client.
-
- The optimal size of the buffer to read data from the channel.
-
-
-
-
- Calculates the optimal size of the buffer to write data on the channel.
-
- The buffer size configured on the client.
- The file handle.
-
- The optimal size of the buffer to write data on the channel.
-
-
- Currently, we do not take the remote window size into account.
-
-
-
-
- Encapsulates the results of an asynchronous directory synchronization operation.
-
-
-
-
- Gets the number of files read so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- The files read.
-
-
-
- Encapsulates the results of an asynchronous upload operation.
-
-
-
-
- Gets or sets a value indicating whether to cancel asynchronous upload operation
-
-
- true if upload operation to be canceled; otherwise, false .
-
-
- Upload operation will be canceled after finishing uploading current buffer.
-
-
-
-
- Gets the number of uploaded bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- Number of uploaded bytes.
-
-
-
- SSH_FX_OK
-
-
-
-
- SSH_FX_EOF
-
-
-
-
- SSH_FX_NO_SUCH_FILE
-
-
-
-
- SSH_FX_PERMISSION_DENIED
-
-
-
-
- SSH_FX_FAILURE
-
-
-
-
- SSH_FX_BAD_MESSAGE
-
-
-
-
- SSH_FX_NO_CONNECTION
-
-
-
-
- SSH_FX_CONNECTION_LOST
-
-
-
-
- SSH_FX_OP_UNSUPPORTED
-
-
-
-
- SSH_FX_INVALID_HANDLE
-
-
-
-
- SSH_FX_NO_SUCH_PATH
-
-
-
-
- SSH_FX_FILE_ALREADY_EXISTS
-
-
-
-
- SSH_FX_WRITE_PROTECT
-
-
-
-
- SSH_FX_NO_MEDIA
-
-
-
-
- SSH_FX_NO_SPACE_ON_FILESYSTEM
-
-
-
-
- SSH_FX_QUOTA_EXCEEDED
-
-
-
-
- SSH_FX_UNKNOWN_PRINCIPAL
-
-
-
-
- SSH_FX_LOCK_CONFLICT
-
-
-
-
- SSH_FX_DIR_NOT_EMPTY
-
-
-
-
- SSH_FX_NOT_A_DIRECTORY
-
-
-
-
- SSH_FX_INVALID_FILENAME
-
-
-
-
- SSH_FX_LINK_LOOP
-
-
-
-
- SSH_FX_CANNOT_DELETE
-
-
-
-
- SSH_FX_INVALID_PARAMETER
-
-
-
-
- SSH_FX_FILE_IS_A_DIRECTORY
-
-
-
-
- SSH_FX_BYTE_RANGE_LOCK_CONFLICT
-
-
-
-
- SSH_FX_BYTE_RANGE_LOCK_REFUSED
-
-
-
-
- SSH_FX_DELETE_PENDING
-
-
-
-
- SSH_FX_FILE_CORRUPT
-
-
-
-
- SSH_FX_OWNER_INVALID
-
-
-
-
- SSH_FX_GROUP_INVALID
-
-
-
-
- SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK
-
-
-
-
- Represents instance of the SSH shell object
-
-
-
-
- Gets a value indicating whether this shell is started.
-
-
- true if started is started; otherwise, false .
-
-
-
-
- Occurs when shell is starting.
-
-
-
-
- Occurs when shell is started.
-
-
-
-
- Occurs when shell is stopping.
-
-
-
-
- Occurs when shell is stopped.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Initializes a new instance of the class.
-
- The session.
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal modes.
- Size of the buffer for output stream.
-
-
-
- Starts this shell.
-
- Shell is started.
-
-
-
- Stops this shell.
-
- Shell is not started.
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Contains operation for working with SSH Shell.
-
-
-
-
- Occurs when data was received.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Gets a value that indicates whether data is available on the to be read.
-
-
- true if data is available to be read; otherwise, false .
-
-
-
-
- Gets the number of bytes that will be written to the internal buffer.
-
-
- The number of bytes that will be written to the internal buffer.
-
-
-
-
- Initializes a new instance.
-
- The SSH session.
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The terminal mode values.
- The size of the buffer.
- The channel could not be opened.
- The pseudo-terminal request was not accepted by the server.
- The request to start a shell was not accepted by the server.
-
-
-
- Gets a value indicating whether the current stream supports reading.
-
-
- true if the stream supports reading; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports seeking.
-
-
- true if the stream supports seeking; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports writing.
-
-
- true if the stream supports writing; otherwise, false .
-
-
-
-
- Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
-
- An I/O error occurs.
- Methods were called after the stream was closed.
-
-
-
- Gets the length in bytes of the stream.
-
- A long value representing the length of the stream in bytes.
- A class derived from Stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- Gets or sets the position within the current stream.
-
-
- The current position within the stream.
-
- An I/O error occurs.
- The stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
-
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
- The zero-based byte offset in at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
-
- The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
-
- The sum of and is larger than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support reading.
- Methods were called after the stream was closed.
-
-
-
- This method is not supported.
-
- A byte offset relative to the parameter.
- A value of type indicating the reference point used to obtain the new position.
-
- The new position within the current stream.
-
- An I/O error occurs.
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
- Methods were called after the stream was closed.
-
-
-
- This method is not supported.
-
- The desired length of the current stream in bytes.
- An I/O error occurs.
- The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.
- Methods were called after the stream was closed.
-
-
-
- Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- An array of bytes. This method copies bytes from to the current stream.
- The zero-based byte offset in at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
- The sum of and is greater than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support writing.
- Methods were called after the stream was closed.
-
-
-
- Expects the specified expression and performs action when one is found.
-
- The expected expressions and actions to perform.
-
-
-
- Expects the specified expression and performs action when one is found.
-
- Time to wait for input.
- The expected expressions and actions to perform, if the specified time elapsed and expected condition have not met, that method will exit without executing any action.
-
-
-
- Begins the expect.
-
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Begins the expect.
-
- The callback.
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Begins the expect.
-
- The callback.
- The state.
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Begins the expect.
-
- The timeout.
- The callback.
- The state.
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Ends the execute.
-
- The async result.
- Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.
-
-
-
- Expects the expression specified by text.
-
- The text to expect.
-
- Text available in the shell that ends with expected text.
-
-
-
-
- Expects the expression specified by text.
-
- The text to expect.
- Time to wait for input.
-
- The text available in the shell that ends with expected text, or null if the specified time has elapsed.
-
-
-
-
- Expects the expression specified by regular expression.
-
- The regular expression to expect.
-
- The text available in the shell that contains all the text that ends with expected expression.
-
-
-
-
- Expects the expression specified by regular expression.
-
- The regular expression to expect.
- Time to wait for input.
-
- The text available in the shell that contains all the text that ends with expected expression,
- or null if the specified time has elapsed.
-
-
-
-
- Reads the line from the shell. If line is not available it will block the execution and will wait for new line.
-
-
- The line read from the shell.
-
-
-
-
- Reads a line from the shell. If line is not available it will block the execution and will wait for new line.
-
- Time to wait for input.
-
- The line read from the shell, or null when no input is received for the specified timeout.
-
-
-
-
- Reads text available in the shell.
-
-
- The text available in the shell.
-
-
-
-
- Writes the specified text to the shell.
-
- The text to be written to the shell.
-
- If is null , nothing is written.
-
-
-
-
- Writes the line to the shell.
-
- The line to be written to the shell.
-
- If is null , only the line terminator is written.
-
-
-
-
- Releases the unmanaged resources used by the and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Provides client connection to SSH server.
-
-
-
-
- Holds the list of forwarded ports
-
-
-
-
- Holds a value indicating whether the current instance is disposed.
-
-
- true if the current instance is disposed; otherwise, false .
-
-
-
-
- Gets the list of forwarded ports.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
-
-
-
-
-
-
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
-
-
-
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
-
-
-
-
- is null .
- is invalid, -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
-
-
-
-
- is null .
- is invalid, -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Adds the forwarded port.
-
- The port.
-
-
-
-
- Forwarded port is already added to a different client.
- is null .
- Client is not connected.
-
-
-
- Stops and removes the forwarded port from the list.
-
- Forwarded port.
- is null .
-
-
-
- Creates the command to be executed.
-
- The command text.
- object.
- Client is not connected.
-
-
-
- Creates the command to be executed with specified encoding.
-
- The command text.
- The encoding to use for results.
- object which uses specified encoding.
- This method will change current default encoding.
- Client is not connected.
- or is null .
-
-
-
- Creates and executes the command.
-
- The command text.
- Returns an instance of with execution results.
- This method internally uses asynchronous calls.
-
-
-
-
- CommandText property is empty.
- Invalid Operation - An existing channel was used to execute this command.
- Asynchronous operation is already in progress.
- Client is not connected.
- is null .
-
-
-
- Creates the shell.
-
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode.
- Size of the internal read buffer.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The input.
- The output.
- The extended output.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The encoding to use to send the input.
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode.
- Size of the internal read buffer.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The encoding.
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal modes.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The encoding.
- The input.
- The output.
- The extended output.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell stream.
-
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The size of the buffer.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Creates the shell stream.
-
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The size of the buffer.
- The terminal mode values.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Stops forwarded ports.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Represents SSH command that can be executed.
-
-
-
-
- Gets the command text.
-
-
-
-
- Gets or sets the command timeout.
-
-
- The command timeout.
-
-
-
-
-
-
-
- Gets the command exit status.
-
-
-
-
-
-
-
- Gets the output stream.
-
-
-
-
-
-
-
- Gets the extended output stream.
-
-
-
-
-
-
-
- Gets the command execution result.
-
-
-
-
-
-
-
- Gets the command execution error.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The session.
- The command text.
- The encoding to use for the results.
- Either , is null .
-
-
-
- Begins an asynchronous command execution.
-
-
- An that represents the asynchronous command execution, which could still be pending.
-
-
-
-
- Asynchronous operation is already in progress.
- Invalid operation.
- CommandText property is empty.
- Client is not connected.
- Operation has timed out.
- Asynchronous operation is already in progress.
- CommandText property is empty.
-
-
-
- Begins an asynchronous command execution.
-
- An optional asynchronous callback, to be called when the command execution is complete.
-
- An that represents the asynchronous command execution, which could still be pending.
-
- Asynchronous operation is already in progress.
- Invalid operation.
- CommandText property is empty.
- Client is not connected.
- Operation has timed out.
- Asynchronous operation is already in progress.
- CommandText property is empty.
-
-
-
- Begins an asynchronous command execution.
-
- An optional asynchronous callback, to be called when the command execution is complete.
- A user-provided object that distinguishes this particular asynchronous read request from other requests.
-
- An that represents the asynchronous command execution, which could still be pending.
-
- Asynchronous operation is already in progress.
- Invalid operation.
- CommandText property is empty.
- Client is not connected.
- Operation has timed out.
- Asynchronous operation is already in progress.
- CommandText property is empty.
-
-
-
- Begins an asynchronous command execution.
-
- The command text.
- An optional asynchronous callback, to be called when the command execution is complete.
- A user-provided object that distinguishes this particular asynchronous read request from other requests.
-
- An that represents the asynchronous command execution, which could still be pending.
-
- Client is not connected.
- Operation has timed out.
-
-
-
- Waits for the pending asynchronous command execution to complete.
-
- The reference to the pending asynchronous request to finish.
- Command execution result.
-
-
-
- Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.
- is null .
-
-
-
- Executes command specified by property.
-
- Command execution result
-
-
-
-
-
- Client is not connected.
- Operation has timed out.
-
-
-
- Cancels command execution in asynchronous scenarios.
-
-
-
-
- Executes the specified command text.
-
- The command text.
- Command execution result
- Client is not connected.
- Operation has timed out.
-
-
- Command '{0}' has timed out.
- The actual command will be included in the exception message.
-
-
-
- Unsubscribes the current from channel events, and disposes
- the .
-
- The channel.
-
- Does nothing when is null .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Defines the highest message number that is currently supported.
-
-
-
-
- Defines the total number of supported messages.
-
-
-
-
- Disables and deactivate all messages.
-
-
-
-
- Base class for SSH subsystem implementations
-
-
-
-
- Holds the number of system wait handles that are returned as the leading entries in the array returned
- in .
-
-
-
-
- Gets or set the number of seconds to wait for an operation to complete.
-
-
- The number of seconds to wait for an operation to complete, or -1 to wait indefinitely.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Occurs when the server has disconnected from the session.
-
-
-
-
- Gets the channel associated with this session.
-
-
- The channel associated with this session.
-
-
-
-
- Gets a value indicating whether this session is open.
-
-
- true if this session is open; otherwise, false .
-
-
-
-
- Initializes a new instance of the SubsystemSession class.
-
- The session.
- Name of the subsystem.
- The number of milliseconds to wait for a given operation to complete, or -1 to wait indefinitely.
- or is null .
-
-
-
- Connects the subsystem using a new SSH channel session.
-
- The session is already connected.
- The method was called after the session was disposed.
- The channel session could not be opened, or the subsystem could not be executed.
-
-
-
- Disconnects the subsystem channel.
-
-
-
-
- Sends data to the subsystem.
-
- The data to be sent.
-
-
-
- Called when channel is open.
-
-
-
-
- Called when data is received.
-
- The data.
-
-
-
- Raises the error.
-
- The error.
-
-
-
- Waits a specified time for a given to get signaled.
-
- The handle to wait for.
- To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
- The connection was closed by the server.
- The channel was closed.
- The handle did not get signaled within the specified timeout.
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The handle to wait for.
- To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
-
- true if received a signal within the specified timeout;
- otherwise, false .
-
- The connection was closed by the server.
- The channel was closed.
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The first handle to wait for.
- The second handle to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- 0 if received a signal within the specified timeout, and 1
- if received a signal within the specified timeout.
-
- The connection was closed by the server.
- The channel was closed.
- The handle did not get signaled within the specified timeout.
-
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
- When both and are signaled during the call,
- then 0 is returned.
-
-
-
-
-
- Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed
- integer to specify the time interval.
-
- A array - constructed using - containing the objects to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- The array index of the first non-system object that satisfied the wait.
-
- The connection was closed by the server.
- The channel was closed.
- No object satified the wait and a time interval equivalent to has passed.
-
- For the return value, the index of the first non-system object is considered to be zero.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- The first to wait for.
- The second to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- A array containing the objects to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Finalizes an instance of the class.
-
-
-
-