Your commit message

This commit is contained in:
zeaslity
2024-11-27 10:33:20 +08:00
commit 080c7bb97f
911 changed files with 168439 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
{
"description":"",
"directory":"~.fastRequest~collections~Root~Default Group",
"filePath":"~.fastRequest~collections~Root~Default Group~",
"groupId":"1",
"id":"1",
"name":"Default Group",
"type":1
}

View File

@@ -0,0 +1,9 @@
{
"description":"",
"directory":"~.fastRequest~collections~Root",
"filePath":"~.fastRequest~collections~Root~",
"groupId":"-1",
"id":"0",
"name":"Root",
"type":1
}

5
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

10
.idea/Shell.iml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/bashsupport-pro.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="bashsupport-pro.project">
<globalVariables>
<var name="rclone_remote" />
</globalVariables>
</component>
</project>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

22
.idea/dataSources.local.xml generated Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal" created-in="IU-242.23726.103">
<data-source name="腾讯云-成都" uuid="79c9466f-d8a3-418a-b54a-f6e314306a0c">
<database-info product="MySQL" version="8.0.27" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="8.0.27" exact-driver-version="8.0">
<extra-name-characters>#@</extra-name-characters>
<identifier-quote-string>`</identifier-quote-string>
</database-info>
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
<secret-storage>master_key</secret-storage>
<user-name>root</user-name>
<schema-mapping>
<introspection-scope>
<node kind="schema">
<name qname="@" />
<name qname="nengdie" />
</node>
</introspection-scope>
</schema-mapping>
</data-source>
</component>
</project>

12
.idea/dataSources.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="腾讯云-成都" uuid="79c9466f-d8a3-418a-b54a-f6e314306a0c">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://114.117.165.222:3306/nengdie</jdbc-url>
<time-zone>Asia/Shanghai</time-zone>
</data-source>
</component>
</project>

View File

@@ -0,0 +1,2 @@
#n:information_schema
!<md> [null, 0, null, null, -2147483648, -2147483648]

View File

@@ -0,0 +1,2 @@
#n:mysql
!<md> [null, 0, null, null, -2147483648, -2147483648]

View File

@@ -0,0 +1,2 @@
#n:performance_schema
!<md> [null, 0, null, null, -2147483648, -2147483648]

View File

@@ -0,0 +1,2 @@
#n:sys
!<md> [null, 0, null, null, -2147483648, -2147483648]

461
.idea/dbnavigator.xml generated Normal file
View File

@@ -0,0 +1,461 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DataEditorManager">
<record-view-column-sorting-type value="BY_INDEX" />
<value-preview-text-wrapping value="true" />
<value-preview-pinned value="false" />
</component>
<component name="DBNavigator.Project.DataExportManager">
<export-instructions>
<create-header value="true" />
<friendly-headers value="false" />
<quote-values-containing-separator value="true" />
<quote-all-values value="false" />
<value-separator value="" />
<file-name value="" />
<file-location value="" />
<scope value="GLOBAL" />
<destination value="FILE" />
<format value="EXCEL" />
<charset value="GBK" />
</export-instructions>
</component>
<component name="DBNavigator.Project.DatabaseBrowserManager">
<autoscroll-to-editor value="false" />
<autoscroll-from-editor value="true" />
<show-object-properties value="true" />
<loaded-nodes />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.EditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.ExecutionManager">
<retain-sticky-names value="false" />
</component>
<component name="DBNavigator.Project.MethodExecutionManager">
<method-browser />
<execution-history>
<group-entries value="true" />
<execution-inputs />
</execution-history>
<argument-values-cache />
</component>
<component name="DBNavigator.Project.ObjectDependencyManager">
<last-used-dependency-type value="INCOMING" />
</component>
<component name="DBNavigator.Project.ObjectQuickFilterManager">
<last-used-operator value="EQUAL" />
<filters />
</component>
<component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true">
<recently-used-interfaces />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<tracking-columns>
<columnNames value="" />
<visible value="true" />
<editable value="false" />
</tracking-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="CSS" enabled="true" />
<content-type name="Java" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JavaScript" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="JSP" enabled="true" />
<content-type name="JSPx" enabled="true" />
<content-type name="Groovy" enabled="true" />
<content-type name="YAML" enabled="true" />
<content-type name="Manifest" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
<debugger>
<debugger-type value="ASK" />
<use-generic-runners value="true" />
</debugger>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
<component name="DBNavigator.Project.StatementExecutionManager">
<execution-variables />
</component>
</project>

23
.idea/fastRequestCollection.xml generated Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="fastRequestCollection">
<option name="detail">
<CollectionDetail>
<option name="childList">
<list>
<CollectionDetail>
<option name="groupId" value="1" />
<option name="id" value="1" />
<option name="name" value="Default Group" />
<option name="type" value="1" />
</CollectionDetail>
</list>
</option>
<option name="groupId" value="-1" />
<option name="id" value="0" />
<option name="name" value="Root" />
<option name="type" value="1" />
</CollectionDetail>
</option>
</component>
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="fastRequestCurrentProjectConfig">
<option name="domain" value="http://localhost:9999" />
<option name="enableEnv" value="local" />
<option name="enableProject" value="ProjectOctopus" />
</component>
</project>

View File

@@ -0,0 +1,41 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HttpUrlsUsage" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredUrls">
<list>
<option value="http://$offline_host_ip" />
<option value="http://${offline_host_ip}" />
<option value="http://0.0.0.0" />
<option value="http://127.0.0.1" />
<option value="http://activemq.apache.org/schema/" />
<option value="http://cxf.apache.org/schemas/" />
<option value="http://java.sun.com/" />
<option value="http://javafx.com/fxml" />
<option value="http://javafx.com/javafx/" />
<option value="http://json-schema.org/draft" />
<option value="http://localhost" />
<option value="http://maven.apache.org/POM/" />
<option value="http://maven.apache.org/xsd/" />
<option value="http://primefaces.org/ui" />
<option value="http://schema.cloudfoundry.org/spring/" />
<option value="http://schemas.xmlsoap.org/" />
<option value="http://tiles.apache.org/" />
<option value="http://www.ibm.com/webservices/xsd" />
<option value="http://www.jboss.com/xml/ns/" />
<option value="http://www.jboss.org/j2ee/schema/" />
<option value="http://www.springframework.org/schema/" />
<option value="http://www.springframework.org/security/tags" />
<option value="http://www.springframework.org/tags" />
<option value="http://www.thymeleaf.org" />
<option value="http://www.w3.org/" />
<option value="http://xmlns.jcp.org/" />
</list>
</option>
</inspection_tool>
<inspection_tool class="bashproGoogleFileNameStyle" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="bashproShellCheck" enabled="true" level="ERROR" enabled_by_default="true">
<shellcheck_settings value="SC2068,SC2145" />
</inspection_tool>
</profile>
</component>

204
.idea/intellij-javadocs-4.0.1.xml generated Normal file
View File

@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaDocConfiguration">
<GENERAL>
<MODE>UPDATE</MODE>
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
<LEVELS>
<LEVEL>TYPE</LEVEL>
<LEVEL>FIELD</LEVEL>
<LEVEL>METHOD</LEVEL>
</LEVELS>
<VISIBILITIES>
<VISIBILITY>DEFAULT</VISIBILITY>
<VISIBILITY>PROTECTED</VISIBILITY>
<VISIBILITY>PUBLIC</VISIBILITY>
</VISIBILITIES>
</GENERAL>
<TEMPLATES>
<CLASSES>
<CLASS>
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
<VALUE>/**\n
* The interface ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
<VALUE>/**\n
* The enum ${name}.\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
<VALUE>/**\n
* The type ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>.+</KEY>
<VALUE>/**\n
* The type ${name}.\n
*/</VALUE>
</CLASS>
</CLASSES>
<CONSTRUCTORS>
<CONSTRUCTOR>
<KEY>.+</KEY>
<VALUE>/**\n
* Instantiates a new ${name}.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</CONSTRUCTOR>
</CONSTRUCTORS>
<METHODS>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*&lt;.+&gt;)*)+\s+get\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Gets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*&lt;.+&gt;)*)+\s+set\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Sets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
<VALUE>/**\n
* The entry point of application.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
* @param ${element.parameterList.parameters[0].name} the input arguments\n
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>.+</KEY>
<VALUE>/**\n
* ${name}&lt;#if isNotVoid&gt; ${return}&lt;/#if&gt;.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${return}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
</METHODS>
<FIELDS>
<FIELD>
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
* The constant ${element.getName()}.\n
*/</VALUE>
</FIELD>
<FIELD>
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isInterface()&gt;
* The constant ${element.getName()}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt; */</VALUE>
</FIELD>
<FIELD>
<KEY>.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isEnum()&gt;
*${name} ${typeName}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt;*/</VALUE>
</FIELD>
</FIELDS>
</TEMPLATES>
</component>
</project>

8
.idea/jenkinsSettings.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Jenkins.Application.Settings">
<option name="delay" value="5" />
<option name="serverUrl" value="http://192.168.34.90:30100" />
<option name="useGreenColor" value="true" />
</component>
</project>

15
.idea/kubernetes-settings.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KubernetesSettings">
<option name="apiVersion" value="1.25" />
<option name="getSpecFromCluster" value="true" />
<option name="helmParameters">
<HelmParameters>
<option name="chartPath" value="$PROJECT_DIR$/部署应用/Oracle-Cloud/rancher部署/rancher-2.6.9" />
<option name="valuesFiles">
<option value="values.yaml" />
</option>
</HelmParameters>
</option>
</component>
</project>

5
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Shell.iml" filepath="$PROJECT_DIR$/.idea/Shell.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

201
.idea/workspace-Lap-Work-WDD.xml generated Normal file
View File

@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f8e0c22b-2f5a-4928-944a-c167e4872058" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings">
<execution />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="BashSupport Pro Bash" />
</list>
</option>
</component>
<component name="Jenkins.Settings">
<option name="connectionTimeout" value="12" />
<option name="jenkinsVersion" value="VERSION_2" />
<option name="lastSelectedView" value="all" />
<option name="username" value="zeaslity" />
</component>
<component name="KubernetesApiPersistence">
<option name="context" value="kubernetes-admin@wdd-test" />
<option name="namespace" value="default" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="C:\SSS\IntelliJ IDEA 2020.2.3\plugins\maven\lib\maven3" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectId" id="1kLy41FEsRhdbKP3lDuTAuM6hNQ" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="DatabaseDriversLRU" value="mysql" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="ToolWindowServices.ShowToolbar" value="false" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="yaml" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../Kubernetes" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="service.view.auto.scroll.to.source" value="true" />
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本\redis哨兵模式-docker" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\Kubernetes\jenkins-in-k8s\Gitlab" />
<recent name="E:\OneDrive - pku.edu.cn\MasterLoad\Shell\Kubernetes\jenkins-in-k8s\sonarQube" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\Kubernetes\jenkins-in-k8s" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本\redis哨兵模式-docker" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\全域监管平台部署脚本" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\Kubernetes\jenkins-in-k8s\jenkins" />
<recent name="E:\OneDrive - pku.edu.cn\MasterLoad\Shell\Kubernetes\promethues+grafana-operator官方\all-deployments" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SshConsoleOptionsProvider">
<option name="myEncoding" value="UTF-8" />
<option name="myConnectionType" value="NONE" />
<option name="myConnectionId" value="" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="f8e0c22b-2f5a-4928-944a-c167e4872058" name="Default Changelist" comment="" />
<created>1605493972221</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1605493972221</updated>
<workItem from="1605493973596" duration="3476000" />
<workItem from="1605497489966" duration="771000" />
<workItem from="1605498277696" duration="611000" />
<workItem from="1605504857417" duration="11980000" />
<workItem from="1605591685490" duration="186000" />
<workItem from="1605591880489" duration="6535000" />
<workItem from="1605613931647" duration="2841000" />
<workItem from="1605682643353" duration="5976000" />
<workItem from="1605688963025" duration="3243000" />
<workItem from="1605748167796" duration="4865000" />
<workItem from="1605835402633" duration="13904000" />
<workItem from="1605858866982" duration="2796000" />
<workItem from="1605871934735" duration="391000" />
<workItem from="1605872340983" duration="91000" />
<workItem from="1605872471492" duration="12000" />
<workItem from="1605872495438" duration="10183000" />
<workItem from="1605943758852" duration="10964000" />
<workItem from="1605962693159" duration="811000" />
<workItem from="1606027898431" duration="4494000" />
<workItem from="1606094156103" duration="16509000" />
<workItem from="1606124584309" duration="17391000" />
<workItem from="1606268109030" duration="21421000" />
<workItem from="1606302170533" duration="8790000" />
<workItem from="1606438996597" duration="6109000" />
<workItem from="1606462420040" duration="113000" />
<workItem from="1606462542386" duration="1088000" />
<workItem from="1606466409419" duration="316000" />
<workItem from="1606466736154" duration="2704000" />
<workItem from="1606699388553" duration="410000" />
<workItem from="1606701749491" duration="1424000" />
<workItem from="1606784828097" duration="20000" />
<workItem from="1607088629309" duration="49000" />
<workItem from="1607583264639" duration="1355000" />
<workItem from="1608023261948" duration="12000" />
<workItem from="1608099058290" duration="316000" />
<workItem from="1608104723228" duration="37000" />
<workItem from="1608167720296" duration="664000" />
<workItem from="1608187688365" duration="3955000" />
<workItem from="1608261542317" duration="644000" />
<workItem from="1609815709323" duration="3890000" />
<workItem from="1609913172586" duration="8528000" />
<workItem from="1609983136403" duration="9954000" />
<workItem from="1610009782311" duration="1348000" />
<workItem from="1610085590760" duration="4802000" />
<workItem from="1610343924334" duration="11298000" />
<workItem from="1610431499927" duration="4939000" />
<workItem from="1610516551221" duration="15000" />
<workItem from="1611194310331" duration="6444000" />
<workItem from="1611219472388" duration="1245000" />
<workItem from="1611287424239" duration="1281000" />
<workItem from="1611538242081" duration="64000" />
<workItem from="1611562648428" duration="4104000" />
<workItem from="1611717809000" duration="469000" />
<workItem from="1611739781287" duration="9662000" />
<workItem from="1611909115149" duration="4438000" />
<workItem from="1612492737464" duration="2193000" />
<workItem from="1615542547566" duration="479000" />
<workItem from="1615773265094" duration="6000" />
<workItem from="1615773282245" duration="1517000" />
<workItem from="1626331891196" duration="118000" />
<workItem from="1634114586499" duration="2632000" />
<workItem from="1634194826604" duration="742000" />
<workItem from="1634195754691" duration="4693000" />
<workItem from="1634261093795" duration="7000" />
<workItem from="1634440485716" duration="1046000" />
<workItem from="1634441554529" duration="313000" />
<workItem from="1634441881148" duration="2413000" />
<workItem from="1634652978350" duration="1045000" />
<workItem from="1634957271801" duration="542000" />
<workItem from="1635058465798" duration="1805000" />
<workItem from="1636096432806" duration="5119000" />
<workItem from="1636335589996" duration="11000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="WindowStateProjectService">
<state x="516" y="102" key="#HTTP_Proxy" timestamp="1634440658521">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state x="516" y="102" key="#HTTP_Proxy/0.0.1536.816@0.0.1536.816" timestamp="1634440658521" />
<state x="362" y="60" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1634957809071">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state x="362" y="60" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1536.816@0.0.1536.816" timestamp="1634440702209" />
<state x="362" y="60" key="#com.intellij.execution.impl.EditConfigurationsDialog/949.2160.1280.640/0.0.1536.816@0.0.1536.816" timestamp="1634957809071" />
<state width="1485" height="277" key="GridCell.Tab.0.bottom" timestamp="1634957272865">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state width="680" height="630" key="GridCell.Tab.0.bottom/0.0.1536.816@0.0.1536.816" timestamp="1634447935618" />
<state width="1485" height="277" key="GridCell.Tab.0.bottom/949.2160.1280.640/0.0.1536.816@0.0.1536.816" timestamp="1634957272865" />
<state width="1485" height="277" key="GridCell.Tab.0.center" timestamp="1634957272865">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state width="680" height="630" key="GridCell.Tab.0.center/0.0.1536.816@0.0.1536.816" timestamp="1634447935618" />
<state width="1485" height="277" key="GridCell.Tab.0.center/949.2160.1280.640/0.0.1536.816@0.0.1536.816" timestamp="1634957272865" />
<state width="1485" height="277" key="GridCell.Tab.0.left" timestamp="1634957272865">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state width="680" height="630" key="GridCell.Tab.0.left/0.0.1536.816@0.0.1536.816" timestamp="1634447935618" />
<state width="1485" height="277" key="GridCell.Tab.0.left/949.2160.1280.640/0.0.1536.816@0.0.1536.816" timestamp="1634957272865" />
<state width="1485" height="277" key="GridCell.Tab.0.right" timestamp="1634957272865">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state width="680" height="630" key="GridCell.Tab.0.right/0.0.1536.816@0.0.1536.816" timestamp="1634447935618" />
<state width="1485" height="277" key="GridCell.Tab.0.right/949.2160.1280.640/0.0.1536.816@0.0.1536.816" timestamp="1634957272865" />
<state x="197" y="0" key="SettingsEditor" timestamp="1634653357284">
<screen x="0" y="0" width="1536" height="816" />
</state>
<state x="177" y="0" key="SettingsEditor/0.0.1536.816@0.0.1536.816" timestamp="1634441869207" />
<state x="197" y="0" key="SettingsEditor/949.2160.1280.640/0.0.1536.816@0.0.1536.816" timestamp="1634653357284" />
</component>
</project>

223
.idea/workspace-LapPro.xml generated Normal file
View File

@@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f8e0c22b-2f5a-4928-944a-c167e4872058" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings">
<execution />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="BashSupport Pro Bash" />
</list>
</option>
</component>
<component name="GitSEFilterConfiguration">
<file-type-list>
<filtered-out-file-type name="LOCAL_BRANCH" />
<filtered-out-file-type name="REMOTE_BRANCH" />
<filtered-out-file-type name="TAG" />
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
</file-type-list>
</component>
<component name="Jenkins.Settings">
<option name="connectionTimeout" value="12" />
<option name="jenkinsVersion" value="VERSION_2" />
<option name="lastSelectedView" value="all" />
<option name="username" value="zeaslity" />
</component>
<component name="KubernetesApiPersistence">
<option name="context" value="wdd-k3s" />
<option name="namespace" value="default" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="C:\SSS\IntelliJ IDEA 2020.2.3\plugins\maven\lib\maven3" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectId" id="1kLy41FEsRhdbKP3lDuTAuM6hNQ" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="DatabaseDriversLRU" value="mysql" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="ToolWindowServices.ShowToolbar" value="false" />
<property name="ToolWindow结构.ShowToolbar" value="false" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="yaml" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/部署应用/Oracle-Cloud/rss-hub-in-k8s" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="service.view.auto.scroll.to.source" value="true" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\OneDrive - pku.edu.cn\MasterLoad\Shell\部署应用\Oracle-Cloud\rss-hub-in-k8s" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本\redis安装" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\部署应用\Oracle-Cloud\kms激活服务器" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本\redis哨兵模式-docker" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本\mysql安装" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\常用脚本\redis安装" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\部署应用\Oracle-Cloud\rancher部署" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\部署应用\Oracle-Cloud\NetMaker全互联" />
<recent name="D:\OneDrive - pku.edu.cn\MasterLoad\Shell\部署应用\Oracle-Cloud\k3s集群" />
</key>
</component>
<component name="RunManager" selected="BashSupport Pro.mysql-install">
<configuration name="mysql-install" type="BashProRunConfiguration" temporary="true">
<option name="scriptPath" value="$PROJECT_DIR$/常用脚本/mysql安装/mysql-install" />
<method v="2" />
</configuration>
<configuration name="redis-install" type="BashProRunConfiguration" temporary="true">
<option name="scriptPath" value="$PROJECT_DIR$/常用脚本/redis安装/redis-install" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="BashSupport Pro.mysql-install" />
<item itemvalue="BashSupport Pro.redis-install" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SshConsoleOptionsProvider">
<option name="myEncoding" value="UTF-8" />
<option name="myConnectionType" value="NONE" />
<option name="myConnectionId" value="" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="f8e0c22b-2f5a-4928-944a-c167e4872058" name="Default Changelist" comment="" />
<created>1605493972221</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1605493972221</updated>
<workItem from="1605493973596" duration="3476000" />
<workItem from="1605497489966" duration="771000" />
<workItem from="1605498277696" duration="611000" />
<workItem from="1605504857417" duration="11980000" />
<workItem from="1605591685490" duration="186000" />
<workItem from="1605591880489" duration="6535000" />
<workItem from="1605613931647" duration="2841000" />
<workItem from="1605682643353" duration="5976000" />
<workItem from="1605688963025" duration="3243000" />
<workItem from="1605748167796" duration="4865000" />
<workItem from="1605835402633" duration="13904000" />
<workItem from="1605858866982" duration="2796000" />
<workItem from="1605871934735" duration="391000" />
<workItem from="1605872340983" duration="91000" />
<workItem from="1605872471492" duration="12000" />
<workItem from="1605872495438" duration="10183000" />
<workItem from="1605943758852" duration="10964000" />
<workItem from="1605962693159" duration="811000" />
<workItem from="1606027898431" duration="4494000" />
<workItem from="1606094156103" duration="16509000" />
<workItem from="1606124584309" duration="17391000" />
<workItem from="1606268109030" duration="21421000" />
<workItem from="1606302170533" duration="8790000" />
<workItem from="1606438996597" duration="6109000" />
<workItem from="1606462420040" duration="113000" />
<workItem from="1606462542386" duration="1088000" />
<workItem from="1606466409419" duration="316000" />
<workItem from="1606466736154" duration="2704000" />
<workItem from="1606699388553" duration="410000" />
<workItem from="1606701749491" duration="1424000" />
<workItem from="1606784828097" duration="20000" />
<workItem from="1607088629309" duration="49000" />
<workItem from="1607583264639" duration="1355000" />
<workItem from="1608023261948" duration="12000" />
<workItem from="1608099058290" duration="316000" />
<workItem from="1608104723228" duration="37000" />
<workItem from="1608167720296" duration="664000" />
<workItem from="1608187688365" duration="3955000" />
<workItem from="1608261542317" duration="644000" />
<workItem from="1609815709323" duration="3890000" />
<workItem from="1609913172586" duration="8528000" />
<workItem from="1609983136403" duration="9954000" />
<workItem from="1610009782311" duration="1348000" />
<workItem from="1610085590760" duration="4802000" />
<workItem from="1610343924334" duration="11298000" />
<workItem from="1610431499927" duration="4939000" />
<workItem from="1610516551221" duration="15000" />
<workItem from="1611194310331" duration="6444000" />
<workItem from="1611219472388" duration="1245000" />
<workItem from="1611287424239" duration="1281000" />
<workItem from="1611538242081" duration="64000" />
<workItem from="1611562648428" duration="4104000" />
<workItem from="1611717809000" duration="469000" />
<workItem from="1611739781287" duration="9662000" />
<workItem from="1611909115149" duration="4438000" />
<workItem from="1612492737464" duration="2193000" />
<workItem from="1615542547566" duration="479000" />
<workItem from="1615773265094" duration="6000" />
<workItem from="1615773282245" duration="1517000" />
<workItem from="1626331891196" duration="118000" />
<workItem from="1634114586499" duration="2632000" />
<workItem from="1634194826604" duration="742000" />
<workItem from="1634195754691" duration="4693000" />
<workItem from="1634261093795" duration="7000" />
<workItem from="1634440485716" duration="1046000" />
<workItem from="1634441554529" duration="313000" />
<workItem from="1634441881148" duration="2413000" />
<workItem from="1634652978350" duration="1045000" />
<workItem from="1634957271801" duration="542000" />
<workItem from="1635058465798" duration="1805000" />
<workItem from="1636096432806" duration="5119000" />
<workItem from="1636164663771" duration="128000" />
<workItem from="1636186575731" duration="28590000" />
<workItem from="1636457432520" duration="36000" />
<workItem from="1637287984492" duration="2544000" />
<workItem from="1637303613051" duration="4638000" />
<workItem from="1638337344777" duration="14826000" />
<workItem from="1638413237039" duration="13385000" />
<workItem from="1638698265461" duration="80000" />
<workItem from="1638698366077" duration="2386000" />
<workItem from="1638789312490" duration="614000" />
<workItem from="1638791080494" duration="56000" />
<workItem from="1638964725619" duration="4604000" />
<workItem from="1638971370992" duration="89000" />
<workItem from="1639012326304" duration="1210000" />
<workItem from="1639115371775" duration="768000" />
<workItem from="1639210750406" duration="758000" />
<workItem from="1639360927827" duration="11000" />
<workItem from="1639725010273" duration="2827000" />
<workItem from="1640048766839" duration="16000" />
<workItem from="1640675021909" duration="189000" />
<workItem from="1644649616767" duration="4634000" />
<workItem from="1644719118463" duration="272000" />
<workItem from="1644826118373" duration="38000" />
<workItem from="1644826184619" duration="930000" />
<workItem from="1646553276466" duration="3155000" />
<workItem from="1646658622141" duration="736000" />
<workItem from="1647222430859" duration="15000" />
<workItem from="1647222465915" duration="10000" />
<workItem from="1647311993260" duration="26000" />
<workItem from="1647669522577" duration="604000" />
<workItem from="1647697890966" duration="3000" />
<workItem from="1648041894504" duration="24000" />
<workItem from="1649319620462" duration="9648000" />
<workItem from="1650978252075" duration="37000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"python.autoComplete.addBrackets": true,
"go.autocompleteUnimportedPackages": true
}

View File

@@ -0,0 +1,520 @@
#!/bin/bash
export LANG=en_US.UTF-8
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
PLAIN="\033[0m"
red(){
echo -e "\033[31m\033[01m$1\033[0m"
}
green(){
echo -e "\033[32m\033[01m$1\033[0m"
}
yellow(){
echo -e "\033[33m\033[01m$1\033[0m"
}
# 判断系统及定义系统安装依赖方式
REGEX=("debian" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora")
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora")
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update")
PACKAGE_INSTALL=("apt -y install" "apt -y install" "yum -y install" "yum -y install" "yum -y install")
PACKAGE_REMOVE=("apt -y remove" "apt -y remove" "yum -y remove" "yum -y remove" "yum -y remove")
PACKAGE_UNINSTALL=("apt -y autoremove" "apt -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove")
[[ $EUID -ne 0 ]] && red "注意: 请在root用户下运行脚本" && exit 1
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')")
for i in "${CMD[@]}"; do
SYS="$i" && [[ -n $SYS ]] && break
done
for ((int = 0; int < ${#REGEX[@]}; int++)); do
[[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]] && SYSTEM="${RELEASE[int]}" && [[ -n $SYSTEM ]] && break
done
[[ -z $SYSTEM ]] && red "目前暂不支持你的VPS的操作系统" && exit 1
if [[ -z $(type -P curl) ]]; then
if [[ ! $SYSTEM == "CentOS" ]]; then
${PACKAGE_UPDATE[int]}
fi
${PACKAGE_INSTALL[int]} curl
fi
realip(){
ip=$(curl -s4m8 ip.sb -k) || ip=$(curl -s6m8 ip.sb -k)
}
inst_cert(){
green "Hysteria 2 协议证书申请方式如下:"
echo ""
echo -e " ${GREEN}1.${PLAIN} 必应自签证书 ${YELLOW}(默认)${PLAIN}"
echo -e " ${GREEN}2.${PLAIN} Acme 脚本自动申请"
echo -e " ${GREEN}3.${PLAIN} 自定义证书路径"
echo ""
read -rp "请输入选项 [1-3]: " certInput
if [[ $certInput == 2 ]]; then
cert_path="/root/cert.crt"
key_path="/root/private.key"
chmod a+x /root # 让 Hysteria 主程序访问到 /root 目录
if [[ -f /root/cert.crt && -f /root/private.key ]] && [[ -s /root/cert.crt && -s /root/private.key ]] && [[ -f /root/ca.log ]]; then
domain=$(cat /root/ca.log)
green "检测到原有域名:$domain 的证书,正在应用"
hy_domain=$domain
else
WARPv4Status=$(curl -s4m8 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
WARPv6Status=$(curl -s6m8 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
if [[ $WARPv4Status =~ on|plus ]] || [[ $WARPv6Status =~ on|plus ]]; then
wg-quick down wgcf >/dev/null 2>&1
systemctl stop warp-go >/dev/null 2>&1
realip
wg-quick up wgcf >/dev/null 2>&1
systemctl start warp-go >/dev/null 2>&1
else
realip
fi
read -p "请输入需要申请证书的域名:" domain
[[ -z $domain ]] && red "未输入域名,无法执行操作!" && exit 1
green "已输入的域名:$domain" && sleep 1
domainIP=$(curl -sm8 ipget.net/?ip="${domain}")
if [[ $domainIP == $ip ]]; then
${PACKAGE_INSTALL[int]} curl wget sudo socat openssl
if [[ $SYSTEM == "CentOS" ]]; then
${PACKAGE_INSTALL[int]} cronie
systemctl start crond
systemctl enable crond
else
${PACKAGE_INSTALL[int]} cron
systemctl start cron
systemctl enable cron
fi
curl https://get.acme.sh | sh -s email=$(date +%s%N | md5sum | cut -c 1-16)@gmail.com
source ~/.bashrc
bash ~/.acme.sh/acme.sh --upgrade --auto-upgrade
bash ~/.acme.sh/acme.sh --set-default-ca --server letsencrypt
if [[ -n $(echo $ip | grep ":") ]]; then
bash ~/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 --listen-v6 --insecure
else
bash ~/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 --insecure
fi
bash ~/.acme.sh/acme.sh --install-cert -d ${domain} --key-file /root/private.key --fullchain-file /root/cert.crt --ecc
if [[ -f /root/cert.crt && -f /root/private.key ]] && [[ -s /root/cert.crt && -s /root/private.key ]]; then
echo $domain > /root/ca.log
sed -i '/--cron/d' /etc/crontab >/dev/null 2>&1
echo "0 0 * * * root bash /root/.acme.sh/acme.sh --cron -f >/dev/null 2>&1" >> /etc/crontab
green "证书申请成功! 脚本申请到的证书 (cert.crt) 和私钥 (private.key) 文件已保存到 /root 文件夹下"
yellow "证书crt文件路径如下: /root/cert.crt"
yellow "私钥key文件路径如下: /root/private.key"
hy_domain=$domain
fi
else
red "当前域名解析的IP与当前VPS使用的真实IP不匹配"
green "建议如下:"
yellow "1. 请确保CloudFlare小云朵为关闭状态(仅限DNS), 其他域名解析或CDN网站设置同理"
yellow "2. 请检查DNS解析设置的IP是否为VPS的真实IP"
yellow "3. 脚本可能跟不上时代, 建议截图发布到GitHub Issues、GitLab Issues、论坛或TG群询问"
exit 1
fi
fi
elif [[ $certInput == 3 ]]; then
read -p "请输入公钥文件 crt 的路径:" cert_path
yellow "公钥文件 crt 的路径:$cert_path "
read -p "请输入密钥文件 key 的路径:" key_path
yellow "密钥文件 key 的路径:$key_path "
read -p "请输入证书的域名:" domain
yellow "证书域名:$domain"
hy_domain=$domain
else
green "将使用必应自签证书作为 Hysteria 2 的节点证书"
cert_path="/etc/hysteria/cert.crt"
key_path="/etc/hysteria/private.key"
openssl ecparam -genkey -name prime256v1 -out /etc/hysteria/private.key
openssl req -new -x509 -days 36500 -key /etc/hysteria/private.key -out /etc/hysteria/cert.crt -subj "/CN=www.bing.com"
chmod 777 /etc/hysteria/cert.crt
chmod 777 /etc/hysteria/private.key
hy_domain="www.bing.com"
domain="www.bing.com"
fi
}
inst_port(){
iptables -t nat -F PREROUTING >/dev/null 2>&1
read -p "设置 Hysteria 2 端口 [1-65535](回车则随机分配端口):" port
[[ -z $port ]] && port=$(shuf -i 2000-65535 -n 1)
until [[ -z $(ss -tunlp | grep -w udp | awk '{print $5}' | sed 's/.*://g' | grep -w "$port") ]]; do
if [[ -n $(ss -tunlp | grep -w udp | awk '{print $5}' | sed 's/.*://g' | grep -w "$port") ]]; then
echo -e "${RED} $port ${PLAIN} 端口已经被其他程序占用,请更换端口重试!"
read -p "设置 Hysteria 2 端口 [1-65535](回车则随机分配端口):" port
[[ -z $port ]] && port=$(shuf -i 2000-65535 -n 1)
fi
done
yellow "将在 Hysteria 2 节点使用的端口是:$port"
inst_jump
}
inst_jump(){
green "Hysteria 2 端口使用模式如下:"
echo ""
echo -e " ${GREEN}1.${PLAIN} 单端口 ${YELLOW}(默认)${PLAIN}"
echo -e " ${GREEN}2.${PLAIN} 端口跳跃"
echo ""
read -rp "请输入选项 [1-2]: " jumpInput
if [[ $jumpInput == 2 ]]; then
read -p "设置范围端口的起始端口 (建议10000-65535之间)" firstport
read -p "设置一个范围端口的末尾端口 (建议10000-65535之间一定要比上面起始端口大)" endport
if [[ $firstport -ge $endport ]]; then
until [[ $firstport -le $endport ]]; do
if [[ $firstport -ge $endport ]]; then
red "你设置的起始端口小于末尾端口,请重新输入起始和末尾端口"
read -p "设置范围端口的起始端口 (建议10000-65535之间)" firstport
read -p "设置一个范围端口的末尾端口 (建议10000-65535之间一定要比上面起始端口大)" endport
fi
done
fi
iptables -t nat -A PREROUTING -p udp --dport $firstport:$endport -j DNAT --to-destination :$port
ip6tables -t nat -A PREROUTING -p udp --dport $firstport:$endport -j DNAT --to-destination :$port
netfilter-persistent save >/dev/null 2>&1
else
red "将继续使用单端口模式"
fi
}
inst_pwd(){
read -p "设置 Hysteria 2 密码(回车跳过为随机字符):" auth_pwd
[[ -z $auth_pwd ]] && auth_pwd=$(date +%s%N | md5sum | cut -c 1-8)
yellow "使用在 Hysteria 2 节点的密码为:$auth_pwd"
}
inst_site(){
read -rp "请输入 Hysteria 2 的伪装网站地址 去除https:// [回车世嘉maimai日本网站]" proxysite
[[ -z $proxysite ]] && proxysite="maimai.sega.jp"
yellow "使用在 Hysteria 2 节点的伪装网站为:$proxysite"
}
insthysteria(){
warpv6=$(curl -s6m8 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
warpv4=$(curl -s4m8 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
if [[ $warpv4 =~ on|plus || $warpv6 =~ on|plus ]]; then
wg-quick down wgcf >/dev/null 2>&1
systemctl stop warp-go >/dev/null 2>&1
realip
systemctl start warp-go >/dev/null 2>&1
wg-quick up wgcf >/dev/null 2>&1
else
realip
fi
if [[ ! ${SYSTEM} == "CentOS" ]]; then
${PACKAGE_UPDATE}
fi
${PACKAGE_INSTALL} curl wget sudo qrencode procps iptables-persistent netfilter-persistent
wget -N https://raw.githubusercontent.com/Misaka-blog/hysteria-install/main/hy2/install_server.sh
bash install_server.sh
rm -f install_server.sh
if [[ -f "/usr/local/bin/hysteria" ]]; then
green "Hysteria 2 安装成功!"
else
red "Hysteria 2 安装失败!"
fi
# 询问用户 Hysteria 配置
inst_cert
inst_port
inst_pwd
inst_site
# 设置 Hysteria 配置文件
cat << EOF > /etc/hysteria/config.yaml
listen: :$port
tls:
cert: $cert_path
key: $key_path
quic:
initStreamReceiveWindow: 16777216
maxStreamReceiveWindow: 16777216
initConnReceiveWindow: 33554432
maxConnReceiveWindow: 33554432
auth:
type: password
password: $auth_pwd
masquerade:
type: proxy
proxy:
url: https://$proxysite
rewriteHost: true
EOF
# 确定最终入站端口范围
if [[ -n $firstport ]]; then
last_port="$port,$firstport-$endport"
else
last_port=$port
fi
# 给 IPv6 地址加中括号
if [[ -n $(echo $ip | grep ":") ]]; then
last_ip="[$ip]"
else
last_ip=$ip
fi
mkdir /root/hy
cat << EOF > /root/hy/hy-client.yaml
server: $last_ip:$last_port
auth: $auth_pwd
tls:
sni: $hy_domain
insecure: true
quic:
initStreamReceiveWindow: 16777216
maxStreamReceiveWindow: 16777216
initConnReceiveWindow: 33554432
maxConnReceiveWindow: 33554432
fastOpen: true
socks5:
listen: 127.0.0.1:5080
transport:
udp:
hopInterval: 30s
EOF
cat << EOF > /root/hy/hy-client.json
{
"server": "$last_ip:$last_port",
"auth": "$auth_pwd",
"tls": {
"sni": "$hy_domain",
"insecure": true
},
"quic": {
"initStreamReceiveWindow": 16777216,
"maxStreamReceiveWindow": 16777216,
"initConnReceiveWindow": 33554432,
"maxConnReceiveWindow": 33554432
},
"socks5": {
"listen": "127.0.0.1:5080"
},
"transport": {
"udp": {
"hopInterval": "30s"
}
}
}
EOF
url="hysteria2://$auth_pwd@$last_ip:$last_port/?insecure=1&sni=$hy_domain#Hysteria2-misaka"
echo $url > /root/hy/url.txt
systemctl daemon-reload
systemctl enable hysteria-server
systemctl start hysteria-server
if [[ -n $(systemctl status hysteria-server 2>/dev/null | grep -w active) && -f '/etc/hysteria/config.yaml' ]]; then
green "Hysteria 2 服务启动成功"
else
red "Hysteria 2 服务启动失败,请运行 systemctl status hysteria-server 查看服务状态并反馈,脚本退出" && exit 1
fi
red "======================================================================================"
green "Hysteria 2 代理服务安装完成"
yellow "Hysteria 2 客户端 YAML 配置文件 hy-client.yaml 内容如下,并保存到 /root/hy/hy-client.yaml"
red "$(cat /root/hy/hy-client.yaml)"
yellow "Hysteria 2 客户端 JSON 配置文件 hy-client.json 内容如下,并保存到 /root/hy/hy-client.json"
red "$(cat /root/hy/hy-client.json)"
yellow "Hysteria 2 节点分享链接如下,并保存到 /root/hy/url.txt"
red "$(cat /root/hy/url.txt)"
}
unsthysteria(){
systemctl stop hysteria-server.service >/dev/null 2>&1
systemctl disable hysteria-server.service >/dev/null 2>&1
rm -f /lib/systemd/system/hysteria-server.service /lib/systemd/system/hysteria-server@.service
rm -rf /usr/local/bin/hysteria /etc/hysteria /root/hy /root/hysteria.sh
iptables -t nat -F PREROUTING >/dev/null 2>&1
netfilter-persistent save >/dev/null 2>&1
green "Hysteria 2 已彻底卸载完成!"
}
starthysteria(){
systemctl start hysteria-server
systemctl enable hysteria-server >/dev/null 2>&1
}
stophysteria(){
systemctl stop hysteria-server
systemctl disable hysteria-server >/dev/null 2>&1
}
hysteriaswitch(){
yellow "请选择你需要的操作:"
echo ""
echo -e " ${GREEN}1.${PLAIN} 启动 Hysteria 2"
echo -e " ${GREEN}2.${PLAIN} 关闭 Hysteria 2"
echo -e " ${GREEN}3.${PLAIN} 重启 Hysteria 2"
echo ""
read -rp "请输入选项 [0-3]: " switchInput
case $switchInput in
1 ) starthysteria ;;
2 ) stophysteria ;;
3 ) stophysteria && starthysteria ;;
* ) exit 1 ;;
esac
}
changeport(){
oldport=$(cat /etc/hysteria/config.yaml 2>/dev/null | sed -n 1p | awk '{print $2}' | awk -F ":" '{print $2}')
read -p "设置 Hysteria 2 端口[1-65535](回车则随机分配端口):" port
[[ -z $port ]] && port=$(shuf -i 2000-65535 -n 1)
until [[ -z $(ss -tunlp | grep -w udp | awk '{print $5}' | sed 's/.*://g' | grep -w "$port") ]]; do
if [[ -n $(ss -tunlp | grep -w udp | awk '{print $5}' | sed 's/.*://g' | grep -w "$port") ]]; then
echo -e "${RED} $port ${PLAIN} 端口已经被其他程序占用,请更换端口重试!"
read -p "设置 Hysteria 2 端口 [1-65535](回车则随机分配端口):" port
[[ -z $port ]] && port=$(shuf -i 2000-65535 -n 1)
fi
done
sed -i "1s#$oldport#$port#g" /etc/hysteria/config.yaml
sed -i "1s#$oldport#$port#g" /root/hy/hy-client.yaml
sed -i "2s#$oldport#$port#g" /root/hy/hy-client.json
stophysteria && starthysteria
green "Hysteria 2 端口已成功修改为:$port"
yellow "请手动更新客户端配置文件以使用节点"
showconf
}
changepasswd(){
oldpasswd=$(cat /etc/hysteria/config.yaml 2>/dev/null | sed -n 15p | awk '{print $2}')
read -p "设置 Hysteria 2 密码(回车跳过为随机字符):" passwd
[[ -z $passwd ]] && passwd=$(date +%s%N | md5sum | cut -c 1-8)
sed -i "1s#$oldpasswd#$passwd#g" /etc/hysteria/config.yaml
sed -i "1s#$oldpasswd#$passwd#g" /root/hy/hy-client.yaml
sed -i "3s#$oldpasswd#$passwd#g" /root/hy/hy-client.json
stophysteria && starthysteria
green "Hysteria 2 节点密码已成功修改为:$passwd"
yellow "请手动更新客户端配置文件以使用节点"
showconf
}
change_cert(){
old_cert=$(cat /etc/hysteria/config.yaml | grep cert | awk -F " " '{print $2}')
old_key=$(cat /etc/hysteria/config.yaml | grep key | awk -F " " '{print $2}')
old_hydomain=$(cat /root/hy/hy-client.yaml | grep sni | awk '{print $2}')
inst_cert
sed -i "s!$old_cert!$cert_path!g" /etc/hysteria/config.yaml
sed -i "s!$old_key!$key_path!g" /etc/hysteria/config.yaml
sed -i "6s/$old_hydomain/$hy_domain/g" /root/hy/hy-client.yaml
sed -i "5s/$old_hydomain/$hy_domain/g" /root/hy/hy-client.json
stophysteria && starthysteria
green "Hysteria 2 节点证书类型已成功修改"
yellow "请手动更新客户端配置文件以使用节点"
showconf
}
changeproxysite(){
oldproxysite=$(cat /etc/hysteria/config.yaml | grep url | awk -F " " '{print $2}' | awk -F "https://" '{print $2}')
inst_site
sed -i "s#$oldproxysite#$proxysite#g" /etc/caddy/Caddyfile
stophysteria && starthysteria
green "Hysteria 2 节点伪装网站已成功修改为:$proxysite"
}
changeconf(){
green "Hysteria 2 配置变更选择如下:"
echo -e " ${GREEN}1.${PLAIN} 修改端口"
echo -e " ${GREEN}2.${PLAIN} 修改密码"
echo -e " ${GREEN}3.${PLAIN} 修改证书类型"
echo -e " ${GREEN}4.${PLAIN} 修改伪装网站"
echo ""
read -p " 请选择操作 [1-4]" confAnswer
case $confAnswer in
1 ) changeport ;;
2 ) changepasswd ;;
3 ) change_cert ;;
4 ) changeproxysite ;;
* ) exit 1 ;;
esac
}
showconf(){
yellow "Hysteria 2 客户端 YAML 配置文件 hy-client.yaml 内容如下,并保存到 /root/hy/hy-client.yaml"
red "$(cat /root/hy/hy-client.yaml)"
yellow "Hysteria 2 客户端 JSON 配置文件 hy-client.json 内容如下,并保存到 /root/hy/hy-client.json"
red "$(cat /root/hy/hy-client.json)"
yellow "Hysteria 2 节点分享链接如下,并保存到 /root/hy/url.txt"
red "$(cat /root/hy/url.txt)"
}
menu() {
clear
echo "#############################################################"
echo -e "# ${RED}Hysteria 2 一键安装脚本${PLAIN} #"
echo -e "# ${GREEN}作者${PLAIN}: MisakaNo の 小破站 #"
echo -e "# ${GREEN}博客${PLAIN}: https://blog.misaka.rest #"
echo -e "# ${GREEN}GitHub 项目${PLAIN}: https://github.com/Misaka-blog #"
echo -e "# ${GREEN}GitLab 项目${PLAIN}: https://gitlab.com/Misaka-blog #"
echo -e "# ${GREEN}Telegram 频道${PLAIN}: https://t.me/misakanocchannel #"
echo -e "# ${GREEN}Telegram 群组${PLAIN}: https://t.me/misakanoc #"
echo -e "# ${GREEN}YouTube 频道${PLAIN}: https://www.youtube.com/@misaka-blog #"
echo "#############################################################"
echo ""
echo -e " ${GREEN}1.${PLAIN} 安装 Hysteria 2"
echo -e " ${GREEN}2.${PLAIN} ${RED}卸载 Hysteria 2${PLAIN}"
echo " -------------"
echo -e " ${GREEN}3.${PLAIN} 关闭、开启、重启 Hysteria 2"
echo -e " ${GREEN}4.${PLAIN} 修改 Hysteria 2 配置"
echo -e " ${GREEN}5.${PLAIN} 显示 Hysteria 2 配置文件"
echo " -------------"
echo -e " ${GREEN}0.${PLAIN} 退出脚本"
echo ""
read -rp "请输入选项 [0-5]: " menuInput
case $menuInput in
1 ) insthysteria ;;
2 ) unsthysteria ;;
3 ) hysteriaswitch ;;
4 ) changeconf ;;
5 ) showconf ;;
* ) exit 1 ;;
esac
}
menu

View File

@@ -0,0 +1,27 @@
#!/bin/bash
export DOMAIN_NAME=super-idol.107421.xyz
export CF_Token="oXJRP5XI8Zhipa_PtYtB_jy6qWL0I9BosrJEYE8p"
export CF_Account_ID="dfaadeb83406ef5ad35da02617af9191"
export CF_Zone_ID="511894a4f1357feb905e974e16241ebb"
acme.sh --issue --dns dns_cf -d ${DOMAIN_NAME} --keylength ec-256
acme.sh --install-cert -d ${DOMAIN_NAME} --ecc \
--key-file /etc/nginx/conf.d/ssl_key/${DOMAIN_NAME}.key.pem \
--fullchain-file /etc/nginx/conf.d/ssl_key/${DOMAIN_NAME}.cert.pem \
--reloadcmd "systemctl restart nginx --force"
openssl x509 -noout -fingerprint -sha256 -in /root/.acme.sh/super-idol.107421.xyz_ecc/fullchain.cer
cp /root/.acme.sh/super-idol.107421.xyz_ecc/super-idol.107421.xyz.cer /etc/hysteria/super-idol.107421.xyz.cert
cp /root/.acme.sh/super-idol.107421.xyz_ecc/super-idol.107421.xyz.key /etc/hysteria/super-idol.107421.xyz.key
cp /root/.acme.sh/super-idol.107421.xyz_ecc/fullchain.cer /etc/hysteria/super-idol.107421.xyz.cert
cp /root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer /etc/trojan-go/xx.s4.cc.hh.107421.xyz.cert
cp /root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key /etc/trojan-go/xx.s4.cc.hh.107421.xyz.key

View File

@@ -0,0 +1,26 @@
server: 140.238.8.73:29100
auth: V2ryStr0ngP@ss
tls:
sni: super-idol.107421.xyz
insecure: false
pinSHA256: 71:82:78:59:3B:9B:33:50:9C:02:A7:C3:DF:9B:77:6B:81:E2:B7:C8:56:B0:25:4F:D2:0E:B8:FB:E0:46:3D:4A
quic:
initStreamReceiveWindow: 8388608
maxStreamReceiveWindow: 8388608
initConnReceiveWindow: 20971520
maxConnReceiveWindow: 20971520
maxIdleTimeout: 30s
keepAlivePeriod: 10s
disablePathMTUDiscovery: false
fastOpen: false
socks5:
listen: 127.0.0.1:5080
transport:
udp:
hopInterval: 20s

View File

@@ -0,0 +1,25 @@
listen: :29100
tls:
cert: /etc/hysteria/super-idol.107421.xyz.cert
key: /etc/hysteria/super-idol.107421.xyz.key
quic:
initStreamReceiveWindow: 8388608
maxStreamReceiveWindow: 8388608
initConnReceiveWindow: 20971520
maxConnReceiveWindow: 20971520
maxIdleTimeout: 30s
keepAlivePeriod: 10s
maxIncomingStreams: 128
disablePathMTUDiscovery: false
auth:
type: password
password: V2ryStr0ngP@ss
masquerade:
type: proxy
proxy:
url: https://aws.amazon.com
rewriteHost: true

View File

@@ -0,0 +1,12 @@
Hysteria 服务端并不能同时监听多个端口,因此不能在服务器端使用上面的格式作为监听地址。建议配合 iptables 的 DNAT 将端口转发到服务器的监听端口。
# IPv4
iptables -t nat -A PREROUTING -i ens3 -p udp --dport 29101:30000 -j DNAT --to-destination :29100
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 29101:30000 -j DNAT --to-destination :29100
# IPv6
ip6tables -t nat -A PREROUTING -i ens3 -p udp --dport 19100:19300 -j DNAT --to-destination :19100
iptables -t nat -L
iptables -t nat -D PREROUTING 1
iptables -t nat -nL --line-number

View File

@@ -0,0 +1,35 @@
server {
listen 80;
location /octopus-agent/ {
root /data/github-action;
autoindex on; # 开启目录浏览功能;
}
location /shell/ {
root /data/github-action;
autoindex on; # 开启目录浏览功能;
}
location /agent-config/ {
root /data/github-action;
autoindex on; # 开启目录浏览功能;
}
location /agent-version {
add_header Content-Type text/plain;
alias /data/github-action/agent-version;
}
}

View File

@@ -0,0 +1,25 @@
______ __ ______ __
/ \ | \ / \ | \
| $$$$$$\ _______ _| $$_ ______ ______ __ __ _______ | $$$$$$\ ______ ______ _______ _| $$_
| $$ | $$/ | $$ \ / \ / \| \ | \/ \ | $$__| $$/ \ / \| | $$ \
| $$ | $| $$$$$$$\$$$$$$ | $$$$$$| $$$$$$| $$ | $| $$$$$$$ | $$ $| $$$$$$| $$$$$$| $$$$$$$\$$$$$$
| $$ | $| $$ | $$ __| $$ | $| $$ | $| $$ | $$\$$ \ | $$$$$$$| $$ | $| $$ $| $$ | $$| $$ __
| $$__/ $| $$_____ | $$| | $$__/ $| $$__/ $| $$__/ $$_\$$$$$$\ | $$ | $| $$__| $| $$$$$$$| $$ | $$| $$| \
\$$ $$\$$ \ \$$ $$\$$ $| $$ $$\$$ $| $$ | $$ | $$\$$ $$\$$ | $$ | $$ \$$ $$
\$$$$$$ \$$$$$$$ \$$$$ \$$$$$$| $$$$$$$ \$$$$$$ \$$$$$$$ \$$ \$$_\$$$$$$$ \$$$$$$$\$$ \$$ \$$$$
| $$ | \__| $$
| $$ \$$ $$
\$$ \$$$$$$
__ __
| \ | \
____| $$ ______ ____| $$ ______ __ __ __ ______ _______ ______
______ ______ ______ / $$| \ / $$| \ | \ | \ | \| \| \ / \
| | | \ | $$$$$$$ \$$$$$$| $$$$$$$ \$$$$$$\ | $$ | $$ | $$ \$$$$$$| $$$$$$$| $$$$$$\
\$$$$$$\$$$$$$\$$$$$$ | $$ | $$/ $| $$ | $$/ $$ | $$ | $$ | $$/ $| $$ | $| $$ | $$
| $$__| $| $$$$$$| $$__| $| $$$$$$$ | $$_/ $$_/ $| $$$$$$| $$ | $| $$__| $$
\$$ $$\$$ $$\$$ $$\$$ $$ \$$ $$ $$\$$ $| $$ | $$\$$ $$
\$$$$$$$ \$$$$$$$ \$$$$$$$ \$$$$$$$ \$$$$$\$$$$ \$$$$$$$\$$ \$$_\$$$$$$$
| \__| $$
\$$ $$
\$$$$$$

View File

@@ -0,0 +1,3 @@
https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/plugins/command-not-found/command-not-found.plugin.zsh
https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/plugins/autojump/autojump.plugin.zsh
https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/plugins/themes/themes.plugin.zsh

View File

@@ -0,0 +1,2 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL9S6CSAjTFe2fy4bAIfqu90ft6E+GBRvS59kno6LDeAbqUQNYf9hEnIg07Ee/x5DlnYE0S3Ykv3WCHuVyBH2zANnC0P87SqphDGmoqdqF3r6uDaCr4lBsUqEai9X2q6dyjZj6ym+r4zQhMApNDzbhcyfKQ54tKFylGIdx6siyktuU/VbOzWc6G8r+BfFsQpMCA1ihmCY1jGjsKPqFlZGLeTrlBb1Zk0OV+GtDhlf/t0cd0kRPJoydm2juTXrZO+tFmf9turfKZsBnRYKtQBLJG5mF1hsjIqo8DHr+PUL2wRrSxEhGTZiJL4rNJo/kHhKXXsomc5RM/AnfgAfxrLlH zeasl@DESKTOP-K2F9GG3

View File

@@ -0,0 +1,41 @@
132.145.87.10 arm-s-1 s0
10.0.0.91 arm-s-1 s0
146.56.159.175 arm-s-2 s5
10.0.0.173 arm-s-2 s5
140.238.8.73 seoul-1 s1
10.0.0.3 seoul-1 s1
140.238.30.110 seoul-2 s2
10.0.0.14 seoul-2 s2
140.238.29.102 seoul-3 s3
10.0.0.2 seoul-3 s3
140.238.14.103 seoul-4 s4
10.0.0.3 seoul-4 s4
150.230.198.103 tokyo-0 t0
140.238.63.37 tokyo-1 t1
140.238.52.228 tokyo-2 t2
140.83.84.142 osaka-1 o1
140.83.58.96 osaka-2 o2
129.146.171.163 p2
129.146.65.80 p3
129.146.57.94 p4
42.192.52.227 tc-sh
43.128.39.232 tc-hk
114.117.165.222 tc-cd
89.208.251.209 los-1

1362
Public/init-script-wdd.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
#!/bin/bash
if [[ ! -f /root/wdd/lib/wdd-lib-log.sh ]]; then
wget https://oss-s1.107421.xyz/wdd-lib-log.sh -O /root/wdd/lib/wdd-lib-log.sh
fi
source /root/wdd/lib/wdd-lib-log.sh
clean_oracle_agent() {
FunctionStart
colorEchoBlue "准备清理 Oracle Agent的相关内容 "
snap info oracle-cloud-agent
snap stop oracle-cloud-agent
snap remove oracle-cloud-agent
for i in $(ls /lib/systemd/system/ | grep snapd | awk '{print$1}'); do
echo $i
systemctl stop $i
systemctl disable $i
done
local loop
for loop in $(df -h | grep snap | awk '{print$1}');do
echo "unmount $loop"
umount "$loop"
done
rm -rf /root/snap
rm -rf /var/snap
rm -rf /usr/bin/snap
rm -rf /snap/
rm -rf /var/lib/snapd
FunctionSuccess
FunctionEnd
}
clean_ip_persist() {
FunctionStart
colorEchoBlue "开始关闭 防火墙持久化存储 …………"
systemctl stop systemd-resolved.service && systemctl disable systemd-resolved.service
systemctl stop netfilter-persistent.service && systemctl disable netfilter-persistent.service
FunctionEnd
FunctionSuccess
}

625
Public/lib/wdd-lib-env.sh Normal file
View File

@@ -0,0 +1,625 @@
#!/bin/bash
octopus_agent_path=/usr/local/etc/octpus-agent
. "$octopus_agent_path/lib/wdd-lib-log.sh"
. "$octopus_agent_path/lib/wdd-lib-sys.sh"
host_arch_version=""
cpu_arch=""
#### CollectSystemInfo ####
server_name=""
server_ip_pb_v4=""
server_ip_in_v4=""
server_ip_pb_v6=""
server_ip_in_v6=""
location=""
provider=""
manage_port=""
cpu_brand=""
cpu_core=""
memory_total=""
disk_total=""
disk_usage=""
os_info=""
os_kernel_info=""
tcp_control=""
virtualization=""
io_speed=""
machine_id=""
arch_info=""
agent_version=""
os_bit=""
### tmp usage
io_speed=""
public_ipv4=""
inner_ipv4=""
public_ipv6=""
inner_ipv6=""
country=""
region=""
city=""
net_provider=""
manage_port=""
machine_number=""
l_bit=""
#### CollectSystemInfo ####
#######################################
# description
# Arguments:
# 1
#######################################
io_test() {
(LANG=C dd if=/dev/zero of=benchtest_$$ bs=512k count=$1 conv=fdatasync && rm -f benchtest_$$) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//'
}
####### 获取系统版本及64位或32位信息
check_sys() {
local sys_bit
sys_bit=$(uname -m)
case $sys_bit in
i[36]86)
os_bit="32"
cpu_arch="386"
;;
x86_64)
os_bit="64"
cpu_arch="amd64"
;;
*armv6*)
os_bit="arm"
cpu_arch="arm6"
;;
*armv7*)
os_bit="arm"
cpu_arch="arm7"
;;
*aarch64* | *armv8*)
os_bit="arm64"
cpu_arch="arm64"
;;
*)
error "
哈哈……这个 辣鸡脚本 不支持你的系统。 (-_-) \n
备注: 仅支持 Ubuntu 16+ / Debian 8+ / CentOS 7+ 系统
" && exit 1
;;
esac
## 判定Linux的发行版本
if [ -f /etc/redhat-release ]; then
host_arch_version="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
host_arch_version="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
host_arch_version="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
host_arch_version="centos"
elif cat /proc/version | grep -Eqi "debian"; then
host_arch_version="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
host_arch_version="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
host_arch_version="centos"
else
host_arch_version=""
fi
return 0
}
#######################################
# description
# Arguments:
# 1
# Returns:
# <unknown> ...
#######################################
calc_size() {
local raw=$1
local total_size=0
local num=1
local unit="KB"
if ! [[ ${raw} =~ ^[0-9]+$ ]]; then
echo ""
return
fi
if [ "${raw}" -ge 1073741824 ]; then
num=1073741824
unit="TB"
elif [ "${raw}" -ge 1048576 ]; then
num=1048576
unit="GB"
elif [ "${raw}" -ge 1024 ]; then
num=1024
unit="MB"
elif [ "${raw}" -eq 0 ]; then
echo "${total_size}"
return
fi
total_size=$(awk 'BEGIN{printf "%.1f", '$raw' / '$num'}')
echo "${total_size} ${unit}"
}
#######################################
# description
# Arguments:
# None
# Returns:
# <unknown> ...
#######################################
get_host_arch_info() {
FunctionStart "开始获取系统架构信息!"
[ -f /etc/redhat-release ] && awk '{print $0}' /etc/redhat-release && return
[ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return
[ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
FunctionEnd
}
#######################################
# description
# Globals:
# freespace
# io1
# io2
# io3
# ioall
# ioavg
# ioraw1
# ioraw2
# ioraw3
# writemb
# Arguments:
# None
#######################################
start_io_test() {
FunctionStart "开始测试IO速度"
freespace=$(df -m . | awk 'NR==2 {print $4}')
if [ -z "${freespace}" ]; then
freespace=$(df -m . | awk 'NR==3 {print $3}')
fi
if [ ${freespace} -gt 1024 ]; then
writemb=2048
io1=$(go_iotest ${writemb})
log "I/O Speed(1st run) : $io1)"
io2=$(go_iotest ${writemb})
log "I/O Speed(2st run) : $io2)"
io3=$(go_iotest ${writemb})
log "I/O Speed(3st run) : $io3)"
ioraw1=$(echo $io1 | awk 'NR==1 {print $1}')
[ "$(echo $io1 | awk 'NR==1 {print $2}')" == "GB/s" ] && ioraw1=$(awk 'BEGIN{print '$ioraw1' * 1024}')
ioraw2=$(echo $io2 | awk 'NR==1 {print $1}')
[ "$(echo $io2 | awk 'NR==1 {print $2}')" == "GB/s" ] && ioraw2=$(awk 'BEGIN{print '$ioraw2' * 1024}')
ioraw3=$(echo $io3 | awk 'NR==1 {print $1}')
[ "$(echo $io3 | awk 'NR==1 {print $2}')" == "GB/s" ] && ioraw3=$(awk 'BEGIN{print '$ioraw3' * 1024}')
ioall=$(awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}')
io_speed=$(awk 'BEGIN{printf "%.1f", '$ioall' / 3}')
log "I/O Speed(average) : $io_speed MB/s)"
else
echo " $(_red "Not enough space for I/O Speed test!")"
fi
FunctionEnd
}
#######################################
# description
# Globals:
# cpu_name
# sys_manu
# sys_product
# sys_ver
# virt
# virtual_x
# Arguments:
# None
#######################################
check_virtualization() {
FunctionStart "开始收集服务器虚拟化信息!"
local virtual_x
if command_exists "dmesg"; then
virtual_x="$(dmesg 2>/dev/null)"
fi
local sys_manu
local sys_product
local sys_ver
if command_exists "dmidecode"; then
sys_manu="$(dmidecode -s system-manufacturer 2>/dev/null)"
sys_product="$(dmidecode -s system-product-name 2>/dev/null)"
sys_ver="$(dmidecode -s system-version 2>/dev/null)"
else
sys_manu=""
sys_product=""
sys_ver=""
fi
if grep -qa docker /proc/1/cgroup; then
virt="Docker"
elif grep -qa lxc /proc/1/cgroup; then
virt="LXC"
elif grep -qa container=lxc /proc/1/environ; then
virt="LXC"
elif [[ -f /proc/user_beancounters ]]; then
virt="OpenVZ"
elif [[ ${virtual_x} == *kvm-clock* ]]; then
virt="KVM"
elif [[ ${sys_product} == *KVM* ]]; then
virt="KVM"
elif [[ ${cpu_name} == *KVM* ]]; then
virt="KVM"
elif [[ ${cpu_name} == *QEMU* ]]; then
virt="KVM"
elif [[ ${virtual_x} == *"VMware Virtual Platform"* ]]; then
virt="VMware"
elif [[ ${sys_product} == *"VMware Virtual Platform"* ]]; then
virt="VMware"
elif [[ ${virtual_x} == *"Parallels Software International"* ]]; then
virt="Parallels"
elif [[ ${virtual_x} == *VirtualBox* ]]; then
virt="VirtualBox"
elif [[ -e /proc/xen ]]; then
if grep -q "control_d" "/proc/xen/capabilities" 2>/dev/null; then
virt="Xen-Dom0"
else
virt="Xen-DomU"
fi
elif [ -f "/sys/hypervisor/type" ] && grep -q "xen" "/sys/hypervisor/type"; then
virt="Xen"
elif [[ ${sys_manu} == *"Microsoft Corporation"* ]]; then
if [[ ${sys_product} == *"Virtual Machine"* ]]; then
if [[ ${sys_ver} == *"7.0"* || ${sys_ver} == *"Hyper-V" ]]; then
virt="Hyper-V"
else
virt="Microsoft Virtual Machine"
fi
fi
else
virt="Dedicated"
fi
FunctionEnd
}
#######################################
# description
# Globals:
# manage_port
# tmp_manage_ports
# Arguments:
# None
#######################################
get_manage_port() {
FunctionStart "开始收集服务器 管理端口 信息!"
local tmp_manage_ports
tmp_manage_ports=$(netstat -ntulp | grep sshd | grep -w tcp | grep -v "127.0.0.1" | awk '{print$4}' | cut -d":" -f2)
manage_port=$(echo "$tmp_manage_ports" | tr '\n' ' ')
log "manage Port is => $manage_port"
FunctionEnd
}
#######################################
# description
# Globals:
# city
# country
# net_provider
# public_ipv4
# region
# Arguments:
# None
#######################################
get_ipv4_info() {
FunctionStart "开始收集服务器IP信息"
# public ip info
net_provider="$(wget -q --timeout=2 -O- ipinfo.io/org)"
city="$(wget -q --timeout=2 -O- ipinfo.io/city)"
country="$(wget -q --timeout=2 -O- ipinfo.io/country)"
region="$(wget -q --timeout=2 -O- ipinfo.io/region)"
public_ipv4="$(wget -q --timeout=2 -O- ipinfo.io/ip)"
public_ipv6="$(curl -q --max-time 2 -6 https://ifconfig.co/ip)"
if [[ $city -eq "" ]]; then
city="Chengdu"
fi
if [[ $country -eq "" ]]; then
country="CN"
fi
if [[ $region -eq "" ]]; then
region="Shuangliu"
fi
if [ -z "$public_ipv4" ]; then
public_ipv4=" "
fi
if [ -z "$public_ipv6" ]; then
public_ipv6=" "
fi
# inner ipinfo
local interface_prefix=("eth[0-9]{1,2}" "ens[0-9]{1,3}" "eno[0-9]{1,3}" "enp[0-9]{1,2}" "enp[0-9]{1,2}s[0-9]{1,2}")
local real_interface="eth90"
local interface
if command_exists ifconfig; then
log "使用ifconfig检测内部IP地址信息"
for interface in "${interface_prefix[@]}"; do
if ifconfig | grep -oqE "${interface}:"; then
real_interface=$(ifconfig | grep -E "${interface}:" | cut -d ":" -f1)
break
fi
done
else
log "使用 ip link show检测内部IP地址信息"
for interface in "${interface_prefix[@]}"; do
if ip link show | grep -oqE "${interface}:"; then
real_interface=$(ip link show | grep -oE "${interface}:" | head -1 | cut -d" " -f2)
break
fi
done
fi
echo "当前主机的真实内网网卡为 => [$real_interface]"
# 提取IPv4地址CIDR格式
local ipv4_regex="inet[[:space:]](25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/[0-9]{1,2}"
# 提取IPv6地址CIDR格式
local ipv6_regex="inet6[[:space:]]([0-9a-fA-F]{0,4}(:[0-9a-fA-F]{0,4}){1,7})\/[0-9]{1,3}"
# 查找IPv4地址
inner_ipv4=$(ip addr show "$real_interface" | grep -oE "$ipv4_regex" | grep -v 127 | cut -d" " -f2)
echo "Interface: $real_interface, IPv4 Address: $inner_ipv4"
# 查找IPv6地址
inner_ipv6=$(ip addr show "$real_interface" | grep -oE "$ipv6_regex" | grep -v "::1" | cut -d" " -f2)
echo "Interface: $real_interface, IPv4 Address: $inner_ipv6"
FunctionEnd
}
#######################################
# description
# Globals:
# LANG
# arch
# c_cache
# cores
# cpu_aes
# cpu_name
# cpu_virt
# disk_total_size
# disk_used_size
# cpu_freq
# kernel_info
# lbit
# load
# os_info
# swap
# tcp_ctrl
# mem_total
# unused_ram
# unused_swap
# up
# Arguments:
# None
#######################################
collect_system_info() {
FunctionStart "开始收集系统信息!"
check_sys
cpu_name=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
cores=$(awk -F: '/processor/ {core++} END {print core}' /proc/cpuinfo)
cpu_freq=$(awk -F'[ :]' '/cpu MHz/ {print $4;exit}' /proc/cpuinfo)
local c_cache
local cpu_aes
local cpu_virt
c_cache=$(awk -F: '/cache size/ {cache=$2} END {print cache}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
cpu_aes=$(grep -i 'aes' /proc/cpuinfo)
cpu_virt=$(grep -Ei 'vmx|svm' /proc/cpuinfo)
mem_total=$(
LANG=C
free | awk '/Mem/ {print $2}'
)
mem_total=$(calc_size "$mem_total")
local unused_ram
unused_ram=$(
LANG=C
free | awk '/Mem/ {print $3}'
)
unused_ram=$(calc_size "$unused_ram")
local swap
swap=$(
LANG=C
free | awk '/Swap/ {print $2}'
)
swap=$(calc_size "$swap")
local unused_swap
unused_swap=$(
LANG=C
free | awk '/Swap/ {print $3}'
)
unused_swap=$(calc_size "$unused_swap")
local up
up=$(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d days, %d hour %d min\n",a,b,c)}' /proc/uptime)
local load
if command_exists "w"; then
load=$(
LANG=C
w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'
)
elif command_exists "uptime"; then
load=$(
LANG=C
uptime | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'
)
fi
os_info=$(get_host_arch_info | tr "\n" " ")
arch=$(uname -m)
local l_bit
if command_exists "getconf"; then
l_bit=$(getconf LONG_BIT)
else
echo "${arch}" | grep -q "64" && l_bit="64" || l_bit="32"
fi
kernel_info=$(uname -r)
disk_total_size=$(
LANG=C
df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total 2>/dev/null | grep total | awk '{ print $2 }'
)
disk_total_size=$(calc_size "$disk_total_size")
disk_used_size=$(
LANG=C
df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total 2>/dev/null | grep total | awk '{ print $3 }'
)
disk_used_size=$(calc_size "$disk_used_size")
tcp_ctrl=$(sysctl net.ipv4.tcp_congestion_control | awk -F ' ' '{print $3}')
if [[ $(cut -d"-" -f 3 </etc/hostname | grep -c '^[0-9][0-9]') -gt 0 ]]; then
machine_number=$(cut -d"-" -f 3 </etc/hostname)
else
machine_number=99
fi
FunctionEnd
}
#######################################
# description
# Arguments:
# None
#######################################
#######################################
# description
# Globals:
# agent_version
# octopus_agent_path
# Arguments:
# None
#######################################
get_agent_version() {
FunctionStart "获取Agent的版本信息"
local file
for file in "${octopus_agent_path}"/*; do
if [[ ! -d ${file} ]]; then
if echo "$file" | grep "octopus-agent_linux_amd64_"; then
agent_version=$(echo "${file}" | cut -d "_" -f4-)
break
fi
fi
done
if [[ $agent_version -eq "" ]]; then
agent_version=2011-11-11-11-11-11
fi
log "获取到的Agent版本信息为 => ${agent_version}"
FunctionEnd
}
#######################################
# description
# Globals:
# agent_server_info_file
# arch
# city
# cores
# country
# cpu_name
# disk_total_size
# disk_used_size
# cpu_freq
# cpu_arch
# inner_ipv4
# inner_ipv6
# io_speed
# kernel_info
# lbit
# machine_number
# manage_port
# os_info
# net_provider
# public_ipv4
# public_ipv6
# region
# tcp_ctrl
# mem_total
# virt
# Arguments:
# None
#######################################
main() {
# todo
# start_iotest
check_sys
get_manage_port
collect_system_info
get_ipv4_info
check_virtualization
get_agent_version
local agent_server_info_file="$octopus_agent_path/octopus-agent-back.conf"
touch "$agent_server_info_file"
cat >"$agent_server_info_file" <<EOF
serverName: "${city}-${cpu_arch}-${machine_number}"
serverIpPbV4: "$public_ipv4"
serverIpInV4: "$inner_ipv4"
serverIpPbV6: "$public_ipv6"
serverIpInV6: "$inner_ipv6"
location: "$city $region $country"
provider: "$net_provider"
managePort: "$manage_port"
cpuCore: "$cores @ $cpu_freq MHz"
cpuBrand: "$cpu_name"
memoryTotal: "$mem_total"
diskTotal: "$disk_total_size"
diskUsage: "$disk_used_size"
archInfo: "$arch ($os_bit Bit)"
osInfo: "$os_info"
osKernelInfo: "$kernel_info"
tcpControl: "$tcp_ctrl"
virtualization: "$virt"
ioSpeed: "$io_speed MB/s"
machineId: "$(cat /etc/machine-id)"
agentVersion: "${agent_version}"
EOF
log "agent server info has collect complete!"
log "file is => $agent_server_info_file"
echo ""
SplitGreen "查看Agent的环境信息"
cat - 1>&2 <<EOF
cat $agent_server_info_file
EOF
}
main

191
Public/lib/wdd-lib-file.sh Normal file
View File

@@ -0,0 +1,191 @@
#!/bin/bash
#
# Library for file system actions
# shellcheck disable=SC1091
# Load Generic Libraries
. /octopus-agent/shell/lib/wdd-lib-log.sh
# Functions
########################
# Ensure a file/directory is owned (user and group) but the given user
# Arguments:
# $1 - filepath
# $2 - owner
# Returns:
# None
#########################
owned_by() {
local path="${1:?path is missing}"
local owner="${2:?owner is missing}"
local group="${3:-}"
if [[ -n $group ]]; then
chown "$owner":"$group" "$path"
else
chown "$owner":"$owner" "$path"
fi
}
########################
# Ensure a directory exists and, optionally, is owned by the given user
# Arguments:
# $1 - directory
# $2 - owner
# Returns:
# None
#########################
ensure_dir_exists() {
local dir="${1:?directory is missing}"
local owner_user="${2:-}"
local owner_group="${3:-}"
mkdir -p "${dir}"
if [[ -n $owner_user ]]; then
owned_by "$dir" "$owner_user" "$owner_group"
fi
}
########################
# Checks whether a directory is empty or not
# arguments:
# $1 - directory
# returns:
# boolean
#########################
is_dir_empty() {
local -r path="${1:?missing directory}"
# Calculate real path in order to avoid issues with symlinks
local -r dir="$(realpath "$path")"
if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then
true
else
false
fi
}
########################
# Checks whether a mounted directory is empty or not
# arguments:
# $1 - directory
# returns:
# boolean
#########################
is_mounted_dir_empty() {
local dir="${1:?missing directory}"
if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then
true
else
false
fi
}
########################
# Checks whether a file can be written to or not
# arguments:
# $1 - file
# returns:
# boolean
#########################
is_file_writable() {
local file="${1:?missing file}"
local dir
dir="$(dirname "$file")"
if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then
true
else
false
fi
}
########################
# Relativize a path
# arguments:
# $1 - path
# $2 - base
# returns:
# None
#########################
relativize() {
local -r path="${1:?missing path}"
local -r base="${2:?missing base}"
pushd "$base" >/dev/null || exit
realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||'
popd >/dev/null || exit
}
########################
# Configure permisions and ownership recursively
# Globals:
# None
# Arguments:
# $1 - paths (as a string).
# Flags:
# -f|--file-mode - mode for directories.
# -d|--dir-mode - mode for files.
# -u|--user - user
# -g|--group - group
# Returns:
# None
#########################
configure_permissions_ownership() {
local -r paths="${1:?paths is missing}"
local dir_mode=""
local file_mode=""
local user=""
local group=""
# Validate arguments
shift 1
while [ "$#" -gt 0 ]; do
case "$1" in
-f | --file-mode)
shift
file_mode="${1:?missing mode for files}"
;;
-d | --dir-mode)
shift
dir_mode="${1:?missing mode for directories}"
;;
-u | --user)
shift
user="${1:?missing user}"
;;
-g | --group)
shift
group="${1:?missing group}"
;;
*)
echo "Invalid command line flag $1" >&2
return 1
;;
esac
shift
done
read -r -a filepaths <<<"$paths"
for p in "${filepaths[@]}"; do
if [[ -e "$p" ]]; then
find -L "$p" -printf ""
if [[ -n $dir_mode ]]; then
find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode"
fi
if [[ -n $file_mode ]]; then
find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode"
fi
if [[ -n $user ]] && [[ -n $group ]]; then
find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}"
elif [[ -n $user ]] && [[ -z $group ]]; then
find -L "$p" -print0 | xargs -r -0 chown "${user}"
elif [[ -z $user ]] && [[ -n $group ]]; then
find -L "$p" -print0 | xargs -r -0 chgrp "${group}"
fi
else
stderr_print "$p does not exist"
fi
done
}

191
Public/lib/wdd-lib-log.sh Normal file
View File

@@ -0,0 +1,191 @@
#!/bin/bash
#
# 日志模块
# Constants
RESET='\033[0m' ## 普通黑
RED='\033[38;5;1m' ## 姨妈红
GREEN='\033[38;5;2m' ## 水鸭青
YELLOW='\033[38;5;3m' ## 鸭屎黄
MAGENTA='\033[38;5;5m' ## 基佬紫
CYAN='\033[38;5;6m' ## 天依蓝
SplitLine="--------------------------------------------------------------------------------"
# Functions
########################
# Print to STDERR
# Arguments:
# Message to print
# Returns:
# None
#########################
stderr_print() {
# 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it
local bool="${BITNAMI_QUIET:-false}"
# comparison is performed without regard to the case of alphabetic characters
shopt -s nocasematch
if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then
printf "%b\\n" "${*}" >&2
fi
}
########################
# Log message
# Arguments:
# Message to log
# Returns:
# None
#########################
log() {
stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%Y-%m-%d %H:%M:%S.%2N ")${RESET}${*}"
}
########################
# Log an 'info' message
# Arguments:
# Message to log
# Returns:
# None
#########################
info() {
log "${GREEN}INFO ${RESET} ==> ${*}"
}
########################
# Log message
# Arguments:
# Message to log
# Returns:
# None
#########################
warn() {
log "${YELLOW}WARN ${RESET} ==> ${*}"
}
########################
# Log an 'error' message
# Arguments:
# Message to log
# Returns:
# None
#########################
error() {
log "${RED}ERROR${RESET} ==> ${*}"
}
########################
# Log a 'debug' message
# Globals:
# BITNAMI_DEBUG
# Arguments:
# None
# Returns:
# None
#########################
debug() {
# 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it
local bool="${BITNAMI_DEBUG:-true}"
# comparison is performed without regard to the case of alphabetic characters
shopt -s nocasematch
if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then
log "${MAGENTA}DEBUG${RESET} ==> ${*}"
fi
}
########################
# Indent a string
# Arguments:
# $1 - string
# $2 - number of indentation characters (default: 4)
# $3 - indentation character (default: " ")
# Returns:
# None
#########################
indent() {
local string="${1:-}"
local num="${2:?missing num}"
local char="${3:-" "}"
# Build the indentation unit string
local indent_unit=""
for ((i = 0; i < num; i++)); do
indent_unit="${indent_unit}${char}"
done
# shellcheck disable=SC2001
# Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions
echo "$string" | sed "s/^/${indent_unit}/"
}
RED_COLOR="31m" ## 姨妈红
GREEN_COLOR="32m" ## 水鸭青
YELLOW_COLOR="33m" ## 鸭屎黄
PURPLE_COLOR="35m" ## 基佬紫
BLUE_COLOR="36m" ## 天依蓝
BlinkGreen_COLOR="32;5m" ## 闪烁的水鸭青
BlinkRed_COLOR="31;5m" ## 闪烁的姨妈红
BlickPurple_COLOR="35;5m" ## 闪烁的基佬紫
BackRed_COLOR="41m" ## 背景红色
######## 颜色函数方法很精妙 ############
colorEcho() {
echo -e "\033[${1}${@:2}\033[0m" 1>&2
}
colorEchoGreen() {
echo -e "\033[32m${@:1}\033[0m" 1>&2
}
colorEchoBlue() {
echo -e "\033[36m${@:1}\033[0m" 1>&2
}
colorEchoYellow() {
echo -e "\033[33m${@:1}\033[0m" 1>&2
}
colorEchoRed() {
echo -e "\033[31m${@:1}\033[0m" 1>&2
}
colorEchoPurple() {
echo -e "\033[35m${@:1}\033[0m" 1>&2
}
SplitLine(){
echo ""
}
SplitBlue(){
colorEchoBlue ${SplitLine}
echo ""
}
SplitGreen(){
colorEchoGreen ${SplitLine}
echo ""
}
SplitRed(){
colorEchoRed ${SplitLine}
echo ""
}
SplitPurple(){
colorEchoPurple ${SplitLine}
echo ""
}
FunctionStart() {
colorEcho ${PURPLE_COLOR} ${SplitLine}
if [[ $# -gt 0 ]]
then
colorEchoBlue " $1 "
fi
echo ""
}
FunctionSuccess() {
colorEcho ${GREEN_COLOR} ${SplitLine}
echo ""
}
FunctionEnd() {
colorEcho ${BlinkGreen_COLOR} ${SplitLine}
echo ""
}

154
Public/lib/wdd-lib-sys.sh Normal file
View File

@@ -0,0 +1,154 @@
#!/bin/bash
echo ""
echo ""
lib_file_list=(wdd-lib-log.sh)
# shellcheck disable=SC2068
for lib_file in ${lib_file_list[@]}; do
# shellcheck disable=SC2154
wget "${oss_url_prefix}/${lib_file}" -qO "${octopus_agent_path}/lib/${lib_file}"
echo "加载库文件 < ${octopus_agent_path}/lib/${lib_file}"
# shellcheck disable=SC1090
. "${octopus_agent_path}/lib/${lib_file}"
done
# 系统相关
linux_release_version=""
linux_release=""
os_bit=""
cmd_install="apt-get -y -qq --allow-downgrades install"
cmd_update="apt-get -qq update"
cmd_remove="apt-get -y remove"
software_updated=0
# 判断命令是否存在
command_exists() {
command -v "$@" >/dev/null 2>&1
}
# 判定是否是root用户
check_root() {
FunctionStart "判定Root用户"
if [[ $EUID != 0 ]]; then
colorEchoRed "当前非root账号(或没有root权限)无法继续操作请更换root账号!"
colorEchoYellow "使用sudo -命令获取临时root权限执行后可能会提示输入root密码"
exit 1
else
log "当前为root账号 "
fi
FunctionEnd
}
####### 获取系统版本及64位或32位信息
check_sys() {
FunctionStart "获取系统参数"
# 获取当前终端的宽度,动态调整分割线的长度
# local shell_width=$(stty size | awk '{print $2}')
# SplitLine=$(yes "-" | sed "${shell_width}"'q' | tr -d '\n')
local sys_bit
sys_bit=$(uname -m)
case $sys_bit in
i[36]86)
os_bit="32"
linux_release="386"
;;
x86_64)
os_bit="64"
linux_release="amd64"
;;
*armv6*)
os_bit="arm"
linux_release="arm6"
;;
*armv7*)
os_bit="arm"
linux_release="arm7"
;;
*aarch64* | *armv8*)
os_bit="arm64"
linux_release="arm64"
;;
*)
error "
哈哈……这个 辣鸡脚本 不支持你的系统。 (-_-) \n
备注: 仅支持 Ubuntu 16+ / Debian 8+ / CentOS 7+ 系统
" && exit 1
;;
esac
log "获取的系统信息如下: OS_BIT => ${os_bit} LinuxRelease => $linux_release"
## 判定Linux的发行版本
if [ -f /etc/redhat-release ]; then
linux_release_version="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
linux_release_version="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
linux_release_version="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
linux_release_version="centos"
elif cat /proc/version | grep -Eqi "debian"; then
linux_release_version="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
linux_release_version="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
linux_release_version="centos"
else
linux_release_version=""
fi
log "系统参数信息如下: linux_release_version => $linux_release_version"
# 判断系统的包管理工具 apt, yum, or zypper
get_package_manage_tool() {
if [[ -n $(command -v apt-get) ]]; then
cmd_install="apt-get -y -qq install"
cmd_update="apt-get -qq update"
cmd_remove="apt-get -y remove"
elif [[ -n $(command -v yum) ]]; then
cmd_install="yum -y -q install"
cmd_update="yum -q makecache"
cmd_remove="yum -y remove"
elif [[ -n $(command -v zypper) ]]; then
cmd_install="zypper -y install"
cmd_update="zypper ref"
# shellcheck disable=SC2034
cmd_remove="zypper -y remove"
else
return 1
fi
}
# 检查系统包管理方式,更新包
get_package_manage_tool
if [[ $? -eq 1 ]]; then
error "系统的包管理不是 APT or YUM, 请手动安装所需要的软件."
return 1
fi
log "系统包管理工具为 => $cmd_install"
# shellcheck disable=SC2154
if [[ $is_offline == 1 ]]; then
FunctionEnd
return 0
fi
### 更新程序引索
if [[ $software_updated -eq 0 ]]; then
log "正在更新软件包管理...可能花费较长时间…………"
$cmd_update
software_updated=1
fi
FunctionEnd
}
# main
main() {
log "sys脚本被调用了"
}
main

475
Public/mid-script.sh Normal file
View File

@@ -0,0 +1,475 @@
#!/bin/bash
## 对外暴露的安装Redis的主函数
install_redis() {
FunctionStart
local redis_port="6379"
local redis_install_method="binary"
local redis_install_help="0"
while [[ $# -gt 0 ]]; do
case "$1" in
-p | --port)
redis_port="${2}"
shift # past argument
;;
-m | --method)
redis_install_method="${2}"
shift # past argument
;;
-h | --help)
redis_install_help="1"
;;
*)
echo "输入的内容有误,请检查!"
# unknown option
;;
esac
shift # past argument or value
done
if [ "${redis_install_help}" -eq "1" ]; then
cat - 1>&2 <<EOF
./install-release.sh [-h] [-p|--port 6379] [-m|--method binary|docker]
-h, --help 打印此安装帮助说明
-p, --port 安装Redis的端口如果不指定此参数则默为6379
-m, --method 安装Redis的方式binary == 源码编译安装docker == 使用docker安装不指定则使用binary
EOF
fi
# echo $redis_port
# echo $redis_install_method
if [[ ${redis_install_method} == "binary" ]]; then
install_redis_binary "${redis_port}"
else
install_redis_docker "${redis_port}"
fi
FunctionEnd
}
#######################################
# description
# Globals:
# redis_port
# Arguments:
# 1
# Returns:
# 3 ...
#######################################
install_redis_binary() {
redis_port=""
if [[ $1 -ne " " ]]; then
redis_port="$1"
echo "Redis Port = ${redis_port}"
fi
echo "InstallRedisBinary"
CMD_REMOVE gcc
installDemandSoftwares gcc wget
echo "开始下载 Redis 6.2.6 的二进制包!"
wget https://oss.107421.xyz/redis-6.2.6.tar.gz
if [ -e redis-6.2.6.tar.gz ]; then
echo "redis源码包下载完成"
echo ""
echo "开始解压缩redis的安装包"
tar -zvxf redis-6.2.6.tar.gz
cd redis-6.2.6
clear
echo ""
echo ""
echo "开始执行编译安装过程!!"
echo "开始执行编译安装过程!!"
echo "开始执行编译安装过程!!"
echo "取决于服务器的性能,可能花费较长的时间!!!"
sleep 3
echo ""
./configure
make && make install
cd redis-6.2.6
echo "Redis已经安装成功"
ehco "开始进行redis的配置修改"
wget https://oss.107421.xyz/redis-6.2.6.conf
wget https://oss.107421.xyz/redis-server-6.2.6.service
if [ -e redis-6.2.6.conf ] && [ -e redis-server-6.2.6.service ]; then
echo "redis配置文件下载成功开始进行修改"
echo ""
touch /var/log/redis_${redis_port}.log
mkdir -p /var/redis/${redis_port}
mkdir -p /etc/redis/
sed -i "s/RedisPort/${redis_port}/g" redis-6.2.6.conf
cp redis-6.2.6.conf /etc/redis/${redis_port}.conf
sed -i "s/RedisPort/${redis_port}/g" redis-server-6.2.6.service
cp redis-server-6.2.6.service /etc/init.d/redisd
cd /etc/init.d
chmod +x /etc/init.d/redisd
if command_exists chkconfig ; then
chkconfig redisd on
elif command_exists update-rc.d ; then
update-rc.d redisd defaults
else
echo "所需要的守护程序未安装,请手动设置!!"
fi
# 启动程序
echo ""
echo "开始启动redis-server服务……"
service redisd start
service redisd status
netstat -ntlp | grep redis
else
echo "redis配置文件下载失败请手动进行修改"
return 3
fi
else
echo "redis源码包下载失败"
return 3
fi
}
#######################################
# description
# Globals:
# RED
# redis_port
# Arguments:
# 1
# Returns:
# 3 ...
#######################################
install_redis_docker() {
redis_port=""
if [[ $1 -ne " " ]]; then
redis_port="$1"
echo "Redis Port = ${redis_port}"
fi
echo "InstallRedisDocker"
echo ""
if ! command_exists "docker info" ; then
colorEcho ${RED} "docker 未安装!! 无法使用docker的方式安装 redis"
return 3
fi
echo "## 为redis配置添加 " >>/etc/sysctl.conf
echo "vm.overcommit_memory = 1" >>/etc/sysctl.conf
sysctl -p /etc/sysctl.conf
echo "开始启动docker-redis !!"
# https://hub.docker.com/r/bitnami/redis#configuration
# 为redis设置密码 -e REDIS_PASSWORD=v2ryStr@ngPa.ss \
docker run -d \
-e ALLOW_EMPTY_PASSWORD=yes \
-e REDIS_AOF_ENABLED=no \
-e REDIS_PORT_NUMBER=${redis_port} \
--name redis-server \
--network host \
bitnami/redis:6.2.6
}
InstallMysql() {
FunctionStart
MysqlPort="3306"
MysqlInstallMethod="binary"
MysqlInstallHelp="0"
MysqlPersistData="/var/lib/docker/mysql-data"
colorEcho ${BLUE} "本脚本默认安装版本为 8.0.27 的MySQL "
colorEcho ${BLUE} "本脚本默认安装版本为 8.0.27 的MySQL "
colorEcho ${BLUE} "本脚本默认安装版本为 8.0.27 的MySQL "
while [[ $# -gt 0 ]]; do
case "$1" in
-p | --port)
MysqlPort="${2}"
shift # past argument
;;
-m | --method)
MysqlInstallMethod="${2}"
shift # past argument
;;
-d | --data)
MysqlPersistData="${2}"
shift # past argument
;;
-h | --help)
MysqlInstallHelp="1"
;;
*)
echo "输入的内容有误,请检查!"
# unknown option
;;
esac
shift # past argument or value
done
if [ "${MysqlInstallHelp}" -eq "1" ]; then
cat - 1>&2 <<EOF
./install-release.sh [-h] [-p|--port 3306] [-m|--method binary|docker]
-h, --help 打印此安装帮助说明
-p, --port 安装Mysql的端口如果不指定此参数则默为3306
-m, --method 安装Mysql的方式binary == 源码编译安装docker == 使用docker安装不指定则使用binary
EOF
return 0
fi
# echo $MysqlPort
# echo $MysqlInstallMethod
if [[ ${MysqlInstallMethod} == "binary" ]]; then
installMysqlBinary ${MysqlPort}
else
installMysqlDocker ${MysqlPort} ${MysqlPersistData}
fi
FunctionEnd
}
installMysqlBinary() {
MysqlPort=""
Latest_Mysql_Version=""
if [[ $1 -ne " " ]]; then
MysqlPort="$1"
echo "mysql Port = ${MysqlPort}"
fi
echo "InstallMysqlBinary"
if [[ ${LinuxReleaseVersion} == "centos" ]]; then
colorEcho ${BLUE} "当前系统发行版为 centos !"
colorEcho ${BLUE} "开始安装mysql官方的yum源"
echo ""
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
colorEcho ${BLUE} "可以安装的 mysql-server 版本为:"
yum list mysql-community-server | grep mysql-community-server
echo ""
Latest_Mysql_Version=$(yum list mysql-community-server | grep mysql-community-server | awk '{print $2}')
colorEcho ${BLUE} "开始安装最新版本:"
installDemandSoftwares mysql-community-server-${Latest_Mysql_Version} mysql-community-server-${Latest_Mysql_Version}
else
colorEcho ${BLUE} "当前系统发行版为 ubuntu/debain !"
colorEcho ${BLUE} "可以安装的 mysql-server 版本为:"
apt-cache madison mysql-server | awk '{print$3}'
echo ""
Latest_Mysql_Version=$(apt-cache madison mysql-server | head -n 1 | awk '{print$3}')
colorEcho ${BLUE} "开始安装最新版本:${Latest_Mysql_Version}"
installDemandSoftwares mysql-server=${Latest_Mysql_Version} mysql-client=${Latest_Mysql_Version}
fi
FunctionSuccess
colorEcho ${BLUE} "准备启动Mysql Server的服务 "
systemctl start mysqld
FunctionSuccess
colorEcho ${BLUE} "准备配置Mysql 服务的开机启动 "
systemctl enable mysqld
FunctionSuccess
}
installMysqlDocker() {
MysqlPort=""
MysqlPersistData=""
MysqlPort="$1"
echo "mysql Port = ${MysqlPort}"
MysqlPersistData="$2"
echo "mysql persist data path = ${MysqlPersistData}"
echo "InstallMysqlDocker"
echo ""
echo "开始启动docker-mysql !!"
# https://hub.docker.com/r/bitnami/mysql#configuration
# 需要准备一个目录方式 mysql.conf文件
# 目录权限需要处理
mkdir -p ${MysqlPersistData}
chown -R 1001:1001 ${MysqlPersistData}
docker run -d \
-e MYSQL_ROOT_USER=root \
-e MYSQL_ROOT_PASSWORD=v2ryStr@ngPa.ss \
-e MYSQL_CHARACTER_SET=utf8mb4 \
-e MYSQL_COLLATE=utf8mb4_bin \
-e MYSQL_DATABASE=demo \
-e MYSQL_USER=wdd \
-e MYSQL_PASSWORD=wdd14Fk@Clever \
-e MYSQL_PORT_NUMBER=${MysqlPort} \
-e MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password \
-v ${MysqlPersistData}:/bitnami/mysql/data \
--name mysql-server \
--network host \
bitnami/mysql:8.0.27-debian-10-r40
}
## 对外暴露的安装JDK的主函数
InstallJDK() {
FunctionStart
JDK_VERSION="11"
JDK_Install_Method="binary"
JDKInstallHelp="0"
while [[ $# -gt 0 ]]; do
case "$1" in
-v | --version)
JDK_VERSION="${2}"
shift # past argument
;;
-m | --method)
JDK_Install_Method="${2}"
shift # past argument
;;
-h | --help)
JDKInstallHelp="1"
;;
*)
echo "输入的内容有误,请检查!"
# unknown option
;;
esac
shift # past argument or value
done
if [ "${JDKInstallHelp}" -eq "1" ]; then
cat - 1>&2 <<EOF
./install-release.sh [-h] [-p|--Version 6379] [-m|--method binary|docker]
-h, --help 打印此安装帮助说明
-v, --version 安装JDK的版本如果不指定此参数则默为11
-m, --method 安装JDK的方式binary == 源码编译安装package == 使用源package安装不指定则使用binary
EOF
return 0
fi
# echo $JDKVersion
# echo $JDKInstallMethod
if [[ ${JDK_Install_Method} == "binary" ]]; then
installJDKBinary ${JDK_VERSION}
else
installJDKPackage ${JDK_VERSION}
fi
FunctionEnd
}
installJDKBinary() {
JDK_VERSION=""
JDK_FILENAME=""
if [[ $1 -ne " " ]]; then
JDK_VERSION="$1"
echo "JDK Version = ${JDK_VERSION}"
fi
echo "InstallJDKBinary"
echo ""
echo "开始下载 JDK 的源码包!!"
mkdir -p /usr/local/java/
if [ "${JDK_VERSION}" -eq "11" ]; then
JDK_FILENAME="jdk-11.0.9"
wget https://oss-s1.107421.xyz/jdk-11.0.9_linux-x64_bin.tar.gz
echo "JDK 二进制文件下载成功,开始解压缩!!"
tar -zxvf jdk-11.0.9_linux-x64_bin.tar.gz -C /usr/local/java/
else
JDK_FILENAME="jdk1.8.0_271"
wget https://oss.107421.xyz/jdk-8u271-linux-x64.tar.gz
echo "JDK 二进制文件下载成功,开始解压缩!!"
tar -zxvf jdk-8u271-linux-x64.tar.gz -C /usr/local/java/
fi
echo ""
echo "开始配置JDK的环境变量"
if [ -e /etc/profile.d/jdk-env.sh ]; then
echo "jdk的配置文件已经存在将会进行覆盖操作"
cp /etc/profile.d/jdk-env.sh .jdk-env-backup.sh
rm /usr/bin/java
fi
cat >/etc/profile.d/jdk-env.sh <<EOF
export JAVA_HOME=/usr/local/java/${JDK_FILENAME}
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib:${CLASSPATH}
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${PATH}
EOF
source /etc/profile
ln -s /usr/local/java/${JDK_FILENAME}/bin/java /usr/bin/java
echo ""
echo ""
echo ""
echo "请检查JDK的安装情况======================================"
java -version
}
installJDKPackage() {
JDK_VERSION=""
if [[ $1 -ne " " ]]; then
JDK_VERSION="$1"
echo "JDK Version = ${JDK_VERSION}"
fi
echo "InstallJDKDocker"
echo ""
if [[ ${LinuxReleaseVersion} == "centos" ]]; then
colorEcho ${BLUE} "当前系统发行版为 centos !"
colorEcho ${BLUE} "可以安装的 openjdk 版本为:"
yum list java-${JDK_VERSION}-openjdk | grep ${JDK_VERSION}
echo ""
colorEcho ${BLUE} "开始安装最新版本:$(yum list java-${JDK_VERSION}-openjdk | grep ${JDK_VERSION} | awk '{print $2}' | cut -d':' -f2 | head -n 1)"
installDemandSoftwares java-${JDK_VERSION}-openjdk-$(yum list java-${JDK_VERSION}-openjdk | grep ${JDK_VERSION} | awk '{print $2}' | cut -d':' -f2 | head -n 1)
else
colorEcho ${BLUE} "当前系统发行版为 ubuntu/debain !"
colorEcho ${BLUE} "可以安装的 openjdk 版本为:"
apt-cache madison openjdk-${JDK_VERSION}-jdk | awk '{print$3}'
echo ""
colorEcho ${BLUE} "开始安装最新版本:$(apt-cache madison openjdk-${JDK_VERSION}-jdk | head -n 1 | awk '{print$3}')"
installDemandSoftwares openjdk-${JDK_VERSION}-jdk=$(apt-cache madison openjdk-${JDK_VERSION}-jdk | head -n 1 | awk '{print$3}')
fi
colorEcho ${BLUE} "请检查下面的内容输出!!!"
java -version
}
install_golang_1.21.3(){
FunctionStart "开始安装Golang运行环境"
wget --timeout=10 -q https://go.dev/dl/go1.21.3.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
log "开始配置环境变量!"
sed -i "$ a export GOPATH=/usr/local/go" /etc/profile
sed -i "$ a PATH=$PATH:/usr/local/go/bin" /etc/profile
source /etc/profile
log "查看golang的版本"
go version
}

View File

@@ -0,0 +1,42 @@
function SayHello
{
param (
[string]$Name
)
Write-Host "Hello, $Name!"
}
# 调用函数
SayHello -Name "Test PowerShell"
function SetMinioAlias
{
# mc.exe alias set local http://10.250.0.100:9000 cmii B#923fC7mk
mc.exe alias set tc-sh http://42.192.52.227:9000 cmii B#923fC7mk
mc.exe alias set seoul-1 https://cnk8d6fazu16.compat.objectstorage.ap-seoul-1.oraclecloud.com aed62d24d85e2da809ce02bf272420ba4ed74820 rQdEcn69K049+JkA1IGoQmC1k8zma8zfWvZvVS0h144=
}
SetMinioAlias
# 获取当前工作目录
$currentDirectory = Get-Location
# 打印当前工作目录
Write-Host "Current directory: $currentDirectory"
Write-Host ""
# 获取当前目录的所有文件名
$files = Get-ChildItem -Path $currentDirectory -Recurse -File -Name
# 遍历并打印文件名
foreach ($file in $files)
{
Write-Output $currentDirectory\$file
Write-Host ""
# mc.exe cp $currentDirectory\$file local/octopus/
mc.exe cp $currentDirectory\$file tc-sh/octopus/
mc.exe cp $currentDirectory\$file seoul-1/seoul/
Write-Host ""
}
Write-Host ""
Write-Host "Octopus Agent all dependency file has been synchronized!"

View File

@@ -0,0 +1,96 @@
show DATABASES;
drop database nengdie;
create database nengdie;
show CREATE DATABASE nengdie;
use nengdie;
# can not rename database
# alter nengdie rename nengdie woshinibaba;
# delete a table
drop table user_info;
# create a table
create table user_info (
user_id TINYINT(3) PRIMARY KEY,
user_name VARCHAR(30) not null,
email_address VARCHAR(50),
age SMALLINT(4) not null,
gender VARCHAR(5) DEFAULT 'male'
);
# read all tables
show tables;
# read a table
describe user_info;
show create table user_info;
# modify a table
## change table name
alter table user_info rename user_information;
show tables;
alter table nengdie.user_information rename user_info;
show tables;
## add a column
alter table user_info add column favoriteID tinyint after age;
describe user_info;
## change column position
alter table user_info modify favoriteID smallint after gender;
## change column name
alter table user_info change favoriteID fav_id tinyint;
## modify column data format
alter table user_info modify gender varchar(10);
## delete a column
alter table user_info drop fav_id;
alter table user_info add fav_id tinyint after age;
## modify column CONSTRAINTS
alter table user_info modify user_id tinyint auto_increment;
# DML insert records into a table user_info
insert into user_info( nengdie.user_info.user_name, nengdie.user_info.email, nengdie.user_info.age, nengdie.user_info.gender)
values
('wangdada','zeaslity@qq.com',15,'male'),
('cxc','cxc@163.com',12,'male'),
('nengdie','nengdie@qq.com',30,'male'),
('hong','hong@qq.com',25,'female'),
('zeaslity','zeaslity@qq.com',18,'male'),
('zey','zety@qq.com',18,'male'),
('die','die@qq.com',15,'male');
SELECT * FROM user_info;
describe user_info;
describe fav_thing;
## 内连接,只输出符合限定条件的内容
select user_name,age,gender from user_info
inner join
fav_thing as t on user_id = t.fav_user_id
order by age;
## left outer join 左外连接 讲用户的喜好表 fav_thing与user表连接查看用户对应喜好的事情
select * from user_info
left join
fav_thing as t on user_id =t.fav_user_id
order by age;
## 全外连接
select *
from user_info
full join fav_thing;
# 交叉连接
select * from user_info
cross join fav_thing;

53
Untitled-1.sh Normal file
View File

@@ -0,0 +1,53 @@
#! /bin/bash
systemctl stop netclient
systemctl disable netclient
rm -rf /etc/systemd/system/netclient.service
rm -rf /etc/netclient/config
/usr/local/bin/k3s-uninstall.sh
/usr/local/bin/k3s-agent-uninstall.sh
apt remove -y wireguard wireguard-tools
rm -rf /root/k3s-install/
ifconfig wg0-oracle down
apt autoremove -y
ifconfig
systemctl stop systemd-resolved.service && systemctl disable systemd-resolved.service
systemctl stop netfilter-persistent.service && systemctl disable netfilter-persistent.service
rm /etc/resolv.conf
cat > /etc/resolv.conf<<EOF
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 223.5.5.5
nameserver 114.114.114.114
EOF
ping google.com
## Ubuntu 18.04
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/bionic.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/bionic.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update
sudo apt-get install tailscale
systemctl enable --now tailscaled
tailscale up --login-server=http://tailscale.107421.xyz --accept-routes=false --accept-dns=false
headscale -n wdd-net nodes register --key
systemctl status tailscaled

View File

@@ -0,0 +1,23 @@
#!/bin/bash
install_pre_binary(){
apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.24/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.24/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
}
boot_up_cluster(){
kubeadm init --apiserver-advertise-address=10.250.0.183 --kubernetes-version v1.24.8 --image-repository=registry.aliyuncs.com/google_containers --service-cidr=10.96.0.0/16 --control-plane-endpoint=master-node --upload-certs --v=6
}
kubeadm init --kubernetes-version v1.24.8 --image-repository=registry.aliyuncs.com/google_containers

165
nginx/addNginxProxy copy.sh Normal file
View File

@@ -0,0 +1,165 @@
#!/bin/bash
# 添加了端口占用的检测
# todo
# 对某一代理内容的删除
# 当运行时, 可以传入额外的参数
## ./runParams.sh [-h] [-c] [--remove] [-p proxy] [-f] [--version vx.y.z] [-l file]
#########color code#############
RED="31m" # Error message
GREEN="32m" # Success message
YELLOW="33m" # Warning message
BLUE="36m" # Info message
###############color echo func#################
colorEcho() {
echo -e "\033[${1}${@:2}\033[0m" 1>&2
}
Help() {
cat - 1>&2 <<EOF
本脚本的用法如下:
[-tcp t] <代理端口> <需要转发的IP> <需要转发的端口>
[-http] <反向代理域名> <代理端口> <反代的IP> <反代的端口>
[-h -help]
-tcp/t <代理端口>代表本机的端口 <需要转发的IP>代表反向代理的ip地址
<需要转发的端口>代表反向代理的端口
-http <反向代理域名>代表转发的url <代理端口>代表本机的端口
<反代的IP>代表反向代理的ip地址 <反代的端口>代表反向代理的端口
-h/help 打印本说明文档
例子:./addNginxProxy.sh -tcp 9500 192.168.1.248 80
即为将本地9500端口 转发至 192.168.1.248的80端口
EOF
}
checkPortInUse(){
# 如果端口被占用则返回错误
# 如果端口未占用则返回0
netstat -ntlp | awk '{print $4}' | cut -d ":" -f 2 | sed -n "3,+99999p"
if [[ `netstat -ntlp | awk '{print $4}' | cut -d ":" -f 2 | sed -n "3,+99999p" | grep -w ${FRONT_PROXY_PORT} &>/dev/null` -eq 0 ]]
then
colorEcho ${RED} "你想要使用的代理端口 ${FRONT_PROXY_PORT} 已被占用,请重新选用端口!!"
return 23
else
return 0
fi
}
addPortForward() {
#判断REVERSE_PROXY_IP是否符合IP的规格
#判断REVERSE_PROXY_PORT是否被占用
## 端口转发模板文件简单,直接写入此处!!
cat > /etc/nginx/conf.d/stream/${FRONT_PROXY_PORT}_${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf <<EOF
server {
listen ${FRONT_PROXY_PORT};
proxy_pass ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT};
}
EOF
if [[ -a /etc/nginx/conf.d/stream/${FRONT_PROXY_PORT}_${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf ]]; then
colorEcho ${GREEN} "端口转发配置成功!!"
nginx -t && nginx -s reload
if [[ $? -eq 0 ]];then
LOCAL_INTERNAL_IP=$(ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/')
colorEcho ${GREEN} "nignx已成功重启"
colorEcho ${BLUE} "端口转发为: ${LOCAL_INTERNAL_IP}:${FRONT_PROXY_PORT} >>>> ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT}"
else
colorEcho ${RED} "nginx重启失败请检查是否端口已被使用"
fi
else
colorEcho ${RED} "端口转发文件添加失败,请手动添加!!"
return 34
fi
return 0
}
addReverProxy() {
#判断REVERSE_PROXY_IP是否符合IP的规格
#判断REVERSE_PROXY_PORT是否被占用
# 读取反向代理的模板然后写入相应的特定反向代理文件
if [[ -a /etc/nginx/conf.d/reverse_proxy_demo ]]
then
cat > /etc/nginx/conf.d/${REVERSE_PROXY_SERVER_NAME}_${FRONT_PROXY_PORT}-${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf < /etc/nginx/conf.d/reverse_proxy_demo
else
colorEcho ${RED} "反向代理的模板文件丢失!!! 无法添加反向代理!"
return 45
fi
if [[ -a /etc/nginx/conf.d/${REVERSE_PROXY_SERVER_NAME}_${FRONT_PROXY_PORT}-${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf ]]; then
sed -i -e "s/\${REVERSE_PROXY_SERVER_NAME}/${REVERSE_PROXY_SERVER_NAME}/g" \
-e "s/\${FRONT_PROXY_PORT}/${FRONT_PROXY_PORT}/g" \
-e "s/\${REVERSE_PROXY_IP}/${REVERSE_PROXY_IP}/g" \
-e "s/\${REVERSE_PROXY_PORT}/${REVERSE_PROXY_PORT}/g" \
/etc/nginx/conf.d/${REVERSE_PROXY_SERVER_NAME}_${FRONT_PROXY_PORT}-${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf
colorEcho ${GREEN} "反向代理文件添加成功!!"
nginx -t && nginx -s reload
if [[ $? -eq 0 ]];then
colorEcho ${GREEN} "nignx已成功重启"
colorEcho ${BLUE} "反向代理为: ${REVERSE_PROXY_SERVER_NAME}:${FRONT_PROXY_PORT} >>>> ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT}"
else
colorEcho ${RED} "nginx重启失败请检查是否端口已被使用"
fi
else
colorEcho ${RED} "反向代理配置文件添加失败,请手动添加!!"
return 34
fi
return 0
}
#########################
if [[ $# > 0 ]]
then
case "$1" in
-tcp | -t)
if [[ $# == 4 ]]; then
FRONT_PROXY_PORT="${2}"
REVERSE_PROXY_IP="${3}"
REVERSE_PROXY_PORT="${4}"
if [[ `checkPortInUse` -eq 0 ]]
then
addPortForward
else
return 23
fi
else
colorEcho ${RED} "输入的参数有误,请重新输入!"
return 123
fi
;;
-h | --help)
Help
;;
-http)
if [[ $# == 5 ]]; then
REVERSE_PROXY_SERVER_NAME="${2}"
FRONT_PROXY_PORT="${3}"
REVERSE_PROXY_IP="${4}"
REVERSE_PROXY_PORT="${5}"
if [[ `checkPortInUse -ne 0` ]]
then
addReverProxy
fi
else
colorEcho ${RED} "输入的参数有误,请重新输入!"
return 123
fi
;;
*)
# unknown option
colorEcho ${RED} "输入的参数不正确!"
Help
return 1
;;
esac
else
colorEcho ${BLUE} "请输入参数!!本脚本的用法如下!!"
Help
fi

128
nginx/addNginxProxy.sh Normal file
View File

@@ -0,0 +1,128 @@
#!/bin/bash
# 当运行时, 可以传入额外的参数
## ./runParams.sh [-h] [-c] [--remove] [-p proxy] [-f] [--version vx.y.z] [-l file]
#########color code#############
RED="31m" # Error message
GREEN="32m" # Success message
YELLOW="33m" # Warning message
BLUE="36m" # Info message
###############color echo func#################
colorEcho() {
echo -e "\033[${1}${@:2}\033[0m" 1>&2
}
Help() {
cat - 1>&2 <<EOF
./addNginxProxy.sh [-tcp t] <FRONT_PROXY_PORT> <REVERSE_PROXY_IP> <REVERSE_PROXY_PORT>
./addNginxProxy.sh [-http] <REVERSE_PROXY_SERVER_NAME> <FRONT_PROXY_PORT> <REVERSE_PROXY_IP> <REVERSE_PROXY_PORT>
./addNginxProxy.sh [-h -help]
-tcp/t <FRONT_PROXY_PORT>代表本机的端口 <REVERSE_PROXY_IP>代表反向代理的ip地址 <REVERSE_PROXY_PORT>代表反向代理的端口
-http <REVERSE_PROXY_SERVER_NAME>代表转发的url <REVERSE_PROXY_IP>代表反向代理的ip地址 <REVERSE_PROXY_PORT>代表反向代理的端口
-h/help 显示本说明
EOF
}
addPortForward() {
#判断FRONT_PROXY_PORT是否被占用
#判断REVERSE_PROXY_IP是否符合IP的规格
#判断REVERSE_PROXY_PORT是否被占用
## 端口转发模板文件简单,直接写入此处!!
cat > /etc/nginx/conf.d/stream/${FRONT_PROXY_PORT}_${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf <<EOF
server {
listen ${FRONT_PROXY_PORT};
proxy_pass ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT};
}
EOF
if [[ -a /etc/nginx/conf.d/stream/${FRONT_PROXY_PORT}_${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf ]]; then
colorEcho ${GREEN} "端口转发配置成功!!"
nginx -t && nginx -s reload
if [[ $? -eq 0 ]];then
LOCAL_INTERNAL_IP=$(ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/')
colorEcho ${GREEN} "nignx已成功重启"
colorEcho ${BLUE} "端口转发为: ${LOCAL_INTERNAL_IP}:${FRONT_PROXY_PORT} >>>> ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT}"
else
colorEcho ${RED} "nginx重启失败请检查是否端口已被使用"
fi
else
colorEcho ${RED} "端口转发文件添加失败,请手动添加!!"
return 34
fi
return 0
}
addReverProxy() {
#判断FRONT_PROXY_PORT是否被占用
#判断REVERSE_PROXY_IP是否符合IP的规格
#判断REVERSE_PROXY_PORT是否被占用
# 读取反向代理的模板然后写入相应的特定反向代理文件
if [[ -a /etc/nginx/conf.d/reverse_proxy_demo ]]
then
cat > /etc/nginx/conf.d/${REVERSE_PROXY_SERVER_NAME}_${FRONT_PROXY_PORT}-${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf < /etc/nginx/conf.d/reverse_proxy_demo
else
colorEcho ${RED} "反向代理的模板文件丢失!!! 无法添加反向代理!"
return 45
fi
if [[ -a /etc/nginx/conf.d/${REVERSE_PROXY_SERVER_NAME}_${FRONT_PROXY_PORT}-${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf ]]; then
sed -i -e "s/\${REVERSE_PROXY_SERVER_NAME}/${REVERSE_PROXY_SERVER_NAME}/g" \
-e "s/\${FRONT_PROXY_PORT}/${FRONT_PROXY_PORT}/g" \
-e "s/\${REVERSE_PROXY_IP}/${REVERSE_PROXY_IP}/g" \
-e "s/\${REVERSE_PROXY_PORT}/${REVERSE_PROXY_PORT}/g" \
/etc/nginx/conf.d/${REVERSE_PROXY_SERVER_NAME}_${FRONT_PROXY_PORT}-${REVERSE_PROXY_IP}::${REVERSE_PROXY_PORT}.conf
colorEcho ${GREEN} "反向代理文件添加成功!!"
nginx -t && nginx -s reload
if [[ $? -eq 0 ]];then
colorEcho ${GREEN} "nignx已成功重启"
colorEcho ${BLUE} "反向代理为: ${REVERSE_PROXY_SERVER_NAME}:${FRONT_PROXY_PORT} >>>> ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT}"
else
colorEcho ${RED} "nginx重启失败请检查是否端口已被使用"
fi
else
colorEcho ${RED} "反向代理配置文件添加失败,请手动添加!!"
return 34
fi
return 0
}
#########################
if [[ $# > 0 ]]
then
case "$1" in
-tcp | -t)
if [[ $# == 4 ]]; then
FRONT_PROXY_PORT="${2}"
REVERSE_PROXY_IP="${3}"
REVERSE_PROXY_PORT="${4}"
addPortForward
else
colorEcho ${RED} "输入的参数有误,请重新输入!"
return 123
fi
;;
-h | --help)
Help
;;
-http)
if [[ $# == 5 ]]; then
REVERSE_PROXY_SERVER_NAME="${2}"
FRONT_PROXY_PORT="${3}"
REVERSE_PROXY_IP="${4}"
REVERSE_PROXY_PORT="${5}"
addReverProxy
else
colorEcho ${RED} "输入的参数有误,请重新输入!"
return 123
fi
;;
*)
# unknown option
colorEcho ${RED} "输入的参数不正确!"
Help
return 1
;;
esac
fi

View File

@@ -0,0 +1,94 @@
ADD file:46ad43b4984bcf49c5a888ff3628f23161f55cd1fb062f469e707100c97fa254 in /
CMD ["/bin/sh"]
LABEL maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>
ENV NGINX_VERSION=1.19.4
ENV NJS_VERSION=0.4.4
ENV PKG_RELEASE=1
RUN /bin/sh -c set -x \
&& addgroup -g 101 -S nginx \
&& adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
&& apkArch="$(cat /etc/apk/arch)" \
&& nginxPackages=" \
nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} " \
&& case "$apkArch" in x86_64) set -x \
&& KEY_SHA512="e7fa8303923d9b95db37a77ad46c68fd4755ff935d0a534d26eba83de193c76166c68bfe7f65471bf8881004ef4aa6df3e34689c305662750c0172fca5d8552a *stdin" \
&& apk add --no-cache --virtual .cert-deps openssl \
&& wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \
&& if [ "$(openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout | openssl sha512 -r)" = "$KEY_SHA512" ]; then\
echo "key verification succeeded!"; \
mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \
else \
echo "key verification failed!"; \
exit 1; \
fi \
&& apk del .cert-deps \
&& apk add -X "https://nginx.org/packages/mainline/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages ;; *) set -x \
&& tempDir="$(mktemp -d)" \
&& chown nobody:nobody $tempDir \
&& apk add --no-cache --virtual .build-deps\
gcc \
libc-dev \
make \
openssl-dev \
pcre-dev \
zlib-dev \
linux-headers \
libxslt-dev \
gd-dev \
geoip-dev \
perl-dev \
libedit-dev \
mercurial \
bash \
alpine-sdk \
findutils \
&& su nobody -s /bin/sh -c "\
export HOME=${tempDir}\
&& cd ${tempDir}\
&& hg clone https://hg.nginx.org/pkg-oss\
&& cd pkg-oss\
&& hg up ${NGINX_VERSION}-${PKG_RELEASE}\
&& cd alpine\
&& make all\
&& apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk\
&& abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz\
"\
&& cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \
&& apk del .build-deps \
&& apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \
;; \
esac \
&& if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \
&& if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then \
rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
&& if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; \
then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
&& apk add --no-cache --virtual .gettext gettext \
&& mv /usr/bin/envsubst /tmp/ \
&& runDeps="$( scanelf --needed --nobanner /tmp/envsubst | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' | sort -u | xargs -r apk info --installed | sort -u )" \
&& apk add --no-cache $runDeps && apk del .gettext \
&& mv /tmp/envsubst /usr/local/bin/ \
&& apk add --no-cache tzdata \
&& apk add --no-cache curl ca-certificates \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& mkdir /docker-entrypoint.d
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
COPY file:13577a83b18ff90a0f97a15cd6380790a5f5288c651fa08708ff64d3f1595861 in /docker-entrypoint.d
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
STOPSIGNAL SIGTERM
CMD ["nginx" "-g" "daemon off;"]

View File

@@ -0,0 +1,49 @@
user nginx;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;
events {
multi_accept on;
worker_connections 65535;
}
http {
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
log_not_found off;
types_hash_max_size 2048;
client_max_body_size 16M;
# MIME
include mime.types;
default_type application/octet-stream;
# Logging
log_format log_json '{'
'"remote_addr": "$remote_addr", '
'"ident": "-", '
'"user": "$remote_user", '
'"timestamp": "$time_local", '
'"request": "$request", '
'"status": $status, '
'"bytes": $body_bytes_sent, '
'"referer": "$http_referer", '
'"agent": "$http_user_agent", '
'"x_forwarded": "$http_x_forwarded_for"'
' }';
access_log /var/log/nginx/access.log log_json;
error_log /var/log/nginx/error.log warn;
# reverse proxy/server configs
include /etc/nginx/conf.d/*.conf;
}
# port forward configs
stream{
include /etc/nginx/conf.d/stream/*.conf;
}

View File

@@ -0,0 +1,37 @@
server {
# ${REVERSE_PROXY_SERVER_NAME}
listen ${FRONT_PROXY_PORT};
server_name ${REVERSE_PROXY_SERVER_NAME};
# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
# logging
access_log /var/log/nginx/${REVERSE_PROXY_SERVER_NAME}.access.log;
error_log /var/log/nginx/${REVERSE_PROXY_SERVER_NAME}.error.log warn;
# reverse proxy
location / {
proxy_pass http://${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT};
proxy_cache_bypass $http_upgrade;
# Proxy headers
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# Proxy timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
}

View File

@@ -0,0 +1,4 @@
server {
listen ${FRONT_PROXY_PORT};
proxy_pass ${REVERSE_PROXY_IP}:${REVERSE_PROXY_PORT};
}

141
nginx/编译安装nginx.sh Normal file
View File

@@ -0,0 +1,141 @@
#!/bin/bash
nginx_version="nginx-1.19.4"
openssl_version="openssl-openssl-3.0.0-alpha8"
nginx_prefix="/etc/nginx"
nginx_config="${nginx_prefix}/conf.d/"
nginx_is_installed=""
#判断是否已经安装
check_is_installed(){
if [ -d $nginx_config ]; then
nginx_is_installed=1
else
nginx_is_installed=0
fi
}
remove_nginx(){
systemctl stop nginx
${nginx_prefix}/sbin/nginx -s stop
pkill -9 nginx
systemctl disable nginx
rm -rf /etc/systemd/system/nginx.service
systemctl daemon-reload
rm -rf ${nginx_prefix}
}
#安装nignx
install_nginx()
{
green "正在编译和安装nginx。。。。"
if ! wget -O ${nginx_version}.tar.gz https://nginx.org/download/${nginx_version}.tar.gz; then
red "获取nginx失败"
yellow "按回车键继续或者按ctrl+c终止"
read -s
fi
tar -zxf ${nginx_version}.tar.gz
if ! wget -O ${openssl_version}.tar.gz https://github.com/openssl/openssl/archive/${openssl_version#*-}.tar.gz; then
red "获取openssl失败"
yellow "按回车键继续或者按ctrl+c终止"
read -s
fi
tar -zxf ${openssl_version}.tar.gz
cd ${nginx_version}
sed -i "s/OPTIMIZE[ \t]*=>[ \t]*'-O'/OPTIMIZE => '-O3'/g" src/http/modules/perl/Makefile.PL
./configure \
--prefix=${nginx_prefix} \
--with-openssl=../$openssl_version \
--with-openssl-opt="enable-ec_nistp_64_gcc_128 shared threads zlib-dynamic sctp" \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_geoip_module=dynamic \
--with-stream_ssl_preread_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_perl_module=dynamic \
--with-pcre \
--with-libatomic \
--with-compat \
--with-cpp_test_module \
--with-google_perftools_module \
--with-file-aio \
--with-threads \
--with-poll_module \
--with-select_module \
--with-cc-opt="-Wno-error -g0 -O3"
# 详细的 nginx-module说明https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#dependencies
if ! make; then
red "nginx编译失败"
yellow "请尝试更换系统建议使用Ubuntu最新版系统"
exit 1
fi
remove_nginx
make install
cd ..
}
config_service_nginx(){
systemctl disable nginx
rm -rf /etc/systemd/system/nginx.service
cat > /etc/systemd/system/nginx.service << EOF
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
User=root
ExecStartPre=/bin/rm -rf /dev/shm/nginx_unixsocket
ExecStartPre=/bin/mkdir /dev/shm/nginx_unixsocket
ExecStartPre=/bin/chmod 711 /dev/shm/nginx_unixsocket
ExecStartPre=/bin/rm -rf /dev/shm/nginx_tcmalloc
ExecStartPre=/bin/mkdir /dev/shm/nginx_tcmalloc
ExecStartPre=/bin/chmod 0777 /dev/shm/nginx_tcmalloc
ExecStart=${nginx_prefix}/sbin/nginx
ExecStop=${nginx_prefix}/sbin/nginx -s stop
ExecStopPost=/bin/rm -rf /dev/shm/nginx_tcmalloc
ExecStopPost=/bin/rm -rf /dev/shm/nginx_unixsocket
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
chmod 0644 /etc/systemd/system/nginx.service
systemctl daemon-reload
systemctl enable nginx
}
main(){
## 检查nginx是否已经安装
}
main

10
removeSeafile.sh Normal file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
rm -rf /root/.my.conf
rm -rf /opt/seafile.my.cnf
rm -rf /opt/seafile/*
pkill -9 -u seafile
userdel seafile

8
shell-scripts.iml Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="GENERAL_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

174
temp.sh Normal file
View File

@@ -0,0 +1,174 @@
#!/bin/bash
ip_list=($(cat ip.txt))
single_ip=()
for ip in ${ip_list[@]}
do
Rrst=$(echo ${single_ip[@]} | grep -q $ip)
if [[ $Rrst -ne 0 ]]
then
single_ip+=($ip)
fi
done
for ip in ${single_ip[@]}
do
timss=$(cat ip.txt | grep -l $ip)
echo "$ip 访问的次数为 $timss"
done
if [[ ${linuxRelease} = "ubuntu" ]] ;then echo yes;else echo no;fi
mv /etc/yum.repos.d/bak/* /etc/yum.repos.d/
rm -rf /etc/yum.repos.d/bak /etc/yum.repos.d/elrepo.repo
yum clean call
yum makecache
cd /root/linux-init
./custom-init.sh
OLD_MYSQL=(mysql MySQL mariadb)
for item in ${OLD_MYSQL[@]}
do
rpm -qa | grep ${item}
done
mysql
root@localhost
v2ryStr@ngPa.ss
sed -i "/skip-grant-tables/ d" /etc/my.cnf
docker run \
-u root \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v /root/jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
gitee all_access_token
47c3f65b7d7539a90f016362a9082ff9
if [[ ${LinuxReleaseVersion} == "centos" ]];then echo "yes";else echo "no";fi
kk logs -n kube-ops ${$(kk -n kube-ops get pods | grep jenkins-work-slave| awk '{print$1}')[@]}
hostnamectl set-hostname tourism-worker-node-1
echo "192.168.12.53 aiboxhb.cdcyy.cn" >>/etc/hosts
heketi-cli --server http://tourism-glusterfs-storage-1:8080 --user admin --secret aCs1dGnaloa8Sadd cluster list
heketi-cli topology load --user admin --secret aCs1dGnaloa8Sadd --json=/etc/heketi/topology.json
FileName="maven-repository"
for i in /home/gfs-data /opt/gfs-data /data/gfs-data ; do
ls $i | grep -qw ${FileName}
if [[ $? -eq 0 ]]; then
echo $i
cd $i
ls $i
fi
done
echo "export JAVA_HOME=/opt/java/openjdk/" >>/etc/profile
echo "export MAVEN_HOME=/usr/local/maven3" >>/etc/profile
echo "export PATH=${PATH}:${JAVA_HOME}/bin:${MAVEN_HOME}/bin" >>/etc/profile
ln -s /usr/local/maven3/bin/mvn /usr/bin/mvn
keadm init --advertise-address=192.168.35.24 --kubeedge-version=1.3.1 --kube-config=/root/.kube/config
echo "151.101.108.133 raw.githubusercontent.com" >>/etc/hosts
LinuxReleaseVersion="ubuntu"
if [ $LinuxReleaseVersion = "ubuntu" ]; then
echo yes
else
echo no
fi
SSHLoginPort=22333
sed -i "/^#Port 22/a Port ${SSHLoginPort}" /etc/ssh/sshd_config
#!/bin/bash
# 判断命令是否存在
command_exists() {
command -v "$@" >/dev/null 2>&1
}
# 获取服务器的IP地址
get_server_ip() {
local server_ip=""
local Network_Manage_Tool=""
if command_exists ip; then
Network_Manage_Tool="$(ip addr)"
elif command_exists ifconfig; then
Network_Manage_Tool="$(ifconfig)"
fi
server_ip=$(echo "$Network_Manage_Tool" | \
grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | \
grep -vE "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\.|^0\." | \
head -n 1)
# 自动获取失败时,通过网站提供的 API 获取外网地址
if [ -z "$server_ip" ]; then
server_ip="$(wget -qO- --no-check-certificate https://ipv4.icanhazip.com)"
fi
echo "$server_ip"
}
get_server_ip
for i in {3..1..-1}
do
echo "倒计时开始-- $i s --准备切换shell上文的日志输出将会消失"
sleep 1
done
for namespace in $(kubectl get ns | awk '{print $1}' | grep -v "NAME")
do
echo $namespace
kubectl get pods -n $namespace | grep Evicted |awk '{print $1}' |xargs kubectl -n $namespace delete pod --force
done
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF7nRu6T9xj8qQzU8EtDFq4NXpgOPIF1CVFID5yhE+VHuXi+ZgaUa7ZSRBIod3I2wRh0HrmzH+cvlvDHmSZtyzxo8JDUkvJbdU037plMp9b0rB0OkVYL60lNRaEs6H4JTydxb9yQvi70GRv+UEz6wu/Xql3gexdLuNoHMbuPjkht3DLeufOws9CfZod70CT/zGHqTWLfSkvxIc5MFJhSo70jO1S7ADRri/2u4JXfFPTqRDdZ2PCPa/4CVFp3JA/ITjgk+HalQ/e+S46DQu7kY8aea4Mjqe6XQXrbISQ/wuBUqu2qF0TV23UWwjqdZlhSwGGiCikd/RiAjEOo2+NuOr root@rke-master" \
>> ~/.ssh/authorized_keys
PrivateServerIPs=(10.170.0.8)
DOCKER_VERSION=19.03.8
for ip in ${PrivateServerIPs[@]}
do
echo "正在将Docker的离线安装包分发至主机 ${ip} 上……"
scp -r /tmp/docker-${DOCKER_VERSION} root@$ip:/tmp/docker-${DOCKER_VERSION}
echo "Docker离线安装包已经分发完成"
echo "----------------------------------------------------------"
done
mkdir rancher
cd rancher/
vim 0.0-extend-disk.sh
chmod +x 0.0-extend-disk.sh
./0.0-extend-disk.sh
umount /var
sed -i "s/\/var/\/var\/lib\/docker/g" /etc/fstab
mount -a
sed -i "s/\/data/\/var\/lib\/docker/g" /etc/fstab

22
tmp.json Normal file
View File

@@ -0,0 +1,22 @@
{
"registry-mirrors": [
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"
],
"insecure-registries": [
"harbor.wdd.io:8033",
"harbor.cdcyy.com.cn"
]
}

20
tmp.yaml Normal file
View File

@@ -0,0 +1,20 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: tenant-prefix-security-application
namespace: uavcloud-test
labels:
app.kubernetes.io/managed-by: Helm
annotations:
meta.helm.sh/release-name: uavcloud-ingress-core
meta.helm.sh/release-namespace: uavcloud-test
data:
ingress-config.js: |-
// 从ConfigMap中注入
// injected from ConfigMap
var __GlobalIngressConfig = {
TenantEnvironment: "integration",
CloudHOST: "lab.uavcmlc.com",
ApplicationShortName: "security",
AppClientId: "APP_kVuQY0pNTxgE6KBd"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
vmess://eyJ2IjoiMiIsInBzIjoidXMtY2VudGUtZnJlZSIsImFkZCI6Im5vcnRoZmxhbmsuMTA3NDIxLnh5eiIsInBvcnQiOjQ0MywiaWQiOiJkZTA0YWRkOS01YzY4LThiYWItOTUwYy0wOGNkNTMyMGRmMTgiLCJhaWQiOjAsInNjeSI6ImF1dG8iLCJuZXQiOiJ3cyIsInBhdGgiOiIvdm1lc3MiLCJ0bHMiOiJ0bHMifQ==
trojan://V2ryStr0ngP0ss@140.238.14.103:443?type=tcp&sni=xx.s4.cc.hh.107421.xyz&allowInsecure=0&host=xx.s4.cc.hh.107421.xyzh2,http/1.1#Seoul-Trojan
trojan://Gaa.c12c.389-cc@89.208.251.209:443?security=tls&sni=xx.l4.cc.nn.107421.xyz&alpn=h2%2Chttp%2F1.1&fp=safari&type=tcp&headerType=none#LosAngels-BanH-Trojan-443
trojan://G1c.adv12.Pac@89.208.251.209:23306?security=tls&sni=xx.l4.cc.nn.107421.xyz&alpn=h2%2Chttp%2F1.1&fp=safari&type=tcp&headerType=none#LosAngels-BanH-Trojan-23789
trojan://V2ryStr0ngP0ss@140.238.14.103:19997?type=tcp&sni=xx.s4.cc.hh.107421.xyz&allowInsecure=0&host=xx.s4.cc.hh.107421.xyzh2,http/1.1#Osaka-Trojan
trojan://V2ryStr0ngP0ss@140.238.14.103:19999?type=tcp&sni=xx.s4.cc.hh.107421.xyz&allowInsecure=0&host=xx.s4.cc.hh.107421.xyzh2,http/1.1#Tokyo-Trojan
trojan://V2ryStr0ngP0ss@140.238.14.103:19998?type=tcp&sni=xx.s4.cc.hh.107421.xyz&allowInsecure=0&host=xx.s4.cc.hh.107421.xyzh2,http/1.1#Pheonix-Trojan
trojan://V2ryStr0ngP0ss@132.145.87.10:30000?type=tcp&sni=xx.s0.yy.ac.107421.xyz&allowInsecure=0&host=xx.s0.yy.ac.107421.xyzh2,http/1.1#Seoul-arm64-01-Trojan
trojan://V2ryStr0ngP0ss@43.154.83.213:443?type=tcp&sni=xx.tc.hk.go.107421.xyz&allowInsecure=0h2,http/1.1#Tencent-Hkong-Trojan
vless://fc903f5d-a007-482b-928c-570da9a851f9@43.154.83.213:29999?security=reality&flow=xtls-rprx-vision&type=tcp&sni=xx.tc.hk.go.107421.xyz&fp=chrome&pbk=IBKk7cbbpnarU9sxJx84tXztytBFH2oCNfy7FlLVjDg&sid=ad570cbfab&encryption=none&headerType=none#Tencent-HK-11.24

View File

@@ -0,0 +1,896 @@
#---------------------------------------------------#
## 更新2022-09-28 09:02:50
## 感谢https://github.com/Hackl0us/SS-Rule-Snippet
## 链接https://link.oness.xyz/link/0fHPiayjsMIn6BUC?clash=1
#---------------------------------------------------#
# HTTP 代理端口
port: 7890
# SOCKS5 代理端口
socks-port: 7891
# Linux 和 macOS 的 redir 代理端口
redir-port: 7892
# 允许局域网的连接
allow-lan: true
# 规则模式Rule规则 / Global全局代理/ Direct全局直连
mode: Rule
# 设置日志输出级别 (默认级别silent即不输出任何内容以避免因日志内容过大而导致程序内存溢出
# 5 个级别silent / info / warning / error / debug。级别越高日志输出量越大越倾向于调试若需要请自行开启。
log-level: info
# Clash 的 RESTful API
external-controller: '0.0.0.0:9090'
# RESTful API 的口令
secret: ''
# 您可以将静态网页资源(如 clash-dashboard放置在一个目录中clash 将会服务于 `RESTful API/ui`
# 参数应填写配置目录的相对路径或绝对路径。
# external-ui: folder
proxies:
# vmess
# cipher support auto/aes-128-gcm/chacha20-poly1305/none
- name: "Tencent-Shanghai-Relay"
type: vmess
server: 42.192.52.227
port: 19999
uuid: 7318178c-5583-40dd-996c-a0add1f8fc1e
alterId: 0
cipher: auto
# udp: true
tls: false
skip-cert-verify: true
# servername: example.com # priority over wss host
network: http
http-opts:
host:
path:
- /v2ice-vmess-tcp-seoul
# headers:
# Host: v2ray.com
# max-early-data: 2048
# early-data-header-name: Sec-WebSocket-Protocol
proxy-groups:
- name: Proxy
type: select
# disable-udp: true
proxies:
- Tencent-Shanghai-Relay
- name: Direct
type: select
proxies:
- DIRECT
- name: Domestic
type: select
proxies:
- DIRECT
- Proxy
- name: Others
type: select
proxies:
- Proxy
- DIRECT
# 规则
rules:
# anti-ads
- DOMAIN-KEYWORD,adservice,REJECT
- DOMAIN-SUFFIX,adcolony.com,REJECT
- DOMAIN-SUFFIX,adinall.com,REJECT
- DOMAIN-SUFFIX,admaster.com.cn,REJECT
- DOMAIN-SUFFIX,admob.com,REJECT
- DOMAIN-SUFFIX,adnxs.com,REJECT
- DOMAIN-SUFFIX,adnyg.com,REJECT
- DOMAIN-SUFFIX,adsensor.org,REJECT
- DOMAIN-SUFFIX,adsymptotic.com,REJECT
- DOMAIN-SUFFIX,adthor.com,REJECT
- DOMAIN-SUFFIX,adwhirl.com,REJECT
- DOMAIN-SUFFIX,amazon-adsystem.com,REJECT
- DOMAIN-SUFFIX,amobee.com,REJECT
- DOMAIN-SUFFIX,app-adforce.jp,REJECT
- DOMAIN-SUFFIX,appads.com,REJECT
- DOMAIN-SUFFIX,appcpi.net,REJECT
- DOMAIN-SUFFIX,appier.net,REJECT
- DOMAIN-SUFFIX,applift.com,REJECT
- DOMAIN-SUFFIX,applovin.com,REJECT
- DOMAIN-SUFFIX,applvn.com,REJECT
- DOMAIN-SUFFIX,apsalar.com,REJECT
- DOMAIN-SUFFIX,apxadtracking.net,REJECT
- DOMAIN-SUFFIX,axonix.com,REJECT
- DOMAIN-SUFFIX,bayimob.com,REJECT
- DOMAIN-SUFFIX,bjvvqu.cn,REJECT
- DOMAIN-SUFFIX,bulldogcpi.com,REJECT
- DOMAIN-SUFFIX,clotfun.mobi,REJECT
- DOMAIN-SUFFIX,clotfun.online,REJECT
- DOMAIN-SUFFIX,cloudmobi.net,REJECT
- DOMAIN-SUFFIX,crwdcntrl.net,REJECT
- DOMAIN-SUFFIX,ctrmi.com,REJECT
- DOMAIN-SUFFIX,exosrv.com,REJECT
- DOMAIN-SUFFIX,go2cloud.org,REJECT
- DOMAIN-SUFFIX,growingio.com,REJECT
- DOMAIN-SUFFIX,haloapps.com,REJECT
- DOMAIN-SUFFIX,hypers.com,REJECT
- DOMAIN-SUFFIX,idealads.net,REJECT
- DOMAIN-SUFFIX,inmobi.cn,REJECT
- DOMAIN-SUFFIX,inmobi.com,REJECT
- DOMAIN-SUFFIX,inmobi.net,REJECT
- DOMAIN-SUFFIX,inmobicdn.cn,REJECT
- DOMAIN-SUFFIX,inmobicdn.net,REJECT
- DOMAIN-SUFFIX,inner-active.mobi,REJECT
- DOMAIN-SUFFIX,insurads.com,REJECT
- DOMAIN-SUFFIX,ironsrc.com,REJECT
- DOMAIN-SUFFIX,irs01.com,REJECT
- DOMAIN-SUFFIX,iskyworker.com,REJECT
- DOMAIN-SUFFIX,juicyads.com,REJECT
- DOMAIN-SUFFIX,kochava.com,REJECT
- DOMAIN-SUFFIX,leadboltmobile.net,REJECT
- DOMAIN-SUFFIX,lenzmx.com,REJECT
- DOMAIN-SUFFIX,liveadvert.com,REJECT
- DOMAIN-SUFFIX,lnk0.com,REJECT
- DOMAIN-SUFFIX,lnk8.cn,REJECT
- DOMAIN-SUFFIX,localytics.com,REJECT
- DOMAIN-SUFFIX,mdfull.com,REJECT
- DOMAIN-SUFFIX,measurementapi.com,REJECT
- DOMAIN-SUFFIX,medialytics.com,REJECT
- DOMAIN-SUFFIX,meetrics.com,REJECT
- DOMAIN-SUFFIX,meetrics.net,REJECT
- DOMAIN-SUFFIX,miaozhen.com,REJECT
- DOMAIN-SUFFIX,mmstat.com,REJECT
- DOMAIN-SUFFIX,moatads.com,REJECT
- DOMAIN-SUFFIX,mobclix.com,REJECT
- DOMAIN-SUFFIX,mopub.com,REJECT
- DOMAIN-SUFFIX,okjhb.xyz,REJECT
- DOMAIN-SUFFIX,openx.net,REJECT
- DOMAIN-SUFFIX,outbrain.com,REJECT
- DOMAIN-SUFFIX,pubmatic.com,REJECT
- DOMAIN-SUFFIX,qchannel01.cn,REJECT
- DOMAIN-SUFFIX,rayjump.com,REJECT
- DOMAIN-SUFFIX,rtbasia.com,REJECT
- DOMAIN-SUFFIX,rubiconproject.com,REJECT
- DOMAIN-SUFFIX,scorecardresearch.com,REJECT
- DOMAIN-SUFFIX,sdkclick.com,REJECT
- DOMAIN-SUFFIX,shuzilm.cn,REJECT
- DOMAIN-SUFFIX,smaato.net,REJECT
- DOMAIN-SUFFIX,smartadserver.com,REJECT
- DOMAIN-SUFFIX,smartnews-ads.com,REJECT
- DOMAIN-SUFFIX,supersonic.com,REJECT
- DOMAIN-SUFFIX,supersonicads.com,REJECT
- DOMAIN-SUFFIX,tagtic.cn,REJECT
- DOMAIN-SUFFIX,tanv.com,REJECT
- DOMAIN-SUFFIX,tanx.com,REJECT
- DOMAIN-SUFFIX,tapjoy.com,REJECT
- DOMAIN-SUFFIX,trafficjunky.net,REJECT
- DOMAIN-SUFFIX,turn.com,REJECT
- DOMAIN-SUFFIX,uri6.com,REJECT
- DOMAIN-SUFFIX,vidoomy.com,REJECT
- DOMAIN-SUFFIX,vungle.com,REJECT
- DOMAIN-SUFFIX,wedolook.com,REJECT
- DOMAIN-SUFFIX,xdrig.com,REJECT
- DOMAIN-SUFFIX,yumimobi.com,REJECT
- DOMAIN-SUFFIX,zu08e.cn,REJECT
- DOMAIN-SUFFIX,ad.cmvideo.cn,REJECT
- DOMAIN-SUFFIX,ad.daum.net,REJECT
- DOMAIN,abema-adx.ameba.jp,REJECT
- DOMAIN,ad.12306.cn,REJECT
- DOMAIN,ad.360in.com,REJECT
- DOMAIN,ad.51wnl-cq.com,REJECT
- DOMAIN,ad.caiyunapp.com,REJECT
- DOMAIN,ad.huajiao.com,REJECT
- DOMAIN,ad.hzyoka.com,REJECT
- DOMAIN,ad.jiemian.com,REJECT
- DOMAIN,ad.qingting.fm,REJECT
- DOMAIN,ad.wappalyzer.com,REJECT
- DOMAIN,ad-cn.jovcloud.com,REJECT
- DOMAIN,adextra.51wnl-cq.com,REJECT
- DOMAIN,api.adnet.mob.com,REJECT
- DOMAIN,ads.adadapted.com,REJECT
- DOMAIN,ads.chinadaily.com.cn,REJECT
- DOMAIN,ads.daydaycook.com.cn,REJECT
- DOMAIN,ads.weilitoutiao.net,REJECT
- DOMAIN,adsapi.manhuaren.com,REJECT
- DOMAIN,adsdk.dmzj.com,REJECT
- DOMAIN,adserver.pandora.com,REJECT
- DOMAIN,adshow.58.com,REJECT
- DOMAIN,adui.tg.meitu.com,REJECT
- DOMAIN,adv.bandi.so,REJECT
- DOMAIN,app-ad.variflight.com,REJECT
- DOMAIN,appnext.hs.llnwd.net,REJECT
- DOMAIN,appnext-a.akamaihd.net,REJECT
- DOMAIN,ggs.myzaker.com,REJECT
- DOMAIN,itad.linetv.tw,REJECT
- DOMAIN,ja.chushou.tv,REJECT
- DOMAIN,mads.suning.com,REJECT
- DOMAIN,mobileads.msn.com,REJECT
- DOMAIN,mopnativeadv.037201.com,REJECT
- DOMAIN,nativeadv.dftoutiao.com,REJECT
- DOMAIN-SUFFIX,iadsdk.apple.com,REJECT
- DOMAIN-SUFFIX,ads.internal.unity3d.com,REJECT
- DOMAIN-SUFFIX,ads.prd.ie.internal.unity3d.com,REJECT
- DOMAIN-SUFFIX,unityads.unity3d.com,REJECT
- DOMAIN,optimus-ads.amap.com,REJECT
- DOMAIN,optimus-ads.amap.com.w.alikunlun.com,REJECT
- DOMAIN,tunion-api.m.taobao.com,REJECT
- DOMAIN,adproxy.autohome.com.cn,REJECT
- DOMAIN,rd.autohome.com.cn,REJECT
- DOMAIN,al.autohome.com.cn,REJECT
- DOMAIN,applogapi.autohome.com.cn,REJECT
- DOMAIN-SUFFIX,cpro.baidu.com,REJECT
- DOMAIN-SUFFIX,pos.baidu.com,REJECT
- DOMAIN,afd.baidu.com,REJECT
- DOMAIN,als.baidu.com,REJECT
- DOMAIN,duclick.baidu.com,REJECT
- DOMAIN,mobads.baidu.com,REJECT
- DOMAIN,mobads-logs.baidu.com,REJECT
- DOMAIN,nsclick.baidu.com,REJECT
- DOMAIN,ad.toutiao.com,REJECT
- DOMAIN,adx.yiche.com,REJECT
- DOMAIN,log.ycapp.yiche.com,REJECT
- DOMAIN,advertise.baicizhan.com,REJECT
- DOMAIN,advertise.baicizhan.org,REJECT
- DOMAIN,galaxy.bjcathay.com,REJECT
- DOMAIN,mdrecv.app.cntvwb.cn,REJECT
- DOMAIN,sdapprecv.app.cntvwb.cn,REJECT
- DOMAIN,vdapprecv.app.cntvwb.cn,REJECT
- DOMAIN,ad.21cn.com,REJECT
- DOMAIN,ad.k.21cn.com,REJECT
- DOMAIN,admarket.21cn.com,REJECT
- DOMAIN,adshows.21cn.com,REJECT
- DOMAIN,atrace.chelaile.net.cn,REJECT
- DOMAIN,logs.chelaile.net.cn,REJECT
- DOMAIN-SUFFIX,doubleclick.net,REJECT
- DOMAIN-SUFFIX,googleadservices.com,REJECT
- DOMAIN-SUFFIX,googleadsserving.cn,REJECT
- DOMAIN-SUFFIX,googlesyndication.com,REJECT
- DOMAIN-SUFFIX,da.mgtv.com,REJECT
- DOMAIN-SUFFIX,da.hunantv.com,REJECT
- DOMAIN,adx.hupu.com,REJECT
- DOMAIN,adx-api.hupu.com,REJECT
- DOMAIN,goblin.hupu.com,REJECT
- DOMAIN,t7z.cupid.iqiyi.com,REJECT
- IP-CIDR,101.227.97.240/32,REJECT,no-resolve
- IP-CIDR,101.227.200.11/32,REJECT,no-resolve
- IP-CIDR,101.227.200.28/32,REJECT,no-resolve
- IP-CIDR,124.192.153.42/32,REJECT,no-resolve
- DOMAIN-SUFFIX,deliver.ifeng.com,REJECT
- DOMAIN,api.newad.ifeng.com,REJECT
- DOMAIN,ifengad.3g.ifeng.com,REJECT
- DOMAIN,adserviceretry.kugou.com,REJECT
- DOMAIN,ads.service.kugou.com,REJECT
- DOMAIN,adsfile.bssdlbig.kugou.com,REJECT
- DOMAIN,g.koowo.com,REJECT
- DOMAIN,kgmobilestat.kugou.com,REJECT
- DOMAIN,kgmobilestatbak.kugou.com,REJECT
- DOMAIN,mobilelog.kugou.com,REJECT
- DOMAIN,mobilead.kuwo.cn,REJECT
- DOMAIN,rich.kuwo.cn,REJECT
- DOMAIN,ad-stat.ksosoft.com,REJECT
- DOMAIN,img.auction-ads.wpscdn.cn,REJECT
- DOMAIN,counter.kingsoft.com,REJECT
- DOMAIN,counter.ksosoft.com,REJECT
- DOMAIN,minfo.wps.cn,REJECT
- DOMAIN,mobad.ijinshan.com,REJECT
- DOMAIN,ups.ksmobile.net,REJECT
- DOMAIN,ws.ksmobile.net,REJECT
- DOMAIN-SUFFIX,webp2p.letv.com,REJECT
- DOMAIN,ark.letv.com,REJECT
- DOMAIN,emma-414870e223.huodonghezi.com,REJECT
- DOMAIN,g3.letv.com,REJECT
- DOMAIN,n.mark.letv.com,REJECT
- DOMAIN,ad.hpplay.cn,REJECT
- DOMAIN,adcdn.hpplay.cn,REJECT
- DOMAIN,adeng.hpplay.cn,REJECT
- DOMAIN,rp.hpplay.cn,REJECT
- DOMAIN-SUFFIX,ad.intl.xiaomi.com,REJECT
- DOMAIN-SUFFIX,ad.xiaomi.com,REJECT
- DOMAIN-SUFFIX,admob.xiaomi.com,REJECT
- DOMAIN,adv.sec.intl.miui.com,REJECT
- DOMAIN,adv.sec.miui.com,REJECT
- DOMAIN,ad.api.moji.com,REJECT
- DOMAIN,adlaunch.moji.com,REJECT
- DOMAIN,ads.mojicdn.com,REJECT
- DOMAIN,v1.log.moji.com,REJECT
- DOMAIN,ad.bn.netease.com,REJECT
- DOMAIN,ad.yixin.im,REJECT
- DOMAIN,admusicpic.music.126.net,REJECT
- DOMAIN,gorgon.youdao.com,REJECT
- DOMAIN,iadmat.nosdn.127.net,REJECT
- DOMAIN,iadmusicmat.music.126.net,REJECT
- DOMAIN,iadmusicmatvideo.music.126.net,REJECT
- DOMAIN,impservice.dictapp.youdao.com,REJECT
- DOMAIN,impservice.youdao.com,REJECT
- DOMAIN,log.yex.youdao.com,REJECT
- DOMAIN,log-yex.youdao.com,REJECT
- DOMAIN,n.3g.163.com,REJECT
- DOMAIN,nex.163.com,REJECT
- DOMAIN,yt-adp.nosdn.127.net,REJECT
- DOMAIN,yt-adp.ws.126.net,REJECT
- DOMAIN,ads.aplus.pptv.com,REJECT
- DOMAIN,ads.aplusapi.pptv.com,REJECT
- DOMAIN,asimgs.pplive.cn,REJECT
- DOMAIN,de.as.pptv.com,REJECT
- DOMAIN,regist.fotoable.com,REJECT
- DOMAIN,cdn.adapi.fotoable.com,REJECT
- DOMAIN,adnew.wifi8.com,REJECT
- DOMAIN,adfile.wifi8.com,REJECT
- DOMAIN-SUFFIX,beacon.sina.com.cn,REJECT
- DOMAIN,adimg.vue.weibo.com,REJECT
- DOMAIN,u1.img.mobile.sina.cn,REJECT
- DOMAIN,sax.sina.com.cn,REJECT
- DOMAIN,saxs.sina.com.cn,REJECT
- DOMAIN,saxn.sina.com.cn,REJECT
- DOMAIN-SUFFIX,ad.sohu.com,REJECT
- DOMAIN-SUFFIX,ads.sohu.com,REJECT
- DOMAIN-SUFFIX,aty.sohu.com,REJECT
- DOMAIN,imp.optaim.com,REJECT
- DOMAIN,v2.reachmax.cn,REJECT
- DOMAIN,track.sohu.com,REJECT
- DOMAIN,hui.sohu.com,REJECT
- DOMAIN-SUFFIX,e.qq.com,REJECT
- DOMAIN-SUFFIX,gdt.qq.com,REJECT
- DOMAIN-SUFFIX,l.qq.com,REJECT
- DOMAIN,adsmind.apdcdn.tc.qq.com,REJECT
- DOMAIN,adsmind.gdtimg.com,REJECT
- DOMAIN,adsmind.tc.qq.com,REJECT
- DOMAIN,pgdt.gtimg.cn,REJECT
- DOMAIN,pgdt.gtimg.com,REJECT
- DOMAIN,pgdt.ugdtimg.com,REJECT
- DOMAIN,splashqqlive.gtimg.com,REJECT
- DOMAIN,wa.gtimg.com,REJECT
- DOMAIN,wxsnsdy.wxs.qq.com,REJECT
- DOMAIN,wxsnsdythumb.wxs.qq.com,REJECT
- DOMAIN,admonitor.thepaper.cn,REJECT
- DOMAIN,adpai.thepaper.cn,REJECT
- DOMAIN,imgadpai.thepaper.cn,REJECT
- DOMAIN,adsp.xunlei.com,REJECT
- DOMAIN,etl.xlmc.sandai.net,REJECT
- DOMAIN,adm.10jqka.com.cn,REJECT
- DOMAIN,stat.10jqka.com.cn,REJECT
- DOMAIN,ad-analysis.pconline.com.cn,REJECT
- DOMAIN,iad0ssl.pcauto.com.cn,REJECT
- DOMAIN,iad0ssl.pconline.com.cn,REJECT
- DOMAIN,imgad0.pcauto.com.cn,REJECT
- DOMAIN,imgad0.pconline.com.cn,REJECT
- DOMAIN,ivy.pchouse.com.cn,REJECT
- DOMAIN,a.wkanx.com,REJECT
- DOMAIN,cwx.lianwangtech.com,REJECT
- DOMAIN,c1wx.lianwangtech.com,REJECT
- DOMAIN,ad.ximalaya.com,REJECT
- DOMAIN,adbs.ximalaya.com,REJECT
- DOMAIN,adse.ximalaya.com,REJECT
- DOMAIN,adse.wsa.ximalaya.com,REJECT
- DOMAIN,adbehavior.wsa.ximalaya.com,REJECT
- DOMAIN,adsebs.ximalaya.com,REJECT
- DOMAIN,ads-img-qc.xhscdn.com,REJECT
- DOMAIN,ads-video-qc.xhscdn.com,REJECT
- DOMAIN,t-ads.xiaohongshu.com,REJECT
- DOMAIN-SUFFIX,atm.youku.com,REJECT
- DOMAIN,ad.mobile.youku.com,REJECT
- DOMAIN,iyes.youku.com,REJECT
- DOMAIN,apppv.zol.com.cn,REJECT
- DOMAIN,pvnapp.zol.com.cn,REJECT
# (DNS Cache Pollution Protection)
# > Google
- DOMAIN-SUFFIX,appspot.com,Proxy
- DOMAIN-SUFFIX,blogger.com,Proxy
- DOMAIN-SUFFIX,getoutline.org,Proxy
- DOMAIN-SUFFIX,gvt0.com,Proxy
- DOMAIN-SUFFIX,gvt1.com,Proxy
- DOMAIN-SUFFIX,gvt3.com,Proxy
- DOMAIN-SUFFIX,xn--ngstr-lra8j.com,Proxy
- DOMAIN-KEYWORD,google,Proxy
- DOMAIN-KEYWORD,blogspot,Proxy
# > Facebook
- DOMAIN-SUFFIX,cdninstagram.com,Proxy
- DOMAIN-SUFFIX,fb.com,Proxy
- DOMAIN-SUFFIX,fb.me,Proxy
- DOMAIN-SUFFIX,fbaddins.com,Proxy
- DOMAIN-SUFFIX,fbcdn.net,Proxy
- DOMAIN-SUFFIX,fbsbx.com,Proxy
- DOMAIN-SUFFIX,fbworkmail.com,Proxy
- DOMAIN-SUFFIX,instagram.com,Proxy
- DOMAIN-SUFFIX,m.me,Proxy
- DOMAIN-SUFFIX,messenger.com,Proxy
- DOMAIN-SUFFIX,oculus.com,Proxy
- DOMAIN-SUFFIX,oculuscdn.com,Proxy
- DOMAIN-SUFFIX,rocksdb.org,Proxy
- DOMAIN-SUFFIX,whatsapp.com,Proxy
- DOMAIN-SUFFIX,whatsapp.net,Proxy
- DOMAIN-KEYWORD,facebook,Proxy
# > Twitter
- DOMAIN-SUFFIX,pscp.tv,Proxy
- DOMAIN-SUFFIX,periscope.tv,Proxy
- DOMAIN-SUFFIX,t.co,Proxy
- DOMAIN-SUFFIX,twimg.co,Proxy
- DOMAIN-SUFFIX,twimg.com,Proxy
- DOMAIN-SUFFIX,twitpic.com,Proxy
- DOMAIN-SUFFIX,vine.co,Proxy
- DOMAIN-KEYWORD,twitter,Proxy
# > Telegram
- DOMAIN-SUFFIX,t.me,Proxy
- DOMAIN-SUFFIX,tdesktop.com,Proxy
- DOMAIN-SUFFIX,telegra.ph,Proxy
- DOMAIN-SUFFIX,telegram.me,Proxy
- DOMAIN-SUFFIX,telegram.org,Proxy
# > Line
- DOMAIN-SUFFIX,line.me,Proxy
- DOMAIN-SUFFIX,line-apps.com,Proxy
- DOMAIN-SUFFIX,line-scdn.net,Proxy
- DOMAIN-SUFFIX,naver.jp,Proxy
# > Other
- DOMAIN-SUFFIX,4shared.com,Proxy
- DOMAIN-SUFFIX,881903.com,Proxy
- DOMAIN-SUFFIX,abc.net.au,Proxy
- DOMAIN-SUFFIX,abebooks.com,Proxy
- DOMAIN-SUFFIX,amazon.co.jp,Proxy
- DOMAIN-SUFFIX,apigee.com,Proxy
- DOMAIN-SUFFIX,apk-dl.com,Proxy
- DOMAIN-SUFFIX,apkmirror.com,Proxy
- DOMAIN-SUFFIX,apkmonk.com,Proxy
- DOMAIN-SUFFIX,apkpure.com,Proxy
- DOMAIN-SUFFIX,aptoide.com,Proxy
- DOMAIN-SUFFIX,archive.is,Proxy
- DOMAIN-SUFFIX,archive.org,Proxy
- DOMAIN-SUFFIX,arte.tv,Proxy
- DOMAIN-SUFFIX,ask.com,Proxy
- DOMAIN-SUFFIX,avgle.com,Proxy
- DOMAIN-SUFFIX,badoo.com,Proxy
- DOMAIN-SUFFIX,bandwagonhost.com,Proxy
- DOMAIN-SUFFIX,bbc.com,Proxy
- DOMAIN-SUFFIX,behance.net,Proxy
- DOMAIN-SUFFIX,bibox.com,Proxy
- DOMAIN-SUFFIX,biggo.com.tw,Proxy
- DOMAIN-SUFFIX,binance.com,Proxy
- DOMAIN-SUFFIX,bitcointalk.org,Proxy
- DOMAIN-SUFFIX,bitfinex.com,Proxy
- DOMAIN-SUFFIX,bitmex.com,Proxy
- DOMAIN-SUFFIX,bit-z.com,Proxy
- DOMAIN-SUFFIX,bloglovin.com,Proxy
- DOMAIN-SUFFIX,bloomberg.cn,Proxy
- DOMAIN-SUFFIX,bloomberg.com,Proxy
- DOMAIN-SUFFIX,book.com.tw,Proxy
- DOMAIN-SUFFIX,booklive.jp,Proxy
- DOMAIN-SUFFIX,books.com.tw,Proxy
- DOMAIN-SUFFIX,box.com,Proxy
- DOMAIN-SUFFIX,brookings.edu,Proxy
- DOMAIN-SUFFIX,businessinsider.com,Proxy
- DOMAIN-SUFFIX,bwh1.net,Proxy
- DOMAIN-SUFFIX,castbox.fm,Proxy
- DOMAIN-SUFFIX,cbc.ca,Proxy
- DOMAIN-SUFFIX,cdw.com,Proxy
- DOMAIN-SUFFIX,change.org,Proxy
- DOMAIN-SUFFIX,ck101.com,Proxy
- DOMAIN-SUFFIX,clarionproject.org,Proxy
- DOMAIN-SUFFIX,clyp.it,Proxy
- DOMAIN-SUFFIX,cna.com.tw,Proxy
- DOMAIN-SUFFIX,comparitech.com,Proxy
- DOMAIN-SUFFIX,conoha.jp,Proxy
- DOMAIN-SUFFIX,crucial.com,Proxy
- DOMAIN-SUFFIX,cts.com.tw,Proxy
- DOMAIN-SUFFIX,cw.com.tw,Proxy
- DOMAIN-SUFFIX,cyberctm.com,Proxy
- DOMAIN-SUFFIX,dailymotion.com,Proxy
- DOMAIN-SUFFIX,dailyview.tw,Proxy
- DOMAIN-SUFFIX,daum.net,Proxy
- DOMAIN-SUFFIX,daumcdn.net,Proxy
- DOMAIN-SUFFIX,dcard.tw,Proxy
- DOMAIN-SUFFIX,deepdiscount.com,Proxy
- DOMAIN-SUFFIX,deezer.com,Proxy
- DOMAIN-SUFFIX,depositphotos.com,Proxy
- DOMAIN-SUFFIX,disconnect.me,Proxy
- DOMAIN-SUFFIX,discordapp.com,Proxy
- DOMAIN-SUFFIX,discordapp.net,Proxy
- DOMAIN-SUFFIX,disqus.com,Proxy
- DOMAIN-SUFFIX,dns2go.com,Proxy
- DOMAIN-SUFFIX,dropbox.com,Proxy
- DOMAIN-SUFFIX,dropboxusercontent.com,Proxy
- DOMAIN-SUFFIX,duckduckgo.com,Proxy
- DOMAIN-SUFFIX,dw.com,Proxy
- DOMAIN-SUFFIX,dynu.com,Proxy
- DOMAIN-SUFFIX,earthcam.com,Proxy
- DOMAIN-SUFFIX,ebookservice.tw,Proxy
- DOMAIN-SUFFIX,economist.com,Proxy
- DOMAIN-SUFFIX,edgecastcdn.net,Proxy
- DOMAIN-SUFFIX,edu,Proxy
- DOMAIN-SUFFIX,elpais.com,Proxy
- DOMAIN-SUFFIX,enanyang.my,Proxy
- DOMAIN-SUFFIX,euronews.com,Proxy
- DOMAIN-SUFFIX,feedly.com,Proxy
- DOMAIN-SUFFIX,files.wordpress.com,Proxy
- DOMAIN-SUFFIX,flickr.com,Proxy
- DOMAIN-SUFFIX,flitto.com,Proxy
- DOMAIN-SUFFIX,foreignpolicy.com,Proxy
- DOMAIN-SUFFIX,friday.tw,Proxy
- DOMAIN-SUFFIX,gate.io,Proxy
- DOMAIN-SUFFIX,getlantern.org,Proxy
- DOMAIN-SUFFIX,getsync.com,Proxy
- DOMAIN-SUFFIX,globalvoices.org,Proxy
- DOMAIN-SUFFIX,goo.ne.jp,Proxy
- DOMAIN-SUFFIX,goodreads.com,Proxy
- DOMAIN-SUFFIX,gov.tw,Proxy
- DOMAIN-SUFFIX,gumroad.com,Proxy
- DOMAIN-SUFFIX,hbg.com,Proxy
- DOMAIN-SUFFIX,hightail.com,Proxy
- DOMAIN-SUFFIX,hk01.com,Proxy
- DOMAIN-SUFFIX,hkbf.org,Proxy
- DOMAIN-SUFFIX,hkbookcity.com,Proxy
- DOMAIN-SUFFIX,hkej.com,Proxy
- DOMAIN-SUFFIX,hket.com,Proxy
- DOMAIN-SUFFIX,hkgolden.com,Proxy
- DOMAIN-SUFFIX,hootsuite.com,Proxy
- DOMAIN-SUFFIX,hudson.org,Proxy
- DOMAIN-SUFFIX,huobi.pro,Proxy
- DOMAIN-SUFFIX,initiummall.com,Proxy
- DOMAIN-SUFFIX,ipfs.io,Proxy
- DOMAIN-SUFFIX,issuu.com,Proxy
- DOMAIN-SUFFIX,japantimes.co.jp,Proxy
- DOMAIN-SUFFIX,jiji.com,Proxy
- DOMAIN-SUFFIX,jinx.com,Proxy
- DOMAIN-SUFFIX,jkforum.net,Proxy
- DOMAIN-SUFFIX,joinmastodon.org,Proxy
- DOMAIN-SUFFIX,kakao.com,Proxy
- DOMAIN-SUFFIX,lihkg.com,Proxy
- DOMAIN-SUFFIX,live.com,Proxy
- DOMAIN-SUFFIX,mail.ru,Proxy
- DOMAIN-SUFFIX,matters.news,Proxy
- DOMAIN-SUFFIX,medium.com,Proxy
- DOMAIN-SUFFIX,mega.nz,Proxy
- DOMAIN-SUFFIX,mil,Proxy
- DOMAIN-SUFFIX,mobile01.com,Proxy
- DOMAIN-SUFFIX,naver.com,Proxy
- DOMAIN-SUFFIX,nikkei.com,Proxy
- DOMAIN-SUFFIX,nofile.io,Proxy
- DOMAIN-SUFFIX,now.com,Proxy
- DOMAIN-SUFFIX,nyt.com,Proxy
- DOMAIN-SUFFIX,nytchina.com,Proxy
- DOMAIN-SUFFIX,nytcn.me,Proxy
- DOMAIN-SUFFIX,nytco.com,Proxy
- DOMAIN-SUFFIX,nytimes.com,Proxy
- DOMAIN-SUFFIX,nytimg.com,Proxy
- DOMAIN-SUFFIX,nytlog.com,Proxy
- DOMAIN-SUFFIX,nytstyle.com,Proxy
- DOMAIN-SUFFIX,ok.ru,Proxy
- DOMAIN-SUFFIX,okex.com,Proxy
- DOMAIN-SUFFIX,pcloud.com,Proxy
- DOMAIN-SUFFIX,pinimg.com,Proxy
- DOMAIN-SUFFIX,pixiv.net,Proxy
- DOMAIN-SUFFIX,pornhub.com,Proxy
- DOMAIN-SUFFIX,pureapk.com,Proxy
- DOMAIN-SUFFIX,quora.com,Proxy
- DOMAIN-SUFFIX,quoracdn.net,Proxy
- DOMAIN-SUFFIX,rakuten.co.jp,Proxy
- DOMAIN-SUFFIX,reddit.com,Proxy
- DOMAIN-SUFFIX,redditmedia.com,Proxy
- DOMAIN-SUFFIX,resilio.com,Proxy
- DOMAIN-SUFFIX,reuters.com,Proxy
- DOMAIN-SUFFIX,scmp.com,Proxy
- DOMAIN-SUFFIX,scribd.com,Proxy
- DOMAIN-SUFFIX,seatguru.com,Proxy
- DOMAIN-SUFFIX,shadowsocks.org,Proxy
- DOMAIN-SUFFIX,slideshare.net,Proxy
- DOMAIN-SUFFIX,soundcloud.com,Proxy
- DOMAIN-SUFFIX,startpage.com,Proxy
- DOMAIN-SUFFIX,steamcommunity.com,Proxy
- DOMAIN-SUFFIX,steemit.com,Proxy
- DOMAIN-SUFFIX,t66y.com,Proxy
- DOMAIN-SUFFIX,teco-hk.org,Proxy
- DOMAIN-SUFFIX,teco-mo.org,Proxy
- DOMAIN-SUFFIX,teddysun.com,Proxy
- DOMAIN-SUFFIX,theinitium.com,Proxy
- DOMAIN-SUFFIX,tineye.com,Proxy
- DOMAIN-SUFFIX,torproject.org,Proxy
- DOMAIN-SUFFIX,tumblr.com,Proxy
- DOMAIN-SUFFIX,turbobit.net,Proxy
- DOMAIN-SUFFIX,twitch.tv,Proxy
- DOMAIN-SUFFIX,udn.com,Proxy
- DOMAIN-SUFFIX,unseen.is,Proxy
- DOMAIN-SUFFIX,upmedia.mg,Proxy
- DOMAIN-SUFFIX,uptodown.com,Proxy
- DOMAIN-SUFFIX,ustream.tv,Proxy
- DOMAIN-SUFFIX,uwants.com,Proxy
- DOMAIN-SUFFIX,v2ray.com,Proxy
- DOMAIN-SUFFIX,viber.com,Proxy
- DOMAIN-SUFFIX,videopress.com,Proxy
- DOMAIN-SUFFIX,vimeo.com,Proxy
- DOMAIN-SUFFIX,voxer.com,Proxy
- DOMAIN-SUFFIX,vzw.com,Proxy
- DOMAIN-SUFFIX,w3schools.com,Proxy
- DOMAIN-SUFFIX,wattpad.com,Proxy
- DOMAIN-SUFFIX,whoer.net,Proxy
- DOMAIN-SUFFIX,wikimapia.org,Proxy
- DOMAIN-SUFFIX,wikipedia.org,Proxy
- DOMAIN-SUFFIX,wire.com,Proxy
- DOMAIN-SUFFIX,worldcat.org,Proxy
- DOMAIN-SUFFIX,wsj.com,Proxy
- DOMAIN-SUFFIX,wsj.net,Proxy
- DOMAIN-SUFFIX,xboxlive.com,Proxy
- DOMAIN-SUFFIX,xvideos.com,Proxy
- DOMAIN-SUFFIX,yahoo.com,Proxy
- DOMAIN-SUFFIX,yesasia.com,Proxy
- DOMAIN-SUFFIX,yes-news.com,Proxy
- DOMAIN-SUFFIX,yomiuri.co.jp,Proxy
- DOMAIN-SUFFIX,you-get.org,Proxy
- DOMAIN-SUFFIX,zb.com,Proxy
- DOMAIN-SUFFIX,zello.com,Proxy
- DOMAIN-SUFFIX,zeronet.io,Proxy
- DOMAIN,cdn-images.mailchimp.com,Proxy
- DOMAIN,id.heroku.com,Proxy
- DOMAIN-KEYWORD,github,Proxy
- DOMAIN-KEYWORD,jav,Proxy
- DOMAIN-KEYWORD,pinterest,Proxy
- DOMAIN-KEYWORD,porn,Proxy
- DOMAIN-KEYWORD,wikileaks,Proxy
# (Region-Restricted Access Denied)
- DOMAIN-SUFFIX,apartmentratings.com,Proxy
- DOMAIN-SUFFIX,apartments.com,Proxy
- DOMAIN-SUFFIX,bankmobilevibe.com,Proxy
- DOMAIN-SUFFIX,bing.com,Proxy
- DOMAIN-SUFFIX,booktopia.com.au,Proxy
- DOMAIN-SUFFIX,centauro.com.br,Proxy
- DOMAIN-SUFFIX,clearsurance.com,Proxy
- DOMAIN-SUFFIX,costco.com,Proxy
- DOMAIN-SUFFIX,crackle.com,Proxy
- DOMAIN-SUFFIX,depositphotos.cn,Proxy
- DOMAIN-SUFFIX,dish.com,Proxy
- DOMAIN-SUFFIX,dmm.co.jp,Proxy
- DOMAIN-SUFFIX,dmm.com,Proxy
- DOMAIN-SUFFIX,dnvod.tv,Proxy
- DOMAIN-SUFFIX,esurance.com,Proxy
- DOMAIN-SUFFIX,extmatrix.com,Proxy
- DOMAIN-SUFFIX,fastpic.ru,Proxy
- DOMAIN-SUFFIX,flipboard.com,Proxy
- DOMAIN-SUFFIX,fnac.be,Proxy
- DOMAIN-SUFFIX,fnac.com,Proxy
- DOMAIN-SUFFIX,funkyimg.com,Proxy
- DOMAIN-SUFFIX,fxnetworks.com,Proxy
- DOMAIN-SUFFIX,gettyimages.com,Proxy
- DOMAIN-SUFFIX,jcpenney.com,Proxy
- DOMAIN-SUFFIX,kknews.cc,Proxy
- DOMAIN-SUFFIX,nationwide.com,Proxy
- DOMAIN-SUFFIX,nbc.com,Proxy
- DOMAIN-SUFFIX,nordstrom.com,Proxy
- DOMAIN-SUFFIX,nordstromimage.com,Proxy
- DOMAIN-SUFFIX,nordstromrack.com,Proxy
- DOMAIN-SUFFIX,read01.com,Proxy
- DOMAIN-SUFFIX,superpages.com,Proxy
- DOMAIN-SUFFIX,target.com,Proxy
- DOMAIN-SUFFIX,thinkgeek.com,Proxy
- DOMAIN-SUFFIX,tracfone.com,Proxy
- DOMAIN-SUFFIX,uploader.jp,Proxy
- DOMAIN-SUFFIX,vevo.com,Proxy
- DOMAIN-SUFFIX,viu.tv,Proxy
- DOMAIN-SUFFIX,vk.com,Proxy
- DOMAIN-SUFFIX,vsco.co,Proxy
- DOMAIN-SUFFIX,xfinity.com,Proxy
- DOMAIN-SUFFIX,zattoo.com,Proxy
- DOMAIN,abc.com,Proxy
- DOMAIN,abc.go.com,Proxy
- DOMAIN,abc.net.au,Proxy
- DOMAIN,wego.here.com,Proxy
# > Telegram
- DOMAIN-SUFFIX,t.me,Proxy
- DOMAIN-SUFFIX,tdesktop.com,Proxy
- DOMAIN-SUFFIX,telegra.ph,Proxy
- DOMAIN-SUFFIX,telegram.me,Proxy
- DOMAIN-SUFFIX,telegram.org,Proxy
- IP-CIDR,91.108.0.0/16,Proxy,no-resolve
- IP-CIDR,109.239.140.0/24,Proxy,no-resolve
- IP-CIDR,149.154.160.0/20,Proxy,no-resolve
- IP-CIDR6,2001:67c:4e8::/48,Proxy,no-resolve
- IP-CIDR6,2001:b28:f23d::/48,Proxy,no-resolve
- IP-CIDR6,2001:b28:f23f::/48,Proxy,no-resolve
#USER-AGENT,Roam*,Proxy
# (The Most Popular Sites)
# > Apple
# > Apple URL Shortener
- DOMAIN-SUFFIX,appsto.re,Proxy
# > TestFlight
- DOMAIN,beta.itunes.apple.com,Proxy
# > iBooks Store download
- DOMAIN,books.itunes.apple.com,Proxy
# > iTunes Store Moveis Trailers
- DOMAIN,hls.itunes.apple.com,Proxy
# App Store Preview
- DOMAIN,itunes.apple.com,Proxy
# > Spotlight
- DOMAIN,api-glb-sea.smoot.apple.com,Proxy
# > Dictionary
- DOMAIN,lookup-api.apple.com,Proxy
#PROCESS-NAME,LookupViewService,Proxy
# > Google
- DOMAIN-SUFFIX,abc.xyz,Proxy
- DOMAIN-SUFFIX,android.com,Proxy
- DOMAIN-SUFFIX,androidify.com,Proxy
- DOMAIN-SUFFIX,dialogflow.com,Proxy
- DOMAIN-SUFFIX,autodraw.com,Proxy
- DOMAIN-SUFFIX,capitalg.com,Proxy
- DOMAIN-SUFFIX,certificate-transparency.org,Proxy
- DOMAIN-SUFFIX,chrome.com,Proxy
- DOMAIN-SUFFIX,chromeexperiments.com,Proxy
- DOMAIN-SUFFIX,chromestatus.com,Proxy
- DOMAIN-SUFFIX,chromium.org,Proxy
- DOMAIN-SUFFIX,creativelab5.com,Proxy
- DOMAIN-SUFFIX,debug.com,Proxy
- DOMAIN-SUFFIX,deepmind.com,Proxy
- DOMAIN-SUFFIX,firebaseio.com,Proxy
- DOMAIN-SUFFIX,getmdl.io,Proxy
- DOMAIN-SUFFIX,ggpht.com,Proxy
- DOMAIN-SUFFIX,gmail.com,Proxy
- DOMAIN-SUFFIX,gmodules.com,Proxy
- DOMAIN-SUFFIX,godoc.org,Proxy
- DOMAIN-SUFFIX,golang.org,Proxy
- DOMAIN-SUFFIX,gstatic.com,Proxy
- DOMAIN-SUFFIX,gv.com,Proxy
- DOMAIN-SUFFIX,gwtproject.org,Proxy
- DOMAIN-SUFFIX,itasoftware.com,Proxy
- DOMAIN-SUFFIX,madewithcode.com,Proxy
- DOMAIN-SUFFIX,material.io,Proxy
- DOMAIN-SUFFIX,polymer-project.org,Proxy
- DOMAIN-SUFFIX,admin.recaptcha.net,Proxy
- DOMAIN-SUFFIX,recaptcha.net,Proxy
- DOMAIN-SUFFIX,shattered.io,Proxy
- DOMAIN-SUFFIX,synergyse.com,Proxy
- DOMAIN-SUFFIX,tensorflow.org,Proxy
- DOMAIN-SUFFIX,tiltbrush.com,Proxy
- DOMAIN-SUFFIX,waveprotocol.org,Proxy
- DOMAIN-SUFFIX,waymo.com,Proxy
- DOMAIN-SUFFIX,webmproject.org,Proxy
- DOMAIN-SUFFIX,webrtc.org,Proxy
- DOMAIN-SUFFIX,whatbrowser.org,Proxy
- DOMAIN-SUFFIX,widevine.com,Proxy
- DOMAIN-SUFFIX,x.company,Proxy
- DOMAIN-SUFFIX,youtu.be,Proxy
- DOMAIN-SUFFIX,yt.be,Proxy
- DOMAIN-SUFFIX,ytimg.com,Proxy
# > Steam
- DOMAIN,media.steampowered.com,Proxy
- DOMAIN,store.steampowered.com,Proxy
# > Other
- DOMAIN-SUFFIX,0rz.tw,Proxy
- DOMAIN-SUFFIX,4bluestones.biz,Proxy
- DOMAIN-SUFFIX,9bis.net,Proxy
- DOMAIN-SUFFIX,allconnected.co,Proxy
- DOMAIN-SUFFIX,amazonaws.com,Proxy
- DOMAIN-SUFFIX,aol.com,Proxy
- DOMAIN-SUFFIX,bcc.com.tw,Proxy
- DOMAIN-SUFFIX,bit.ly,Proxy
- DOMAIN-SUFFIX,bitshare.com,Proxy
- DOMAIN-SUFFIX,blog.jp,Proxy
- DOMAIN-SUFFIX,blogimg.jp,Proxy
- DOMAIN-SUFFIX,blogtd.org,Proxy
- DOMAIN-SUFFIX,broadcast.co.nz,Proxy
- DOMAIN-SUFFIX,camfrog.com,Proxy
- DOMAIN-SUFFIX,cfos.de,Proxy
- DOMAIN-SUFFIX,citypopulation.de,Proxy
- DOMAIN-SUFFIX,cloudfront.net,Proxy
- DOMAIN-SUFFIX,ctitv.com.tw,Proxy
- DOMAIN-SUFFIX,cuhk.edu.hk,Proxy
- DOMAIN-SUFFIX,cusu.hk,Proxy
- DOMAIN-SUFFIX,discuss.com.hk,Proxy
- DOMAIN-SUFFIX,dropboxapi.com,Proxy
- DOMAIN-SUFFIX,edditstatic.com,Proxy
- DOMAIN-SUFFIX,flickriver.com,Proxy
- DOMAIN-SUFFIX,focustaiwan.tw,Proxy
- DOMAIN-SUFFIX,free.fr,Proxy
- DOMAIN-SUFFIX,ftchinese.com,Proxy
- DOMAIN-SUFFIX,gigacircle.com,Proxy
- DOMAIN-SUFFIX,gov,Proxy
- DOMAIN-SUFFIX,hk-pub.com,Proxy
- DOMAIN-SUFFIX,hosting.co.uk,Proxy
- DOMAIN-SUFFIX,hwcdn.net,Proxy
- DOMAIN-SUFFIX,jtvnw.net,Proxy
- DOMAIN-SUFFIX,linksalpha.com,Proxy
- DOMAIN-SUFFIX,manyvids.com,Proxy
- DOMAIN-SUFFIX,myactimes.com,Proxy
- DOMAIN-SUFFIX,newsblur.com,Proxy
- DOMAIN-SUFFIX,now.im,Proxy
- DOMAIN-SUFFIX,redditlist.com,Proxy
- DOMAIN-SUFFIX,signal.org,Proxy
- DOMAIN-SUFFIX,sparknotes.com,Proxy
- DOMAIN-SUFFIX,streetvoice.com,Proxy
- DOMAIN-SUFFIX,ttvnw.net,Proxy
- DOMAIN-SUFFIX,tv.com,Proxy
- DOMAIN-SUFFIX,twitchcdn.net,Proxy
- DOMAIN-SUFFIX,typepad.com,Proxy
- DOMAIN-SUFFIX,udnbkk.com,Proxy
- DOMAIN-SUFFIX,whispersystems.org,Proxy
- DOMAIN-SUFFIX,wikia.com,Proxy
- DOMAIN-SUFFIX,wn.com,Proxy
- DOMAIN-SUFFIX,wolframalpha.com,Proxy
- DOMAIN-SUFFIX,x-art.com,Proxy
- DOMAIN-SUFFIX,yimg.com,Proxy
- DOMAIN-KEYWORD,dlercloud,Proxy
- DOMAIN-SUFFIX,dler.cloud,Proxy
# Local Area Network
- DOMAIN-KEYWORD,announce,DIRECT
- DOMAIN-KEYWORD,torrent,DIRECT
- DOMAIN-KEYWORD,tracker,DIRECT
- DOMAIN-SUFFIX,smtp,DIRECT
- DOMAIN-SUFFIX,local,DIRECT
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,100.64.0.0/10,DIRECT
# # > IQIYI
# - IP-CIDR,101.227.0.0/16,Bilibili|iQIYI|NeteaseMusic|TencentVideo
# - IP-CIDR,101.224.0.0/13,Bilibili|iQIYI|NeteaseMusic|TencentVideo
# - IP-CIDR,119.176.0.0/12,Bilibili|iQIYI|NeteaseMusic|TencentVideo
# # > Youku
# - IP-CIDR,106.11.0.0/16,Bilibili|iQIYI|NeteaseMusic|TencentVideo
# > Telegram
- IP-CIDR,67.198.55.0/24,Proxy
- IP-CIDR,91.108.4.0/22,Proxy
- IP-CIDR,91.108.8.0/22,Proxy
- IP-CIDR,91.108.12.0/22,Proxy
- IP-CIDR,91.108.16.0/22,Proxy
- IP-CIDR,91.108.56.0/22,Proxy
- IP-CIDR,109.239.140.0/24,Proxy
- IP-CIDR,149.154.160.0/20,Proxy
- IP-CIDR,205.172.60.0/22,Proxy
# (Extra IP-CIRD)
# > Google
- IP-CIDR,35.190.247.0/24,Proxy
- IP-CIDR,64.233.160.0/19,Proxy
- IP-CIDR,66.102.0.0/20,Proxy
- IP-CIDR,66.249.80.0/20,Proxy
- IP-CIDR,72.14.192.0/18,Proxy
- IP-CIDR,74.125.0.0/16,Proxy
- IP-CIDR,108.177.8.0/21,Proxy
- IP-CIDR,172.217.0.0/16,Proxy
- IP-CIDR,173.194.0.0/16,Proxy
- IP-CIDR,209.85.128.0/17,Proxy
- IP-CIDR,216.58.192.0/19,Proxy
- IP-CIDR,216.239.32.0/19,Proxy
# > Facebook
- IP-CIDR,31.13.24.0/21,Proxy
- IP-CIDR,31.13.64.0/18,Proxy
- IP-CIDR,45.64.40.0/22,Proxy
- IP-CIDR,66.220.144.0/20,Proxy
- IP-CIDR,69.63.176.0/20,Proxy
- IP-CIDR,69.171.224.0/19,Proxy
- IP-CIDR,74.119.76.0/22,Proxy
- IP-CIDR,103.4.96.0/22,Proxy
- IP-CIDR,129.134.0.0/17,Proxy
- IP-CIDR,157.240.0.0/17,Proxy
- IP-CIDR,173.252.64.0/19,Proxy
- IP-CIDR,173.252.96.0/19,Proxy
- IP-CIDR,179.60.192.0/22,Proxy
- IP-CIDR,185.60.216.0/22,Proxy
- IP-CIDR,204.15.20.0/22,Proxy
# > Twitter
- IP-CIDR,69.195.160.0/19,Proxy
- IP-CIDR,104.244.42.0/21,Proxy
- IP-CIDR,192.133.76.0/22,Proxy
- IP-CIDR,199.16.156.0/22,Proxy
- IP-CIDR,199.59.148.0/22,Proxy
- IP-CIDR,199.96.56.0/21,Proxy
- IP-CIDR,202.160.128.0/22,Proxy
- IP-CIDR,209.237.192.0/19,Proxy
# GeoIP China
- GEOIP,CN,Domestic
- MATCH,Others

View File

@@ -0,0 +1,28 @@
mixed-port: 7890
allow-lan: false
external-controller: 127.0.0.1:61889
secret: 5c090877-21bb-4006-a97c-0bd4bfbb9be9
log-level: info
ipv6: false
proxy-groups:
- name: PROXY-ALL
type: select
proxies:
- tc-sh
proxies:
- name: proxy-server
type: socks5
server: 192.168.11.19
port: 22999
username: zeaslity
password: password
- name: tc-sh
type: socks5
server: 42.192.52.227
port: 28888
username: zeaslity
password: lovemm.23
- name: tc-sh
type: socks5
server: 42.192.52.227
port: 28889

Binary file not shown.

View File

@@ -0,0 +1,2 @@
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install --without-geodata

View File

@@ -0,0 +1,21 @@
# 香港 xx.tc.hk.go.107421.xyz
# Seoul-arm64-01 xx.s0.yy.ac.107421.xyz
# Seoul-amd64-04 xx.s4.cc.hh.107421.xyz
# LosAngeles-amd64-01 xx.l4.cc.nn.107421.xyz
export DOMAIN_NAME=xx.l4.cc.nn.107421.xyz
export CF_Token="oXJRP5XI8Zhipa_PtYtB_jy6qWL0I9BosrJEYE8p"
export CF_Account_ID="dfaadeb83406ef5ad35da02617af9191"
export CF_Zone_ID="511894a4f1357feb905e974e16241ebb"
acme.sh --issue --dns dns_cf -d ${DOMAIN_NAME} --keylength ec-256
chmod -R 644 /root/.acme.sh/${DOMAIN_NAME}_ecc/fullchain.cer
chmod -R 644 /root/.acme.sh/${DOMAIN_NAME}_ecc/${DOMAIN_NAME}.key
systemctl restart xray && sleep 1 && systemctl status xray
curl https://get.acme.sh | sh -s email=ice@qq.com

View File

@@ -0,0 +1,744 @@
#!/usr/bin/env bash
#====================================================
# System Request:Debian 9+/Ubuntu 18.04+/Centos 7+
# Author: wulabing
# Dscription: Xray onekey Management
# email: admin@wulabing.com
#====================================================
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
stty erase ^?
cd "$(
cd "$(dirname "$0")" || exit
pwd
)" || exit
# 字体颜色配置
Green="\033[32m"
Red="\033[31m"
Yellow="\033[33m"
Blue="\033[36m"
Font="\033[0m"
GreenBG="\033[42;37m"
RedBG="\033[41;37m"
OK="${Green}[OK]${Font}"
ERROR="${Red}[ERROR]${Font}"
# 变量
shell_version="1.3.7"
github_branch="main"
xray_conf_dir="/usr/local/etc/xray"
website_dir="/www/xray_web/"
xray_access_log="/var/log/xray/access.log"
xray_error_log="/var/log/xray/error.log"
cert_dir="/usr/local/etc/xray"
domain_tmp_dir="/usr/local/etc/xray"
cert_group="nobody"
random_num=$((RANDOM % 12 + 4))
VERSION=$(echo "${VERSION}" | awk -F "[()]" '{print $2}')
WS_PATH="/$(head -n 10 /dev/urandom | md5sum | head -c ${random_num})/"
function shell_mode_check() {
if [ -f ${xray_conf_dir}/config.json ]; then
if [ "$(grep -c "wsSettings" ${xray_conf_dir}/config.json)" -ge 1 ]; then
shell_mode="ws"
else
shell_mode="tcp"
fi
else
shell_mode="None"
fi
}
function print_ok() {
echo -e "${OK} ${Blue} $1 ${Font}"
}
function print_error() {
echo -e "${ERROR} ${RedBG} $1 ${Font}"
}
function is_root() {
if [[ 0 == "$UID" ]]; then
print_ok "当前用户是 root 用户,开始安装流程"
else
print_error "当前用户不是 root 用户,请切换到 root 用户后重新执行脚本"
exit 1
fi
}
judge() {
if [[ 0 -eq $? ]]; then
print_ok "$1 完成"
sleep 1
else
print_error "$1 失败"
exit 1
fi
}
function system_check() {
source '/etc/os-release'
if [[ "${ID}" == "centos" && ${VERSION_ID} -ge 7 ]]; then
print_ok "当前系统为 Centos ${VERSION_ID} ${VERSION}"
INS="yum install -y"
wget -N -P /etc/yum.repos.d/ https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/basic/nginx.repo
elif [[ "${ID}" == "ol" ]]; then
print_ok "当前系统为 Oracle Linux ${VERSION_ID} ${VERSION}"
INS="yum install -y"
wget -N -P /etc/yum.repos.d/ https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/basic/nginx.repo
elif [[ "${ID}" == "debian" && ${VERSION_ID} -ge 9 ]]; then
print_ok "当前系统为 Debian ${VERSION_ID} ${VERSION}"
INS="apt install -y"
# 清除可能的遗留问题
rm -f /etc/apt/sources.list.d/nginx.list
$INS lsb-release gnupg2
echo "deb http://nginx.org/packages/debian $(lsb_release -cs) nginx" >/etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add -
apt update
elif [[ "${ID}" == "ubuntu" && $(echo "${VERSION_ID}" | cut -d '.' -f1) -ge 18 ]]; then
print_ok "当前系统为 Ubuntu ${VERSION_ID} ${UBUNTU_CODENAME}"
INS="apt install -y"
# 清除可能的遗留问题
rm -f /etc/apt/sources.list.d/nginx.list
$INS lsb-release gnupg2
echo "deb http://nginx.org/packages/ubuntu $(lsb_release -cs) nginx" >/etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add -
apt update
else
print_error "当前系统为 ${ID} ${VERSION_ID} 不在支持的系统列表内"
exit 1
fi
if [[ $(grep "nogroup" /etc/group) ]]; then
cert_group="nogroup"
fi
$INS dbus
# 关闭各类防火墙
systemctl stop firewalld
systemctl disable firewalld
systemctl stop nftables
systemctl disable nftables
systemctl stop ufw
systemctl disable ufw
}
function nginx_install() {
if ! command -v nginx >/dev/null 2>&1; then
${INS} nginx
judge "Nginx 安装"
else
print_ok "Nginx 已存在"
${INS} nginx
fi
# 遗留问题处理
mkdir -p /etc/nginx/conf.d >/dev/null 2>&1
}
function dependency_install() {
${INS} wget lsof tar
judge "安装 wget lsof tar"
if [[ "${ID}" == "centos" || "${ID}" == "ol" ]]; then
${INS} crontabs
else
${INS} cron
fi
judge "安装 crontab"
if [[ "${ID}" == "centos" || "${ID}" == "ol" ]]; then
touch /var/spool/cron/root && chmod 600 /var/spool/cron/root
systemctl start crond && systemctl enable crond
else
touch /var/spool/cron/crontabs/root && chmod 600 /var/spool/cron/crontabs/root
systemctl start cron && systemctl enable cron
fi
judge "crontab 自启动配置 "
${INS} unzip
judge "安装 unzip"
${INS} curl
judge "安装 curl"
# upgrade systemd
${INS} systemd
judge "安装/升级 systemd"
# Nginx 后置 无需编译 不再需要
# if [[ "${ID}" == "centos" || "${ID}" == "ol" ]]; then
# yum -y groupinstall "Development tools"
# else
# ${INS} build-essential
# fi
# judge "编译工具包 安装"
if [[ "${ID}" == "centos" ]]; then
${INS} pcre pcre-devel zlib-devel epel-release openssl openssl-devel
elif [[ "${ID}" == "ol" ]]; then
${INS} pcre pcre-devel zlib-devel openssl openssl-devel
# Oracle Linux 不同日期版本的 VERSION_ID 比较乱 直接暴力处理
yum-config-manager --enable ol7_developer_EPEL >/dev/null 2>&1
yum-config-manager --enable ol8_developer_EPEL >/dev/null 2>&1
else
${INS} libpcre3 libpcre3-dev zlib1g-dev openssl libssl-dev
fi
${INS} jq
if ! command -v jq; then
wget -P /usr/bin https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/binary/jq && chmod +x /usr/bin/jq
judge "安装 jq"
fi
# 防止部分系统xray的默认bin目录缺失
mkdir /usr/local/bin >/dev/null 2>&1
}
function basic_optimization() {
# 最大文件打开数
sed -i '/^\*\ *soft\ *nofile\ *[[:digit:]]*/d' /etc/security/limits.conf
sed -i '/^\*\ *hard\ *nofile\ *[[:digit:]]*/d' /etc/security/limits.conf
echo '* soft nofile 65536' >>/etc/security/limits.conf
echo '* hard nofile 65536' >>/etc/security/limits.conf
# 关闭 Selinux
if [[ "${ID}" == "centos" || "${ID}" == "ol" ]]; then
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
setenforce 0
fi
}
function domain_check() {
read -rp "请输入你的域名信息(eg: www.wulabing.com):" domain
domain_ip=$(ping "${domain}" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')
print_ok "正在获取 IP 地址信息,请耐心等待"
local_ip=$(curl -4L api64.ipify.org)
echo -e "域名通过 DNS 解析的 IP 地址:${domain_ip}"
echo -e "本机公网 IP 地址: ${local_ip}"
sleep 2
if [[ ${domain_ip} == "${local_ip}" ]]; then
print_ok "域名通过 DNS 解析的 IP 地址与 本机 IP 地址匹配"
sleep 2
else
print_error "请确保域名添加了正确的 A 记录,否则将无法正常使用 xray"
print_error "域名通过 DNS 解析的 IP 地址与 本机 IP 地址不匹配是否继续安装y/n" && read -r install
case $install in
[yY][eE][sS] | [yY])
print_ok "继续安装"
sleep 2
;;
*)
print_error "安装终止"
exit 2
;;
esac
fi
}
function port_exist_check() {
if [[ 0 -eq $(lsof -i:"$1" | grep -i -c "listen") ]]; then
print_ok "$1 端口未被占用"
sleep 1
else
print_error "检测到 $1 端口被占用,以下为 $1 端口占用信息"
lsof -i:"$1"
print_error "5s 后将尝试自动 kill 占用进程"
sleep 5
lsof -i:"$1" | awk '{print $2}' | grep -v "PID" | xargs kill -9
print_ok "kill 完成"
sleep 1
fi
}
function update_sh() {
ol_version=$(curl -L -s https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/install.sh | grep "shell_version=" | head -1 | awk -F '=|"' '{print $3}')
if [[ "$shell_version" != "$(echo -e "$shell_version\n$ol_version" | sort -rV | head -1)" ]]; then
print_ok "存在新版本,是否更新 [Y/N]?"
read -r update_confirm
case $update_confirm in
[yY][eE][sS] | [yY])
wget -N --no-check-certificate https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/install.sh
print_ok "更新完成"
print_ok "您可以通过 bash $0 执行本程序"
exit 0
;;
*) ;;
esac
else
print_ok "当前版本为最新版本"
print_ok "您可以通过 bash $0 执行本程序"
fi
}
function xray_tmp_config_file_check_and_use() {
if [[ -s ${xray_conf_dir}/config_tmp.json ]]; then
mv -f ${xray_conf_dir}/config_tmp.json ${xray_conf_dir}/config.json
else
print_error "xray 配置文件修改异常"
fi
}
function modify_UUID() {
[ -z "$UUID" ] && UUID=$(cat /proc/sys/kernel/random/uuid)
cat ${xray_conf_dir}/config.json | jq 'setpath(["inbounds",0,"settings","clients",0,"id"];"'${UUID}'")' >${xray_conf_dir}/config_tmp.json
xray_tmp_config_file_check_and_use
judge "Xray TCP UUID 修改"
}
function modify_UUID_ws() {
cat ${xray_conf_dir}/config.json | jq 'setpath(["inbounds",1,"settings","clients",0,"id"];"'${UUID}'")' >${xray_conf_dir}/config_tmp.json
xray_tmp_config_file_check_and_use
judge "Xray ws UUID 修改"
}
function modify_fallback_ws() {
cat ${xray_conf_dir}/config.json | jq 'setpath(["inbounds",0,"settings","fallbacks",2,"path"];"'${WS_PATH}'")' >${xray_conf_dir}/config_tmp.json
xray_tmp_config_file_check_and_use
judge "Xray fallback_ws 修改"
}
function modify_ws() {
cat ${xray_conf_dir}/config.json | jq 'setpath(["inbounds",1,"streamSettings","wsSettings","path"];"'${WS_PATH}'")' >${xray_conf_dir}/config_tmp.json
xray_tmp_config_file_check_and_use
judge "Xray ws 修改"
}
function configure_nginx() {
nginx_conf="/etc/nginx/conf.d/${domain}.conf"
cd /etc/nginx/conf.d/ && rm -f ${domain}.conf && wget -O ${domain}.conf https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/config/web.conf
sed -i "s/xxx/${domain}/g" ${nginx_conf}
judge "Nginx config modify"
systemctl restart nginx
}
function modify_port() {
read -rp "请输入端口号(默认443)" PORT
[ -z "$PORT" ] && PORT="443"
if [[ $PORT -le 0 ]] || [[ $PORT -gt 65535 ]]; then
print_error "请输入 0-65535 之间的值"
exit 1
fi
port_exist_check $PORT
cat ${xray_conf_dir}/config.json | jq 'setpath(["inbounds",0,"port"];'${PORT}')' >${xray_conf_dir}/config_tmp.json
xray_tmp_config_file_check_and_use
judge "Xray 端口 修改"
}
function configure_xray() {
cd /usr/local/etc/xray && rm -f config.json && wget -O config.json https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/config/xray_xtls-rprx-direct.json
modify_UUID
modify_port
}
function configure_xray_ws() {
cd /usr/local/etc/xray && rm -f config.json && wget -O config.json https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/config/xray_tls_ws_mix-rprx-direct.json
modify_UUID
modify_UUID_ws
modify_port
modify_fallback_ws
modify_ws
}
function xray_install() {
print_ok "安装 Xray"
curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh | bash -s -- install
judge "Xray 安装"
# 用于生成 Xray 的导入链接
echo $domain >$domain_tmp_dir/domain
judge "域名记录"
}
function ssl_install() {
# 使用 Nginx 配合签发 无需安装相关依赖
# if [[ "${ID}" == "centos" || "${ID}" == "ol" ]]; then
# ${INS} socat nc
# else
# ${INS} socat netcat
# fi
# judge "安装 SSL 证书生成脚本依赖"
curl -L get.acme.sh | bash
judge "安装 SSL 证书生成脚本"
}
function acme() {
"$HOME"/.acme.sh/acme.sh --set-default-ca --server letsencrypt
sed -i "6s/^/#/" "$nginx_conf"
sed -i "6a\\\troot $website_dir;" "$nginx_conf"
systemctl restart nginx
if "$HOME"/.acme.sh/acme.sh --issue -d "${domain}" --webroot "$website_dir" -k ec-256 --force; then
print_ok "SSL 证书生成成功"
sleep 2
if "$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath /ssl/xray.crt --keypath /ssl/xray.key --reloadcmd "systemctl restart xray" --ecc --force; then
print_ok "SSL 证书配置成功"
sleep 2
fi
else
print_error "SSL 证书生成失败"
rm -rf "$HOME/.acme.sh/${domain}_ecc"
exit 1
fi
sed -i "7d" "$nginx_conf"
sed -i "6s/#//" "$nginx_conf"
}
function ssl_judge_and_install() {
mkdir -p /ssl >/dev/null 2>&1
if [[ -f "/ssl/xray.key" || -f "/ssl/xray.crt" ]]; then
print_ok "/ssl 目录下证书文件已存在"
print_ok "是否删除 /ssl 目录下的证书文件 [Y/N]?"
read -r ssl_delete
case $ssl_delete in
[yY][eE][sS] | [yY])
rm -rf /ssl/*
print_ok "已删除"
;;
*) ;;
esac
fi
if [[ -f "/ssl/xray.key" || -f "/ssl/xray.crt" ]]; then
echo "证书文件已存在"
elif [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]]; then
echo "证书文件已存在"
"$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath /ssl/xray.crt --keypath /ssl/xray.key --ecc
judge "证书应用"
else
mkdir /ssl
cp -a $cert_dir/self_signed_cert.pem /ssl/xray.crt
cp -a $cert_dir/self_signed_key.pem /ssl/xray.key
ssl_install
acme
fi
# Xray 默认以 nobody 用户运行,证书权限适配
chown -R nobody.$cert_group /ssl/*
}
function generate_certificate() {
signedcert=$(xray tls cert -domain="$local_ip" -name="$local_ip" -org="$local_ip" -expire=87600h)
echo $signedcert | jq '.certificate[]' | sed 's/\"//g' | tee $cert_dir/self_signed_cert.pem
echo $signedcert | jq '.key[]' | sed 's/\"//g' >$cert_dir/self_signed_key.pem
openssl x509 -in $cert_dir/self_signed_cert.pem -noout || 'print_error "生成自签名证书失败" && exit 1'
print_ok "生成自签名证书成功"
chown nobody.$cert_group $cert_dir/self_signed_cert.pem
chown nobody.$cert_group $cert_dir/self_signed_key.pem
}
function configure_web() {
rm -rf /www/xray_web
mkdir -p /www/xray_web
wget -O web.tar.gz https://raw.githubusercontent.com/wulabing/Xray_onekey/main/basic/web.tar.gz
tar xzf web.tar.gz -C /www/xray_web
judge "站点伪装"
rm -f web.tar.gz
}
function xray_uninstall() {
curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh | bash -s -- remove --purge
rm -rf $website_dir
print_ok "是否卸载nginx [Y/N]?"
read -r uninstall_nginx
case $uninstall_nginx in
[yY][eE][sS] | [yY])
if [[ "${ID}" == "centos" || "${ID}" == "ol" ]]; then
yum remove nginx -y
else
apt purge nginx -y
fi
;;
*) ;;
esac
print_ok "是否卸载acme.sh [Y/N]?"
read -r uninstall_acme
case $uninstall_acme in
[yY][eE][sS] | [yY])
/root/.acme.sh/acme.sh --uninstall
rm -rf /root/.acme.sh
rm -rf /ssl/
;;
*) ;;
esac
print_ok "卸载完成"
exit 0
}
function restart_all() {
systemctl restart nginx
judge "Nginx 启动"
systemctl restart xray
judge "Xray 启动"
}
function vless_xtls-rprx-direct_link() {
UUID=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].id | tr -d '"')
PORT=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].port)
FLOW=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].flow | tr -d '"')
DOMAIN=$(cat ${domain_tmp_dir}/domain)
print_ok "URL 链接VLESS + TCP + TLS"
print_ok "vless://$UUID@$DOMAIN:$PORT?security=tls&flow=$FLOW#TLS_wulabing-$DOMAIN"
print_ok "URL 链接VLESS + TCP + XTLS"
print_ok "vless://$UUID@$DOMAIN:$PORT?security=xtls&flow=$FLOW#XTLS_wulabing-$DOMAIN"
print_ok "-------------------------------------------------"
print_ok "URL 二维码VLESS + TCP + TLS请在浏览器中访问"
print_ok "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless://$UUID@$DOMAIN:$PORT?security=tls%26flow=$FLOW%23TLS_wulabing-$DOMAIN"
print_ok "URL 二维码VLESS + TCP + XTLS请在浏览器中访问"
print_ok "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless://$UUID@$DOMAIN:$PORT?security=xtls%26flow=$FLOW%23XTLS_wulabing-$DOMAIN"
}
function vless_xtls-rprx-direct_information() {
UUID=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].id | tr -d '"')
PORT=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].port)
FLOW=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].flow | tr -d '"')
DOMAIN=$(cat ${domain_tmp_dir}/domain)
echo -e "${Red} Xray 配置信息 ${Font}"
echo -e "${Red} 地址address:${Font} $DOMAIN"
echo -e "${Red} 端口port${Font} $PORT"
echo -e "${Red} 用户 IDUUID${Font} $UUID"
echo -e "${Red} 流控flow${Font} $FLOW"
echo -e "${Red} 加密方式security${Font} none "
echo -e "${Red} 传输协议network${Font} tcp "
echo -e "${Red} 伪装类型type${Font} none "
echo -e "${Red} 底层传输安全:${Font} xtls 或 tls"
}
function ws_information() {
UUID=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].id | tr -d '"')
PORT=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].port)
FLOW=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].flow | tr -d '"')
WS_PATH=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.fallbacks[2].path | tr -d '"')
DOMAIN=$(cat ${domain_tmp_dir}/domain)
echo -e "${Red} Xray 配置信息 ${Font}"
echo -e "${Red} 地址address:${Font} $DOMAIN"
echo -e "${Red} 端口port${Font} $PORT"
echo -e "${Red} 用户 IDUUID${Font} $UUID"
echo -e "${Red} 加密方式security${Font} none "
echo -e "${Red} 传输协议network${Font} ws "
echo -e "${Red} 伪装类型type${Font} none "
echo -e "${Red} 路径path${Font} $WS_PATH "
echo -e "${Red} 底层传输安全:${Font} tls "
}
function ws_link() {
UUID=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].id | tr -d '"')
PORT=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].port)
FLOW=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].flow | tr -d '"')
WS_PATH=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.fallbacks[2].path | tr -d '"')
WS_PATH_WITHOUT_SLASH=$(echo $WS_PATH | tr -d '/')
DOMAIN=$(cat ${domain_tmp_dir}/domain)
print_ok "URL 链接VLESS + TCP + TLS"
print_ok "vless://$UUID@$DOMAIN:$PORT?security=tls#TLS_wulabing-$DOMAIN"
print_ok "URL 链接VLESS + TCP + XTLS"
print_ok "vless://$UUID@$DOMAIN:$PORT?security=xtls&flow=$FLOW#XTLS_wulabing-$DOMAIN"
print_ok "URL 链接VLESS + WebSocket + TLS"
print_ok "vless://$UUID@$DOMAIN:$PORT?type=ws&security=tls&path=%2f${WS_PATH_WITHOUT_SLASH}%2f#WS_TLS_wulabing-$DOMAIN"
print_ok "-------------------------------------------------"
print_ok "URL 二维码VLESS + TCP + TLS请在浏览器中访问"
print_ok "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless://$UUID@$DOMAIN:$PORT?security=tls%23TLS_wulabing-$DOMAIN"
print_ok "URL 二维码VLESS + TCP + XTLS请在浏览器中访问"
print_ok "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless://$UUID@$DOMAIN:$PORT?security=xtls%26flow=$FLOW%23XTLS_wulabing-$DOMAIN"
print_ok "URL 二维码VLESS + WebSocket + TLS请在浏览器中访问"
print_ok "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless://$UUID@$DOMAIN:$PORT?type=ws%26security=tls%26path=%2f${WS_PATH_WITHOUT_SLASH}%2f%23WS_TLS_wulabing-$DOMAIN"
}
function basic_information() {
print_ok "VLESS+TCP+XTLS+Nginx 安装成功"
vless_xtls-rprx-direct_information
vless_xtls-rprx-direct_link
}
function basic_ws_information() {
print_ok "VLESS+TCP+TLS+Nginx with WebSocket 混合模式 安装成功"
ws_information
print_ok "————————————————————————"
vless_xtls-rprx-direct_information
ws_link
}
function show_access_log() {
[ -f ${xray_access_log} ] && tail -f ${xray_access_log} || echo -e "${RedBG}log文件不存在${Font}"
}
function show_error_log() {
[ -f ${xray_error_log} ] && tail -f ${xray_error_log} || echo -e "${RedBG}log文件不存在${Font}"
}
function bbr_boost_sh() {
[ -f "tcp.sh" ] && rm -rf ./tcp.sh
wget -N --no-check-certificate "https://raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
}
function mtproxy_sh() {
wget -N --no-check-certificate "https://github.com/wulabing/mtp/raw/master/mtproxy.sh" && chmod +x mtproxy.sh && bash mtproxy.sh
}
function install_xray() {
is_root
system_check
dependency_install
basic_optimization
domain_check
port_exist_check 80
xray_install
configure_xray
nginx_install
configure_nginx
configure_web
generate_certificate
ssl_judge_and_install
restart_all
basic_information
}
function install_xray_ws() {
is_root
system_check
dependency_install
basic_optimization
domain_check
port_exist_check 80
xray_install
configure_xray_ws
nginx_install
configure_nginx
configure_web
generate_certificate
ssl_judge_and_install
restart_all
basic_ws_information
}
menu() {
#update_sh
shell_mode_check
echo -e "\t Xray 安装管理脚本 ${Red}[${shell_version}]${Font}"
echo -e "\t---authored by wulabing---"
echo -e "\thttps://github.com/wulabing\n"
echo -e "当前已安装版本:${shell_mode}"
echo -e "—————————————— 安装向导 ——————————————"""
echo -e "${Green}0.${Font} 升级 脚本"
echo -e "${Green}1.${Font} 安装 Xray (VLESS + TCP + XTLS / TLS + Nginx)"
echo -e "${Green}2.${Font} 安装 Xray (VLESS + TCP + XTLS / TLS + Nginx 及 VLESS + TCP + TLS + Nginx + WebSocket 回落并存模式)"
echo -e "—————————————— 配置变更 ——————————————"
echo -e "${Green}11.${Font} 变更 UUID"
echo -e "${Green}13.${Font} 变更 连接端口"
echo -e "${Green}14.${Font} 变更 WebSocket PATH"
echo -e "—————————————— 查看信息 ——————————————"
echo -e "${Green}21.${Font} 查看 实时访问日志"
echo -e "${Green}22.${Font} 查看 实时错误日志"
echo -e "${Green}23.${Font} 查看 Xray 配置链接"
# echo -e "${Green}23.${Font} 查看 V2Ray 配置信息"
echo -e "—————————————— 其他选项 ——————————————"
echo -e "${Green}31.${Font} 安装 4 合 1 BBR、锐速安装脚本"
echo -e "${Yellow}32.${Font} 安装 MTproxy(不推荐使用,请相关用户关闭或卸载)"
echo -e "${Green}33.${Font} 卸载 Xray"
echo -e "${Green}34.${Font} 更新 Xray-core"
echo -e "${Green}35.${Font} 安装 Xray-core 测试版(Pre)"
echo -e "${Green}36.${Font} 手动更新SSL证书"
echo -e "${Green}40.${Font} 退出"
read -rp "请输入数字:" menu_num
case $menu_num in
0)
update_sh
;;
1)
install_xray
;;
2)
install_xray_ws
;;
11)
read -rp "请输入UUID:" UUID
if [[ ${shell_mode} == "tcp" ]]; then
modify_UUID
elif [[ ${shell_mode} == "ws" ]]; then
modify_UUID
modify_UUID_ws
fi
restart_all
;;
13)
modify_port
restart_all
;;
14)
if [[ ${shell_mode} == "ws" ]]; then
read -rp "请输入路径(示例:/wulabing/ 要求两侧都包含/):" WS_PATH
modify_fallback_ws
modify_ws
restart_all
else
print_error "当前模式不是Websocket模式"
fi
;;
21)
tail -f $xray_access_log
;;
22)
tail -f $xray_error_log
;;
23)
if [[ -f $xray_conf_dir/config.json ]]; then
if [[ ${shell_mode} == "tcp" ]]; then
basic_information
elif [[ ${shell_mode} == "ws" ]]; then
basic_ws_information
fi
else
print_error "xray 配置文件不存在"
fi
;;
31)
bbr_boost_sh
;;
32)
mtproxy_sh
;;
33)
source '/etc/os-release'
xray_uninstall
;;
34)
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" - install
restart_all
;;
35)
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" - install --beta
restart_all
;;
36)
"/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh"
restart_all
;;
40)
exit 0
;;
*)
print_error "请输入正确的数字"
;;
esac
}
menu "$@"

View File

@@ -0,0 +1,911 @@
#!/usr/bin/env bash
# The files installed by the script conform to the Filesystem Hierarchy Standard:
# https://wiki.linuxfoundation.org/lsb/fhs
# The URL of the script project is:
# https://github.com/XTLS/Xray-install
# The URL of the scraaaaaipt is:
# https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh
# If the script executes incorrectly, go to:
# https://github.com/XTLS/Xray-install/issues
# You can set this variable whatever you want in shell session right before running this script by issuing:
# export DAT_PATH='/usr/local/share/xray'
DAT_PATH=${DAT_PATH:-/usr/local/share/xray}
# You can set this variable whatever you want in shell session right before running this script by issuing:
# export JSON_PATH='/usr/local/etc/xray'
JSON_PATH=${JSON_PATH:-/usr/local/etc/xray}
# Set this variable only if you are starting xray with multiple configuration files:
# export JSONS_PATH='/usr/local/etc/xray'
# Set this variable only if you want this script to check all the systemd unit file:
# export check_all_service_files='yes'
# Gobal verbals
if [[ -f '/etc/systemd/system/xray.service' ]] && [[ -f '/usr/local/bin/xray' ]]; then
XRAY_IS_INSTALLED_BEFORE_RUNNING_SCRIPT=1
else
XRAY_IS_INSTALLED_BEFORE_RUNNING_SCRIPT=0
fi
# Xray current version
CURRENT_VERSION=''
# Xray latest release version
RELEASE_LATEST=''
# Xray latest prerelease/release version
PRE_RELEASE_LATEST=''
# Xray version will be installed
INSTALL_VERSION=''
# install
INSTALL='0'
# install-geodata
INSTALL_GEODATA='0'
# remove
REMOVE='0'
# help
HELP='0'
# check
CHECK='0'
# --force
FORCE='0'
# --beta
BETA='0'
# --install-user ?
INSTALL_USER=''
# --without-geodata
NO_GEODATA='0'
# --without-logfiles
NO_LOGFILES='0'
# --no-update-service
N_UP_SERVICE='0'
# --reinstall
REINSTALL='0'
# --version ?
SPECIFIED_VERSION=''
# --local ?
LOCAL_FILE=''
# --proxy ?
PROXY=''
# --purge
PURGE='0'
curl() {
$(type -P curl) -L -q --retry 5 --retry-delay 10 --retry-max-time 60 "$@"
}
systemd_cat_config() {
if systemd-analyze --help | grep -qw 'cat-config'; then
systemd-analyze --no-pager cat-config "$@"
echo
else
echo "${aoi}~~~~~~~~~~~~~~~~"
cat "$@" "$1".d/*
echo "${aoi}~~~~~~~~~~~~~~~~"
echo "${red}warning: ${green}The systemd version on the current operating system is too low."
echo "${red}warning: ${green}Please consider to upgrade the systemd or the operating system.${reset}"
echo
fi
}
check_if_running_as_root() {
# If you want to run as another user, please modify $EUID to be owned by this user
if [[ "$EUID" -ne '0' ]]; then
echo "error: You must run this script as root!"
exit 1
fi
}
identify_the_operating_system_and_architecture() {
if [[ "$(uname)" == 'Linux' ]]; then
case "$(uname -m)" in
'i386' | 'i686')
MACHINE='32'
;;
'amd64' | 'x86_64')
MACHINE='64'
;;
'armv5tel')
MACHINE='arm32-v5'
;;
'armv6l')
MACHINE='arm32-v6'
grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5'
;;
'armv7' | 'armv7l')
MACHINE='arm32-v7a'
grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5'
;;
'armv8' | 'aarch64')
MACHINE='arm64-v8a'
;;
'mips')
MACHINE='mips32'
;;
'mipsle')
MACHINE='mips32le'
;;
'mips64')
MACHINE='mips64'
lscpu | grep -q "Little Endian" && MACHINE='mips64le'
;;
'mips64le')
MACHINE='mips64le'
;;
'ppc64')
MACHINE='ppc64'
;;
'ppc64le')
MACHINE='ppc64le'
;;
'riscv64')
MACHINE='riscv64'
;;
's390x')
MACHINE='s390x'
;;
*)
echo "error: The architecture is not supported."
exit 1
;;
esac
if [[ ! -f '/etc/os-release' ]]; then
echo "error: Don't use outdated Linux distributions."
exit 1
fi
# Do not combine this judgment condition with the following judgment condition.
## Be aware of Linux distribution like Gentoo, which kernel supports switch between Systemd and OpenRC.
if [[ -f /.dockerenv ]] || grep -q 'docker\|lxc' /proc/1/cgroup && [[ "$(type -P systemctl)" ]]; then
true
elif [[ -d /run/systemd/system ]] || grep -q systemd <(ls -l /sbin/init); then
true
else
echo "error: Only Linux distributions using systemd are supported."
exit 1
fi
if [[ "$(type -P apt)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='apt -y --no-install-recommends install'
PACKAGE_MANAGEMENT_REMOVE='apt purge'
package_provide_tput='ncurses-bin'
elif [[ "$(type -P dnf)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='dnf -y install'
PACKAGE_MANAGEMENT_REMOVE='dnf remove'
package_provide_tput='ncurses'
elif [[ "$(type -P yum)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='yum -y install'
PACKAGE_MANAGEMENT_REMOVE='yum remove'
package_provide_tput='ncurses'
elif [[ "$(type -P zypper)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='zypper install -y --no-recommends'
PACKAGE_MANAGEMENT_REMOVE='zypper remove'
package_provide_tput='ncurses-utils'
elif [[ "$(type -P pacman)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='pacman -Syu --noconfirm'
PACKAGE_MANAGEMENT_REMOVE='pacman -Rsn'
package_provide_tput='ncurses'
elif [[ "$(type -P emerge)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='emerge -v'
PACKAGE_MANAGEMENT_REMOVE='emerge -Cv'
package_provide_tput='ncurses'
else
echo "error: The script does not support the package manager in this operating system."
exit 1
fi
else
echo "error: This operating system is not supported."
exit 1
fi
}
## Demo function for processing parameters
judgment_parameters() {
local local_install='0'
local temp_version='0'
while [[ "$#" -gt '0' ]]; do
case "$1" in
'install')
INSTALL='1'
;;
'install-geodata')
INSTALL_GEODATA='1'
;;
'remove')
REMOVE='1'
;;
'help')
HELP='1'
;;
'check')
CHECK='1'
;;
'--without-geodata')
NO_GEODATA='1'
;;
'--without-logfiles')
NO_LOGFILES='1'
;;
'--purge')
PURGE='1'
;;
'--version')
if [[ -z "$2" ]]; then
echo "error: Please specify the correct version."
exit 1
fi
temp_version='1'
SPECIFIED_VERSION="$2"
shift
;;
'-f' | '--force')
FORCE='1'
;;
'--beta')
BETA='1'
;;
'-l' | '--local')
local_install='1'
if [[ -z "$2" ]]; then
echo "error: Please specify the correct local file."
exit 1
fi
LOCAL_FILE="$2"
shift
;;
'-p' | '--proxy')
if [[ -z "$2" ]]; then
echo "error: Please specify the proxy server address."
exit 1
fi
PROXY="$2"
shift
;;
'-u' | '--install-user')
if [[ -z "$2" ]]; then
echo "error: Please specify the install user.}"
exit 1
fi
INSTALL_USER="$2"
shift
;;
'--reinstall')
REINSTALL='1'
;;
'--no-update-service')
N_UP_SERVICE='1'
;;
*)
echo "$0: unknown option -- -"
exit 1
;;
esac
shift
done
if ((INSTALL+INSTALL_GEODATA+HELP+CHECK+REMOVE==0)); then
INSTALL='1'
elif ((INSTALL+INSTALL_GEODATA+HELP+CHECK+REMOVE>1)); then
echo 'You can only choose one action.'
exit 1
fi
if [[ "$INSTALL" -eq '1' ]] && ((temp_version+local_install+REINSTALL+BETA>1)); then
echo "--version,--reinstall,--beta and --local can't be used together."
exit 1
fi
}
check_install_user() {
if [[ -z "$INSTALL_USER" ]]; then
if [[ -f '/usr/local/bin/xray' ]]; then
INSTALL_USER="$(grep '^[ '$'\t]*User[ '$'\t]*=' /etc/systemd/system/xray.service | tail -n 1 | awk -F = '{print $2}' | awk '{print $1}')"
if [[ -z "$INSTALL_USER" ]]; then
INSTALL_USER='root'
fi
else
INSTALL_USER='nobody'
fi
fi
if ! id $INSTALL_USER > /dev/null 2>&1; then
echo "the user '$INSTALL_USER' is not effective"
exit 1
fi
INSTALL_USER_UID="$(id -u $INSTALL_USER)"
INSTALL_USER_GID="$(id -g $INSTALL_USER)"
}
install_software() {
package_name="$1"
file_to_detect="$2"
type -P "$file_to_detect" > /dev/null 2>&1 && return
if ${PACKAGE_MANAGEMENT_INSTALL} "$package_name"; then
echo "info: $package_name is installed."
else
echo "error: Installation of $package_name failed, please check your network."
exit 1
fi
}
get_current_version() {
# Get the CURRENT_VERSION
if [[ -f '/usr/local/bin/xray' ]]; then
CURRENT_VERSION="$(/usr/local/bin/xray -version | awk 'NR==1 {print $2}')"
CURRENT_VERSION="v${CURRENT_VERSION#v}"
else
CURRENT_VERSION=""
fi
}
get_latest_version() {
# Get Xray latest release version number
local tmp_file
tmp_file="$(mktemp)"
if ! curl -x "${PROXY}" -sS -H "Accept: application/vnd.github.v3+json" -o "$tmp_file" 'https://api.github.com/repos/XTLS/Xray-core/releases/latest'; then
"rm" "$tmp_file"
echo 'error: Failed to get release list, please check your network.'
exit 1
fi
RELEASE_LATEST="$(sed 'y/,/\n/' "$tmp_file" | grep 'tag_name' | awk -F '"' '{print $4}')"
if [[ -z "$RELEASE_LATEST" ]]; then
if grep -q "API rate limit exceeded" "$tmp_file"; then
echo "error: github API rate limit exceeded"
else
echo "error: Failed to get the latest release version."
echo "Welcome bug report:https://github.com/XTLS/Xray-install/issues"
fi
"rm" "$tmp_file"
exit 1
fi
"rm" "$tmp_file"
RELEASE_LATEST="v${RELEASE_LATEST#v}"
if ! curl -x "${PROXY}" -sS -H "Accept: application/vnd.github.v3+json" -o "$tmp_file" 'https://api.github.com/repos/XTLS/Xray-core/releases'; then
"rm" "$tmp_file"
echo 'error: Failed to get release list, please check your network.'
exit 1
fi
local releases_list
releases_list=($(sed 'y/,/\n/' "$tmp_file" | grep 'tag_name' | awk -F '"' '{print $4}'))
if [[ "${#releases_list[@]}" -eq '0' ]]; then
if grep -q "API rate limit exceeded" "$tmp_file"; then
echo "error: github API rate limit exceeded"
else
echo "error: Failed to get the latest release version."
echo "Welcome bug report:https://github.com/XTLS/Xray-install/issues"
fi
"rm" "$tmp_file"
exit 1
fi
local i
for i in ${!releases_list[@]}
do
releases_list[$i]="v${releases_list[$i]#v}"
grep -q "https://github.com/XTLS/Xray-core/releases/download/${releases_list[$i]}/Xray-linux-$MACHINE.zip" "$tmp_file" && break
done
"rm" "$tmp_file"
PRE_RELEASE_LATEST="${releases_list[$i]}"
}
version_gt() {
# compare two version
# 0: $1 > $2
# 1: $1 <= $2
if [[ "$1" != "$2" ]]; then
local temp_1_version_number="${1#v}"
local temp_1_major_version_number="${temp_1_version_number%%.*}"
local temp_1_minor_version_number
temp_1_minor_version_number="$(echo "$temp_1_version_number" | awk -F '.' '{print $2}')"
local temp_1_minimunm_version_number="${temp_1_version_number##*.}"
# shellcheck disable=SC2001
local temp_2_version_number="${2#v}"
local temp_2_major_version_number="${temp_2_version_number%%.*}"
local temp_2_minor_version_number
temp_2_minor_version_number="$(echo "$temp_2_version_number" | awk -F '.' '{print $2}')"
local temp_2_minimunm_version_number="${temp_2_version_number##*.}"
if [[ "$temp_1_major_version_number" -gt "$temp_2_major_version_number" ]]; then
return 0
elif [[ "$temp_1_major_version_number" -eq "$temp_2_major_version_number" ]]; then
if [[ "$temp_1_minor_version_number" -gt "$temp_2_minor_version_number" ]]; then
return 0
elif [[ "$temp_1_minor_version_number" -eq "$temp_2_minor_version_number" ]]; then
if [[ "$temp_1_minimunm_version_number" -gt "$temp_2_minimunm_version_number" ]]; then
return 0
else
return 1
fi
else
return 1
fi
else
return 1
fi
elif [[ "$1" == "$2" ]]; then
return 1
fi
}
download_xray() {
DOWNLOAD_LINK="https://github.com/XTLS/Xray-core/releases/download/$INSTALL_VERSION/Xray-linux-$MACHINE.zip"
echo "Downloading Xray archive: $DOWNLOAD_LINK"
if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
return 0
echo "Downloading verification file for Xray archive: $DOWNLOAD_LINK.dgst"
if ! curl -x "${PROXY}" -sSR -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
if [[ "$(cat "$ZIP_FILE".dgst)" == 'Not Found' ]]; then
echo 'error: This version does not support verification. Please replace with another version.'
return 1
fi
# Verification of Xray archive
for LISTSUM in 'md5' 'sha1' 'sha256' 'sha512'; do
SUM="$(${LISTSUM}sum "$ZIP_FILE" | sed 's/ .*//')"
CHECKSUM="$(grep ${LISTSUM^^} "$ZIP_FILE".dgst | grep "$SUM" -o -a | uniq)"
if [[ "$SUM" != "$CHECKSUM" ]]; then
echo 'error: Check failed! Please check your network or try again.'
return 1
fi
done
}
decompression() {
if ! unzip -q "$1" -d "$TMP_DIRECTORY"; then
echo 'error: Xray decompression failed.'
"rm" -r "$TMP_DIRECTORY"
echo "removed: $TMP_DIRECTORY"
exit 1
fi
echo "info: Extract the Xray package to $TMP_DIRECTORY and prepare it for installation."
}
install_file() {
NAME="$1"
if [[ "$NAME" == 'xray' ]]; then
install -m 755 "${TMP_DIRECTORY}/$NAME" "/usr/local/bin/$NAME"
elif [[ "$NAME" == 'geoip.dat' ]] || [[ "$NAME" == 'geosite.dat' ]]; then
install -m 644 "${TMP_DIRECTORY}/$NAME" "${DAT_PATH}/$NAME"
fi
}
install_xray() {
# Install Xray binary to /usr/local/bin/ and $DAT_PATH
install_file xray
# If the file exists, geoip.dat and geosite.dat will not be installed or updated
if [[ "$NO_GEODATA" -eq '0' ]] && [[ ! -f "${DAT_PATH}/.undat" ]]; then
install -d "$DAT_PATH"
install_file geoip.dat
install_file geosite.dat
GEODATA='1'
fi
# Install Xray configuration file to $JSON_PATH
# shellcheck disable=SC2153
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
install -d "$JSON_PATH"
echo "{}" > "${JSON_PATH}/config.json"
CONFIG_NEW='1'
fi
# Install Xray configuration file to $JSONS_PATH
if [[ -n "$JSONS_PATH" ]] && [[ ! -d "$JSONS_PATH" ]]; then
install -d "$JSONS_PATH"
for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do
echo '{}' > "${JSONS_PATH}/${BASE}.json"
done
CONFDIR='1'
fi
# Used to store Xray log files
if [[ "$NO_LOGFILES" -eq '0' ]]; then
if [[ ! -d '/var/log/xray/' ]]; then
install -d -m 700 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /var/log/xray/
install -m 600 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /dev/null /var/log/xray/access.log
install -m 600 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /dev/null /var/log/xray/error.log
LOG='1'
else
chown -R "$INSTALL_USER_UID:$INSTALL_USER_GID" /var/log/xray/
fi
fi
}
install_startup_service_file() {
mkdir -p '/etc/systemd/system/xray.service.d'
mkdir -p '/etc/systemd/system/xray@.service.d/'
local temp_CapabilityBoundingSet="CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE"
local temp_AmbientCapabilities="AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE"
local temp_NoNewPrivileges="NoNewPrivileges=true"
if [[ "$INSTALL_USER_UID" -eq '0' ]]; then
temp_CapabilityBoundingSet="#${temp_CapabilityBoundingSet}"
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
fi
cat > /etc/systemd/system/xray.service << EOF
[Unit]
Description=Xray Service
Documentation=https://github.com/xtls
After=network.target nss-lookup.target
[Service]
User=$INSTALL_USER
${temp_CapabilityBoundingSet}
${temp_AmbientCapabilities}
${temp_NoNewPrivileges}
ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json
Restart=on-failure
RestartPreventExitStatus=23
LimitNPROC=10000
LimitNOFILE=1000000
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/xray@.service <<EOF
[Unit]
Description=Xray Service
Documentation=https://github.com/xtls
After=network.target nss-lookup.target
[Service]
User=$INSTALL_USER
${temp_CapabilityBoundingSet}
${temp_AmbientCapabilities}
${temp_NoNewPrivileges}
ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/%i.json
Restart=on-failure
RestartPreventExitStatus=23
LimitNPROC=10000
LimitNOFILE=1000000
[Install]
WantedBy=multi-user.target
EOF
chmod 644 /etc/systemd/system/xray.service /etc/systemd/system/xray@.service
if [[ -n "$JSONS_PATH" ]]; then
"rm" '/etc/systemd/system/xray.service.d/10-donot_touch_single_conf.conf' \
'/etc/systemd/system/xray@.service.d/10-donot_touch_single_conf.conf'
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/xray run -confdir $JSONS_PATH" |
tee '/etc/systemd/system/xray.service.d/10-donot_touch_multi_conf.conf' > \
'/etc/systemd/system/xray@.service.d/10-donot_touch_multi_conf.conf'
else
"rm" '/etc/systemd/system/xray.service.d/10-donot_touch_multi_conf.conf' \
'/etc/systemd/system/xray@.service.d/10-donot_touch_multi_conf.conf'
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/xray run -config ${JSON_PATH}/config.json" > \
'/etc/systemd/system/xray.service.d/10-donot_touch_single_conf.conf'
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/xray run -config ${JSON_PATH}/%i.json" > \
'/etc/systemd/system/xray@.service.d/10-donot_touch_single_conf.conf'
fi
echo "info: Systemd service files have been installed successfully!"
echo "${red}warning: ${green}The following are the actual parameters for the xray service startup."
echo "${red}warning: ${green}Please make sure the configuration file path is correctly set.${reset}"
systemd_cat_config /etc/systemd/system/xray.service
# shellcheck disable=SC2154
if [[ x"${check_all_service_files:0:1}" = x'y' ]]; then
echo
echo
systemd_cat_config /etc/systemd/system/xray@.service
fi
systemctl daemon-reload
SYSTEMD='1'
}
start_xray() {
if [[ -f '/etc/systemd/system/xray.service' ]]; then
systemctl start "${XRAY_CUSTOMIZE:-xray}"
sleep 1s
if systemctl -q is-active "${XRAY_CUSTOMIZE:-xray}"; then
echo 'info: Start the Xray service.'
else
echo 'error: Failed to start Xray service.'
exit 1
fi
fi
}
stop_xray() {
XRAY_CUSTOMIZE="$(systemctl list-units | grep 'xray@' | awk -F ' ' '{print $1}')"
if [[ -z "$XRAY_CUSTOMIZE" ]]; then
local xray_daemon_to_stop='xray.service'
else
local xray_daemon_to_stop="$XRAY_CUSTOMIZE"
fi
if ! systemctl stop "$xray_daemon_to_stop"; then
echo 'error: Stopping the Xray service failed.'
exit 1
fi
echo 'info: Stop the Xray service.'
}
install_geodata() {
download_geodata() {
if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
echo 'error: Download failed! Please check your network or try again.'
exit 1
fi
if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
echo 'error: Download failed! Please check your network or try again.'
exit 1
fi
}
local download_link_geoip="https://github.com/v2fly/geoip/releases/latest/download/geoip.dat"
local download_link_geosite="https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat"
local file_ip='geoip.dat'
local file_dlc='dlc.dat'
local file_site='geosite.dat'
local dir_tmp
dir_tmp="$(mktemp -d)"
[[ "$XRAY_IS_INSTALLED_BEFORE_RUNNING_SCRIPT" -eq '0' ]] && echo "warning: Xray was not installed"
download_geodata $download_link_geoip $file_ip
download_geodata $download_link_geosite $file_dlc
cd "${dir_tmp}" || exit
for i in "${dir_tmp}"/*.sha256sum; do
if ! sha256sum -c "${i}"; then
echo 'error: Check failed! Please check your network or try again.'
exit 1
fi
done
cd - > /dev/null
install -d "$DAT_PATH"
install -m 644 "${dir_tmp}"/${file_dlc} "${DAT_PATH}"/${file_site}
install -m 644 "${dir_tmp}"/${file_ip} "${DAT_PATH}"/${file_ip}
rm -r "${dir_tmp}"
exit 0
}
check_update() {
if [[ "$XRAY_IS_INSTALLED_BEFORE_RUNNING_SCRIPT" -eq '1' ]]; then
get_current_version
echo "info: The current version of Xray is $CURRENT_VERSION ."
else
echo 'warning: Xray is not installed.'
fi
get_latest_version
echo "info: The latest release version of Xray is $RELEASE_LATEST ."
echo "info: The latest pre-release/release version of Xray is $PRE_RELEASE_LATEST ."
exit 0
}
remove_xray() {
if systemctl list-unit-files | grep -qw 'xray'; then
if [[ -n "$(pidof xray)" ]]; then
stop_xray
fi
local delete_files=('/usr/local/bin/xray' '/etc/systemd/system/xray.service' '/etc/systemd/system/xray@.service' '/etc/systemd/system/xray.service.d' '/etc/systemd/system/xray@.service.d')
[[ -d "$DAT_PATH" ]] && delete_files+=("$DAT_PATH")
if [[ "$PURGE" -eq '1' ]]; then
if [[ -z "$JSONS_PATH" ]]; then
delete_files+=("$JSON_PATH")
else
delete_files+=("$JSONS_PATH")
fi
[[ -d '/var/log/xray' ]] && delete_files+=('/var/log/xray')
fi
systemctl disable xray
if ! ("rm" -r "${delete_files[@]}"); then
echo 'error: Failed to remove Xray.'
exit 1
else
for i in ${!delete_files[@]}
do
echo "removed: ${delete_files[$i]}"
done
systemctl daemon-reload
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
echo 'info: Xray has been removed.'
if [[ "$PURGE" -eq '0' ]]; then
echo 'info: If necessary, manually delete the configuration and log files.'
if [[ -n "$JSONS_PATH" ]]; then
echo "info: e.g., $JSONS_PATH and /var/log/xray/ ..."
else
echo "info: e.g., $JSON_PATH and /var/log/xray/ ..."
fi
fi
exit 0
fi
else
echo 'error: Xray is not installed.'
exit 1
fi
}
# Explanation of parameters in the script
show_help() {
echo "usage: $0 ACTION [OPTION]..."
echo
echo 'ACTION:'
echo ' install Install/Update Xray'
echo ' install-geodata Install/Update geoip.dat and geosite.dat only'
echo ' remove Remove Xray'
echo ' help Show help'
echo ' check Check if Xray can be updated'
echo 'If no action is specified, then install will be selected'
echo
echo 'OPTION:'
echo ' install:'
echo ' --version Install the specified version of Xray, e.g., --version v1.0.0'
echo ' -f, --force Force install even though the versions are same'
echo ' --beta Install the pre-release version if it is exist'
echo ' -l, --local Install Xray from a local file'
echo ' -p, --proxy Download through a proxy server, e.g., -p http://127.0.0.1:8118 or -p socks5://127.0.0.1:1080'
echo ' -u, --install-user Install Xray in specified user, e.g, -u root'
echo ' --reinstall Reinstall current Xray version'
echo " --no-update-service Don't change service files if they are exist"
echo " --without-geodata Don't install/update geoip.dat and geosite.dat"
echo " --without-logfiles Don't install /var/log/xray"
echo ' install-geodata:'
echo ' -p, --proxy Download through a proxy server'
echo ' remove:'
echo ' --purge Remove all the Xray files, include logs, configs, etc'
echo ' check:'
echo ' -p, --proxy Check new version through a proxy server'
exit 0
}
main() {
check_if_running_as_root
identify_the_operating_system_and_architecture
judgment_parameters "$@"
install_software "$package_provide_tput" 'tput'
red=$(tput setaf 1)
green=$(tput setaf 2)
aoi=$(tput setaf 6)
reset=$(tput sgr0)
# Parameter information
[[ "$HELP" -eq '1' ]] && show_help
[[ "$CHECK" -eq '1' ]] && check_update
[[ "$REMOVE" -eq '1' ]] && remove_xray
[[ "$INSTALL_GEODATA" -eq '1' ]] && install_geodata
# Check if the user is effective
check_install_user
# Two very important variables
TMP_DIRECTORY="$(mktemp -d)"
ZIP_FILE="${TMP_DIRECTORY}/Xray-linux-$MACHINE.zip"
# Install Xray from a local file, but still need to make sure the network is available
if [[ -n "$LOCAL_FILE" ]]; then
echo 'warn: Install Xray from a local file, but still need to make sure the network is available.'
echo -n 'warn: Please make sure the file is valid because we cannot confirm it. (Press any key) ...'
read -r
install_software 'unzip' 'unzip'
decompression "$LOCAL_FILE"
else
get_current_version
if [[ "$REINSTALL" -eq '1' ]]; then
if [[ -z "$CURRENT_VERSION" ]]; then
echo "error: Xray is not installed"
exit 1
fi
INSTALL_VERSION="$CURRENT_VERSION"
echo "info: Reinstalling Xray $CURRENT_VERSION"
elif [[ -n "$SPECIFIED_VERSION" ]]; then
SPECIFIED_VERSION="v${SPECIFIED_VERSION#v}"
if [[ "$CURRENT_VERSION" == "$SPECIFIED_VERSION" ]] && [[ "$FORCE" -eq '0' ]]; then
echo "info: The current version is same as the specified version. The version is $CURRENT_VERSION ."
exit 0
fi
INSTALL_VERSION="$SPECIFIED_VERSION"
echo "info: Installing specified Xray version $INSTALL_VERSION for $(uname -m)"
else
install_software 'curl' 'curl'
get_latest_version
if [[ "$BETA" -eq '0' ]]; then
INSTALL_VERSION="$RELEASE_LATEST"
else
INSTALL_VERSION="$PRE_RELEASE_LATEST"
fi
if ! version_gt "$INSTALL_VERSION" "$CURRENT_VERSION" && [[ "$FORCE" -eq '0' ]]; then
echo "info: No new version. The current version of Xray is $CURRENT_VERSION ."
exit 0
fi
echo "info: Installing Xray $INSTALL_VERSION for $(uname -m)"
fi
install_software 'curl' 'curl'
install_software 'unzip' 'unzip'
if ! download_xray; then
"rm" -r "$TMP_DIRECTORY"
echo "removed: $TMP_DIRECTORY"
exit 1
fi
decompression "$ZIP_FILE"
fi
# Determine if Xray is running
if systemctl list-unit-files | grep -qw 'xray'; then
if [[ -n "$(pidof xray)" ]]; then
stop_xray
XRAY_RUNNING='1'
fi
fi
install_xray
([[ "$N_UP_SERVICE" -eq '1' ]] && [[ -f '/etc/systemd/system/xray.service' ]]) || install_startup_service_file
echo 'installed: /usr/local/bin/xray'
# If the file exists, the content output of installing or updating geoip.dat and geosite.dat will not be displayed
if [[ "$GEODATA" -eq '1' ]]; then
echo "installed: ${DAT_PATH}/geoip.dat"
echo "installed: ${DAT_PATH}/geosite.dat"
fi
if [[ "$CONFIG_NEW" -eq '1' ]]; then
echo "installed: ${JSON_PATH}/config.json"
fi
if [[ "$CONFDIR" -eq '1' ]]; then
echo "installed: ${JSON_PATH}/00_log.json"
echo "installed: ${JSON_PATH}/01_api.json"
echo "installed: ${JSON_PATH}/02_dns.json"
echo "installed: ${JSON_PATH}/03_routing.json"
echo "installed: ${JSON_PATH}/04_policy.json"
echo "installed: ${JSON_PATH}/05_inbounds.json"
echo "installed: ${JSON_PATH}/06_outbounds.json"
echo "installed: ${JSON_PATH}/07_transport.json"
echo "installed: ${JSON_PATH}/08_stats.json"
echo "installed: ${JSON_PATH}/09_reverse.json"
fi
if [[ "$LOG" -eq '1' ]]; then
echo 'installed: /var/log/xray/'
echo 'installed: /var/log/xray/access.log'
echo 'installed: /var/log/xray/error.log'
fi
if [[ "$SYSTEMD" -eq '1' ]]; then
echo 'installed: /etc/systemd/system/xray.service'
echo 'installed: /etc/systemd/system/xray@.service'
fi
"rm" -r "$TMP_DIRECTORY"
echo "removed: $TMP_DIRECTORY"
get_current_version
echo "info: Xray $CURRENT_VERSION is installed."
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
if [[ "$XRAY_IS_INSTALLED_BEFORE_RUNNING_SCRIPT" -eq '1' ]] && [[ "$FORCE" -eq '0' ]] && [[ "$REINSTALL" -eq '0' ]]; then
[[ "$XRAY_RUNNING" -eq '1' ]] && start_xray
else
systemctl start xray
systemctl enable xray
sleep 1s
if systemctl -q is-active xray; then
echo "info: Enable and start the Xray service"
else
echo "warning: Failed to enable and start the Xray service"
fi
fi
}
main "$@"

View File

@@ -0,0 +1,73 @@
{
"inbounds": [
{
"tag": "proxy",
"protocol": "socks",
"listen": "0.0.0.0",
"port": 1234,
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1",
"userLevel": 0
}
},
{
"protocol": "socks",
"tag": "cloudflare",
"listen": "0.0.0.0",
"port": 1235,
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 0
}
}
],
"outbounds": [
{
"tag": "cloudflare",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 40000,
"level": 0
}
]
},
"streamSettings": {
"network": "tcp"
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "proxy",
"protocol": "freedom"
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"cloudflare"
],
"outboundTag": "cloudflare"
},
{
"type": "field",
"inboundTag": [
"proxy"
],
"outboundTag": "proxy"
}
]
}
}

View File

@@ -0,0 +1,226 @@
{
"log": {
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log",
"loglevel": "warning"
},
"inbounds": [
{
"port": 19990,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "adbd84eb-15fe-4c62-931c-b471791672ad",
"flow": "xtls-rprx-direct",
"level": 0,
"email": "ice@gmail.com"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 60001,
"alpn": "",
"xver": 1
},
{
"dest": 60002,
"alpn": "h2",
"xver": 1
},
{
"path": "/v2ice-vless-ws/",
"dest": 19998,
"xver": 1
},
{
"path": "/v2ice-vmess-tcp",
"dest": 19997,
"xver": 1
},
{
"path": "/v2ice-vmess-ws",
"dest": 19996,
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key"
}
]
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
},
{
"port": 19999,
"listen": "127.0.0.1",
"protocol": "trojan",
"settings": {
"clients": [
{
"password": "loveff.22",
"level": 0,
"email": "ice@gmail.com.cn",
"flow": "xtls-rprx-direct"
}
],
"fallbacks": [
{
"dest": 8080,
"alpn": "",
"xver": 1
},
{
"dest": 8081,
"alpn": "h2",
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key"
}
]
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
},
{
"port": 19998,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "adbd84eb-15fe-4c62-931c-b471791672ad",
"level": 0,
"email": "ice@gmail.com"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/v2ice-vless-ws/"
}
}
},
{
"port": 19997,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "3da8aa3f-ddd7-49bf-94ba-950593f24471",
"level": 0,
"email": "ice@gmail.com"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "auto",
"tcpSettings": {
"acceptProxyProtocol": true,
"header": {
"type": "http",
"request": {
"path": [
"/v2ice-vmess-tcp"
]
}
}
}
}
},
{
"port": 19996,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "c08e68f1-283c-4f91-9603-0b80484bb283",
"level": 0,
"email": "ice@gmail.com"
}
]
},
"streamSettings": {
"network": "ws",
"security": "auto",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/v2ice-vmess-ws"
}
}
},
{
"port": 19995,
"listen": "0.0.0.0",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "becaca40-b457-4572-9b46-ed66ecca7b4e",
"level": 0,
"alterId": 0,
"email": "ice@cc.com"
}
]
},
"streamSettings": {
"network": "ws",
"security": "auto",
"wsSettings": {
"acceptProxyProtocol": false,
"path": "/v2ice-default-ws"
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}

View File

@@ -0,0 +1,225 @@
{
"inbounds": [
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 443,
"settings": {
"clients": [
{
"password": "V2ryStr0ngP0ss",
"email": "lovemm@107421.xyz"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key"
}
]
}
},
"tag": "Seoul-amd64-01"
},
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 19999,
"settings": {
"clients": [
{
"password": "V2ryStr0ngP0ss",
"email": "lovemm@107421.xyz"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key"
}
]
}
},
"tag": "Seoul-amd64-01->Tokyo-amd64-02"
},
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 19998,
"settings": {
"clients": [
{
"password": "V2ryStr0ngP0ss",
"email": "lovemm@107421.xyz"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key"
}
]
}
},
"tag": "Seoul-amd64-01->Phoenix-amd64-02"
},
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 19997,
"settings": {
"clients": [
{
"password": "V2ryStr0ngP0ss",
"email": "lovemm@107421.xyz"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.s4.cc.hh.107421.xyz_ecc/xx.s4.cc.hh.107421.xyz.key"
}
]
}
},
"tag": "Seoul-amd64-01->Osaka-amd64-01"
}
],
"outbounds": [
{
"protocol": "freedom"
},
{
"protocol": "freedom",
"tag": "Seoul-amd64-01"
},
{
"protocol": "blackhole",
"tag": "block"
},
{
"tag": "Seoul-amd64-01->Tokyo-amd64-02",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "140.238.52.228",
"port": 1234
}
]
}
},
{
"tag": "Seoul-amd64-01->Phoenix-amd64-02",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "129.146.171.163",
"port": 1234
}
]
}
},
{
"tag": "Seoul-amd64-01->London-amd64-01",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "141.147.99.91",
"port": 1234
}
]
}
},
{
"tag": "Seoul-amd64-01->Osaka-amd64-01",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "140.83.84.142",
"port": 1234
}
]
}
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"Seoul-amd64-01"
],
"outboundTag": "Seoul-amd64-01"
},
{
"type": "field",
"inboundTag": [
"Seoul-amd64-01->Tokyo-amd64-02"
],
"outboundTag": "Seoul-amd64-01->Tokyo-amd64-02"
},
{
"type": "field",
"inboundTag": [
"Seoul-amd64-01->Phoenix-amd64-02"
],
"outboundTag": "Seoul-amd64-01->Phoenix-amd64-02"
},
{
"type": "field",
"inboundTag": [
"Seoul-amd64-01->London-amd64-01"
],
"outboundTag": "Seoul-amd64-01->London-amd64-01"
},
{
"type": "field",
"inboundTag": [
"Seoul-amd64-01->Osaka-amd64-01"
],
"outboundTag": "Seoul-amd64-01->Osaka-amd64-01"
}
]
}
}

View File

@@ -0,0 +1,135 @@
{
"inbounds": [
{
"tag": "proxy-http",
"port": 22889,
"listen": "0.0.0.0",
"protocol": "http",
"settings": {
"allowTransparent": true,
"userLevel": 0
}
},
{
"tag": "proxy-socks",
"port": 22888,
"listen": "0.0.0.0",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "password",
"accounts": [
{
"user": "zeaslity",
"pass": "lovemm.23"
}
],
"udp": true,
"allowTransparent": false
}
},
{
"tag": "direct",
"port": 22887,
"listen": "0.0.0.0",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "password",
"accounts": [
{
"user": "zeaslity",
"pass": "lovemm.23"
}
],
"udp": true,
"allowTransparent": false
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "89.208.251.209",
"ota": false,
"password": "v2ryStr@ngPa.ss",
"port": 29999,
"level": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": false,
"serverName": "xx.l4.cc.nn.107421.xyz",
"show": false
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"dns": {
"servers": [
"1.1.1.1",
"8.8.8.8"
]
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"domainMatcher": "mph",
"rules": [
{
"type": "field",
"outboundTag": "proxy",
"inboundTag": [
"proxy-socks",
"proxy-http"
]
},
{
"type": "field",
"outboundTag": "direct",
"inboundTag": [
"direct"
]
}
]
}
}

View File

@@ -0,0 +1,125 @@
{
"inbounds": [
{
"tag": "proxy-socks",
"port": 22888,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "password",
"accounts": [
{
"user": "zeaslity",
"pass": "lovemm.23"
}
],
"udp": true,
"allowTransparent": false
}
},
{
"tag": "direct",
"port": 22887,
"listen": "0.0.0.0",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "password",
"accounts": [
{
"user": "zeaslity",
"pass": "lovemm.23"
}
],
"udp": true,
"allowTransparent": false
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "140.238.14.103",
"method": "chacha20",
"ota": false,
"password": "V2ryStr0ngP0ss",
"port": 443,
"level": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": false,
"serverName": "xx.s4.cc.hh.107421.xyz",
"show": false
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"dns": {
"servers": [
"1.1.1.1",
"8.8.8.8"
]
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"domainMatcher": "mph",
"rules": [
{
"type": "field",
"outboundTag": "proxy",
"inboundTag": [
"proxy-socks"
]
},
{
"type": "field",
"outboundTag": "direct",
"inboundTag": [
"direct"
]
}
]
}
}

View File

@@ -0,0 +1,67 @@
{
"inbounds": [
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 443,
"settings": {
"clients": [
{
"password": "V2ryStr0ngP0ss",
"email": "lovemm@107421.xyz"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.l4.cc.nn.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.l4.cc.nn.107421.xyz_ecc/xx.l4.cc.nn.107421.xyz.key"
}
]
}
},
"tag": "LosAngels-amd64-01"
},
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 29999,
"settings": {
"clients": [
{
"password": "v2ryStr@ngPa.ss"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.l4.cc.nn.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.l4.cc.nn.107421.xyz_ecc/xx.l4.cc.nn.107421.xyz.key"
}
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}

View File

@@ -0,0 +1,77 @@
{
"log": {
"loglevel": "error"
},
"inbounds": [
{
"protocol": "trojan",
"listen": "0.0.0.0",
"port": 443,
"settings": {
"clients": [
{
"password": "V2ryStr0ngP0ss"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/root/.acme.sh/xx.tc.hk.go.107421.xyz_ecc/fullchain.cer",
"keyFile": "/root/.acme.sh/xx.tc.hk.go.107421.xyz_ecc/xx.tc.hk.go.107421.xyz.key"
}
]
}
},
"tag": "hongkong-trojan"
},
{
"port": 29999,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9",
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"dest": "xx.tc.hk.go.107421.xyz:443",
"serverNames": [
"xx.tc.hk.go.107421.xyz"
],
"privateKey": "eOuEdWwYFkhKHAq6lhx3Txq2H7rZ9uy1csbKt4Jkq0E",
"shortIds": [
"ad570cbfab"
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls",
"quic"
],
"routeOnly": true
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}

View File

@@ -0,0 +1,89 @@
{
"log": {
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log",
"loglevel": "warning"
},
"inbounds": [
{
"port": 29999,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9",
"flow": "xtls-rprx-direct"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 60000,
"alpn": "",
"xver": 1
},
{
"dest": 60001,
"alpn": "h2",
"xver": 1
},
{
"dest": 60002,
"path": "/0e03986e4baac9/",
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"minVersion": "1.2",
"certificates": [
{
"certificateFile": "/usr/local/etc/xray/self_signed_cert.pem",
"keyFile": "/usr/local/etc/xray/self_signed_key.pem"
},
{
"certificateFile": "/ssl/xray.crt",
"keyFile": "/ssl/xray.key"
}
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"port": 60002,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/0e03986e4baac9/"
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}

View File

@@ -0,0 +1,23 @@
# 默认禁止所有其他端口
firewall-cmd --set-default-zone=drop
# 允许从任何源访问 22333、443、80 端口的 TCP 和 UDP 流量
firewall-cmd --permanent --add-port=22333/tcp
firewall-cmd --permanent --add-port=22333/udp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --permanent --add-port=443/udp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=80/udp
# 允许来自20000-30000的tcp udp端口
firewall-cmd --zone=drop --add-port=20000-30000/tcp --permanent
firewall-cmd --zone=drop --add-port=20000-30000/udp --permanent
# 允许icmp的ping请求
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="0.0.0.0/0" protocol value="icmp" accept'
firewall-cmd --zone=drop --add-icmp-block-inversion --permanent
firewall-cmd --zone=public --add-icmp-block-inversion --permanent
firewall-cmd --reload
# 重新载入防火墙规则
firewall-cmd --reload

View File

@@ -0,0 +1,32 @@
function SayHello
{
param (
[string]$Name
)
Write-Host "Hello, $Name!"
}
# 调用函数
SayHello -Name "Test PowerShell"
function SetMinioAlias
{
# mc.exe alias set local http://10.250.0.100:9000 cmii B#923fC7mk
# mc.exe alias set tc-sh http://42.192.52.227:9000 cmii B#923fC7mk
mc.exe alias set seoul-1 https://cnk8d6fazu16.compat.objectstorage.ap-seoul-1.oraclecloud.com aed62d24d85e2da809ce02bf272420ba4ed74820 rQdEcn69K049+JkA1IGoQmC1k8zma8zfWvZvVS0h144=
}
SetMinioAlias
# 获取当前工作目录
$currentDirectory = Get-Location
# 打印当前工作目录
Write-Host "Current directory: $currentDirectory"
Write-Host ""
# 获取当前目录的所有文件名
mc.exe cp $currentDirectory\98-subscribe-clash.yaml seoul-1/seoul/
mc.exe cp $currentDirectory\99-subscribe-octopus-latest.txt seoul-1/seoul/
Write-Host ""
Write-Host "All proxy config has been synchronized !"

View File

@@ -0,0 +1,56 @@
{
"inbounds": [
{
"protocol": "http",
"port": 58888,
"listen": "192.168.11.241"
}
,
{
"protocol": "socks",
"port": 58889,
"listen": "192.168.11.241",
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 0
}
}
],
"dns": {
"network": "udp",
"address": "223.5.5.5",
"port": 53
},
"outbounds": [
{
"tag": "proxy",
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "140.238.14.103",
"method": "chacha20",
"ota": false,
"password": "V2ryStr0ngP0ss",
"port": 443,
"level": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": false,
"serverName": "xx.s4.cc.hh.107421.xyz",
"show": false
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
}
]
}

View File

@@ -0,0 +1,31 @@
{
"inbounds": [
{
"protocol": "http",
"port": 58888,
"listen": "10.20.1.130"
}
,
{
"protocol": "socks",
"port": 58889,
"listen": "10.20.1.130",
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 0
}
}
],
"dns": {
"network": "udp",
"address": "223.5.5.5",
"port": 53
},
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View File

@@ -0,0 +1,41 @@
{
"inbounds": [
{
"protocol": "socks",
"port": 28888,
"listen": "0.0.0.0",
"settings": {
"auth": "password",
"accounts": [
{
"user": "zeaslity",
"pass": "lovemm.23"
}
],
"udp": true,
"userLevel": 0
}
},
{
"protocol": "socks",
"port": 58889,
"listen": "0.0.0.0",
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 0
}
}
],
"dns": {
"network": "udp",
"address": "223.5.5.5",
"port": 53
},
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View File

@@ -0,0 +1,601 @@
#!/bin/bash
# The files installed by the script conform to the Filesystem Hierarchy Standard:
# https://wiki.linuxfoundation.org/lsb/fhs
# The URL of the script project is:
# https://github.com/v2fly/fhs-install-v2ray
# The URL of the script is:
# https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
# If the script executes incorrectly, go to:
# https://github.com/v2fly/fhs-install-v2ray/issues
# You can set this variable whatever you want in shell session right before running this script by issuing:
# export DAT_PATH='/usr/local/share/v2ray'
DAT_PATH=${DAT_PATH:-/usr/local/share/v2ray}
# You can set this variable whatever you want in shell session right before running this script by issuing:
# export JSON_PATH='/usr/local/etc/v2ray'
JSON_PATH=${JSON_PATH:-/usr/local/etc/v2ray}
# Set this variable only if you are starting v2ray with multiple configuration files:
# export JSONS_PATH='/usr/local/etc/v2ray'
# Set this variable only if you want this script to check all the systemd unit file:
# export check_all_service_files='yes'
curl() {
$(type -P curl) -L -q --retry 5 --retry-delay 10 --retry-max-time 60 "$@"
}
systemd_cat_config() {
if systemd-analyze --help | grep -qw 'cat-config'; then
systemd-analyze --no-pager cat-config "$@"
echo
else
echo "${aoi}~~~~~~~~~~~~~~~~"
cat "$@" "$1".d/*
echo "${aoi}~~~~~~~~~~~~~~~~"
echo "${red}warning: ${green}The systemd version on the current operating system is too low."
echo "${red}warning: ${green}Please consider to upgrade the systemd or the operating system.${reset}"
echo
fi
}
check_if_running_as_root() {
# If you want to run as another user, please modify $UID to be owned by this user
if [[ "$UID" -ne '0' ]]; then
echo "error: You must run this script as root!"
exit 1
fi
}
identify_the_operating_system_and_architecture() {
if [[ "$(uname)" == 'Linux' ]]; then
case "$(uname -m)" in
'i386' | 'i686')
MACHINE='32'
;;
'amd64' | 'x86_64')
MACHINE='64'
;;
'armv5tel')
MACHINE='arm32-v5'
;;
'armv6l')
MACHINE='arm32-v6'
;;
'armv7' | 'armv7l')
MACHINE='arm32-v7a'
;;
'armv8' | 'aarch64')
MACHINE='arm64-v8a'
;;
'mips')
MACHINE='mips32'
;;
'mipsle')
MACHINE='mips32le'
;;
'mips64')
MACHINE='mips64'
;;
'mips64le')
MACHINE='mips64le'
;;
'ppc64')
MACHINE='ppc64'
;;
'ppc64le')
MACHINE='ppc64le'
;;
'riscv64')
MACHINE='riscv64'
;;
's390x')
MACHINE='s390x'
;;
*)
echo "error: The architecture is not supported."
exit 1
;;
esac
if [[ ! -f '/etc/os-release' ]]; then
echo "error: Don't use outdated Linux distributions."
exit 1
fi
# Do not combine this judgment condition with the following judgment condition.
## Be aware of Linux distribution like Gentoo, which kernel supports switch between Systemd and OpenRC.
### Refer: https://github.com/v2fly/fhs-install-v2ray/issues/84#issuecomment-688574989
if [[ -f /.dockerenv ]] || grep -q 'docker\|lxc' /proc/1/cgroup && [[ "$(type -P systemctl)" ]]; then
true
elif [[ -d /run/systemd/system ]] || grep -q systemd <(ls -l /sbin/init); then
true
else
echo "error: Only Linux distributions using systemd are supported."
exit 1
fi
if [[ "$(type -P apt)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='apt -y --no-install-recommends install'
PACKAGE_MANAGEMENT_REMOVE='apt purge'
package_provide_tput='ncurses-bin'
elif [[ "$(type -P dnf)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='dnf -y install'
PACKAGE_MANAGEMENT_REMOVE='dnf remove'
package_provide_tput='ncurses'
elif [[ "$(type -P yum)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='yum -y install'
PACKAGE_MANAGEMENT_REMOVE='yum remove'
package_provide_tput='ncurses'
elif [[ "$(type -P zypper)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='zypper install -y --no-recommends'
PACKAGE_MANAGEMENT_REMOVE='zypper remove'
package_provide_tput='ncurses-utils'
elif [[ "$(type -P pacman)" ]]; then
PACKAGE_MANAGEMENT_INSTALL='pacman -Syu --noconfirm'
PACKAGE_MANAGEMENT_REMOVE='pacman -Rsn'
package_provide_tput='ncurses'
else
echo "error: The script does not support the package manager in this operating system."
exit 1
fi
else
echo "error: This operating system is not supported."
exit 1
fi
}
## Demo function for processing parameters
judgment_parameters() {
while [[ "$#" -gt '0' ]]; do
case "$1" in
'--remove')
if [[ "$#" -gt '1' ]]; then
echo 'error: Please enter the correct parameters.'
exit 1
fi
REMOVE='1'
;;
'--version')
VERSION="${2:?error: Please specify the correct version.}"
break
;;
'-c' | '--check')
CHECK='1'
break
;;
'-f' | '--force')
FORCE='1'
break
;;
'-h' | '--help')
HELP='1'
break
;;
'-l' | '--local')
LOCAL_INSTALL='1'
LOCAL_FILE="${2:?error: Please specify the correct local file.}"
break
;;
'-p' | '--proxy')
if [[ -z "${2:?error: Please specify the proxy server address.}" ]]; then
exit 1
fi
PROXY="$2"
shift
;;
*)
echo "$0: unknown option -- -"
exit 1
;;
esac
shift
done
}
install_software() {
package_name="$1"
file_to_detect="$2"
type -P "$file_to_detect" > /dev/null 2>&1 && return
if ${PACKAGE_MANAGEMENT_INSTALL} "$package_name"; then
echo "info: $package_name is installed."
else
echo "error: Installation of $package_name failed, please check your network."
exit 1
fi
}
get_version() {
# 0: Install or update V2Ray.
# 1: Installed or no new version of V2Ray.
# 2: Install the specified version of V2Ray.
if [[ -n "$VERSION" ]]; then
RELEASE_VERSION="v${VERSION#v}"
return 2
fi
# Determine the version number for V2Ray installed from a local file
if [[ -f '/usr/local/bin/v2ray' ]]; then
VERSION="$(/usr/local/bin/v2ray -version | awk 'NR==1 {print $2}')"
CURRENT_VERSION="v${VERSION#v}"
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
RELEASE_VERSION="$CURRENT_VERSION"
return
fi
fi
# Get V2Ray release version number
TMP_FILE="$(mktemp)"
if ! curl -x "${PROXY}" -sS -H "Accept: application/vnd.github.v3+json" -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then
"rm" "$TMP_FILE"
echo 'error: Failed to get release list, please check your network.'
exit 1
fi
RELEASE_LATEST="$(sed 'y/,/\n/' "$TMP_FILE" | grep 'tag_name' | awk -F '"' '{print $4}')"
"rm" "$TMP_FILE"
RELEASE_VERSION="v${RELEASE_LATEST#v}"
# Compare V2Ray version numbers
if [[ "$RELEASE_VERSION" != "$CURRENT_VERSION" ]]; then
RELEASE_VERSIONSION_NUMBER="${RELEASE_VERSION#v}"
RELEASE_MAJOR_VERSION_NUMBER="${RELEASE_VERSIONSION_NUMBER%%.*}"
RELEASE_MINOR_VERSION_NUMBER="$(echo "$RELEASE_VERSIONSION_NUMBER" | awk -F '.' '{print $2}')"
RELEASE_MINIMUM_VERSION_NUMBER="${RELEASE_VERSIONSION_NUMBER##*.}"
# shellcheck disable=SC2001
CURRENT_VERSIONSION_NUMBER="$(echo "${CURRENT_VERSION#v}" | sed 's/-.*//')"
CURRENT_MAJOR_VERSION_NUMBER="${CURRENT_VERSIONSION_NUMBER%%.*}"
CURRENT_MINOR_VERSION_NUMBER="$(echo "$CURRENT_VERSIONSION_NUMBER" | awk -F '.' '{print $2}')"
CURRENT_MINIMUM_VERSION_NUMBER="${CURRENT_VERSIONSION_NUMBER##*.}"
if [[ "$RELEASE_MAJOR_VERSION_NUMBER" -gt "$CURRENT_MAJOR_VERSION_NUMBER" ]]; then
return 0
elif [[ "$RELEASE_MAJOR_VERSION_NUMBER" -eq "$CURRENT_MAJOR_VERSION_NUMBER" ]]; then
if [[ "$RELEASE_MINOR_VERSION_NUMBER" -gt "$CURRENT_MINOR_VERSION_NUMBER" ]]; then
return 0
elif [[ "$RELEASE_MINOR_VERSION_NUMBER" -eq "$CURRENT_MINOR_VERSION_NUMBER" ]]; then
if [[ "$RELEASE_MINIMUM_VERSION_NUMBER" -gt "$CURRENT_MINIMUM_VERSION_NUMBER" ]]; then
return 0
else
return 1
fi
else
return 1
fi
else
return 1
fi
elif [[ "$RELEASE_VERSION" == "$CURRENT_VERSION" ]]; then
return 1
fi
}
download_v2ray() {
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
if ! curl -x "${PROXY}" -sSR -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
if [[ "$(cat "$ZIP_FILE".dgst)" == 'Not Found' ]]; then
echo 'error: This version does not support verification. Please replace with another version.'
return 1
fi
# Verification of V2Ray archive
for LISTSUM in 'md5' 'sha1' 'sha256' 'sha512'; do
SUM="$(${LISTSUM}sum "$ZIP_FILE" | sed 's/ .*//')"
CHECKSUM="$(grep ${LISTSUM^^} "$ZIP_FILE".dgst | grep "$SUM" -o -a | uniq)"
if [[ "$SUM" != "$CHECKSUM" ]]; then
echo 'error: Check failed! Please check your network or try again.'
return 1
fi
done
}
decompression() {
if ! unzip -q "$1" -d "$TMP_DIRECTORY"; then
echo 'error: V2Ray decompression failed.'
"rm" -r "$TMP_DIRECTORY"
echo "removed: $TMP_DIRECTORY"
exit 1
fi
echo "info: Extract the V2Ray package to $TMP_DIRECTORY and prepare it for installation."
}
install_file() {
NAME="$1"
if [[ "$NAME" == 'v2ray' ]] || [[ "$NAME" == 'v2ctl' ]]; then
install -m 755 "${TMP_DIRECTORY}/$NAME" "/usr/local/bin/$NAME"
elif [[ "$NAME" == 'geoip.dat' ]] || [[ "$NAME" == 'geosite.dat' ]]; then
install -m 644 "${TMP_DIRECTORY}/$NAME" "${DAT_PATH}/$NAME"
fi
}
install_v2ray() {
# Install V2Ray binary to /usr/local/bin/ and $DAT_PATH
install_file v2ray
install_file v2ctl
install -d "$DAT_PATH"
# If the file exists, geoip.dat and geosite.dat will not be installed or updated
if [[ ! -f "${DAT_PATH}/.undat" ]]; then
install_file geoip.dat
install_file geosite.dat
fi
# Install V2Ray configuration file to $JSON_PATH
# shellcheck disable=SC2153
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
install -d "$JSON_PATH"
echo "{}" > "${JSON_PATH}/config.json"
CONFIG_NEW='1'
fi
# Install V2Ray configuration file to $JSONS_PATH
if [[ -n "$JSONS_PATH" ]] && [[ ! -d "$JSONS_PATH" ]]; then
install -d "$JSONS_PATH"
for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do
echo '{}' > "${JSONS_PATH}/${BASE}.json"
done
CONFDIR='1'
fi
# Used to store V2Ray log files
if [[ ! -d '/var/log/v2ray/' ]]; then
if id nobody | grep -qw 'nogroup'; then
install -d -m 700 -o nobody -g nogroup /var/log/v2ray/
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/access.log
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/error.log
else
install -d -m 700 -o nobody -g nobody /var/log/v2ray/
install -m 600 -o nobody -g nobody /dev/null /var/log/v2ray/access.log
install -m 600 -o nobody -g nobody /dev/null /var/log/v2ray/error.log
fi
LOG='1'
fi
}
install_startup_service_file() {
install -m 644 "${TMP_DIRECTORY}/systemd/system/v2ray.service" /etc/systemd/system/v2ray.service
install -m 644 "${TMP_DIRECTORY}/systemd/system/v2ray@.service" /etc/systemd/system/v2ray@.service
mkdir -p '/etc/systemd/system/v2ray.service.d'
mkdir -p '/etc/systemd/system/v2ray@.service.d/'
if [[ -n "$JSONS_PATH" ]]; then
"rm" '/etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf' \
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_single_conf.conf'
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/v2ray -confdir $JSONS_PATH" |
tee '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' > \
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf'
else
"rm" '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' \
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf'
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/v2ray -config ${JSON_PATH}/config.json" > \
'/etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf'
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/v2ray -config ${JSON_PATH}/%i.json" > \
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_single_conf.conf'
fi
echo "info: Systemd service files have been installed successfully!"
echo "${red}warning: ${green}The following are the actual parameters for the v2ray service startup."
echo "${red}warning: ${green}Please make sure the configuration file path is correctly set.${reset}"
systemd_cat_config /etc/systemd/system/v2ray.service
# shellcheck disable=SC2154
if [[ x"${check_all_service_files:0:1}" = x'y' ]]; then
echo
echo
systemd_cat_config /etc/systemd/system/v2ray@.service
fi
systemctl daemon-reload
SYSTEMD='1'
}
start_v2ray() {
if [[ -f '/etc/systemd/system/v2ray.service' ]]; then
if systemctl start "${V2RAY_CUSTOMIZE:-v2ray}"; then
echo 'info: Start the V2Ray service.'
else
echo 'error: Failed to start V2Ray service.'
exit 1
fi
fi
}
stop_v2ray() {
V2RAY_CUSTOMIZE="$(systemctl list-units | grep 'v2ray@' | awk -F ' ' '{print $1}')"
if [[ -z "$V2RAY_CUSTOMIZE" ]]; then
local v2ray_daemon_to_stop='v2ray.service'
else
local v2ray_daemon_to_stop="$V2RAY_CUSTOMIZE"
fi
if ! systemctl stop "$v2ray_daemon_to_stop"; then
echo 'error: Stopping the V2Ray service failed.'
exit 1
fi
echo 'info: Stop the V2Ray service.'
}
check_update() {
if [[ -f '/etc/systemd/system/v2ray.service' ]]; then
(get_version)
local get_ver_exit_code=$?
if [[ "$get_ver_exit_code" -eq '0' ]]; then
echo "info: Found the latest release of V2Ray $RELEASE_VERSION . (Current release: $CURRENT_VERSION)"
elif [[ "$get_ver_exit_code" -eq '1' ]]; then
echo "info: No new version. The current version of V2Ray is $CURRENT_VERSION ."
fi
exit 0
else
echo 'error: V2Ray is not installed.'
exit 1
fi
}
remove_v2ray() {
if systemctl list-unit-files | grep -qw 'v2ray'; then
if [[ -n "$(pidof v2ray)" ]]; then
stop_v2ray
fi
if ! ("rm" -r '/usr/local/bin/v2ray' \
'/usr/local/bin/v2ctl' \
"$DAT_PATH" \
'/etc/systemd/system/v2ray.service' \
'/etc/systemd/system/v2ray@.service' \
'/etc/systemd/system/v2ray.service.d' \
'/etc/systemd/system/v2ray@.service.d'); then
echo 'error: Failed to remove V2Ray.'
exit 1
else
echo 'removed: /usr/local/bin/v2ray'
echo 'removed: /usr/local/bin/v2ctl'
echo "removed: $DAT_PATH"
echo 'removed: /etc/systemd/system/v2ray.service'
echo 'removed: /etc/systemd/system/v2ray@.service'
echo 'removed: /etc/systemd/system/v2ray.service.d'
echo 'removed: /etc/systemd/system/v2ray@.service.d'
echo 'Please execute the command: systemctl disable v2ray'
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
echo 'info: V2Ray has been removed.'
echo 'info: If necessary, manually delete the configuration and log files.'
if [[ -n "$JSONS_PATH" ]]; then
echo "info: e.g., $JSONS_PATH and /var/log/v2ray/ ..."
else
echo "info: e.g., $JSON_PATH and /var/log/v2ray/ ..."
fi
exit 0
fi
else
echo 'error: V2Ray is not installed.'
exit 1
fi
}
# Explanation of parameters in the script
show_help() {
echo "usage: $0 [--remove | --version number | -c | -f | -h | -l | -p]"
echo ' [-p address] [--version number | -c | -f]'
echo ' --remove Remove V2Ray'
echo ' --version Install the specified version of V2Ray, e.g., --version v4.18.0'
echo ' -c, --check Check if V2Ray can be updated'
echo ' -f, --force Force installation of the latest version of V2Ray'
echo ' -h, --help Show help'
echo ' -l, --local Install V2Ray from a local file'
echo ' -p, --proxy Download through a proxy server, e.g., -p http://127.0.0.1:8118 or -p socks5://127.0.0.1:1080'
exit 0
}
main() {
check_if_running_as_root
identify_the_operating_system_and_architecture
judgment_parameters "$@"
install_software "$package_provide_tput" 'tput'
red=$(tput setaf 1)
green=$(tput setaf 2)
aoi=$(tput setaf 6)
reset=$(tput sgr0)
# Parameter information
[[ "$HELP" -eq '1' ]] && show_help
[[ "$CHECK" -eq '1' ]] && check_update
[[ "$REMOVE" -eq '1' ]] && remove_v2ray
# Two very important variables
TMP_DIRECTORY="$(mktemp -d)"
ZIP_FILE="${TMP_DIRECTORY}/v2ray-linux-$MACHINE.zip"
# Install V2Ray from a local file, but still need to make sure the network is available
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
echo 'warn: Install V2Ray from a local file, but still need to make sure the network is available.'
echo -n 'warn: Please make sure the file is valid because we cannot confirm it. (Press any key) ...'
read -r
install_software 'unzip' 'unzip'
decompression "$LOCAL_FILE"
else
# Normal way
install_software 'curl' 'curl'
get_version
NUMBER="$?"
if [[ "$NUMBER" -eq '0' ]] || [[ "$FORCE" -eq '1' ]] || [[ "$NUMBER" -eq 2 ]]; then
echo "info: Installing V2Ray $RELEASE_VERSION for $(uname -m)"
download_v2ray
if [[ "$?" -eq '1' ]]; then
"rm" -r "$TMP_DIRECTORY"
echo "removed: $TMP_DIRECTORY"
exit 0
fi
install_software 'unzip' 'unzip'
decompression "$ZIP_FILE"
elif [[ "$NUMBER" -eq '1' ]]; then
echo "info: No new version. The current version of V2Ray is $CURRENT_VERSION ."
exit 0
fi
fi
# Determine if V2Ray is running
if systemctl list-unit-files | grep -qw 'v2ray'; then
if [[ -n "$(pidof v2ray)" ]]; then
stop_v2ray
V2RAY_RUNNING='1'
fi
fi
install_v2ray
install_startup_service_file
echo 'installed: /usr/local/bin/v2ray'
echo 'installed: /usr/local/bin/v2ctl'
# If the file exists, the content output of installing or updating geoip.dat and geosite.dat will not be displayed
if [[ ! -f "${DAT_PATH}/.undat" ]]; then
echo "installed: ${DAT_PATH}/geoip.dat"
echo "installed: ${DAT_PATH}/geosite.dat"
fi
if [[ "$CONFIG_NEW" -eq '1' ]]; then
echo "installed: ${JSON_PATH}/config.json"
fi
if [[ "$CONFDIR" -eq '1' ]]; then
echo "installed: ${JSON_PATH}/00_log.json"
echo "installed: ${JSON_PATH}/01_api.json"
echo "installed: ${JSON_PATH}/02_dns.json"
echo "installed: ${JSON_PATH}/03_routing.json"
echo "installed: ${JSON_PATH}/04_policy.json"
echo "installed: ${JSON_PATH}/05_inbounds.json"
echo "installed: ${JSON_PATH}/06_outbounds.json"
echo "installed: ${JSON_PATH}/07_transport.json"
echo "installed: ${JSON_PATH}/08_stats.json"
echo "installed: ${JSON_PATH}/09_reverse.json"
fi
if [[ "$LOG" -eq '1' ]]; then
echo 'installed: /var/log/v2ray/'
echo 'installed: /var/log/v2ray/access.log'
echo 'installed: /var/log/v2ray/error.log'
fi
if [[ "$SYSTEMD" -eq '1' ]]; then
echo 'installed: /etc/systemd/system/v2ray.service'
echo 'installed: /etc/systemd/system/v2ray@.service'
fi
"rm" -r "$TMP_DIRECTORY"
echo "removed: $TMP_DIRECTORY"
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
get_version
fi
echo "info: V2Ray $RELEASE_VERSION is installed."
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
if [[ "$V2RAY_RUNNING" -eq '1' ]]; then
start_v2ray
else
echo 'Please execute the command: systemctl enable v2ray; systemctl start v2ray'
fi
}
main "$@"

Binary file not shown.

View File

@@ -0,0 +1,65 @@
# 设置策略路由
# 添加路由表 100
sudo ip route add local default dev lo table 100
# 为路由表 100 设定规则
ip rule add fwmark 1 table 100
# 创建XRAY过滤器链
iptables -t mangle -N XRAY
# 代理局域网设备
iptables -t mangle -A XRAY -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 100.64.0.0/10 -j RETURN
iptables -t mangle -A XRAY -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A XRAY -d 172.16.0.0/12 -j RETURN
iptables -t mangle -A XRAY -d 192.0.0.0/24 -j RETURN
iptables -t mangle -A XRAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY -d 240.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY -d 255.255.255.255/32 -j RETURN
# 直连局域网,避免 XRAY 无法启动时无法连网关的 SSH如果你配置的是其他网段如 10.x.x.x 等),则修改成自己的
iptables -t mangle -A XRAY -d 10.10.10.0/24 -p tcp -j RETURN
# 直连局域网53 端口除外(因为要使用 XRAY 的 DNS)
iptables -t mangle -A XRAY -d 10.10.10.0/24 -p udp ! --dport 53 -j RETURN
# 直连 SO_MARK 为 0xff 的流量(0xff 是 16 进制数数值上等同与上面XRAY 配置的 255)此规则目的是解决XRAY占用大量CPUhttps://github.com/XRAY/XRAY-core/issues/2621
#iptables -t mangle -A XRAY -j RETURN -m mark --mark 0xff
# 给 UDP 打标记 1转发至 12345 端口
iptables -t mangle -A XRAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
# 给 TCP 打标记 1转发至 12345 端口
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
# 应用规则
iptables -t mangle -A PREROUTING -j XRAY
# 代理网关本机
iptables -t mangle -N XRAY_SELF
iptables -t mangle -A XRAY_SELF -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY_SELF -d 100.64.0.0/10 -j RETURN
iptables -t mangle -A XRAY_SELF -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY_SELF -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A XRAY_SELF -d 172.16.0.0/12 -j RETURN
iptables -t mangle -A XRAY_SELF -d 192.0.0.0/24 -j RETURN
iptables -t mangle -A XRAY_SELF -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY_SELF -d 240.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY_SELF -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A XRAY_SELF -d 10.10.10.0/24 -p tcp -j RETURN # 直连局域网
# 直连局域网53 端口除外(因为要使用 XRAY 的 DNS
iptables -t mangle -A XRAY_SELF -d 10.10.10.0/24 -p udp ! --dport 53 -j RETURN
# 直连 SO_MARK 为 0xff 的流量(0xff 是 16 进制数数值上等同与上面XRAY 配置的 255),此规则目的是避免代理本机(网关)流量出现回环问题
#iptables -t mangle -A XRAY_SELF -m mark --mark 0xff -j RETURN
iptables -t mangle -A XRAY_SELF -m mark --mark 2 -j RETURN
# 给 UDP 打标记,重路由
iptables -t mangle -A XRAY_SELF -p udp -j MARK --set-mark 1
# 给 TCP 打标记,重路由
iptables -t mangle -A XRAY_SELF -p tcp -j MARK --set-mark 1
# 应用规则
iptables -t mangle -A OUTPUT -j XRAY_SELF

View File

@@ -0,0 +1,200 @@
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"tag": "all-in",
"port": 12345,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
},
{
"protocol": "socks",
"port": 22999,
"listen": "0.0.0.0",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "none",
"udp": true,
"userLevel": 10
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
},
"streamSettings": {
"sockopt": {
"mark": 2
}
}
},
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "43.154.83.213",
"port": 29999,
"users": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9",
"alterId": 0,
"email": "192.168.11.19@qq.com",
"security": "auto",
"encryption": "none",
"flow": "xtls-rprx-direct"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"serverName": "tencent-hk-11.17.107421.xyz",
"allowInsecure": true,
"rejectUnknownSni": false,
"alpn": [
"h2",
"http/1.1"
],
"minVersion": "1.2",
"maxVersion": "1.3"
},
"sockopt": {
"mark": 2
}
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
},
{
"tag": "dns-out",
"protocol": "dns",
"settings": {
"address": "8.8.8.8"
},
"proxySettings": {
"tag": "proxy"
},
"streamSettings": {
"sockopt": {
"mark": 2
}
}
}
],
"dns": {
"hosts": {
"icederce.io": "192.168.11.19"
},
"servers": [
{
"address": "223.5.5.5",
"port": 53,
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
},
{
"address": "119.29.29.29",
"port": 53,
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
},
"8.8.8.8",
"1.1.1.1",
"https+local://doh.dns.sb/dns-query"
]
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"all-in"
],
"port": 53,
"outboundTag": "dns-out"
},
{
"type": "field",
"ip": [
"8.8.8.8",
"1.1.1.1"
],
"outboundTag": "proxy"
},
{
"type": "field",
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "block"
},
{
"type": "field",
"domain": [
"geosite:geolocation-!cn"
],
"outboundTag": "proxy"
},
{
"type": "field",
"domains": [
"geosite:cn"
],
"outboundTag": "direct"
}
]
}
}

View File

@@ -0,0 +1,76 @@
#!/usr/bin/env bash
# 设置策略路由
# 添加路由表 100
sudo ip route add local default dev lo table 100
# 为路由表 100 设定规则
+ip rule add fwmark 1 table 100
# 创建XRAY过滤器链
iptables -t mangle -N XRAY
# 代理局域网设备
iptables -t mangle -A XRAY -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 100.64.0.0/10 -j RETURN
iptables -t mangle -A XRAY -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A XRAY -d 172.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY -d 255.255.255.255/32 -j RETURN
# 直连局域网,避免 XRAY 无法启动时无法连网关的 SSH如果你配置的是其他网段如 10.x.x.x 等),则修改成自己的
iptables -t mangle -A XRAY -d 192.168.233.0/24 -p tcp -j RETURN
# 直连局域网53 端口除外(因为要使用 XRAY 的 DNS)
iptables -t mangle -A XRAY -d 192.168.233.0/24 -p udp ! --dport 53 -j RETURN
# 给 UDP 打标记 1转发至 12345 端口
iptables -t mangle -A XRAY -i ens3 -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
# 给 TCP 打标记 1转发至 12345 端口
iptables -t mangle -A XRAY -i ens3 -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
# 应用规则
iptables -t mangle -A PREROUTING -j XRAY
# 代理网关本机
iptables -t mangle -N XRAY_SELF
iptables -t mangle -A XRAY -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 100.64.0.0/10 -j RETURN
iptables -t mangle -A XRAY -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A XRAY -d 172.0.0.0/8 -j RETURN
iptables -t mangle -A XRAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A XRAY_SELF -d 192.168.233.0/24 -p tcp -j RETURN # 直连局域网
# 直连局域网53 端口除外(因为要使用 XRAY 的 DNS
iptables -t mangle -A XRAY_SELF -d 192.168.233.0/24 -p udp ! --dport 53 -j RETURN
# 除了上述的所有流量均为进入PostRouting的流量需要判定mark标记然后释放
iptables -t mangle -A XRAY_SELF -m mark --mark 23 -j RETURN
# 为CoreDNS开启PostRouting流量
# 请求UDP-53的流量 放行请求国内dns的请求直接出去
iptables -t mangle -A XRAY_SELF -i ens3 -p udp --dport 53 -j RETURN
# 请求DNS over TLS - 853 的流量 需要重新回到Xray中走代理
#iptables -t mangle -A XRAY_SELF -p tcp --dport 853 -j RETURN
#iptables -t mangle -A XRAY_SELF -p udp --dport 853 -j RETURN
# 所有其他流量,需要重路由
# 给 UDP 打标记,重路由
iptables -t mangle -A XRAY_SELF -i ens3 -p udp -j MARK --set-mark 1
# 给 TCP 打标记,重路由
iptables -t mangle -A XRAY_SELF -i ens3 -p tcp -j MARK --set-mark 1
# 应用规则
iptables -t mangle -A OUTPUT -j XRAY_SELF
# 新建 DIVERT 规则,避免已有连接的包二次通过 TPROXY理论上有一定的性能提升
iptables -t mangle -N DIVERT
iptables -t mangle -A DIVERT -i ens3 -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -I PREROUTING -p tcp -m socket -j DIVERT

View File

@@ -0,0 +1,18 @@
#!/usr/bin/ bash
iptables -t mangle -F XRAY
iptables -t mangle -F XRAY_SELF
iptables -t mangle -F DIVERT
iptables -t mangle -D PREROUTING -j XRAY
iptables -t mangle -D PREROUTING 1
iptables -t mangle -X XRAY
iptables -t mangle -X DIVERT
iptables -t mangle -D OUTPUT -j XRAY_SELF
iptables -t mangle -X XRAY_SELF
sudo ip route del local default dev lo table 100
iptables -t mangle -nL --line-number

View File

@@ -0,0 +1,185 @@
{
"log": {
"loglevel": "warning",
"error": "/var/log/xray/error.log",
"access": "/var/log/xray/access.log"
},
"inbounds": [
{
"tag": "all-in",
"port": 12345,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
},
{
"protocol": "socks",
"port": 22999,
"listen": "0.0.0.0",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 10
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
},
"streamSettings": {
"sockopt": {
"mark": 233
}
}
},
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "43.154.83.213",
"port": 29999,
"users": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9",
"alterId": 0,
"email": "192.168.11.19@qq.com",
"security": "auto",
"encryption": "none",
"flow": "xtls-rprx-direct"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"serverName": "tencent-hk-11.17.107421.xyz",
"allowInsecure": true,
"rejectUnknownSni": false,
"alpn": [
"h2",
"http/1.1"
],
"minVersion": "1.2",
"maxVersion": "1.3"
},
"sockopt": {
"mark": 233
}
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
},
{
"tag": "dns-out",
"protocol": "dns",
"streamSettings": {
"sockopt": {
"mark": 233
}
}
}
],
"dns": {
"hosts": {
"proxy.io": "192.168.233.2"
},
"servers": [
{
"address": "223.5.5.5",
"port": 53,
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
},
{
"address": "8.8.8.8",
"port": 53,
"domains": [
"geosite:geolocation-!cn"
]
},
"https+local://doh.dns.sb/dns-query"
]
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"all-in"
],
"port": 53,
"outboundTag": "dns-out"
},
{
"type": "field",
"ip": [
"8.8.8.8",
"1.1.1.1"
],
"outboundTag": "proxy"
},
{
"type": "field",
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "block"
},
{
"type": "field",
"domain": [
"travel.state.gov",
"geosite:geolocation-!cn"
],
"outboundTag": "proxy"
}
]
}
}

View File

@@ -0,0 +1,164 @@
// 为了更好的分流体验,请替换默认路由规则文件为 Loyalsoldier/v2ray-rules-dat否则 Xray-core 将无法加载本配置。
//
//sudo curl -oL /usr/local/share/xray/geoip.dat https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat
//sudo curl -oL /usr/local/share/xray/geosite.dat https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat
// https://xtls.github.io/document/level-2/tproxy.html#xray-%E9%85%8D%E7%BD%AE
{
"log": {
"loglevel": "warning",
"error": "/var/log/xray/error.log",
"access": "/var/log/xray/access.log"
},
"inbounds": [
{
"tag": "dns-in",
"port": 53,
"protocol": "dokodemo-door",
"settings": {
"address": "192.168.233.2",
"port": 5353,
"network": "udp",
"userLevel": 1
}
},
{
"tag": "all-in",
"port": 12345,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
},
{
"protocol": "socks",
"port": 22999,
"listen": "0.0.0.0",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 10
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "43.154.83.213",
"port": 29999,
"users": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9",
"alterId": 0,
"email": "192.168.11.19@qq.com",
"security": "auto",
"encryption": "none",
"flow": "xtls-rprx-direct"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"serverName": "tencent-hk-11.17.107421.xyz",
"allowInsecure": true,
"rejectUnknownSni": false,
"alpn": [
"h2",
"http/1.1"
],
"minVersion": "1.2",
"maxVersion": "1.3"
},
"sockopt": {
"mark": 23
}
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
},
"streamSettings": {
"sockopt": {
"mark": 23
}
}
},
{
"tag": "block",
"protocol": "blackhole"
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"ip": [
"geoip:private",
"geoip:cn"
],
"domain": [
"geosite:cn",
"geosite:apple-cn"
],
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
"8.8.8.8",
"8.8.4.4",
"1.1.1.1",
"1.0.0.1"
],
"domain": [
"geosite:geolocation-!cn"
],
"outboundTag": "proxy"
},
{
"type": "field",
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "block"
}
]
}
}

View File

@@ -0,0 +1,167 @@
{
"log": {
"loglevel": "warning",
"error": "/var/log/xray/error.log",
"access": "/var/log/xray/access.log"
},
"inbounds": [
{
"tag": "dns-in",
"port": 53,
"protocol": "dokodemo-door",
"settings": {
"address": "192.168.233.2",
"port": 5353,
"network": "udp",
"userLevel": 1
}
},
{
"tag": "all-in",
"port": 12345,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
},
{
"protocol": "socks",
"port": 22999,
"listen": "0.0.0.0",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"userLevel": 10
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
},
"streamSettings": {
"sockopt": {
"mark": 23
}
}
},
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "43.154.83.213",
"port": 29999,
"users": [
{
"id": "fc903f5d-a007-482b-928c-570da9a851f9",
"alterId": 0,
"email": "192.168.11.19@qq.com",
"security": "auto",
"encryption": "none",
"flow": "xtls-rprx-direct"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"serverName": "tencent-hk-11.17.107421.xyz",
"allowInsecure": true,
"rejectUnknownSni": false,
"alpn": [
"h2",
"http/1.1"
],
"minVersion": "1.2",
"maxVersion": "1.3"
},
"sockopt": {
"mark": 23
}
}
},
{
"tag": "block",
"protocol": "blackhole"
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"ip": [
"geoip:google",
"geoip:us",
"geoip:facebook",
"geoip:jp",
"geoip:facebook",
"geoip:telegram",
"geoip:twitter",
"1.1.1.1/32",
"1.0.0.1/32",
"8.8.8.8/32",
"8.8.4.4/32"
],
"domain": [
"github.com",
"youtube.com",
"geosite:gfw",
"geosite:greatfire",
"chatgpt.107421.xyz"
],
"outboundTag": "proxy"
},
{
"type": "field",
"ip": [
"223.5.5.5/32",
"119.29.29.29/32",
"180.76.76.76/32",
"114.114.114.114/32",
"geoip:cn",
"geoip:private"
],
"domain": [
"superwdd-my.sharepoint.com",
"sharepoint.com",
"geosite:apple-cn"
],
"outboundTag": "direct"
}
]
}
}

View File

@@ -0,0 +1,27 @@
#!/bin/bash
LogPath=/var/log/xray/geoip_update.log
rm -rf /usr/local/share/xray/geosite.dat
rm -rf /usr/local/share/xray/geoip.dat
echo "current time is $(date), start to update geo ip for xray" >> $LogPath
curl --connect-timeout 5 -s -o /dev/null https://www.google.com
if [[ $? -eq 0 ]];then
echo "start to download from github !"
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -O /usr/local/share/xray/geosite.dat
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -O /usr/local/share/xray/geoip.dat
else
echo "start to download from jsdelivr !"
wget https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -O /usr/local/share/xray/geosite.dat
wget https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat -O /usr/local/share/xray/geoip.dat
fi
echo "start to restrat xray !" >> $LogPath
systemctl restart xray

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
docker run \
-d \
--name redis \
-p 16379:6379 \
-e ALLOW_EMPTY_PASSWORD=yes \
bitnami/redis:6.2.7

View File

@@ -0,0 +1,72 @@
#!/usr/bin/env bash
cat > /etc/coredns/Corefile <<EOF
# https://coredns.io/plugins/cache/
(global_cache) {
cache {
# [5, 60]
success 65536 7200 900
# [1, 10]
denial 8192 600 60
prefetch 1 60m 10%
}
}
.:5353 {
ads {
default-lists
blacklist https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt
whitelist https://files.krnl.eu/whitelist.txt
log
auto-update-interval 24h
list-store ads-cache
}
errors
# health
# prometheus :9153
import global_cache
template ANY AAAA {
rcode NXDOMAIN
}
dnsredir accelerated-domains.china.conf google.china.conf apple.china.conf mydns.conf {
expire 15s
max_fails 3
health_check 3s
policy round_robin
path_reload 2s
to 223.5.5.5 119.29.29.29 114.114.114.114
no_ipv6
}
hosts {
fallthrough
}
dnsredir . {
expire 60s
max_fails 5
health_check 5s
policy random
spray
to tls://8.8.8.8@dns.google tls://8.8.4.4@dns.google
to tls://1.1.1.1:853 tls://1.0.0.1:853
# to tcp://8.8.8.8
# Global TLS server name
# tls_servername cloudflare-dns.com
}
log
loop
reload 6s
}
EOF

View File

@@ -0,0 +1,24 @@
#!bin/bash
cat > /etc/systemd/system/coredns.service << EOF
[Unit]
Description=CoreDNS DNS - Custom Build Plugins server
Documentation=https://coredns.minidump.info/
After=network.target
[Service]
PermissionsStartOnly=true
LimitNOFILE=1048576
LimitNPROC=512
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
User=coredns
WorkingDirectory=~
ExecStart=/usr/local/bin/coredns -conf=/etc/coredns/Corefile
ExecReload=/bin/kill -SIGUSR1 $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
cat > /usr/local/bin/update_coredns.sh <<EOF
#!/bin/bash
cd /usr/local/etc/
rm accelerated-domains.china.conf
wget https://jsdelivr.icloudnative.io/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf -O /usr/local/etc/accelerated-domains.china.conf
rm apple.china.conf
wget https://jsdelivr.icloudnative.io/gh/felixonmars/dnsmasq-china-list/apple.china.conf -O /usr/local/etc/apple.china.conf
rm google.china.conf
wget https://jsdelivr.icloudnative.io/gh/felixonmars/dnsmasq-china-list/google.china.conf -O /usr/local/etc/google.china.conf
EOF
sudo chmod +x /usr/local/bin/update_coredns.sh

View File

@@ -0,0 +1,30 @@
.:5353 {
ads {
strict-default-lists
blacklist https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt
whitelist https://files.krnl.eu/whitelist.txt
log
auto-update-interval 48h
list-store ads-cache
}
hosts {
fallthrough
}
forward . tcp://8.8.8.8 127.0.0.1:53001 {
log
cache
redisc {
endpoint 16379
}
health
reload
}
.:53001 {
bind 127.0.0.1
forward . tls://1.1.1.1:853 {
tls_servername cloudflare-dns.com
}
cache
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,191 @@
// https://guide.v2fly.org/app/tproxy.html#%E4%B8%BA-v2ray-%E9%85%8D%E7%BD%AE%E9%80%8F%E6%98%8E%E4%BB%A3%E7%90%86%E7%9A%84%E5%85%A5%E7%AB%99%E5%92%8C-dns-%E5%88%86%E6%B5%81
{
"inbounds": [
{
"tag":"transparent",
"port": 12345,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy", // 透明代理使用 TPROXY 方式
"mark":255
}
}
},
{
"port": 1080,
"protocol": "socks", // 入口协议为 SOCKS 5
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "vmess", // 代理服务器
"settings": {
"vnext": [
...
]
},
"streamSettings": {
"sockopt": {
"mark": 255
}
},
"mux": {
"enabled": true
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP"
},
"streamSettings": {
"sockopt": {
"mark": 255
}
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
},
{
"tag": "dns-out",
"protocol": "dns",
"streamSettings": {
"sockopt": {
"mark": 255
}
}
}
],
"dns": {
"servers": [
{
"address": "223.5.5.5", //中国大陆域名使用阿里的 DNS
"port": 53,
"domains": [
"geosite:cn",
"ntp.org", // NTP 服务器
"$myserver.address" // 此处改为你 VPS 的域名
]
},
{
"address": "114.114.114.114", //中国大陆域名使用 114 的 DNS (备用)
"port": 53,
"domains": [
"geosite:cn",
"ntp.org", // NTP 服务器
"$myserver.address" // 此处改为你 VPS 的域名
]
},
{
"address": "8.8.8.8", //非中国大陆域名使用 Google 的 DNS
"port": 53,
"domains": [
"geosite:geolocation-!cn"
]
},
{
"address": "1.1.1.1", //非中国大陆域名使用 Cloudflare 的 DNS
"port": 53,
"domains": [
"geosite:geolocation-!cn"
]
}
]
},
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{ // 劫持 53 端口 UDP 流量,使用 V2Ray 的 DNS
"type": "field",
"inboundTag": [
"transparent"
],
"port": 53,
"network": "udp",
"outboundTag": "dns-out"
},
{ // 直连 123 端口 UDP 流量NTP 协议)
"type": "field",
"inboundTag": [
"transparent"
],
"port": 123,
"network": "udp",
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
// 设置 DNS 配置中的国内 DNS 服务器地址直连,以达到 DNS 分流目的
"223.5.5.5",
"114.114.114.114"
],
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
// 设置 DNS 配置中的国外 DNS 服务器地址走代理,以达到 DNS 分流目的
"8.8.8.8",
"1.1.1.1"
],
"outboundTag": "proxy" // 改为你自己代理的出站 tag
},
{ // 广告拦截
"type": "field",
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "block"
},
{ // BT 流量直连
"type": "field",
"protocol":["bittorrent"],
"outboundTag": "direct"
},
{ // 直连中国大陆主流网站 ip 和 保留 ip
"type": "field",
"ip": [
"geoip:private",
"geoip:cn"
],
"outboundTag": "direct"
},
{ // 直连中国大陆主流网站域名
"type": "field",
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
}
]
}
}

Some files were not shown because too many files have changed in this diff Show More