mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-27 19:52:08 +08:00
Compare commits
90 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
36fda2e287 | ||
![]() |
7dfece6e29 | ||
![]() |
ffb9bfdf7f | ||
![]() |
17e96a94fe | ||
![]() |
b16b22c117 | ||
![]() |
9a6879207f | ||
![]() |
8e66e5c801 | ||
![]() |
47d84ac3dd | ||
![]() |
073a894e26 | ||
![]() |
7a92e6688e | ||
![]() |
971a2c66c7 | ||
![]() |
b4e9e17925 | ||
![]() |
5de0e9734e | ||
![]() |
465c6031f8 | ||
![]() |
a421e12435 | ||
![]() |
766f978e3e | ||
![]() |
ae9d74c17c | ||
![]() |
958c0c4153 | ||
![]() |
9924bb1e72 | ||
![]() |
a6d28bd72a | ||
![]() |
955b887039 | ||
![]() |
ac3839a8eb | ||
![]() |
4d2c89dc96 | ||
![]() |
e773e4d0fd | ||
![]() |
d0814ee1da | ||
![]() |
c31c978fc8 | ||
![]() |
040a3db6e2 | ||
![]() |
cd68643df8 | ||
![]() |
5ad59dcd36 | ||
![]() |
476ae5d25f | ||
![]() |
369ae42139 | ||
![]() |
676973d946 | ||
![]() |
3ce8b69065 | ||
![]() |
d752a2fb7f | ||
![]() |
95fba10d0f | ||
![]() |
acebe04732 | ||
![]() |
226f751655 | ||
![]() |
18a0de4c4e | ||
![]() |
e5f29dc46c | ||
![]() |
c94d0133fc | ||
![]() |
7cd1e9190b | ||
![]() |
df735880fe | ||
![]() |
f0b89d4168 | ||
![]() |
8af46d4bfb | ||
![]() |
e8fdbee3e4 | ||
![]() |
6cbd20fc90 | ||
![]() |
25c0b2ba95 | ||
![]() |
f16c0e7bcf | ||
![]() |
12e29bc105 | ||
![]() |
f7a7e34b34 | ||
![]() |
4d7049c9b8 | ||
![]() |
ad61caf1d2 | ||
![]() |
f84cbe2078 | ||
![]() |
a9df37f216 | ||
![]() |
60bec3d46c | ||
![]() |
3c1e1f19c4 | ||
![]() |
207d8ff746 | ||
![]() |
835dc7a0fd | ||
![]() |
cdfb956211 | ||
![]() |
d5ba31e5d7 | ||
![]() |
e80ec4f063 | ||
![]() |
cdb8d8681e | ||
![]() |
d6d0abeb1c | ||
![]() |
9565248f95 | ||
![]() |
1d6cd5984b | ||
![]() |
63b857c915 | ||
![]() |
6811f19db4 | ||
![]() |
847e1c0d6e | ||
![]() |
99a8448d53 | ||
![]() |
4fe9cd21ef | ||
![]() |
bdb53ac436 | ||
![]() |
01b9ee4505 | ||
![]() |
fadbf9c6aa | ||
![]() |
60e235e4d7 | ||
![]() |
da4b431761 | ||
![]() |
7fff30521e | ||
![]() |
e7c78774ca | ||
![]() |
fb6f9da14c | ||
![]() |
7b1773c5f0 | ||
![]() |
7b15a74448 | ||
![]() |
956f65941e | ||
![]() |
6d1f806e94 | ||
![]() |
d727d6b778 | ||
![]() |
ea891861b3 | ||
![]() |
e0826a80c8 | ||
![]() |
74868a918e | ||
![]() |
889ecee3f3 | ||
![]() |
f6dd0bbb56 | ||
![]() |
01686f3e9d | ||
![]() |
5a6cd7d671 |
12
.github/workflows/main.yaml
vendored
12
.github/workflows/main.yaml
vendored
@@ -8,14 +8,19 @@ on:
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# 1.20 是 Windows 7/8 Server 2008/2012 最后一个支持版本
|
||||
image: goreleaser/goreleaser-cross:v1.20
|
||||
steps:
|
||||
- run: |
|
||||
git config --global --add safe.directory /__w/ecs/ecs
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.22.4
|
||||
|
||||
@@ -27,12 +32,11 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v4
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean
|
||||
args: release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
GOPRIVATE: github.com/oneclickvirt/security
|
||||
CGO_ENABLED: 0 # 禁用 CGO,强制静态链接
|
||||
|
78
.goreleaser.yaml
Normal file
78
.goreleaser.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy -v
|
||||
builds:
|
||||
- id: universal
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- freebsd
|
||||
goarch:
|
||||
- arm
|
||||
- arm64
|
||||
- 386
|
||||
- amd64
|
||||
- mips
|
||||
- mipsle
|
||||
- s390x
|
||||
- riscv64
|
||||
gomips:
|
||||
- softfloat
|
||||
ignore:
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
main: ./
|
||||
binary: goecs
|
||||
- id: darwin-amd64
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=o64-clang
|
||||
- CXX=o64-clang++
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
main: ./
|
||||
binary: goecs
|
||||
- id: darwin-arm64
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=oa64-clang
|
||||
- CXX=oa64-clang++
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- arm64
|
||||
main: ./
|
||||
binary: goecs
|
||||
universal_binaries:
|
||||
- name_template: "goecs"
|
||||
replace: false
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
snapshot:
|
||||
name_template: "goecs"
|
||||
archives:
|
||||
- name_template: "goecs_{{ .Os }}_{{ .Arch }}"
|
||||
format: zip
|
||||
files:
|
||||
- none*
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
- "^chore"
|
||||
- Merge pull request
|
||||
- Merge branch
|
||||
- go mod tidy
|
||||
- New translations
|
687
LICENSE
687
LICENSE
@@ -1,21 +1,674 @@
|
||||
MIT License
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (c) 2024 oneclickvirt
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
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:
|
||||
Preamble
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
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.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
179
README.md
179
README.md
@@ -1,11 +1,31 @@
|
||||
# ecs
|
||||
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [](https://www.spiritlhl.net/)
|
||||
|
||||
融合怪测评脚本 - GO重构版本
|
||||
融合怪测评脚本 - GO重构版本 - 由于未正式发版,如有问题请issues反馈
|
||||
|
||||
Shell版本: https://github.com/spiritLHLS/ecs
|
||||
|
||||
## 语言
|
||||
|
||||
[中文文档](README.md) | [English Docs](README_EN.md)
|
||||
|
||||
## 适配系统和架构
|
||||
|
||||
编译支持的架构: amd64、arm、arm64、386、s390x、mips、mipsle、s390x、riscv64
|
||||
|
||||
测试支持的架构: amd64、arm64
|
||||
|
||||
更多架构请自行测试
|
||||
|
||||
编译支持的系统: Linux、Windows、FreeBSD、OpenBSD
|
||||
|
||||
测试支持的系统: Linux、Windows
|
||||
|
||||
更多系统请自行测试
|
||||
|
||||
待支持的系统(存在硬件测试BUG未修复): MacOS、FreeBSD、OpenBSD
|
||||
|
||||
## 功能
|
||||
|
||||
- [x] 系统基础信息查询[自研[basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)]
|
||||
@@ -20,11 +40,158 @@ Shell版本: https://github.com/spiritLHLS/ecs
|
||||
- [x] 三网回程测试[借鉴[zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace)二次开发至于[oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
|
||||
- [x] 三网路由测试[借鉴[NTrace-core](https://github.com/nxtrace/NTrace-core)二次开发至于[nt3](https://github.com/oneclickvirt/nt3)]
|
||||
- [x] 测试网速[基于[speedtest.net-爬虫](https://github.com/spiritLHLS/speedtest.net-CN-ID)、[speedtest.cn-爬虫](https://github.com/spiritLHLS/speedtest.cn-CN-ID)的数据,借鉴[speedtest-go](https://github.com/showwin/speedtest-go)二次开发至于[oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
|
||||
- [x] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发至于[pingtest](https://github.com/oneclickvirt/pingtest)]
|
||||
|
||||
## TODO
|
||||
## Linux/FreeBSD/MacOS上使用的说明
|
||||
|
||||
- [ ] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发]
|
||||
### 一键命令
|
||||
|
||||
## 说明
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
|
||||
开发中,勿要使用
|
||||
或
|
||||
|
||||
```
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
|
||||
### 详细说明
|
||||
|
||||
下载脚本
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
安装环境
|
||||
|
||||
```
|
||||
./goecs.sh env
|
||||
```
|
||||
|
||||
安装goecs
|
||||
|
||||
```
|
||||
./goecs.sh install
|
||||
```
|
||||
|
||||
升级goecs
|
||||
|
||||
```
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
|
||||
卸载goecs
|
||||
|
||||
```
|
||||
./goecs.sh delete
|
||||
```
|
||||
|
||||
shell脚本的说明
|
||||
|
||||
```
|
||||
Available commands:
|
||||
|
||||
./goecs.sh env Check and Install package:
|
||||
sudo (Almost all unix-like systems have it.)
|
||||
tar (Almost all unix-like systems have it.)
|
||||
unzip (Almost all unix-like systems have it.)
|
||||
dd (Almost all unix-like systems have it.)
|
||||
fio (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
|
||||
speedtest (Use the officially provided binaries for more accurate test results.)
|
||||
ping (Use the officially provided binaries for more accurate test results.)
|
||||
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
|
||||
./goecs.sh install Install goecs command
|
||||
./goecs.sh upgrade Upgrade goecs command
|
||||
./goecs.sh delete Uninstall goecs command
|
||||
./goecs.sh help Show this message
|
||||
```
|
||||
|
||||
goecs唤起菜单
|
||||
|
||||
```
|
||||
goecs
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```
|
||||
./goecs
|
||||
```
|
||||
|
||||
goecs命令参数化
|
||||
|
||||
```
|
||||
Usage: goecs [options]
|
||||
-backtrace
|
||||
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
|
||||
-basic
|
||||
Enable/Disable basic test (default true)
|
||||
-comm
|
||||
Enable/Disable common media test (default true)
|
||||
-cpu
|
||||
Enable/Disable CPU test (default true)
|
||||
-cpum string
|
||||
Set CPU test method (supported: sysbench, geekbench, winsat) (default "sysbench")
|
||||
-cput string
|
||||
Set CPU test thread mode (supported: single, multi) (default "multi")
|
||||
-disk
|
||||
Enable/Disable disk test (default true)
|
||||
-diskm string
|
||||
Set disk test method (supported: fio, dd, winsat) (default "fio")
|
||||
-diskmc
|
||||
Enable/Disable multiple disk checks, e.g., -diskmc=false
|
||||
-diskp string
|
||||
Set disk test path, e.g., -diskp /root
|
||||
-email
|
||||
Enable/Disable email port test (default true)
|
||||
-h Show help information
|
||||
-l string
|
||||
Set language (supported: en, zh) (default "zh")
|
||||
-log
|
||||
Enable/Disable logging in the current path
|
||||
-memory
|
||||
Enable/Disable memory test (default true)
|
||||
-memorym string
|
||||
Set memory test method (supported: sysbench, dd, winsat) (default "dd")
|
||||
-menu
|
||||
Enable/Disable menu mode, disable example: -menu=false (default true)
|
||||
-nt3
|
||||
Enable/Disable NT3 test (in 'en' language or on windows it always false) (default true)
|
||||
-nt3loc string
|
||||
Specify NT3 test location (supported: GZ, SH, BJ, CD for Guangzhou, Shanghai, Beijing, Chengdu) (default "GZ")
|
||||
-nt3t string
|
||||
Set NT3 test type (supported: both, ipv4, ipv6) (default "ipv4")
|
||||
-security
|
||||
Enable/Disable security test (default true)
|
||||
-speed
|
||||
Enable/Disable speed test (default true)
|
||||
-spnum int
|
||||
Set the number of servers per operator for speed test (default 2)
|
||||
-upload
|
||||
Enable/Disable upload the result (default true)
|
||||
-ut
|
||||
Enable/Disable unlock media test (default true)
|
||||
-v Display version information
|
||||
```
|
||||
|
||||
## Windows上使用的说明
|
||||
|
||||
下载带exe文件的压缩文件
|
||||
|
||||
https://github.com/oneclickvirt/ecs/releases
|
||||
|
||||
找其中最新的版本,按照对应架构下载对应的 .zip 文件,解压后文件夹内有一个exe文件
|
||||
|
||||
选择该exe文件,右键点击选择管理员模式运行(非管理员模式运行无法进行硬件测试),唤起菜单自选
|
||||
|
||||
windows测试无需进行环境安装
|
185
README_EN.md
Normal file
185
README_EN.md
Normal file
@@ -0,0 +1,185 @@
|
||||
# ecs
|
||||
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [](https://www.spiritlhl.net/)
|
||||
|
||||
Fusion Monster Evaluation Script - GO Refactored Version - Since it has not been officially released, please report any issues via issues.
|
||||
|
||||
Shell version: https://github.com/spiritLHLS/ecs/blob/main/README_EN.md
|
||||
|
||||
## Language
|
||||
|
||||
[中文文档](README.md) | [English Docs](README_EN.md)
|
||||
|
||||
## Supported Systems and Architectures
|
||||
|
||||
Architectures supported for compilation: amd64、arm、arm64、386、s390x、mips、mipsle、s390x、riscv64
|
||||
|
||||
Tested architectures: amd64, arm64
|
||||
|
||||
More architectures please test by yourself
|
||||
|
||||
Compilation support: Linux, Windows、FreeBSD、OpenBSD
|
||||
|
||||
Tested on: Linux, Windows
|
||||
|
||||
More systems to be tested
|
||||
|
||||
Systems to be supported (hardware testing bugs not yet fixed): MacOS、FreeBSD、OpenBSD
|
||||
|
||||
## Features
|
||||
|
||||
- [x] System basic information query [Self-developed [basics](https://github.com/oneclickvirt/basics), [gostun](https://github.com/oneclickvirt/gostun)]
|
||||
- [x] Concurrent IP basic information query [Self-developed [basics](https://github.com/oneclickvirt/basics)]
|
||||
- [x] CPU test [Self-developed [cputest](https://github.com/oneclickvirt/cputest) supporting sysbench, geekbench, winsat]
|
||||
- [x] Memory test [Self-developed [memorytest](https://github.com/oneclickvirt/memorytest) supporting sysbench, dd]
|
||||
- [x] Disk test [Self-developed [disktest](https://github.com/oneclickvirt/disktest) supporting dd, fio, winsat]
|
||||
- [x] Concurrent streaming media unlock information query for three major platforms [Modified from [netflix-verify](https://github.com/sjlleo/netflix-verify), [VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus), [TubeCheck](https://github.com/sjlleo/TubeCheck) to [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)]
|
||||
- [x] Concurrent common streaming media tests [Self-developed code, logic modified from [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck), [MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest) to [UnlockTests](https://github.com/oneclickvirt/UnlockTests)]
|
||||
- [x] Concurrent IP quality/security information query [Self-developed, due to testing with key information, privately developed, but binary files compiled in [securityCheck](https://github.com/oneclickvirt/securityCheck)]
|
||||
- [x] Email port test [Self-developed [portchecker](https://github.com/oneclickvirt/portchecker)]
|
||||
- [x] Three-network return path test [Modified from [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace) to [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
|
||||
- [x] Three-network route test [Modified from [NTrace-core](https://github.com/nxtrace/NTrace-core) to [nt3](https://github.com/oneclickvirt/nt3)]
|
||||
- [x] Speed test [Based on data from [speedtest.net-crawler](https://github.com/spiritLHLS/speedtest.net-CN-ID), [speedtest.cn-crawler](https://github.com/spiritLHLS/speedtest.cn-CN-ID), modified from [speedtest-go](https://github.com/showwin/speedtest-go) to [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
|
||||
- [x] Three-network Ping test [Modified from [ecsspeed](https://github.com/spiritLHLS/ecsspeed) logic to [pingtest](https://github.com/oneclickvirt/pingtest)]
|
||||
|
||||
## Instructions for Use on Linux/FreeBSD/MacOS
|
||||
|
||||
### one-click command
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
|
||||
### explain in detail
|
||||
|
||||
Download the script
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
Install environment
|
||||
|
||||
```
|
||||
./goecs.sh env
|
||||
```
|
||||
|
||||
Install goecs
|
||||
|
||||
```
|
||||
./goecs.sh install
|
||||
```
|
||||
|
||||
Upgrade goecs
|
||||
|
||||
```
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
|
||||
Uninstall goecs
|
||||
|
||||
```
|
||||
./goecs.sh delete
|
||||
```
|
||||
|
||||
Explanation of the shell script
|
||||
|
||||
```
|
||||
Available commands:
|
||||
|
||||
./goecs.sh env Check and Install package:
|
||||
sudo (Almost all unix-like systems have it.)
|
||||
tar (Almost all unix-like systems have it.)
|
||||
unzip (Almost all unix-like systems have it.)
|
||||
dd (Almost all unix-like systems have it.)
|
||||
fio (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
|
||||
speedtest (Use the officially provided binaries for more accurate test results.)
|
||||
ping (Use the officially provided binaries for more accurate test results.)
|
||||
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
|
||||
./goecs.sh install Install goecs command
|
||||
./goecs.sh upgrade Upgrade goecs command
|
||||
./goecs.sh delete Uninstall goecs command
|
||||
./goecs.sh help Show this message
|
||||
```
|
||||
|
||||
Invoke the goecs menu
|
||||
|
||||
```
|
||||
goecs
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
./goecs
|
||||
```
|
||||
|
||||
Parameterized goecs command
|
||||
|
||||
```
|
||||
Usage: goecs [options]
|
||||
-backtrace
|
||||
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
|
||||
-basic
|
||||
Enable/Disable basic test (default true)
|
||||
-comm
|
||||
Enable/Disable common media test (default true)
|
||||
-cpu
|
||||
Enable/Disable CPU test (default true)
|
||||
-cpum string
|
||||
Set CPU test method (supported: sysbench, geekbench, winsat) (default "sysbench")
|
||||
-cput string
|
||||
Set CPU test thread mode (supported: single, multi) (default "multi")
|
||||
-disk
|
||||
Enable/Disable disk test (default true)
|
||||
-diskm string
|
||||
Set disk test method (supported: fio, dd, winsat) (default "fio")
|
||||
-diskmc
|
||||
Enable/Disable multiple disk checks, e.g., -diskmc=false
|
||||
-diskp string
|
||||
Set disk test path, e.g., -diskp /root
|
||||
-email
|
||||
Enable/Disable email port test (default true)
|
||||
-h Show help information
|
||||
-l string
|
||||
Set language (supported: en, zh) (default "zh")
|
||||
-log
|
||||
Enable/Disable logging in the current path
|
||||
-memory
|
||||
Enable/Disable memory test (default true)
|
||||
-memorym string
|
||||
Set memory test method (supported: sysbench, dd, winsat) (default "dd")
|
||||
-menu
|
||||
Enable/Disable menu mode, disable example: -menu=false (default true)
|
||||
-nt3
|
||||
Enable/Disable NT3 test (in 'en' language or on windows it always false) (default true)
|
||||
-nt3loc string
|
||||
Specify NT3 test location (supported: GZ, SH, BJ, CD for Guangzhou, Shanghai, Beijing, Chengdu) (default "GZ")
|
||||
-nt3t string
|
||||
Set NT3 test type (supported: both, ipv4, ipv6) (default "ipv4")
|
||||
-security
|
||||
Enable/Disable security test (default true)
|
||||
-speed
|
||||
Enable/Disable speed test (default true)
|
||||
-spnum int
|
||||
Set the number of servers per operator for speed test (default 2)
|
||||
-upload
|
||||
Enable/Disable upload the result (default true)
|
||||
-ut
|
||||
Enable/Disable unlock media test (default true)
|
||||
-v Display version information
|
||||
```
|
||||
|
||||
## Instructions for Use on Windows
|
||||
|
||||
Download the compressed file with the exe file
|
||||
|
||||
https://github.com/oneclickvirt/ecs/releases
|
||||
|
||||
Find the latest version, download the .zip file corresponding to your architecture, and unzip it to get an exe file.
|
||||
|
||||
Right-click the exe file and select Run as administrator (running without administrator mode will not allow hardware testing), and invoke the menu to choose.
|
||||
|
||||
No environment installation is required for Windows testing.
|
24
go.mod
24
go.mod
@@ -4,19 +4,20 @@ go 1.22.4
|
||||
|
||||
require (
|
||||
github.com/imroc/req/v3 v3.43.7
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.2-20240630023003
|
||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240624090335
|
||||
github.com/oneclickvirt/basics v0.0.3-20240625075226
|
||||
github.com/oneclickvirt/cputest v0.0.7-20240701020012
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
|
||||
github.com/oneclickvirt/UnlockTests v0.0.11-20240704101006
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
|
||||
github.com/oneclickvirt/basics v0.0.5-20240704113233
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240702070215
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
|
||||
github.com/oneclickvirt/disktest v0.0.3-20240629152513
|
||||
github.com/oneclickvirt/gostun v0.0.2-20240625025941
|
||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629
|
||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642
|
||||
github.com/oneclickvirt/disktest v0.0.4-20240704095213
|
||||
github.com/oneclickvirt/gostun v0.0.3-20240702054621
|
||||
github.com/oneclickvirt/memorytest v0.0.2-20240702031042
|
||||
github.com/oneclickvirt/nt3 v0.0.3-20240702132013
|
||||
github.com/oneclickvirt/pingtest v0.0.4-20240703142340
|
||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
|
||||
github.com/oneclickvirt/security v0.0.2-20240630142358
|
||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816
|
||||
github.com/oneclickvirt/security v0.0.4-20240704114145
|
||||
github.com/oneclickvirt/speedtest v0.0.7-20240704023701
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -45,6 +46,7 @@ require (
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/nxtrace/NTrace-core v1.3.1 // indirect
|
||||
|
46
go.sum
46
go.sum
@@ -75,32 +75,34 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/nxtrace/NTrace-core v1.3.1 h1:f4z5UaZEuhUP/g6xElpZ2bo+guWITJVrMKrJTqd27oc=
|
||||
github.com/nxtrace/NTrace-core v1.3.1/go.mod h1:0Px/Zc60qk6cssmP+yv4kstFxvX9sXqDduoVqBO+qf8=
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.2-20240630023003 h1:8jQFqDK5m7V9xlLBk8rSUYDyi3u5xzf5kqwEx5b+/7g=
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.2-20240630023003/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930 h1:/Sc4Eas1Pso18ak93wlazkuMKRRElCntITja/0opOpM=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240624090335 h1:0LP5KyA6GLlqQAtOF0uyBSAykHJrzOA96Eb87qUhGQw=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240624090335/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
|
||||
github.com/oneclickvirt/basics v0.0.3-20240625075226 h1:K9VriCHIYnXPZXBSn9PRQX+jBS6AIFH8tBVb/i8VGAw=
|
||||
github.com/oneclickvirt/basics v0.0.3-20240625075226/go.mod h1:dTB+/oyFQYfTYX55rFJVWatum5F9g62zjfmHCM6Vj1s=
|
||||
github.com/oneclickvirt/cputest v0.0.7-20240701020012 h1:U5cCI+6ZU3pudoAlmb1b3yB9IQNm5AnDXi1TQAZJCIA=
|
||||
github.com/oneclickvirt/cputest v0.0.7-20240701020012/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502 h1:hRIYJ2uEp2N3AH5bP5X6bwfdwWfZQO/2WoqpUJ8+WsY=
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.11-20240704101006 h1:dJyfuPFwmueK7x0TC/PZU1jfgB6s15T9VOwjMn13loY=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.11-20240704101006/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
|
||||
github.com/oneclickvirt/basics v0.0.5-20240704113233 h1:Mu4c/LJKOOyEDRK9r6g6ehpwivvCaeqecg0IgTjYr04=
|
||||
github.com/oneclickvirt/basics v0.0.5-20240704113233/go.mod h1:P0+c+E5C+Ewur2Zs9N+U3aZECrFeigXsTTzZOv97ShM=
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240702070215 h1:CcFpyVPlQkJ6vjFP17BRuJhh/afiJhOhZ0BW+TtfVDg=
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240702070215/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc=
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
|
||||
github.com/oneclickvirt/disktest v0.0.3-20240629152513 h1:ZW7MBMd2HxQi1ktg/ztVI2A10JzF4ZI6I7ATZvcK9w8=
|
||||
github.com/oneclickvirt/disktest v0.0.3-20240629152513/go.mod h1:x7VAJF0Ks05FyE4BI5xedXNKmwbeXfp8GCRALAIlueI=
|
||||
github.com/oneclickvirt/gostun v0.0.2-20240625025941 h1:h+ZL8jkjXR6QE0qEX34FjWTv89+lNj2fEkWx5Agpgzc=
|
||||
github.com/oneclickvirt/gostun v0.0.2-20240625025941/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
|
||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629 h1:2rJAB3gFGlFPocIb/WRVWYqs4nr2jGYokfDOgqFicD4=
|
||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
|
||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642 h1:BkpR1j9JaDxMzx7iIwtsnFDxSldjYr2TUYpZE7m8z/Y=
|
||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642/go.mod h1:UojPmtangn17TiQaDccVrZbn6sZwJOtzBgg3idp68cA=
|
||||
github.com/oneclickvirt/disktest v0.0.4-20240704095213 h1:ATIc0VeFBnYvfKjJCtDZS6hTxTU9nTFvUmfzGkr6Clw=
|
||||
github.com/oneclickvirt/disktest v0.0.4-20240704095213/go.mod h1:wIZy8G6Mbcy8Op8tc0HmJNpbJQQ5A15fvnUqMJXIdO0=
|
||||
github.com/oneclickvirt/gostun v0.0.3-20240702054621 h1:IE89eEYV9TJbF94SakQDAxTLIaqX+Tb6ZhJ/CCIP+90=
|
||||
github.com/oneclickvirt/gostun v0.0.3-20240702054621/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
|
||||
github.com/oneclickvirt/memorytest v0.0.2-20240702031042 h1:j+LsjOh5glYiidqtSqjZJRw694LYW1PHLMh6AovluTQ=
|
||||
github.com/oneclickvirt/memorytest v0.0.2-20240702031042/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
|
||||
github.com/oneclickvirt/nt3 v0.0.3-20240702132013 h1:zPI/zqqCraIVwRnYz07hMkBKDRJVkEBb6gZpZ4M9CjI=
|
||||
github.com/oneclickvirt/nt3 v0.0.3-20240702132013/go.mod h1:UojPmtangn17TiQaDccVrZbn6sZwJOtzBgg3idp68cA=
|
||||
github.com/oneclickvirt/pingtest v0.0.4-20240703142340 h1:012W8Ly6ALISwIL5cYFM8O1ZLSc9l+Z2hHUCscMemms=
|
||||
github.com/oneclickvirt/pingtest v0.0.4-20240703142340/go.mod h1:IU9RzZpS5tfP2kcFd2sw2fE80BgtiMUK8jp6qnN/0cY=
|
||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKThDzppyIMY7hWxK7F5RBkZg4o=
|
||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||
github.com/oneclickvirt/security v0.0.2-20240630142358 h1:yioMtHuW9wbJ7payL8GCPnj1ScEqNoqbNHt3+4Z4VAg=
|
||||
github.com/oneclickvirt/security v0.0.2-20240630142358/go.mod h1:cUNNOldoVQuovyc0EtAVAZlAT4y2xA1e0uA80aj1ly8=
|
||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816 h1:gI2hqV0IwcvGqYzLhlt4w2oZvYhCL+73jftUuJYBsuI=
|
||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||
github.com/oneclickvirt/security v0.0.4-20240704114145 h1:+3s2foEUS7Br/oYjEAi+VR0y46lE6jMvXHI1vnRX4aE=
|
||||
github.com/oneclickvirt/security v0.0.4-20240704114145/go.mod h1:ouSxY43DU46HYncAHCjyWbWqVtnP/YJouB/+TwKXnh8=
|
||||
github.com/oneclickvirt/speedtest v0.0.7-20240704023701 h1:F8ChZXf3U1/bUk+dCFt0Gc01LSPLhbBhCeHjkEJ6K88=
|
||||
github.com/oneclickvirt/speedtest v0.0.7-20240704023701/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
|
||||
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
|
||||
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
|
||||
|
342
goecs.go
342
goecs.go
@@ -4,8 +4,11 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/oneclickvirt/CommonMediaTests/commediatests"
|
||||
unlocktestmodel "github.com/oneclickvirt/UnlockTests/model"
|
||||
backtraceori "github.com/oneclickvirt/backtrace/bk"
|
||||
basicmodel "github.com/oneclickvirt/basics/model"
|
||||
cputestmodel "github.com/oneclickvirt/cputest/model"
|
||||
disktestmodel "github.com/oneclickvirt/disktest/disk"
|
||||
"github.com/oneclickvirt/ecs/backtrace"
|
||||
"github.com/oneclickvirt/ecs/commediatest"
|
||||
"github.com/oneclickvirt/ecs/cputest"
|
||||
@@ -16,8 +19,13 @@ import (
|
||||
"github.com/oneclickvirt/ecs/unlocktest"
|
||||
"github.com/oneclickvirt/ecs/utils"
|
||||
gostunmodel "github.com/oneclickvirt/gostun/model"
|
||||
memorytestmodel "github.com/oneclickvirt/memorytest/memory"
|
||||
nt3model "github.com/oneclickvirt/nt3/model"
|
||||
ptmodel "github.com/oneclickvirt/pingtest/model"
|
||||
"github.com/oneclickvirt/pingtest/pt"
|
||||
"github.com/oneclickvirt/portchecker/email"
|
||||
speedtestmodel "github.com/oneclickvirt/speedtest/model"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
@@ -29,8 +37,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.0.19"
|
||||
ecsVersion = "v0.0.50"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
showVersion bool
|
||||
enableLogger bool
|
||||
@@ -41,40 +50,49 @@ var (
|
||||
diskMultiCheck bool
|
||||
nt3CheckType, nt3Location string
|
||||
spNum int
|
||||
width = 84
|
||||
width = 82
|
||||
basicStatus, cpuTestStatus, memoryTestStatus, diskTestStatus bool
|
||||
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus bool
|
||||
backtraceStatus, nt3Status, speedTestStatus bool
|
||||
backtraceStatus, nt3Status, speedTestStatus, pingTestStatus bool
|
||||
filePath = "goecs.txt"
|
||||
enabelUpload = true
|
||||
help bool
|
||||
goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError)
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.BoolVar(&showVersion, "v", false, "Display version information")
|
||||
flag.BoolVar(&menuMode, "menu", true, "Enable/Disable menu mode, disable example: -menu=false") // true 默认启用菜单栏模式
|
||||
flag.StringVar(&language, "l", "zh", "Set language (supported: en, zh)")
|
||||
flag.BoolVar(&basicStatus, "basic", true, "Enable/Disable basic test")
|
||||
flag.BoolVar(&cpuTestStatus, "cpu", true, "Enable/Disable CPU test")
|
||||
flag.BoolVar(&memoryTestStatus, "memory", true, "Enable/Disable memory test")
|
||||
flag.BoolVar(&diskTestStatus, "disk", true, "Enable/Disable disk test")
|
||||
flag.BoolVar(&commTestStatus, "comm", true, "Enable/Disable common media test")
|
||||
flag.BoolVar(&utTestStatus, "ut", true, "Enable/Disable unlock media test")
|
||||
flag.BoolVar(&securityTestStatus, "security", true, "Enable/Disable security test")
|
||||
flag.BoolVar(&emailTestStatus, "email", true, "Enable/Disable email port test")
|
||||
flag.BoolVar(&backtraceStatus, "backtrace", true, "Enable/Disable backtrace test (in 'en' language or on `windows` it always false)")
|
||||
flag.BoolVar(&nt3Status, "nt3", true, "Enable/Disable NT3 test (in 'en' language or on `windows` it always false)")
|
||||
flag.BoolVar(&speedTestStatus, "speed", true, "Enable/Disable speed test")
|
||||
flag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
|
||||
flag.StringVar(&cpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)")
|
||||
flag.StringVar(&memoryTestMethod, "memorym", "dd", "Set memory test method (supported: sysbench, dd, winsat)")
|
||||
flag.StringVar(&diskTestMethod, "diskm", "fio", "Set disk test method (supported: fio, dd, winsat)")
|
||||
flag.StringVar(&diskTestPath, "diskp", "", "Set disk test path, e.g., -diskp /root")
|
||||
flag.BoolVar(&diskMultiCheck, "diskmc", false, "Enable/Disable multiple disk checks, e.g., -diskmc=false")
|
||||
flag.StringVar(&nt3Location, "nt3loc", "GZ", "Specify NT3 test location (supported: GZ, SH, BJ, CD for Guangzhou, Shanghai, Beijing, Chengdu)")
|
||||
flag.StringVar(&nt3CheckType, "nt3t", "ipv4", "Set NT3 test type (supported: both, ipv4, ipv6)")
|
||||
flag.IntVar(&spNum, "spnum", 2, "Set the number of servers per operator for speed test")
|
||||
flag.BoolVar(&enableLogger, "log", false, "Enable/Disable logging in the current path")
|
||||
flag.Parse()
|
||||
goecsFlag.BoolVar(&help, "h", false, "Show help information")
|
||||
goecsFlag.BoolVar(&showVersion, "v", false, "Display version information")
|
||||
goecsFlag.BoolVar(&menuMode, "menu", true, "Enable/Disable menu mode, disable example: -menu=false") // true 默认启用菜单栏模式
|
||||
goecsFlag.StringVar(&language, "l", "zh", "Set language (supported: en, zh)")
|
||||
goecsFlag.BoolVar(&basicStatus, "basic", true, "Enable/Disable basic test")
|
||||
goecsFlag.BoolVar(&cpuTestStatus, "cpu", true, "Enable/Disable CPU test")
|
||||
goecsFlag.BoolVar(&memoryTestStatus, "memory", true, "Enable/Disable memory test")
|
||||
goecsFlag.BoolVar(&diskTestStatus, "disk", true, "Enable/Disable disk test")
|
||||
goecsFlag.BoolVar(&commTestStatus, "comm", true, "Enable/Disable common media test")
|
||||
goecsFlag.BoolVar(&utTestStatus, "ut", true, "Enable/Disable unlock media test")
|
||||
goecsFlag.BoolVar(&securityTestStatus, "security", true, "Enable/Disable security test")
|
||||
goecsFlag.BoolVar(&emailTestStatus, "email", true, "Enable/Disable email port test")
|
||||
goecsFlag.BoolVar(&backtraceStatus, "backtrace", true, "Enable/Disable backtrace test (in 'en' language or on windows it always false)")
|
||||
goecsFlag.BoolVar(&nt3Status, "nt3", true, "Enable/Disable NT3 test (in 'en' language or on windows it always false)")
|
||||
goecsFlag.BoolVar(&speedTestStatus, "speed", true, "Enable/Disable speed test")
|
||||
goecsFlag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
|
||||
goecsFlag.StringVar(&cpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)")
|
||||
goecsFlag.StringVar(&memoryTestMethod, "memorym", "dd", "Set memory test method (supported: sysbench, dd, winsat)")
|
||||
goecsFlag.StringVar(&diskTestMethod, "diskm", "fio", "Set disk test method (supported: fio, dd, winsat)")
|
||||
goecsFlag.StringVar(&diskTestPath, "diskp", "", "Set disk test path, e.g., -diskp /root")
|
||||
goecsFlag.BoolVar(&diskMultiCheck, "diskmc", false, "Enable/Disable multiple disk checks, e.g., -diskmc=false")
|
||||
goecsFlag.StringVar(&nt3Location, "nt3loc", "GZ", "Specify NT3 test location (supported: GZ, SH, BJ, CD for Guangzhou, Shanghai, Beijing, Chengdu)")
|
||||
goecsFlag.StringVar(&nt3CheckType, "nt3t", "ipv4", "Set NT3 test type (supported: both, ipv4, ipv6)")
|
||||
goecsFlag.IntVar(&spNum, "spnum", 2, "Set the number of servers per operator for speed test")
|
||||
goecsFlag.BoolVar(&enableLogger, "log", false, "Enable/Disable logging in the current path")
|
||||
goecsFlag.BoolVar(&enabelUpload, "upload", true, "Enable/Disable upload the result")
|
||||
goecsFlag.Parse(os.Args[1:])
|
||||
if help {
|
||||
fmt.Printf("Usage: %s [options]\n", os.Args[0])
|
||||
goecsFlag.PrintDefaults()
|
||||
return
|
||||
}
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
if showVersion {
|
||||
@@ -82,37 +100,48 @@ func main() {
|
||||
return
|
||||
}
|
||||
if enableLogger {
|
||||
basicmodel.EnableLoger = true
|
||||
speedtestmodel.EnableLoger = true
|
||||
gostunmodel.EnableLoger = true
|
||||
basicmodel.EnableLoger = true
|
||||
cputestmodel.EnableLoger = true
|
||||
memorytestmodel.EnableLoger = true
|
||||
disktestmodel.EnableLoger = true
|
||||
commediatests.EnableLoger = true
|
||||
unlocktestmodel.EnableLoger = true
|
||||
ptmodel.EnableLoger = true
|
||||
backtraceori.EnableLoger = true
|
||||
nt3model.EnableLoger = true
|
||||
speedtestmodel.EnableLoger = true
|
||||
}
|
||||
go func() {
|
||||
http.Get("https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fecs&count_bg=%2357DEFF&title_bg=%23000000&icon=cliqz.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false")
|
||||
}()
|
||||
if menuMode {
|
||||
basicStatus, cpuTestStatus, memoryTestStatus, diskTestStatus = false, false, false, false
|
||||
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus = false, false, false, false
|
||||
backtraceStatus, nt3Status, speedTestStatus = false, false, false
|
||||
switch language {
|
||||
case "zh":
|
||||
fmt.Println("VPS融合怪版本: ", ecsVersion)
|
||||
fmt.Println("1. 融合怪完全体")
|
||||
fmt.Println("2. 极简版(系统信息+CPU+内存+磁盘+测速节点5个)")
|
||||
fmt.Println("3. 精简版(系统信息+CPU+内存+磁盘+御三家+常用流媒体+回程+路由+测速节点5个)")
|
||||
fmt.Println("3. 精简版(系统信息+CPU+内存+磁盘+常用流媒体+路由+测速节点5个)")
|
||||
fmt.Println("4. 精简网络版(系统信息+CPU+内存+磁盘+回程+路由+测速节点5个)")
|
||||
fmt.Println("5. 精简解锁版(系统信息+CPU+内存+磁盘IO+御三家+常用流媒体+测速节点5个)")
|
||||
fmt.Println("6. 网络单项(IP质量检测+三网回程+三网路由与延迟+测速节点11个)")
|
||||
fmt.Println("7. 解锁单项(御三家解锁+常用流媒体解锁)")
|
||||
fmt.Println("8. 硬件单项(基础系统信息+CPU+内存+dd磁盘测试+fio磁盘测试)")
|
||||
fmt.Println("8. 硬件单项(系统信息+CPU+内存+dd磁盘测试+fio磁盘测试)-待修复")
|
||||
fmt.Println("9. IP质量检测(15个数据库的IP检测+邮件端口检测)")
|
||||
fmt.Println("10. 三网回程线路+广州三网路由+全国三网延迟")
|
||||
case "en":
|
||||
fmt.Println("VPS Fusion Monster Test Version: ", ecsVersion)
|
||||
fmt.Println("1. VPS Fusion Monster Test Comprehensive Test Suite")
|
||||
fmt.Println("2. Minimal Test Suite (System Info + CPU + Memory + Disk + 5 Speed Test Nodes)")
|
||||
fmt.Println("3. Standard Test Suite (System Info + CPU + Memory + Disk + Basic Unlock Tests + Common Streaming Services + 5 Speed Test Nodes)")
|
||||
fmt.Println("3. Standard Test Suite (System Info + CPU + Memory + Disk + Basic Unlock Tests + 5 Speed Test Nodes)")
|
||||
fmt.Println("4. Network-Focused Test Suite (System Info + CPU + Memory + Disk + 5 Speed Test Nodes)")
|
||||
fmt.Println("5. Unlock-Focused Test Suite (System Info + CPU + Memory + Disk IO + Basic Unlock Tests + Common Streaming Services + 5 Speed Test Nodes)")
|
||||
fmt.Println("6. Network-Only Test (IP Quality Test + 5 Speed Test Nodes)")
|
||||
fmt.Println("7. Unlock-Only Test (Basic Unlock Tests + Common Streaming Services Unlock)")
|
||||
fmt.Println("8. Hardware-Only Test (Basic System Info + CPU + Memory + dd Disk Test + fio Disk Test)")
|
||||
fmt.Println("8. Hardware-Only Test (System Info + CPU + Memory + dd Disk Test + fio Disk Test)")
|
||||
fmt.Println("9. IP Quality Test (IP Test with 15 Databases + Email Port Test)")
|
||||
}
|
||||
Loop:
|
||||
@@ -137,6 +166,7 @@ func main() {
|
||||
backtraceStatus = true
|
||||
nt3Status = true
|
||||
speedTestStatus = true
|
||||
onlyChinaTest = utils.CheckChina(enableLogger)
|
||||
break Loop
|
||||
case "2":
|
||||
basicStatus = true
|
||||
@@ -150,10 +180,7 @@ func main() {
|
||||
cpuTestStatus = true
|
||||
memoryTestStatus = true
|
||||
diskTestStatus = true
|
||||
commTestStatus = true
|
||||
utTestStatus = true
|
||||
securityTestStatus = true
|
||||
backtraceStatus = true
|
||||
nt3Status = true
|
||||
speedTestStatus = true
|
||||
break Loop
|
||||
@@ -171,31 +198,39 @@ func main() {
|
||||
cpuTestStatus = true
|
||||
memoryTestStatus = true
|
||||
diskTestStatus = true
|
||||
securityTestStatus = true
|
||||
commTestStatus = true
|
||||
utTestStatus = true
|
||||
speedTestStatus = true
|
||||
break Loop
|
||||
case "6":
|
||||
securityTestStatus = true
|
||||
speedTestStatus = true
|
||||
backtraceStatus = true
|
||||
nt3Status = true
|
||||
enabelUpload = false
|
||||
break Loop
|
||||
case "7":
|
||||
securityTestStatus = true
|
||||
commTestStatus = true
|
||||
utTestStatus = true
|
||||
enabelUpload = false
|
||||
break Loop
|
||||
case "8":
|
||||
basicStatus = true
|
||||
cpuTestStatus = true
|
||||
memoryTestStatus = true
|
||||
diskTestStatus = true
|
||||
// TODO 双硬盘类型测试
|
||||
break Loop
|
||||
case "9":
|
||||
securityTestStatus = true
|
||||
emailTestStatus = true
|
||||
enabelUpload = false
|
||||
break Loop
|
||||
case "10":
|
||||
backtraceStatus = true
|
||||
nt3Status = true
|
||||
speedTestStatus = true
|
||||
pingTestStatus = true
|
||||
enabelUpload = false
|
||||
break Loop
|
||||
default:
|
||||
if language == "zh" {
|
||||
@@ -217,174 +252,251 @@ func main() {
|
||||
backtraceStatus = false
|
||||
nt3Status = false
|
||||
}
|
||||
startTime := time.Now()
|
||||
if !enabelUpload {
|
||||
securityTestStatus = false
|
||||
}
|
||||
var (
|
||||
wg1, wg2 sync.WaitGroup
|
||||
basicInfo, securityInfo, emailInfo, mediaInfo string
|
||||
output, tempOutput string
|
||||
startTime time.Time
|
||||
wg1, wg2, wg3 sync.WaitGroup
|
||||
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
|
||||
output, tempOutput string
|
||||
)
|
||||
// 启动一个goroutine来等待信号
|
||||
// 启动一个goroutine来等待信号,内置计时器
|
||||
go func() {
|
||||
startTime = time.Now()
|
||||
// 等待信号
|
||||
<-sig
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
output = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("", width)
|
||||
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
|
||||
fmt.Printf("Current Time : %s\n", currentTime)
|
||||
utils.PrintCenteredTitle("", width)
|
||||
}, tempOutput, output)
|
||||
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
os.Exit(1) // 使用非零状态码退出,表示意外退出
|
||||
}()
|
||||
output = utils.PrintAndCapture(func() {
|
||||
switch language {
|
||||
case "zh":
|
||||
switch language {
|
||||
case "zh":
|
||||
output = utils.PrintAndCapture(func() {
|
||||
utils.PrintHead(language, width, ecsVersion)
|
||||
if basicStatus || securityTestStatus {
|
||||
if basicStatus {
|
||||
utils.PrintCenteredTitle("基础信息", width)
|
||||
utils.PrintCenteredTitle("系统基础信息", width)
|
||||
}
|
||||
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
if basicStatus {
|
||||
fmt.Printf(basicInfo)
|
||||
}
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if cpuTestStatus {
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("CPU测试-通过%s测试", cpuTestMethod), width)
|
||||
cputest.CpuTest(language, cpuTestMethod, cpuTestThreadMode)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if memoryTestStatus {
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("内存测试-通过%s测试", cpuTestMethod), width)
|
||||
memorytest.MemoryTest(language, memoryTestMethod)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if diskTestStatus {
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", diskTestMethod), width)
|
||||
disktest.DiskTest(language, diskTestMethod, diskTestPath, diskMultiCheck)
|
||||
}
|
||||
if emailTestStatus {
|
||||
wg2.Add(1)
|
||||
go func() {
|
||||
defer wg2.Done()
|
||||
emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
if utTestStatus {
|
||||
wg1.Add(1)
|
||||
go func() {
|
||||
defer wg1.Done()
|
||||
mediaInfo = unlocktest.MediaTest(language)
|
||||
}()
|
||||
}
|
||||
if commTestStatus {
|
||||
}, tempOutput, output)
|
||||
if onlyChinaTest || pingTestStatus {
|
||||
wg3.Add(1)
|
||||
go func() {
|
||||
defer wg3.Done()
|
||||
ptInfo = pt.PingTest()
|
||||
}()
|
||||
}
|
||||
if emailTestStatus {
|
||||
wg2.Add(1)
|
||||
go func() {
|
||||
defer wg2.Done()
|
||||
emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
if utTestStatus && !onlyChinaTest {
|
||||
wg1.Add(1)
|
||||
go func() {
|
||||
defer wg1.Done()
|
||||
mediaInfo = unlocktest.MediaTest(language)
|
||||
}()
|
||||
}
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if commTestStatus && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("御三家流媒体解锁", width)
|
||||
commediatest.ComMediaTest(language)
|
||||
}
|
||||
if utTestStatus {
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if utTestStatus && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("跨国流媒体解锁", width)
|
||||
wg1.Wait()
|
||||
fmt.Printf(mediaInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if securityTestStatus {
|
||||
utils.PrintCenteredTitle("IP质量检测", width)
|
||||
fmt.Printf(securityInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if emailTestStatus {
|
||||
utils.PrintCenteredTitle("邮件端口检测", width)
|
||||
wg2.Wait()
|
||||
fmt.Println(emailInfo)
|
||||
}
|
||||
if runtime.GOOS != "windows" {
|
||||
if backtraceStatus {
|
||||
utils.PrintCenteredTitle("三网回程", width)
|
||||
}, tempOutput, output)
|
||||
if runtime.GOOS != "windows" {
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if backtraceStatus && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("三网回程线路检测", width)
|
||||
backtrace.BackTrace()
|
||||
}
|
||||
// nexttrace 在win上不支持检测,报错 bind: An invalid argument was supplied.
|
||||
if nt3Status {
|
||||
utils.PrintCenteredTitle("路由检测", width)
|
||||
}, tempOutput, output)
|
||||
// nexttrace 在win上不支持检测,报错 bind: An invalid argument was supplied.
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if nt3Status && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("三网回程路由检测", width)
|
||||
ntrace.TraceRoute3(language, nt3Location, nt3CheckType)
|
||||
}
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if onlyChinaTest || pingTestStatus {
|
||||
utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
|
||||
wg3.Wait()
|
||||
fmt.Println(ptInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
}
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if speedTestStatus {
|
||||
utils.PrintCenteredTitle("就近节点测速", width)
|
||||
speedtest.ShowHead(language)
|
||||
if (menuMode && choice == "1") || !menuMode {
|
||||
speedtest.NearbySP()
|
||||
speedtest.CustomSP("net", "global", 2)
|
||||
speedtest.CustomSP("net", "cu", spNum)
|
||||
speedtest.CustomSP("net", "ct", spNum)
|
||||
speedtest.CustomSP("net", "cmcc", spNum)
|
||||
speedtest.CustomSP("net", "global", 2, language)
|
||||
speedtest.CustomSP("net", "cu", spNum, language)
|
||||
speedtest.CustomSP("net", "ct", spNum, language)
|
||||
speedtest.CustomSP("net", "cmcc", spNum, language)
|
||||
} else if menuMode && choice == "2" || choice == "3" || choice == "4" || choice == "5" {
|
||||
speedtest.CustomSP("net", "global", 4)
|
||||
speedtest.CustomSP("net", "global", 4, language)
|
||||
}
|
||||
}
|
||||
}, tempOutput, output)
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
output = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("", width)
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
fmt.Printf("花费 : %d 分 %d 秒\n", minutes, seconds)
|
||||
fmt.Printf("时间 : %s\n", currentTime)
|
||||
utils.PrintCenteredTitle("", width)
|
||||
case "en":
|
||||
}, tempOutput, output)
|
||||
case "en":
|
||||
output = utils.PrintAndCapture(func() {
|
||||
utils.PrintHead(language, width, ecsVersion)
|
||||
if basicStatus || securityTestStatus {
|
||||
if basicStatus {
|
||||
utils.PrintCenteredTitle("Basic Information", width)
|
||||
utils.PrintCenteredTitle("System-Basic-Information", width)
|
||||
}
|
||||
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
if basicStatus {
|
||||
fmt.Printf(basicInfo)
|
||||
}
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if cpuTestStatus {
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("CPU Test - %s Method", cpuTestMethod), width)
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("CPU-Test--%s-Method", cpuTestMethod), width)
|
||||
cputest.CpuTest(language, cpuTestMethod, cpuTestThreadMode)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if memoryTestStatus {
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("Memory Test - %s Method", memoryTestMethod), width)
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("Memory-Test--%s-Method", memoryTestMethod), width)
|
||||
memorytest.MemoryTest(language, memoryTestMethod)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if diskTestStatus {
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("Disk Test - %s Method", diskTestMethod), width)
|
||||
utils.PrintCenteredTitle(fmt.Sprintf("Disk-Test--%s-Method", diskTestMethod), width)
|
||||
disktest.DiskTest(language, diskTestMethod, diskTestPath, diskMultiCheck)
|
||||
}
|
||||
if emailTestStatus {
|
||||
wg1.Add(1)
|
||||
go func() {
|
||||
defer wg1.Done()
|
||||
emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
if commTestStatus {
|
||||
utils.PrintCenteredTitle("The Three Families Streaming Media Unlock", width)
|
||||
commediatest.ComMediaTest(language)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
if utTestStatus {
|
||||
wg1.Add(1)
|
||||
go func() {
|
||||
defer wg1.Done()
|
||||
mediaInfo = unlocktest.MediaTest(language)
|
||||
}()
|
||||
}
|
||||
if emailTestStatus {
|
||||
wg2.Add(1)
|
||||
go func() {
|
||||
defer wg2.Done()
|
||||
emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if utTestStatus {
|
||||
utils.PrintCenteredTitle("Cross-Border Streaming Media Unlock", width)
|
||||
unlocktest.MediaTest(language)
|
||||
utils.PrintCenteredTitle("Cross-Border-Streaming-Media-Unlock", width)
|
||||
wg1.Wait()
|
||||
fmt.Printf(mediaInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if securityTestStatus {
|
||||
utils.PrintCenteredTitle("IP Quality Check", width)
|
||||
utils.PrintCenteredTitle("IP-Quality-Check", width)
|
||||
fmt.Printf(securityInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if emailTestStatus {
|
||||
utils.PrintCenteredTitle("Email Port Check", width)
|
||||
wg1.Wait()
|
||||
utils.PrintCenteredTitle("Email-Port-Check", width)
|
||||
wg2.Wait()
|
||||
fmt.Println(emailInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if speedTestStatus {
|
||||
utils.PrintCenteredTitle("Nearby Node Speed Test", width)
|
||||
utils.PrintCenteredTitle("Speed-Test", width)
|
||||
speedtest.ShowHead(language)
|
||||
speedtest.NearbySP()
|
||||
speedtest.CustomSP("net", "global", -1)
|
||||
speedtest.CustomSP("net", "global", -1, language)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
output = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("", width)
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
fmt.Printf("Cost Time : %d 分 %d 秒\n", minutes, seconds)
|
||||
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
|
||||
fmt.Printf("Current Time : %s\n", currentTime)
|
||||
utils.PrintCenteredTitle("", width)
|
||||
default:
|
||||
fmt.Println("Unsupported language")
|
||||
}
|
||||
}, tempOutput, output)
|
||||
}, tempOutput, output)
|
||||
default:
|
||||
fmt.Println("Unsupported language")
|
||||
}
|
||||
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
}
|
||||
}
|
||||
|
161
goecs.sh
161
goecs.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#From https://github.com/oneclickvirt/ecs
|
||||
#2024.06.29
|
||||
#2024.07.04
|
||||
|
||||
# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
|
||||
@@ -59,17 +59,16 @@ goecs_check() {
|
||||
ECS_VERSION=$(curl -m 6 -sSL "https://githubapi.spiritlhl.top/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
|
||||
fi
|
||||
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
|
||||
version_output=$(goecs -v || ./goecs -v)
|
||||
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
extracted_version=$(echo "${version_output//v/}")
|
||||
extracted_version=${version_output//v/}
|
||||
if [ -n "$extracted_version" ]; then
|
||||
current_version=$(echo "$extracted_version" | cut -c 2-)
|
||||
ecs_version=$ECS_VERSION
|
||||
if [[ "$(echo -e "$current_version\n$ecs_version" | sort -V | tail -n 1)" == "$current_version" ]]; then
|
||||
echo "goecs version ($current_version) is latest, no need to upgrade."
|
||||
if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then
|
||||
echo "goecs version ($extracted_version) is latest, no need to upgrade."
|
||||
return
|
||||
else
|
||||
echo "goecs version ($current_version) < $ecs_version, need to upgrade, 5 seconds later will start to upgrade"
|
||||
echo "goecs version ($extracted_version) < $ecs_version, need to upgrade, 5 seconds later will start to upgrade"
|
||||
rm -rf /usr/bin/goecs
|
||||
rm -rf goecs
|
||||
fi
|
||||
@@ -84,13 +83,13 @@ goecs_check() {
|
||||
Linux)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_amd64.tar.gz"
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip"
|
||||
;;
|
||||
"i386" | "i686")
|
||||
wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_386.tar.gz"
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip"
|
||||
;;
|
||||
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
|
||||
wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_arm64.tar.gz"
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $arch"
|
||||
@@ -98,13 +97,30 @@ goecs_check() {
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
FreeBSD)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip"
|
||||
;;
|
||||
"i386" | "i686")
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip"
|
||||
;;
|
||||
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $arch"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Darwin)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_amd64.tar.gz"
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip"
|
||||
;;
|
||||
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
|
||||
wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_arm64.tar.gz"
|
||||
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $arch"
|
||||
@@ -117,16 +133,17 @@ goecs_check() {
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
tar -xvf goecs.tar.gz
|
||||
rm -rf goecs.tar.gz
|
||||
unzip goecs.zip
|
||||
rm -rf goecs.zip
|
||||
rm -rf README.md
|
||||
rm -rf LICENSE
|
||||
mv ecs goecs
|
||||
sleep 1
|
||||
chmod 777 goecs
|
||||
rm -rf /usr/bin/goecs
|
||||
sleep 1
|
||||
cp goecs /usr/bin/goecs
|
||||
rm -rf README_EN.md
|
||||
rm -rf README.md
|
||||
echo "goecs version:"
|
||||
goecs -v || ./goecs -v
|
||||
}
|
||||
@@ -163,7 +180,7 @@ InstallSysbench() {
|
||||
arch) pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
|
||||
freebsd) pkg install -y sysbench ;;
|
||||
alpinelinux) echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1" ;;
|
||||
*) echo "Error: Unknown OS release: $os_release" && exit 1 ;;
|
||||
*) echo "Error: Unknown OS release: $os_release" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -182,8 +199,7 @@ Check_SysBench() {
|
||||
_yellow "Install sysbench successfully!"
|
||||
else
|
||||
_red "SysBench Moudle install Failure! Try Restart Bench or Manually install it! (/usr/bin/sysbench)"
|
||||
_blue "Will try to test with geekbench5 instead later on"
|
||||
test_cpu_type="gb5"
|
||||
_blue "Will try to test with geekbench5 instead later."
|
||||
fi
|
||||
sleep 3
|
||||
}
|
||||
@@ -230,32 +246,79 @@ prepare_compile_env() {
|
||||
env_check() {
|
||||
REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd")
|
||||
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD")
|
||||
PACKAGE_UPDATE=("! apt-get update && apt-get --fix-broken install -y && apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -u")
|
||||
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -u")
|
||||
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add")
|
||||
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del")
|
||||
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "" "pkg autoremove" "apk autoremove")
|
||||
CMD=("$(grep -i pretty_name /etc/os-release 2>/dev/null | cut -d \" -f2)" "$(hostnamectl 2>/dev/null | grep -i system | cut -d : -f2)" "$(lsb_release -sd 2>/dev/null)" "$(grep -i description /etc/lsb-release 2>/dev/null | cut -d \" -f2)" "$(grep . /etc/redhat-release 2>/dev/null)" "$(grep . /etc/issue 2>/dev/null | cut -d \\ -f1 | sed '/^[ ]*$/d')" "$(grep -i pretty_name /etc/os-release 2>/dev/null | cut -d \" -f2)" "$(uname -s)" "$(uname -s)")
|
||||
SYS="${CMD[0]}"
|
||||
# 检查系统信息
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
SYS="alpine"
|
||||
elif [ -s /etc/os-release ]; then
|
||||
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
|
||||
elif [ -x "$(type -p hostnamectl)" ]; then
|
||||
SYS="$(hostnamectl | grep -i system | cut -d : -f2 | xargs)"
|
||||
elif [ -x "$(type -p lsb_release)" ]; then
|
||||
SYS="$(lsb_release -sd)"
|
||||
elif [ -s /etc/lsb-release ]; then
|
||||
SYS="$(grep -i description /etc/lsb-release | cut -d \" -f2)"
|
||||
elif [ -s /etc/redhat-release ]; then
|
||||
SYS="$(grep . /etc/redhat-release)"
|
||||
elif [ -s /etc/issue ]; then
|
||||
SYS="$(grep . /etc/issue | cut -d '\' -f1 | sed '/^[ ]*$/d')"
|
||||
else
|
||||
SYS="$(uname -s)"
|
||||
fi
|
||||
[[ -n $SYS ]] || exit 1
|
||||
# 匹配操作系统
|
||||
for ((int = 0; int < ${#REGEX[@]}; int++)); do
|
||||
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
|
||||
SYSTEM="${RELEASE[int]}"
|
||||
[[ -n $SYSTEM ]] && break
|
||||
fi
|
||||
done
|
||||
# 检查是否成功匹配
|
||||
[[ -n $SYSTEM ]] || exit 1
|
||||
# 根据 SYSTEM 设置相应的包管理命令
|
||||
UPDATE_CMD=${PACKAGE_UPDATE[int]}
|
||||
INSTALL_CMD=${PACKAGE_INSTALL[int]}
|
||||
REMOVE_CMD=${PACKAGE_REMOVE[int]}
|
||||
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
|
||||
echo "System: $SYSTEM"
|
||||
echo "Update command: $UPDATE_CMD"
|
||||
echo "Install command: $INSTALL_CMD"
|
||||
echo "Remove command: $REMOVE_CMD"
|
||||
echo "Uninstall command: $UNINSTALL_CMD"
|
||||
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
_green "Update system manager."
|
||||
${PACKAGE_UPDATE[int]} 2>/dev/null
|
||||
if ! command -v sudo >/dev/null 2>&1; then
|
||||
_green "Installing sudo"
|
||||
${PACKAGE_INSTALL[int]} sudo
|
||||
fi
|
||||
if ! command -v wget >/dev/null 2>&1; then
|
||||
_green "Installing wget"
|
||||
${PACKAGE_INSTALL[int]} wget
|
||||
fi
|
||||
if ! command -v tar >/dev/null 2>&1; then
|
||||
_green "Installing tar"
|
||||
${PACKAGE_INSTALL[int]} tar
|
||||
fi
|
||||
if ! command -v unzip >/dev/null 2>&1; then
|
||||
_green "Installing unzip"
|
||||
${PACKAGE_INSTALL[int]} unzip
|
||||
fi
|
||||
if ! command -v dd >/dev/null 2>&1; then
|
||||
_green "Installing dd"
|
||||
$PACKAGE_INSTALL dd
|
||||
${PACKAGE_INSTALL[int]} dd
|
||||
fi
|
||||
if ! command -v fio >/dev/null 2>&1; then
|
||||
_green "Installing fio"
|
||||
$PACKAGE_INSTALL fio
|
||||
${PACKAGE_INSTALL[int]} fio
|
||||
fi
|
||||
if ! command -v sysbench >/dev/null 2>&1; then
|
||||
if ! command -v sysbench >/dev/null 2>&1 && [ "${REGEX[int]}" != "freebsd" ]; then
|
||||
_green "Installing sysbench"
|
||||
$PACKAGE_INSTALL sysbench
|
||||
${PACKAGE_INSTALL[int]} sysbench
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unable to download sysbench through the system's package manager, speak to try compiling and installing it..."
|
||||
if ! wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"; then
|
||||
@@ -267,6 +330,7 @@ env_check() {
|
||||
fi
|
||||
chmod +x /tmp/sysbench.zip
|
||||
unzip /tmp/sysbench.zip -d /tmp
|
||||
Check_SysBench
|
||||
fi
|
||||
fi
|
||||
if ! command -v geekbench >/dev/null 2>&1; then
|
||||
@@ -286,21 +350,57 @@ env_check() {
|
||||
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh" -o dspt.sh && chmod +x dspt.sh
|
||||
bash dspt.sh
|
||||
rm -rf dspt.sh
|
||||
rm -rf speedtest.tar.gz
|
||||
_blue "if you want to use golang origin speedtest, you can use"
|
||||
echo "rm -rf /usr/bin/speedtest"
|
||||
echo "rm -rf /usr/bin/speedtest-go"
|
||||
_blue "to uninstall speedtest and speedtest-go"
|
||||
fi
|
||||
if ! command -v ping >/dev/null 2>&1; then
|
||||
_green "Installing ping"
|
||||
${PACKAGE_INSTALL[int]} iputils-ping >/dev/null 2>&1
|
||||
${PACKAGE_INSTALL[int]} ping >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "Detected MacOS. Installing sysbench and fio..."
|
||||
brew install --force sysbench fio dd
|
||||
# 有问题,需要修复,root环境不能brew,brew安装完毕后可能路径不在环境变量中
|
||||
else
|
||||
if ! grep -q "^net.ipv4.ping_group_range = 0 2147483647$" /etc/sysctl.conf; then
|
||||
echo "net.ipv4.ping_group_range = 0 2147483647" >> /etc/sysctl.conf
|
||||
sysctl -p
|
||||
fi
|
||||
fi
|
||||
_green "The environment is ready."
|
||||
_green "The next command is: ./goecs.sh install"
|
||||
}
|
||||
|
||||
delete_goecs() {
|
||||
rm -rf /root/goecs
|
||||
rm -rf /usr/bin/goecs
|
||||
_green "The command (goecs) has been deleted."
|
||||
}
|
||||
|
||||
show_help() {
|
||||
cat <<"EOF"
|
||||
Available commands:
|
||||
|
||||
env Check and Install package: dd fio sysbench geekbench5 speedtest
|
||||
install Install goecs command
|
||||
upgrade Upgrade goecs command
|
||||
help Show this message
|
||||
./goecs.sh env Check and Install package:
|
||||
sudo (Almost all unix-like systems have it.)
|
||||
wget (Almost all unix-like systems have it.)
|
||||
tar (Almost all unix-like systems have it.)
|
||||
unzip (Almost all unix-like systems have it.)
|
||||
dd (Almost all unix-like systems have it.)
|
||||
fio (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
|
||||
speedtest (Use the officially provided binaries for more accurate test results.)
|
||||
ping (Use the officially provided binaries for more accurate test results.)
|
||||
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
|
||||
./goecs.sh install Install goecs command
|
||||
./goecs.sh upgrade Upgrade goecs command
|
||||
./goecs.sh delete Uninstall goecs command
|
||||
./goecs.sh help Show this message
|
||||
|
||||
EOF
|
||||
}
|
||||
@@ -315,6 +415,9 @@ case "$1" in
|
||||
"install" | "upgrade")
|
||||
goecs_check
|
||||
;;
|
||||
"delete")
|
||||
delete_goecs
|
||||
;;
|
||||
*)
|
||||
echo "No command found."
|
||||
echo
|
||||
|
@@ -24,6 +24,7 @@ REM 提示用户输入版本号
|
||||
set /p version="Enter the version number (e.g., v1.0.0): "
|
||||
|
||||
REM 创建并推送标签
|
||||
:push_tag
|
||||
git tag %version%
|
||||
git push origin %version%
|
||||
if errorlevel 1 (
|
@@ -19,7 +19,7 @@ func NearbySP() {
|
||||
}
|
||||
}
|
||||
|
||||
func CustomSP(platform, operator string, num int) {
|
||||
func CustomSP(platform, operator string, num int, language string) {
|
||||
var url, parseType string
|
||||
if strings.ToLower(platform) == "cn" {
|
||||
if strings.ToLower(operator) == "cmcc" {
|
||||
@@ -59,8 +59,8 @@ func CustomSP(platform, operator string, num int) {
|
||||
parseType = "id"
|
||||
}
|
||||
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
|
||||
sp.CustomSpeedTest(url, parseType, num)
|
||||
sp.CustomSpeedTest(url, parseType, num, language)
|
||||
} else {
|
||||
sp.OfficialCustomSpeedTest(url, parseType, num)
|
||||
sp.OfficialCustomSpeedTest(url, parseType, num, language)
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ git commit -am"update"
|
||||
|
||||
:push
|
||||
cd %repo_path%
|
||||
|
||||
git push -f origin master
|
||||
if errorlevel 1 (
|
||||
echo Push failed. Retrying in 3 seconds...
|
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/imroc/req/v3"
|
||||
"github.com/oneclickvirt/UnlockTests/uts"
|
||||
"github.com/oneclickvirt/basics/system"
|
||||
. "github.com/oneclickvirt/defaultset"
|
||||
"github.com/oneclickvirt/security/network"
|
||||
"io"
|
||||
"os"
|
||||
@@ -44,6 +45,89 @@ func PrintHead(language string, width int, ecsVersion string) {
|
||||
}
|
||||
}
|
||||
|
||||
func CheckChina(enableLogger bool) bool {
|
||||
if enableLogger {
|
||||
InitLogger()
|
||||
defer Logger.Sync()
|
||||
}
|
||||
var selectChina bool
|
||||
client := req.C()
|
||||
client.SetTimeout(6 * time.Second)
|
||||
client.R().
|
||||
SetRetryCount(2).
|
||||
SetRetryBackoffInterval(1*time.Second, 3*time.Second).
|
||||
SetRetryFixedInterval(2 * time.Second)
|
||||
ipapiURL := "https://ipapi.co/json"
|
||||
cipccURL := "http://cip.cc"
|
||||
ipapiResp, err := client.R().Get(ipapiURL)
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法获取IP信息:" + err.Error())
|
||||
}
|
||||
} else {
|
||||
defer ipapiResp.Body.Close()
|
||||
var ipapiBody string
|
||||
ipapiBody, err = ipapiResp.ToString()
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法读取IP信息响应:" + err.Error())
|
||||
}
|
||||
} else {
|
||||
isInChina := strings.Contains(ipapiBody, "China")
|
||||
if isInChina {
|
||||
fmt.Println("根据ipapi.co提供的信息,当前IP可能在中国")
|
||||
var input string
|
||||
fmt.Print("是否选用中国专项测试(无流媒体测试,有三网Ping值测试)? ([y]/n) ")
|
||||
fmt.Scanln(&input)
|
||||
switch strings.ToLower(input) {
|
||||
case "yes", "y":
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
case "no", "n":
|
||||
fmt.Println("不使用中国专项测试")
|
||||
default:
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
}
|
||||
return selectChina
|
||||
}
|
||||
}
|
||||
}
|
||||
cipccResp, err := client.R().Get(cipccURL)
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法获取IP信息:" + err.Error())
|
||||
}
|
||||
return false
|
||||
}
|
||||
defer cipccResp.Body.Close()
|
||||
cipccBody, err := cipccResp.ToString()
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法读取IP信息响应:" + err.Error())
|
||||
}
|
||||
return false
|
||||
}
|
||||
isInChina := strings.Contains(cipccBody, "中国")
|
||||
if isInChina {
|
||||
fmt.Println("根据cip.cc提供的信息,当前IP可能在中国")
|
||||
var input string
|
||||
fmt.Print("是否选用中国专项测试(无流媒体测试,有三网Ping值测试)? ([y]/n) ")
|
||||
fmt.Scanln(&input)
|
||||
switch strings.ToLower(input) {
|
||||
case "yes", "y":
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
case "no", "n":
|
||||
fmt.Println("不使用中国专项测试")
|
||||
default:
|
||||
fmt.Println("不使用中国专项测试")
|
||||
selectChina = true
|
||||
}
|
||||
}
|
||||
return selectChina
|
||||
}
|
||||
|
||||
// SecurityCheck 执行安全检查
|
||||
func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
|
||||
var wgt sync.WaitGroup
|
||||
@@ -215,16 +299,16 @@ func ProcessAndUpload(output string, filePath string, enableUplaod bool) {
|
||||
}
|
||||
if enableUplaod {
|
||||
// 获取文件的绝对路径
|
||||
absPath, err := filepath.Abs(filePath)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to get absolute file path:", err)
|
||||
absPath, err2 := filepath.Abs(filePath)
|
||||
if err2 != nil {
|
||||
fmt.Println("Failed to get absolute file path:", err2)
|
||||
return
|
||||
}
|
||||
// 上传文件并生成短链接
|
||||
shorturl, err := UploadText(absPath)
|
||||
if err != nil {
|
||||
shorturl, err3 := UploadText(absPath)
|
||||
if err3 != nil {
|
||||
fmt.Println("Upload failed, cannot generate short URL.")
|
||||
fmt.Println(err.Error())
|
||||
fmt.Println(err3.Error())
|
||||
return
|
||||
}
|
||||
fmt.Println("Upload successful, short URL:", shorturl)
|
||||
|
Reference in New Issue
Block a user