mirror of
https://github.com/tsingui/softcenter-1.git
synced 2024-11-14 09:55:17 +00:00
add cpufreq
This commit is contained in:
parent
f4d1a54489
commit
bb78a6a707
30
cpufreq/build.sh
Executable file
30
cpufreq/build.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
MODULE=cpufreq
|
||||||
|
VERSION=1.0
|
||||||
|
TITLE=CPU频率设置
|
||||||
|
DESCRIPTION='Intel CPU频率设置'
|
||||||
|
HOME_URL=Module_cpufreq.asp
|
||||||
|
|
||||||
|
# Check and include base
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
if [ "$MODULE" == "" ]; then
|
||||||
|
echo "module not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$DIR/$MODULE/$MODULE/install.sh" ]; then
|
||||||
|
echo "install script not found"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# now include build_base.sh
|
||||||
|
. $DIR/../softcenter/build_base.sh
|
||||||
|
|
||||||
|
# change to module directory
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
# do something here
|
||||||
|
|
||||||
|
do_build_result
|
8
cpufreq/config.json.js
Normal file
8
cpufreq/config.json.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"version":"1.0",
|
||||||
|
"md5":"e9ddf7d75daa25dc388ff5ef62407c6b",
|
||||||
|
"home_url":"Module_cpufreq.asp",
|
||||||
|
"title":"CPU频率设置",
|
||||||
|
"description":"Intel CPU频率设置",
|
||||||
|
"build_date":"2019-01-30_19:23:59"
|
||||||
|
}
|
BIN
cpufreq/cpufreq.tar.gz
Normal file
BIN
cpufreq/cpufreq.tar.gz
Normal file
Binary file not shown.
BIN
cpufreq/cpufreq/bin/cpufreq-info
Executable file
BIN
cpufreq/cpufreq/bin/cpufreq-info
Executable file
Binary file not shown.
BIN
cpufreq/cpufreq/bin/cpufreq-set
Executable file
BIN
cpufreq/cpufreq/bin/cpufreq-set
Executable file
Binary file not shown.
25
cpufreq/cpufreq/install.sh
Normal file
25
cpufreq/cpufreq/install.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
export KSROOT=/jffs/softcenter
|
||||||
|
source $KSROOT/scripts/base.sh
|
||||||
|
find /jffs/softcenter/init.d/ -name "*cpufreq*" | xargs rm -rf
|
||||||
|
mkdir -p /jffs/softcenter/lib
|
||||||
|
cp -rf /tmp/cpufreq/bin/* /jffs/softcenter/bin/
|
||||||
|
cp -rf /tmp/cpufreq/scripts/* /jffs/softcenter/scripts/
|
||||||
|
cp -rf /tmp/cpufreq/webs/* /jffs/softcenter/webs/
|
||||||
|
cp -rf /tmp/cpufreq/lib/* /jffs/softcenter/lib/
|
||||||
|
cp -rf /tmp/cpufreq/res/* /jffs/softcenter/res/
|
||||||
|
cp -rf /tmp/cpufreq/uninstall.sh /jffs/softcenter/scripts/uninstall_cpufreq.sh
|
||||||
|
|
||||||
|
rm -fr /tmp/cpufreq* >/dev/null 2>&1
|
||||||
|
chmod +x /jffs/softcenter/scripts/cpufreq*.sh
|
||||||
|
chmod +x /jffs/softcenter/scripts/uninstall_cpufreq.sh
|
||||||
|
[ ! -L "/jffs/softcenter/init.d/S99cpufreq.sh" ] && cp -rf /jffs/softcenter/scripts/cpufreq_config.sh /jffs/softcenter/init.d/S99cpufreq.sh
|
||||||
|
|
||||||
|
dbus set cpufreq_version="1.0"
|
||||||
|
dbus set softcenter_module_cpufreq_version="1.0"
|
||||||
|
dbus set softcenter_module_cpufreq_description="Intel CPU频率设置"
|
||||||
|
dbus set softcenter_module_cpufreq_install=1
|
||||||
|
dbus set softcenter_module_cpufreq_name=cpufreq
|
||||||
|
dbus set softcenter_module_cpufreq_title="CPU频率设置"
|
||||||
|
|
BIN
cpufreq/cpufreq/lib/libcpufreq.so
Executable file
BIN
cpufreq/cpufreq/lib/libcpufreq.so
Executable file
Binary file not shown.
BIN
cpufreq/cpufreq/lib/libcpufreq.so.0
Executable file
BIN
cpufreq/cpufreq/lib/libcpufreq.so.0
Executable file
Binary file not shown.
BIN
cpufreq/cpufreq/lib/libcpufreq.so.0.0.0
Executable file
BIN
cpufreq/cpufreq/lib/libcpufreq.so.0.0.0
Executable file
Binary file not shown.
1
cpufreq/cpufreq/res/cpufreq_log.htm
Normal file
1
cpufreq/cpufreq/res/cpufreq_log.htm
Normal file
@ -0,0 +1 @@
|
|||||||
|
<% nvram_dump("cpufreq.log",""); %>
|
BIN
cpufreq/cpufreq/res/icon-cpufreq.png
Normal file
BIN
cpufreq/cpufreq/res/icon-cpufreq.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
34
cpufreq/cpufreq/scripts/cpufreq_config.sh
Normal file
34
cpufreq/cpufreq/scripts/cpufreq_config.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
eval `dbus export cpufreq`
|
||||||
|
start(){
|
||||||
|
if [ "-n $cpufreq_set" ];then
|
||||||
|
[ "-z `echo ${LD_LIBRARY_PATH} |grep jffs`" ] && export LD_LIBRARY_PATH=/jffs/softcenter/lib:/lib:/usr/lib:/opt/lantiq/usr/lib:/opt/lantiq/usr/sbin/:/tmp/wireless/lantiq/usr/lib/:${LD_LIBRARY_PATH}
|
||||||
|
[ "$cpufreq_set" -gt "$cpufreq_max" ] && echo "$(date "+%F %T"): 频率设置错误" >> /tmp/cpufreq.log && exit 1
|
||||||
|
[ "$cpufreq_set" -lt 150 ] && echo "$(date "+%F %T"): 频率设置错误" >> /tmp/cpufreq.log && exit 1
|
||||||
|
if [ "$cpufreq_set" -eq 667 ] ;then
|
||||||
|
/jffs/softcenter/bin/cpufreq-set -f 666666
|
||||||
|
else
|
||||||
|
/jffs/softcenter/bin/cpufreq-set -f ${cpufreq_set}MHz
|
||||||
|
fi
|
||||||
|
echo "$(date "+%F %T"): 已设置频率:${cpufreq_set}MHz" >> /tmp/cpufreq.log
|
||||||
|
/jffs/softcenter/scripts/cpufreq_status.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop(){
|
||||||
|
[ "-e /jffs/softcenter/init.d/S99cpufreq.sh" ] && rm -rf /jffs/softcenter/init.d/S99cpufreq.sh
|
||||||
|
}
|
||||||
|
restart() {
|
||||||
|
if [ "`dbus get cpufreq_enable`" == "1" ];then
|
||||||
|
[ "! -e /jffs/softcenter/init.d/S99cpufreq.sh" ] && cp -r /jffs/softcenter/scripts/cpufreq_config.sh /jffs/softcenter/init.d/S99cpufreq.sh
|
||||||
|
echo "$(date "+%F %T"): 已开启自动频率设置" >> /tmp/cpufreq.log
|
||||||
|
start
|
||||||
|
else
|
||||||
|
echo "$(date "+%F %T"): 插件未启用,已关闭自动频率设置" >> /tmp/cpufreq.log
|
||||||
|
stop
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restart
|
||||||
|
|
11
cpufreq/cpufreq/scripts/cpufreq_status.sh
Normal file
11
cpufreq/cpufreq/scripts/cpufreq_status.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
[ "-z `echo ${LD_LIBRARY_PATH} |grep jffs`" ] && export LD_LIBRARY_PATH=/jffs/softcenter/lib:/lib:/usr/lib:/opt/lantiq/usr/lib:/opt/lantiq/usr/sbin/:/tmp/wireless/lantiq/usr/lib/:${LD_LIBRARY_PATH}
|
||||||
|
/jffs/softcenter/bin/cpufreq-info -c 0 > /tmp/cpufreq-info 2>&1
|
||||||
|
|
||||||
|
freq_cur=$(cat /tmp/cpufreq-info |grep 'current CPU' |awk '{printf $5}')
|
||||||
|
freq_max=$(cat /tmp/cpufreq-info |grep 'hardware limits' |awk '{printf $6}')
|
||||||
|
|
||||||
|
dbus set cpufreq_cur=$freq_cur
|
||||||
|
dbus set cpufreq_max=$freq_max
|
||||||
|
|
||||||
|
|
16
cpufreq/cpufreq/uninstall.sh
Normal file
16
cpufreq/cpufreq/uninstall.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
eval `dbus export cpufreq_`
|
||||||
|
source /jffs/softcenter/scripts/base.sh
|
||||||
|
|
||||||
|
sh /jffs/softcenter/scripts/cpufreq_config.sh stop
|
||||||
|
|
||||||
|
find /jffs/softcenter/init.d/ -name "*cpufreq*" | xargs rm -rf
|
||||||
|
rm -rf /jffs/softcenter/bin/cpufreq-info
|
||||||
|
rm -rf /jffs/softcenter/bin/cpufreq-set
|
||||||
|
rm -rf /jffs/softcenter/res/icon-cpufreq.png
|
||||||
|
rm -rf /jffs/softcenter/scripts/cpufreq*.sh
|
||||||
|
rm -rf /jffs/softcenter/webs/Module_cpufreq.asp
|
||||||
|
rm -rf /jffs/softcenter/lib/libcpufreq.so
|
||||||
|
rm -rf /jffs/softcenter/lib/libcpufreq.so.0
|
||||||
|
rm -rf /jffs/softcenter/lib/libcpufreq.so.0.0.0
|
||||||
|
rm -f /jffs/softcenter/scripts/uninstall_cpufreq.sh
|
320
cpufreq/cpufreq/webs/Module_cpufreq.asp
Normal file
320
cpufreq/cpufreq/webs/Module_cpufreq.asp
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
|
||||||
|
<meta HTTP-EQUIV="Expires" CONTENT="-1"/>
|
||||||
|
<link rel="shortcut icon" href="images/favicon.png"/>
|
||||||
|
<link rel="icon" href="images/favicon.png"/>
|
||||||
|
<title>CPU频率设置</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="index_style.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="form_style.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="usp_style.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/element.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="ParentalControl.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/icon.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/device-map/device-map.css">
|
||||||
|
<script type="text/javascript" src="/state.js"></script>
|
||||||
|
<script type="text/javascript" src="/popup.js"></script>
|
||||||
|
<script type="text/javascript" src="/help.js"></script>
|
||||||
|
<script type="text/javascript" src="/validator.js"></script>
|
||||||
|
<script type="text/javascript" src="/js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="/general.js"></script>
|
||||||
|
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
|
||||||
|
<script type="text/javascript" src="/dbconf?p=cpufreq&v=<% uptime(); %>"></script>
|
||||||
|
<script type="text/javascript" src="/client_function.js"></script>
|
||||||
|
<style>
|
||||||
|
.show-btn1, .show-btn2, .show-btn3 {
|
||||||
|
border: 1px solid #222;
|
||||||
|
background: linear-gradient(to bottom, #919fa4 0%, #67767d 100%); /* W3C */
|
||||||
|
/*background: linear-gradient(to bottom, #91071f 0%, #700618 100%);*/ /* W3C */
|
||||||
|
font-size:10pt;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 3.75px;
|
||||||
|
border-radius: 5px 5px 0px 0px;
|
||||||
|
width:8.45601%;
|
||||||
|
/*border: 1px solid #91071f;*/
|
||||||
|
/*background: none;*/
|
||||||
|
}
|
||||||
|
.active {
|
||||||
|
background: #2f3a3e;
|
||||||
|
background: linear-gradient(to bottom, #61b5de 0%, #279fd9 100%); /* W3C */
|
||||||
|
/*background: linear-gradient(to bottom, #cf0a2c 0%, #91071f 100%);*/ /* W3C */
|
||||||
|
/*border: 1px solid #91071f;*/
|
||||||
|
}
|
||||||
|
.popup_bar_bg_ks{
|
||||||
|
position:fixed;
|
||||||
|
margin: auto;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width:100%;
|
||||||
|
height:100%;
|
||||||
|
z-index:99;
|
||||||
|
filter:alpha(opacity=90); /*IE5、IE5.5、IE6、IE7*/
|
||||||
|
background-repeat: repeat;
|
||||||
|
visibility:hidden;
|
||||||
|
overflow:hidden;
|
||||||
|
background-color: #444F53;*/
|
||||||
|
background:rgba(68, 79, 83, 0.9) none repeat scroll 0 0 !important;
|
||||||
|
/*background: url(/images/New_ui/login_bg.png);
|
||||||
|
background-position: 0 0;
|
||||||
|
background-size: cover;
|
||||||
|
opacity: .94;*/
|
||||||
|
}
|
||||||
|
.ss_btn {
|
||||||
|
border: 1px solid #222;
|
||||||
|
background: linear-gradient(to bottom, #003333 0%, #000000 100%); /* W3C */
|
||||||
|
/*background: linear-gradient(to bottom, #91071f 0%, #700618 100%);*/ /* W3C */
|
||||||
|
font-size:10pt;
|
||||||
|
color: #fff;
|
||||||
|
padding: 5px 5px;
|
||||||
|
border-radius: 5px 5px 5px 5px;
|
||||||
|
width:14%;
|
||||||
|
}
|
||||||
|
.ss_btn:hover {
|
||||||
|
border: 1px solid #222;
|
||||||
|
background: linear-gradient(to bottom, #27c9c9 0%, #279fd9 100%); /* W3C */
|
||||||
|
/*background: linear-gradient(to bottom, #cf0a2c 0%, #91071f 100%);*/ /* W3C */
|
||||||
|
font-size:10pt;
|
||||||
|
color: #fff;
|
||||||
|
padding: 5px 5px;
|
||||||
|
border-radius: 5px 5px 5px 5px;
|
||||||
|
width:14%;
|
||||||
|
}
|
||||||
|
textarea{
|
||||||
|
width:99%;
|
||||||
|
font-family:'Lucida Console';
|
||||||
|
font-size:12px;
|
||||||
|
color:#FFFFFF;
|
||||||
|
background:#475A5F;
|
||||||
|
/*background:transparent;*/
|
||||||
|
/*border:1px solid #91071f;*/
|
||||||
|
}
|
||||||
|
input[type=button]:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
var cpumax;
|
||||||
|
var _responseLen;
|
||||||
|
function E(e) {
|
||||||
|
return (typeof(e) == 'string') ? document.getElementById(e) : e;
|
||||||
|
}
|
||||||
|
function init() {
|
||||||
|
show_menu(menu_hook);
|
||||||
|
check_status();
|
||||||
|
get_log();
|
||||||
|
buildswitch();
|
||||||
|
var rrt = document.getElementById("switch");
|
||||||
|
if (document.form.cpufreq_enable.value != "1") {
|
||||||
|
rrt.checked = false;
|
||||||
|
} else {
|
||||||
|
rrt.checked = true;
|
||||||
|
}
|
||||||
|
$('#switch_tr').after(verifyFields());
|
||||||
|
document.form.cpufreq_set.value=<% dbus_get_def("cpufreq_set", "0"); %>;
|
||||||
|
}
|
||||||
|
function buildswitch(){
|
||||||
|
$("#switch").click(
|
||||||
|
function(){
|
||||||
|
if(document.getElementById('switch').checked){
|
||||||
|
document.form.cpufreq_enable.value = 1;
|
||||||
|
}else{
|
||||||
|
document.form.cpufreq_enable.value = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function verifyFields() {
|
||||||
|
check_status();
|
||||||
|
cpumax=<% dbus_get_def("cpufreq_max", "0"); %>;
|
||||||
|
var code = '';
|
||||||
|
code = code + '<tr id="cpufreq_tr">';
|
||||||
|
code = code + '<th>可用频率</th>';
|
||||||
|
code = code + '<td id="cpufreq_set_tr">';
|
||||||
|
code = code + '<select id="cpufreq_set" name="cpufreq_set" class="input_option">';
|
||||||
|
if ( cpumax == 1200 ) {
|
||||||
|
code = code + '<option value="1200" <% dbus_match( "cpufreq_set", "1200","selected"); %>>1200MHz</option>';
|
||||||
|
code = code + '<option value="800" <% dbus_match( "cpufreq_set", "800","selected"); %>>800MHz</option>';
|
||||||
|
code = code + '<option value="600" <% dbus_match( "cpufreq_set", "600","selected"); %>>600MHz</option>';
|
||||||
|
code = code + '<option value="150" <% dbus_match( "cpufreq_set", "150","selected"); %>>150MHz</option>';
|
||||||
|
} else if ( cpumax == 1000 ) {
|
||||||
|
code = code + '<option value="1000" <% dbus_match( "cpufreq_set", "1000","selected"); %>>1000MHz</option>';
|
||||||
|
code = code + '<option value="667" <% dbus_match( "cpufreq_set", "667","selected"); %>>667MHz</option>';
|
||||||
|
code = code + '<option value="333" <% dbus_match( "cpufreq_set", "333","selected"); %>>333MHz</option>';
|
||||||
|
code = code + '<option value="167" <% dbus_match( "cpufreq_set", "167","selected"); %>>167MHz</option>';
|
||||||
|
} else if ( cpumax == 800 ) {
|
||||||
|
code = code + '<option value="800" <% dbus_match( "cpufreq_set", "800","selected"); %>>800MHz</option>';
|
||||||
|
code = code + '<option value="600" <% dbus_match( "cpufreq_set", "600","selected"); %>>600MHz</option>';
|
||||||
|
code = code + '<option value="150" <% dbus_match( "cpufreq_set", "150","selected"); %>>150MHz</option>';
|
||||||
|
}
|
||||||
|
code = code + '</select>';
|
||||||
|
code = code + '</td>';
|
||||||
|
code = code + '</tr>';
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
function save() {
|
||||||
|
if ( cpumax == 1200 )
|
||||||
|
// 提交数据
|
||||||
|
document.form.action_mode.value = 'toolscript';
|
||||||
|
document.form.action_script.value = "cpufreq_config.sh";
|
||||||
|
showLoading(1);
|
||||||
|
refreshpage(5);
|
||||||
|
document.form.submit();
|
||||||
|
}
|
||||||
|
function check_status(){
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '/applydb.cgi?p=cpufreq¤t_page=Module_cpufreq.asp.asp&next_page=Module_cpufreq.asp.asp&group_id=&modified=0&action_mode=+Refresh+&action_script=cpufreq_status.sh&action_wait=&first_time=&preferred_lang=CN&firmver=3.0.0.4',
|
||||||
|
dataType: 'html',
|
||||||
|
success: function (response) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function get_log() {
|
||||||
|
$.ajax({
|
||||||
|
url: '/res/cpufreq_log.htm',
|
||||||
|
dataType: 'html',
|
||||||
|
success: function(response) {
|
||||||
|
var retArea = E("log_content1");
|
||||||
|
if (_responseLen == response.length) {
|
||||||
|
noChange++;
|
||||||
|
} else {
|
||||||
|
noChange = 0;
|
||||||
|
}
|
||||||
|
if (noChange > 6000) {
|
||||||
|
//retArea.value = "当前日志文件为空";
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
setTimeout("get_log();",2000);
|
||||||
|
}
|
||||||
|
retArea.value = response;
|
||||||
|
_responseLen = response.length;
|
||||||
|
},
|
||||||
|
error: function(xhr) {
|
||||||
|
//setTimeout("get_log();", 1000);
|
||||||
|
E("log_content1").value = "暂无日志信息!";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function menu_hook(title, tab) {
|
||||||
|
tabtitle[tabtitle.length -1] = new Array("", "软件中心", "离线安装", "CPU频率设置");
|
||||||
|
tablink[tablink.length -1] = new Array("", "Main_Soft_center.asp", "Main_Soft_setting.asp", "Module_cpufreq.asp");
|
||||||
|
}
|
||||||
|
function reload_Soft_Center(){
|
||||||
|
location.href = "/Main_Soft_center.asp";
|
||||||
|
}
|
||||||
|
function done_validating(action) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init();">
|
||||||
|
<div id="TopBanner"></div>
|
||||||
|
<div id="Loading" class="popup_bg"></div>
|
||||||
|
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
|
||||||
|
<form method="POST" name="form" action="/applydb.cgi?p=cpufreq" target="hidden_frame">
|
||||||
|
<input type="hidden" name="current_page" value="Module_cpufreq.asp"/>
|
||||||
|
<input type="hidden" name="next_page" value="Module_cpufreq.asp"/>
|
||||||
|
<input type="hidden" name="group_id" value=""/>
|
||||||
|
<input type="hidden" name="modified" value="0"/>
|
||||||
|
<input type="hidden" name="action_mode" value=" Refresh "/>
|
||||||
|
<input type="hidden" name="action_script" value="cpufreq_config.sh"/>
|
||||||
|
<input type="hidden" name="action_wait" value="5"/>
|
||||||
|
<input type="hidden" name="first_time" value=""/>
|
||||||
|
<input type="hidden" name="cpufreq_enable" value="<% dbus_get_def("cpufreq_enable", "0"); %>"/>
|
||||||
|
<input type="hidden" name="cpufreq_cur" value="<% dbus_get_def("cpufreq_cur", "0"); %>"/>
|
||||||
|
<input type="hidden" name="cpufreq_set" value="<% dbus_get_def("cpufreq_set", "0"); %>"/>
|
||||||
|
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>"/>
|
||||||
|
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>"/>
|
||||||
|
<table class="content" align="center" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td width="17"> </td>
|
||||||
|
<td valign="top" width="202">
|
||||||
|
<div id="mainMenu"></div>
|
||||||
|
<div id="subMenu"></div>
|
||||||
|
</td>
|
||||||
|
<td valign="top">
|
||||||
|
<div id="tabMenu" class="submenuBlock"></div>
|
||||||
|
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0" style="display: block;">
|
||||||
|
<tr>
|
||||||
|
<td align="left" valign="top">
|
||||||
|
<div>
|
||||||
|
<table width="760px" border="0" cellpadding="5" cellspacing="0" bordercolor="#6b8fa3" class="FormTitle" id="FormTitle">
|
||||||
|
<tr>
|
||||||
|
<td bgcolor="#4D595D" colspan="3" valign="top">
|
||||||
|
<div> </div>
|
||||||
|
<div id="cpufreq_title" style="float:left;" class="formfonttitle" style="padding-top: 12px">CPU频率设置</div>
|
||||||
|
<div style="float:right; width:15px; height:25px;margin-top:10px"><img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img></div>
|
||||||
|
<div style="margin:30px 0 10px 5px;" class="splitLine"></div>
|
||||||
|
<div class="SimpleNote" id="head_illustrate"><i></i><em>Intel CPU频率设置<br>请合理设置频率,过低会导致运行异常缓慢,频率越低温度越低</em></div>
|
||||||
|
<div id="cpufreq_switch" style="margin:0px 0px 0px 0px;">
|
||||||
|
<table style="margin:-1px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">设置</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr>
|
||||||
|
<th>系统当前频率</th>
|
||||||
|
<td>
|
||||||
|
<i><% dbus_get_def("cpufreq_cur", "未知"); %>MHz</i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="switch_tr">
|
||||||
|
<th>
|
||||||
|
<label>开启频率设置</label>
|
||||||
|
</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="switch_field" style="display:table-cell">
|
||||||
|
<label for="switch">
|
||||||
|
<input id="switch" class="switch" type="checkbox" style="display: none;">
|
||||||
|
<div class="switch_container" >
|
||||||
|
<div class="switch_bar"></div>
|
||||||
|
<div class="switch_circle transition_style">
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="cpufreq_log" style="margin:-1px 0px 0px 0px;">
|
||||||
|
<table style="margin:-1px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">运行信息</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div id="log_content" style="margin-top:-1px;display:block;overflow:hidden;">
|
||||||
|
<textarea cols="63" rows="36" wrap="on" readonly="readonly" id="log_content1" style="width:99%;font-family:Courier New, Courier, mono; font-size:11px;background:#475A5F;color:#FFFFFF;" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="apply_gen">
|
||||||
|
<button id="cmdBtn" class="button_gen" onclick="save()">提交</button>
|
||||||
|
</div>
|
||||||
|
<div class="KoolshareBottom">
|
||||||
|
Shell&Web by: <i>paldier</i>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div id="footer"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
2
cpufreq/version
Normal file
2
cpufreq/version
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
1.0
|
||||||
|
e9ddf7d75daa25dc388ff5ef62407c6b
|
@ -129,6 +129,16 @@
|
|||||||
"tar_url": "ddnspod/ddnspod.tar.gz",
|
"tar_url": "ddnspod/ddnspod.tar.gz",
|
||||||
"title": "DDnspod",
|
"title": "DDnspod",
|
||||||
"version": "0.1.6"
|
"version": "0.1.6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"build_date": "2019-01-30_19:23:59",
|
||||||
|
"description": "Intel CPU频率设置",
|
||||||
|
"home_url": "Module_cpufreq.asp",
|
||||||
|
"md5": "e9ddf7d75daa25dc388ff5ef62407c6b",
|
||||||
|
"name": "cpufreq",
|
||||||
|
"tar_url": "cpufreq/cpufreq.tar.gz",
|
||||||
|
"title": "CPU频率设置",
|
||||||
|
"version": "1.0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"home_url": "https://raw.githubusercontent.com/paldier/softcenter/master",
|
"home_url": "https://raw.githubusercontent.com/paldier/softcenter/master",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
VERSION=1.1.6
|
VERSION=1.1.7
|
||||||
|
|
||||||
cat version
|
cat version
|
||||||
rm -f softcenter.tar.gz
|
rm -f softcenter.tar.gz
|
||||||
|
@ -73,5 +73,6 @@ kservice_reload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export PATH=$PATH:/jffs/softcenter/bin:/jffs/softcenter/scripts:/bin:/usr/bin:/sbin:/usr/sbin:/home/admin:/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin
|
export PATH=$PATH:/jffs/softcenter/bin:/jffs/softcenter/scripts:/bin:/usr/bin:/sbin:/usr/sbin:/home/admin:/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin
|
||||||
|
export LD_LIBRARY_PATH=/jffs/softcenter/lib:/lib:/usr/lib:/opt/lantiq/usr/lib:/opt/lantiq/usr/sbin/:/tmp/wireless/lantiq/usr/lib/:${LD_LIBRARY_PATH}
|
||||||
|
|
||||||
#logger "Leaving ${0##*/}."
|
#logger "Leaving ${0##*/}."
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version":"4.13.0",
|
"version":"4.13.0",
|
||||||
"md5":"4ff156ed5cfd6183ac19ebca1193ba16",
|
"md5":"9ef8deadd029b47b4bf59a2c7f9b8a96",
|
||||||
"home_url":"Module_v2ray.asp",
|
"home_url":"Module_v2ray.asp",
|
||||||
"title":"v2ray",
|
"title":"v2ray",
|
||||||
"description":"v2ray",
|
"description":"v2ray",
|
||||||
"build_date":"2019-01-24_01:15:57"
|
"build_date":"2019-01-29_20:02:27"
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
BIN
v2ray/v2ray/bin/dns2socks
Executable file
BIN
v2ray/v2ray/bin/dns2socks
Executable file
Binary file not shown.
BIN
v2ray/v2ray/bin/jq
Executable file
BIN
v2ray/v2ray/bin/jq
Executable file
Binary file not shown.
@ -6,11 +6,11 @@ cp -rf /tmp/v2ray/geosite.dat /jffs/softcenter/bin/
|
|||||||
cp -rf /tmp/v2ray/geoip.dat /jffs/softcenter/bin/
|
cp -rf /tmp/v2ray/geoip.dat /jffs/softcenter/bin/
|
||||||
cp -rf /tmp/v2ray/webs/Module_v2ray.asp /jffs/softcenter/webs/
|
cp -rf /tmp/v2ray/webs/Module_v2ray.asp /jffs/softcenter/webs/
|
||||||
cp -rf /tmp/v2ray/res/* /jffs/softcenter/res/
|
cp -rf /tmp/v2ray/res/* /jffs/softcenter/res/
|
||||||
cp -rf /tmp/v2ray/scripts/softcenter_v2ray.sh /jffs/softcenter/scripts/
|
cp -rf /tmp/v2ray/scripts/*.sh /jffs/softcenter/scripts/
|
||||||
cd /
|
cd /
|
||||||
rm -rf /tmp/v2ray* >/dev/null 2>&1
|
rm -rf /tmp/v2ray* >/dev/null 2>&1
|
||||||
|
|
||||||
|
|
||||||
chmod 755 /jffs/softcenter/bin/v2*
|
chmod 755 /jffs/softcenter/bin/v2*
|
||||||
chmod 755 /jffs/softcenter/scripts/softcenter_v2ray.sh
|
chmod 755 /jffs/softcenter/scripts/*.sh
|
||||||
|
|
||||||
|
3168
v2ray/v2ray/res/ss-menu.js
Executable file
3168
v2ray/v2ray/res/ss-menu.js
Executable file
File diff suppressed because it is too large
Load Diff
1
v2ray/v2ray/res/v2ray_log.htm
Normal file
1
v2ray/v2ray/res/v2ray_log.htm
Normal file
@ -0,0 +1 @@
|
|||||||
|
<% nvram_dump("v2ray.log",""); %>
|
@ -1,269 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
udp_enable=`nvram get v2ray_udp_enable`
|
|
||||||
v2ray_user=`nvram get v2ray_user`
|
|
||||||
v2ray_sip=`nvram get v2ray_srcip`
|
|
||||||
dns_mode=`nvram get v2ray_dnsmode`
|
|
||||||
ss_dns_china=`nvram get v2ray_dns`
|
|
||||||
mdisk=`nvram get k3c_disk`
|
|
||||||
usb_disk="/tmp/mnt/$mdisk"
|
|
||||||
usbmount=`ls /tmp/mnt/`
|
|
||||||
V2RAY_CONFIG_FILE="/tmp/etc/v2rayconfig.json"
|
|
||||||
TEMP_CONFIG_FILE="/tmp/v2rayconfig.pb"
|
|
||||||
|
|
||||||
gen_conf() {
|
|
||||||
json_data=`/jffs/softcenter/bin/jq . $V2RAY_CONFIG_FILE`
|
|
||||||
/jffs/softcenter/bin/jq -e . $V2RAY_CONFIG_FILE >/dev/null 2>&1 || return 2
|
|
||||||
local json_key="socks"
|
|
||||||
local json_value="\"dokodemo-door\""
|
|
||||||
local line_data=$(echo "$json_data" | grep -w "$json_key" )
|
|
||||||
[ "${line_data:$((${#line_data}-1))}" = "," ] && json_value="${json_value},"
|
|
||||||
local json_new_data=$(echo "$json_data" | sed "s/$line_data/ \"protocol\": $json_value/")
|
|
||||||
echo "$json_new_data" | /jffs/softcenter/bin/jq -e . >/dev/null 2>&1 || return 3
|
|
||||||
json_data="$json_new_data" && echo "$json_data" > $V2RAY_CONFIG_FILE
|
|
||||||
}
|
|
||||||
gen_conf1() {
|
|
||||||
json_data=`/jffs/softcenter/bin/jq . $V2RAY_CONFIG_FILE`
|
|
||||||
/jffs/softcenter/bin/jq -e . $V2RAY_CONFIG_FILE >/dev/null 2>&1 || return 2
|
|
||||||
local json_key="1080,"
|
|
||||||
local json_value="1234"
|
|
||||||
local line_data=$(echo "$json_data" | grep -w "$json_key" )
|
|
||||||
[ "${line_data:$((${#line_data}-1))}" = "," ] && json_value="${json_value},"
|
|
||||||
local json_new_data=$(echo "$json_data" | sed "s/$line_data/ \"port\": $json_value/")
|
|
||||||
echo "$json_new_data" | /jffs/softcenter/bin/jq -e . >/dev/null 2>&1 || return 3
|
|
||||||
json_data="$json_new_data" && echo "$json_data" > $V2RAY_CONFIG_FILE
|
|
||||||
}
|
|
||||||
gen_conf2() {
|
|
||||||
json_data=`/jffs/softcenter/bin/jq . $V2RAY_CONFIG_FILE`
|
|
||||||
/jffs/softcenter/bin/jq -e . $V2RAY_CONFIG_FILE >/dev/null 2>&1 || return 2
|
|
||||||
local json_key="127.0.0.1"
|
|
||||||
local json_value=" \"followRedirect\": true"
|
|
||||||
local line_data=$(echo "$json_data" | grep -w "$json_key" )
|
|
||||||
[ "${line_data:$((${#line_data}-1))}" = "," ] && json_value="${json_value}," && json_key="\"${json_key}\","
|
|
||||||
local json_new_data=$(echo "$json_data" | sed "s/$line_data/ \"ip\": $json_key\n$json_value/")
|
|
||||||
json_data="$json_new_data" && echo "$json_data" > $V2RAY_CONFIG_FILE
|
|
||||||
}
|
|
||||||
|
|
||||||
download_v2ray(){
|
|
||||||
#
|
|
||||||
PKG_VERSION=$(wget --no-check-certificate https://api.github.com/repos/v2ray/v2ray-core/releases/latest -q -O -|grep tag_name|awk {'print $2'}|cut -d '"' -f 2)
|
|
||||||
V2RA_VER=`/jffs/softcenter/bin/v2ray --version 2>/dev/null | head -n1 | awk '{print $2}'` || 0
|
|
||||||
Tmpv2ray=v2ray
|
|
||||||
Tmpv2ctl=v2ctl
|
|
||||||
tarfile=v2ray-linux-mips.zip
|
|
||||||
v2ray_bin=https://github.com/v2ray/v2ray-core/releases/download/"$PKG_VERSION"/$tarfile
|
|
||||||
v2ray_bin2=http://k3c.paldier.com/tools/$tarfile
|
|
||||||
d_rule() {
|
|
||||||
wget --no-check-certificate --timeout=10 --tries=3 -qO $1 $2
|
|
||||||
}
|
|
||||||
echo "$(date "+%F %T") 在线版本: $PKG_VERSION" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T") 本地版本: v$V2RA_VER" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "在线版本 $PKG_VERSION"
|
|
||||||
logger -t "【v2ray】" "本地版本 v$V2RA_VER"
|
|
||||||
if [ "v$V2RA_VER" != "$PKG_VERSION" ]; then
|
|
||||||
logger -t "【v2ray】" "本地版本与在线版本不同,下载 $PKG_VERSION ......"
|
|
||||||
echo "$(date "+%F %T"): 本地版本与在线版本不同,下载 $PKG_VERSION ......" >> /tmp/v2ray.log
|
|
||||||
cd /tmp
|
|
||||||
d_rule $tarfile $v2ray_bin
|
|
||||||
[ "$?" != "0" ] && sleep 2 && d_rule $tarfile $v2ray_bin2 && \
|
|
||||||
[ "$?" != "0" ] && logger -t "【v2ray】" "$PKG_VERSION 下载失败" && echo "$(date "+%F %T"): $PKG_VERSION 下载失败" >> /tmp/v2ray.log && exit 1
|
|
||||||
mkdir /tmp/v2ray-"$PKG_VERSION"-linux-mips
|
|
||||||
unzip -o /tmp/$tarfile -d /tmp/v2ray-"$PKG_VERSION"-linux-mips
|
|
||||||
mv /tmp/v2ray-"$PKG_VERSION"-linux-mips/v2ray /jffs/softcenter/bin/v2ray && chmod 755 /jffs/softcenter/bin/v2ray
|
|
||||||
mv /tmp/v2ray-"$PKG_VERSION"-linux-mips/v2ctl /jffs/softcenter/bin/v2ctl && chmod 755 /jffs/softcenter/bin/v2ctl
|
|
||||||
mv /tmp/v2ray-"$PKG_VERSION"-linux-mips/geosite.dat /jffs/softcenter/bin/geosite.dat && chmod 755 /jffs/softcenter/bin/geosite.dat
|
|
||||||
mv /tmp/v2ray-"$PKG_VERSION"-linux-mips/geoip.dat /jffs/softcenter/bin/geoip.dat && chmod 755 /jffs/softcenter/bin/geoip.dat
|
|
||||||
if [ ! -e "/jffs/softcenter/bin/jq" ] ;then
|
|
||||||
wget --no-check-certificate --timeout=10 --tries=3 -qO /jffs/softcenter/bin/jq http://k3c.paldier.com/tools/jq
|
|
||||||
wget --no-check-certificate --timeout=10 --tries=3 -qO /jffs/softcenter/bin/dns2socks http://k3c.paldier.com/tools/dns2socks
|
|
||||||
chmod 755 /jffs/softcenter/bin/jq >/dev/null 2>&1
|
|
||||||
chmod 755 /jffs/softcenter/bin/dns2socks >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
jqmd5=`md5sum /jffs/softcenter/bin/jq |awk '{print $1}'`
|
|
||||||
if [ "$jqmd5" != "91d61fbe4378a0d077109f9c9047dffa" ] ;then
|
|
||||||
wget --no-check-certificate --timeout=10 --tries=3 -qO /jffs/softcenter/bin/jq http://k3c.paldier.com/tools/jq
|
|
||||||
[ "$?" != "0" ] && sleep 2 && wget --no-check-certificate --timeout=10 --tries=3 -qO /jffs/softcenter/bin/jq http://k3c.paldier.com/tools/jq
|
|
||||||
[ "$?" != "0" ] && echo "$(date "+%F %T"): jq 下载失败" >> /tmp/v2ray.log && exit 1
|
|
||||||
fi
|
|
||||||
logger -t "【v2ray】" "$PKG_VERSION 下载成功!"
|
|
||||||
echo "$(date "+%F %T"): $PKG_VERSION 下载成功" >> /tmp/v2ray.log
|
|
||||||
rm -rf /tmp/$tarfile /tmp/v2ray-"$PKG_VERSION"-linux-mips >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
v2ray_test(){
|
|
||||||
echo "$(date "+%F %T"): 测试V2Ray配置文件....." >> /tmp/v2ray.log
|
|
||||||
result=$(/jffs/softcenter/bin/v2ray -test -config="$V2RAY_CONFIG_FILE" | grep "Configuration OK.")
|
|
||||||
if [ -n "$result" ];then
|
|
||||||
echo $result
|
|
||||||
echo "$(date "+%F %T"): V2Ray配置文件通过测试!!!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "配置文件通过测试!"
|
|
||||||
[ "$v2ray_user" = "1" ] && {
|
|
||||||
cp -f "$V2RAY_CONFIG_FILE" /jffs/softcenter/etc/v2rayconfig.json.bak
|
|
||||||
echo "$(date "+%F %T"): V2Ray配置文件已备份!!!" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T"): 运行正常后请关闭启用配置选项,不然每重启均保存一次!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "配置文件已备份!"
|
|
||||||
logger -t "【v2ray】" "运行正常后请关闭启用配置选项,不然每重启均保存一次!"
|
|
||||||
}
|
|
||||||
/jffs/softcenter/bin/v2ctl config < "$V2RAY_CONFIG_FILE" > "$TEMP_CONFIG_FILE"
|
|
||||||
else
|
|
||||||
echo "$(date "+%F %T"): V2Ray配置文件没有通过测试,请检查设置!!!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "配置文件没有通过测试,请检查设置!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
v2ray_serverip(){
|
|
||||||
# 检测用户json的服务器ip地址
|
|
||||||
v2ray_protocal=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.protocol`
|
|
||||||
case $v2ray_protocal in
|
|
||||||
vmess)
|
|
||||||
v2ray_server=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.settings.vnext[0].address`
|
|
||||||
;;
|
|
||||||
socks)
|
|
||||||
v2ray_server=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.settings.servers[0].address`
|
|
||||||
;;
|
|
||||||
shadowsocks)
|
|
||||||
v2ray_server=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.settings.servers[0].address`
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
v2ray_server=""
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -n "$v2ray_server" -a "$v2ray_server" != "null" ];then
|
|
||||||
IFIP_VS=`echo $v2ray_server|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
|
||||||
if [ -n "$IFIP_VS" ];then
|
|
||||||
v2ray_server_ip="$v2ray_server"
|
|
||||||
echo "$(date "+%F %T"): 检测到你的json配置的v2ray服务器是:$v2ray_server" >> /tmp/v2ray.log
|
|
||||||
else
|
|
||||||
echo "$(date "+%F %T"): 检测到你的json配置的v2ray服务器:$v2ray_server不是ip格式!" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T"): 为了确保v2ray的正常工作,建议配置ip格式的v2ray服务器地址!" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T"): 尝试解析v2ray服务器的ip地址..." >> /tmp/v2ray.log
|
|
||||||
v2ray_server_ip=`nslookup "$v2ray_server" 114.114.114.114 | sed '1,4d' | awk '{print $3}' | grep -v :|awk 'NR==1{print}'`
|
|
||||||
if [ "$?" == "0" ]; then
|
|
||||||
v2ray_server_ip=`echo $v2ray_server_ip|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
|
||||||
else
|
|
||||||
echo "$(date "+%F %T"): v2ray服务器域名解析失败!" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T"): 尝试用resolveip方式解析..." >> /tmp/v2ray.log
|
|
||||||
v2ray_server_ip=`resolveip -4 -t 2 $ss_basic_server|awk 'NR==1{print}'`
|
|
||||||
if [ "$?" == "0" ];then
|
|
||||||
v2ray_server_ip=`echo $v2ray_server_ip|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -n "$v2ray_server_ip" ];then
|
|
||||||
echo "$(date "+%F %T"): v2ray服务器的ip地址解析成功:$v2ray_server_ip" >> /tmp/v2ray.log
|
|
||||||
echo "address=/$v2ray_server/$v2ray_server_ip" > /etc/dnsmasq.user/ss_host.conf
|
|
||||||
v2ray_server_ip="$v2ray_server_ip"
|
|
||||||
else
|
|
||||||
echo "$(date "+%F %T"): v2ray服务器的ip地址解析失败!插件将继续运行,域名解析将由v2ray自己进行!" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T"): 请自行将v2ray服务器的ip地址填入IP/CIDR白名单中!" >> /tmp/v2ray.log
|
|
||||||
echo "$(date "+%F %T"): 为了确保v2ray的正常工作,建议配置ip格式的v2ray服务器地址!" >> /tmp/v2ray.log
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> /tmp/v2ray.log
|
|
||||||
echo "+ 没有检测到你的v2ray服务器地址,如果你确定你的配置是正确的 +" >> /tmp/v2ray.log
|
|
||||||
echo "+ 请自行将v2ray服务器的ip地址填入黑名单中,以确保正常使用 +" >> /tmp/v2ray.log
|
|
||||||
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> /tmp/v2ray.log
|
|
||||||
fi
|
|
||||||
mip=$v2ray_server_ip
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
killall -q -9 v2ray_mon.sh >/dev/null 2>&1 && killall v2ray_mon.sh >/dev/null 2>&1
|
|
||||||
killall -q -9 dns2socks 2>/dev/null && killall dns2socks 2>/dev/null
|
|
||||||
killall -q -9 v2ray 2>/dev/null && killall v2ray 2>/dev/null
|
|
||||||
killall -q pdnsd 2>/dev/null
|
|
||||||
service restart_dnsmasq >/dev/null 2>&1
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
killall -q -9 v2ray_mon.sh >/dev/null 2>&1
|
|
||||||
icount=`ps -w|grep v2rayconfig |grep -v grep|wc -l`
|
|
||||||
|
|
||||||
if [ $icount != 0 ] ;then
|
|
||||||
stop
|
|
||||||
sleep 2s
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$usbmount" == "" ];then
|
|
||||||
echo " $(date "+%F %T"):""系统正在启动,等待USB设备挂载中!" >> /tmp/v2ray.log
|
|
||||||
fi
|
|
||||||
while [ "$usbmount" == "" ]
|
|
||||||
do
|
|
||||||
sleep 5s
|
|
||||||
usbmount=`ls /tmp/mnt/ |grep $mdisk`
|
|
||||||
done
|
|
||||||
[ "$ss_dns_china" == "0" ] && GFWCDN="208.67.222.222"
|
|
||||||
[ "$ss_dns_china" == "1" ] && GFWCDN="8.8.8.8"
|
|
||||||
|
|
||||||
download_v2ray
|
|
||||||
|
|
||||||
if [ "$v2ray_user" = "1" ] ;then
|
|
||||||
echo $v2ray_sip > $V2RAY_CONFIG_FILE
|
|
||||||
sed -i "s/,yushi,/\n/g" $V2RAY_CONFIG_FILE
|
|
||||||
|
|
||||||
gen_conf
|
|
||||||
gen_conf1
|
|
||||||
gen_conf2
|
|
||||||
else
|
|
||||||
if [ -f /jffs/softcenter/etc/v2rayconfig.json.bak ];then
|
|
||||||
rm -rf "$V2RAY_CONFIG_FILE"
|
|
||||||
cp -f /jffs/softcenter/etc/v2rayconfig.json.bak "$V2RAY_CONFIG_FILE"
|
|
||||||
echo "$(date "+%F %T"): V2Ray使用备份配置启动!!!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "使用备份配置启动!"
|
|
||||||
else
|
|
||||||
echo "$(date "+%F %T"): V2Ray没选择启用配置,地球上也找不到备份配置,暂时休息!!!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "没选择启用配置,地球上也找不到备份配置,暂时休息!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
v2ray_test
|
|
||||||
v2ray_serverip
|
|
||||||
|
|
||||||
#if [ -f "$TEMP_CONFIG_FILE" ];then
|
|
||||||
/jffs/softcenter/bin/v2ray -format pb -config "$TEMP_CONFIG_FILE" >/dev/null 2>&1 &
|
|
||||||
#else
|
|
||||||
# /jffs/toolscript/ssr/v2ray -config "$V2RAY_CONFIG_FILE" >/dev/null 2>&1 &
|
|
||||||
#fi
|
|
||||||
if [ "$udp_enable" == "1" ];then
|
|
||||||
echo "$(date "+%F %T"): V2Ray暂不支持前端UDP转发这个选项,不影响程序继续运行!!!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "V2Ray暂不支持前端UDP转发这个选项,不影响程序继续运行!"
|
|
||||||
fi
|
|
||||||
if [ "$dns_mode" == "2" ];then
|
|
||||||
/jffs/softcenter/bin/dns2socks 127.0.0.1:23456 $GFWCDN:53 127.0.0.1:7913 >/dev/null 2>&1 &
|
|
||||||
fi
|
|
||||||
if [ "$dns_mode" == "0" ];then
|
|
||||||
echo "$(date "+%F %T"): V2Ray暂不支持远程解析模式,请选择其它解析模式再试!!!" >> /tmp/v2ray.log
|
|
||||||
logger -t "【v2ray】" "暂不支持远程解析模式,请选择其它解析模式再试!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
/usr/sbin/v2ray-rules $mip 1234 &
|
|
||||||
|
|
||||||
/usr/sbin/ssr-state 2>/dev/null &
|
|
||||||
rm -rf $V2RAY_CONFIG_FILE
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
restart() {
|
|
||||||
stop
|
|
||||||
sleep 2
|
|
||||||
menable=`nvram get v2ray_enable`
|
|
||||||
kenable=`nvram get k3c_enable`
|
|
||||||
if [ "$menable" == "1" ];then
|
|
||||||
if [ "$kenable" == "1" ] ;then
|
|
||||||
start
|
|
||||||
else
|
|
||||||
logger -t "K3C" "K3C扩展设置挂载未开启!"
|
|
||||||
echo " $(date "+%F %T"):""K3C扩展设置挂载未开启!" >> /tmp/v2ray.log
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
restart
|
|
||||||
|
|
279
v2ray/v2ray/scripts/v2ray-rules.sh
Normal file
279
v2ray/v2ray/scripts/v2ray-rules.sh
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
flush_r() {
|
||||||
|
|
||||||
|
iptables -t nat -F v2ray_pre > /dev/null 2>&1
|
||||||
|
iptables -t nat -D kool_chain -p tcp -j v2ray_pre > /dev/null 2>&1
|
||||||
|
iptables -t nat -D PREROUTING -p tcp -j v2ray_pre > /dev/null 2>&1
|
||||||
|
iptables -t nat -D OUTPUT -p tcp -m multiport --dports 53,80,443 -m set --match-set ssr dst -j REDIRECT --to-ports $local_port > /dev/null 2>&1
|
||||||
|
iptables -t nat -D OUTPUT -p tcp -m multiport --dports 53,80,443 -d 93.46.8.89/32 -j REDIRECT --to-ports $local_port > /dev/null 2>&1
|
||||||
|
iptables -t nat -X v2ray_pre > /dev/null 2>&1
|
||||||
|
|
||||||
|
ipset -F ssr >/dev/null 2>&1 && ipset -X ssr >/dev/null 2>&1
|
||||||
|
ipset -F ssr_ignore >/dev/null 2>&1 && ipset -X ssr_ignore >/dev/null 2>&1
|
||||||
|
ipset -F white_list >/dev/null 2>&1 && ipset -X white_list >/dev/null 2>&1
|
||||||
|
|
||||||
|
#udp
|
||||||
|
iptables -t mangle -F SS_SPEC_TPROXY 2>/dev/null
|
||||||
|
iptables -t mangle -D PREROUTING -p udp -j SS_SPEC_TPROXY 2>/dev/null
|
||||||
|
iptables -t mangle -D kool_chain -p udp -j SS_SPEC_TPROXY 2>/dev/null
|
||||||
|
iptables -t mangle -X SS_SPEC_TPROXY 2>/dev/null
|
||||||
|
ip rule del fwmark 1 table 100 2>/dev/null
|
||||||
|
ip route del local default dev lo table 100 2>/dev/null
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_iplist() {
|
||||||
|
cat <<-EOF
|
||||||
|
0.0.0.0/8
|
||||||
|
10.0.0.0/8
|
||||||
|
100.64.0.0/10
|
||||||
|
127.0.0.0/8
|
||||||
|
169.254.0.0/16
|
||||||
|
172.16.0.0/12
|
||||||
|
192.0.0.0/24
|
||||||
|
192.0.2.0/24
|
||||||
|
192.88.99.0/24
|
||||||
|
192.168.0.0/16
|
||||||
|
198.18.0.0/15
|
||||||
|
198.51.100.0/24
|
||||||
|
203.0.113.0/24
|
||||||
|
224.0.0.0/4
|
||||||
|
240.0.0.0/4
|
||||||
|
255.255.255.255
|
||||||
|
$(cat ${IGNORE2:=/dev/null} 2>/dev/null)
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_iplist2() {
|
||||||
|
cat <<-EOF
|
||||||
|
$(cat ${IGNORE:=/dev/null} 2>/dev/null)
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
start_pdnsd() {
|
||||||
|
mkdir -p /var/etc /var/pdnsd
|
||||||
|
CACHE=/var/pdnsd/pdnsd.cache
|
||||||
|
|
||||||
|
if ! test -f "$CACHE"; then
|
||||||
|
mkdir -p `dirname $CACHE` 2>/dev/null
|
||||||
|
dd if=/dev/zero of="$CACHE" bs=1 count=4 2>/dev/null
|
||||||
|
chown -R nobody.nogroup /var/pdnsd 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > /var/etc/pdnsd.conf <<EOF
|
||||||
|
global {
|
||||||
|
perm_cache=2048;
|
||||||
|
cache_dir="/var/pdnsd";
|
||||||
|
pid_file = /var/run/pdnsd.pid;
|
||||||
|
run_as="nobody";
|
||||||
|
server_ip = 127.0.0.1;
|
||||||
|
server_port = 1053;
|
||||||
|
status_ctl = on;
|
||||||
|
query_method = tcp_only;
|
||||||
|
min_ttl=1h;
|
||||||
|
max_ttl=1w;
|
||||||
|
timeout=10;
|
||||||
|
neg_domain_pol=on;
|
||||||
|
proc_limit=40;
|
||||||
|
procq_limit=60;
|
||||||
|
}
|
||||||
|
server {
|
||||||
|
label= "opendns";
|
||||||
|
ip = 208.67.222.222, 208.67.220.220;
|
||||||
|
port = 443;
|
||||||
|
timeout=6;
|
||||||
|
uptest=none;
|
||||||
|
interval=10m;
|
||||||
|
purge_cache=off;
|
||||||
|
}
|
||||||
|
server {
|
||||||
|
label= "google dns";
|
||||||
|
ip = 8.8.8.8, 8.8.4.4;
|
||||||
|
port = 53;
|
||||||
|
timeout=6;
|
||||||
|
uptest=none;
|
||||||
|
interval=10m;
|
||||||
|
purge_cache=off;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
chmod 755 /var/etc/pdnsd.conf
|
||||||
|
/jffs/softcenter/bin/pdnsd -c /var/etc/pdnsd.conf -d
|
||||||
|
echo -ne "pd13\000\000\000\000" >/var/pdnsd/pdnsd.cache 2>/dev/null
|
||||||
|
chown -R nobody.nogroup /var/pdnsd 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get argument
|
||||||
|
server=$1
|
||||||
|
local_port=$2
|
||||||
|
if [ "$server" == "clean" ] ;then
|
||||||
|
flush_r
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[ ! -f $IGNORE ] && echo "$IGNORE not found." && exit 1
|
||||||
|
|
||||||
|
# Check variable
|
||||||
|
[ -z $server ] || [ -z $local_port ] && {
|
||||||
|
echo "Invalid variable, please check CONFIG."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
all_proxy=`dbus get v2ray_mode`
|
||||||
|
dns_mode=`dbus get v2ray_dnsmode`
|
||||||
|
udp_enable=`dbus get v2ray_udp_enable`
|
||||||
|
|
||||||
|
# Create a new chain
|
||||||
|
menable=`dbus get koolproxy_enable`
|
||||||
|
if [ "$menable" = "1" ]; then
|
||||||
|
BEGIN="*nat\n\
|
||||||
|
:v2ray_pre - [0:0]\n\
|
||||||
|
-I kool_chain -p tcp -j v2ray_pre\n\
|
||||||
|
"
|
||||||
|
else
|
||||||
|
BEGIN="*nat\n\
|
||||||
|
:v2ray_pre - [0:0]\n\
|
||||||
|
-I PREROUTING -p tcp -j v2ray_pre\n\
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ADD_white() {
|
||||||
|
|
||||||
|
ISP_DNS1=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 1p)
|
||||||
|
ISP_DNS2=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 2p)
|
||||||
|
IFIP_DNS1=`echo $ISP_DNS1|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||||
|
IFIP_DNS2=`echo $ISP_DNS2|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||||
|
# white ip/cidr
|
||||||
|
[ -n "$server" ] && SERVER_IP="$server" || SERVER_IP=""
|
||||||
|
[ -n "$IFIP_DNS1" ] && ISP_DNS_a="$ISP_DNS1" || ISP_DNS_a=""
|
||||||
|
[ -n "$IFIP_DNS2" ] && ISP_DNS_b="$ISP_DNS2" || ISP_DNS_b=""
|
||||||
|
ip_lan="0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4 223.5.5.5 223.6.6.6 114.114.114.114 114.114.115.115 1.2.4.8 210.2.4.8 112.124.47.27 114.215.126.16 180.76.76.76 119.29.29.29 $ISP_DNS_a $ISP_DNS_b $SERVER_IP"
|
||||||
|
for ip in $ip_lan
|
||||||
|
do
|
||||||
|
ipset -! add white_list $ip >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ipset -! create ssr nethash && ipset flush ssr
|
||||||
|
ipset -! create white_list nethash && ipset flush white_list
|
||||||
|
if [ "$dns_mode" = "1" ] ;then
|
||||||
|
cp -f /usr/sbin/ssr/gfw_list.conf /tmp/etc/dnsmasq.user/gfw_list.conf
|
||||||
|
if [ -f "/jffs/configs/ssr_gfw.txt" ] ;then
|
||||||
|
icount=`cat /jffs/configs/ssr_gfw.txt|grep .|wc -l`
|
||||||
|
if [ $icount -gt 0 ] ;then
|
||||||
|
sed '/.*/s/.*/server=\/&\/127.0.0.1#1053\nipset=\/&\/ssr/' /jffs/configs/ssr_gfw.txt > /tmp/etc/dnsmasq.user/gfw_user.conf
|
||||||
|
else
|
||||||
|
[ -f "/tmp/etc/dnsmasq.user/gfw_user.conf" ] && rm -f /tmp/etc/dnsmasq.user/gfw_user.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
start_pdnsd
|
||||||
|
else
|
||||||
|
cp -f /usr/sbin/ssr/gfw_addr.conf /tmp/etc/dnsmasq.user/gfw_addr.conf
|
||||||
|
if [ -f "/jffs/configs/ssr_gfw.txt" ] ;then
|
||||||
|
icount=`cat /jffs/configs/ssr_gfw.txt|grep .|wc -l`
|
||||||
|
if [ $icount -gt 0 ] ;then
|
||||||
|
sed '/.*/s/.*/address=\/&\/93.46.8.89/' /jffs/configs/ssr_gfw.txt > /tmp/etc/dnsmasq.user/gfw_user.conf
|
||||||
|
else
|
||||||
|
[ -f "/tmp/etc/dnsmasq.user/gfw_user.conf" ] && rm -f /tmp/etc/dnsmasq.user/gfw_user.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
service restart_dnsmasq
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/jffs/softcenter/scripts/v2ray_mon.sh &
|
||||||
|
|
||||||
|
logger -t "v2ray" "守护进程启动"
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$all_proxy" = "1" ] ;then
|
||||||
|
|
||||||
|
ip_gfw="208.67.222.222 208.67.220.220 8.8.8.8 8.8.4.4"
|
||||||
|
for ip in $ip_gfw
|
||||||
|
do
|
||||||
|
ipset -! add ssr $ip 2>/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
ip_tg="149.154.0.0/16 91.108.4.0/22 91.108.56.0/24 109.239.140.0/24 67.198.55.0/24 "
|
||||||
|
for ip in $ip_tg
|
||||||
|
do
|
||||||
|
ipset -! add ssr $ip 2>/dev/null
|
||||||
|
done
|
||||||
|
ADD_white
|
||||||
|
|
||||||
|
if [ "$dns_mode" = "1" ] ;then
|
||||||
|
echo -e "$BEGIN\
|
||||||
|
-A v2ray_pre -p tcp -m set --match-set white_list dst -j RETURN\n\
|
||||||
|
-A v2ray_pre -p tcp -m set ! --match-set ssr dst -j RETURN\n\
|
||||||
|
-A v2ray_pre -p tcp -m set --match-set ssr dst -j REDIRECT --to-ports $local_port\n\
|
||||||
|
-I OUTPUT 1 -p tcp -m multiport --dports 53,80,443 -m set --match-set ssr dst -j REDIRECT --to-ports $local_port\n\
|
||||||
|
|
||||||
|
COMMIT" | iptables-restore -n
|
||||||
|
else
|
||||||
|
echo -e "$BEGIN\
|
||||||
|
-A v2ray_pre -p tcp -m set --match-set white_list dst -j RETURN\n\
|
||||||
|
-A v2ray_pre -p tcp -d 93.46.8.89/32 -j REDIRECT --to-ports $local_port\n\
|
||||||
|
-A v2ray_pre -p tcp -m set --match-set ssr dst -j REDIRECT --to-ports $local_port\n\
|
||||||
|
-I OUTPUT 1 -p tcp -m multiport --dports 53,80,443 -d 93.46.8.89/32 -j REDIRECT --to-ports $local_port\n\
|
||||||
|
-A OUTPUT -p tcp -m multiport --dports 53,80,443 -m set --match-set ssr dst -j REDIRECT --to-ports $local_port\n\
|
||||||
|
|
||||||
|
COMMIT" | iptables-restore -n
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$FORCE" ] ;then
|
||||||
|
sed "/.*/s/.*/iptables -t nat -A v2ray_pre -p tcp -d & -j REDIRECT --to-ports $local_port /" $FORCE 2>/dev/null | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
#udp
|
||||||
|
if [ "$udp_enable" == "1" ] ;then
|
||||||
|
ip rule add fwmark 1 table 100
|
||||||
|
ip route add local default dev lo table 100
|
||||||
|
iptables -t mangle -N SS_SPEC_TPROXY
|
||||||
|
if [ "$dns_mode" = "1" ] ;then
|
||||||
|
iptables -t mangle -A SS_SPEC_TPROXY -p udp -m set --match-set ssr dst \
|
||||||
|
-j TPROXY --on-port $local_port --tproxy-mark 0x01/0x01
|
||||||
|
else
|
||||||
|
iptables -t mangle -A SS_SPEC_TPROXY -p udp -d 93.46.8.89/32 \
|
||||||
|
-j TPROXY --on-port $local_port --tproxy-mark 0x01/0x01
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
logger -t "v2ray" "启动完毕!"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ipset -! create ssr_ignore nethash && ipset flush ssr_ignore
|
||||||
|
echo -e "$BEGIN\n\
|
||||||
|
-A v2ray_pre -p tcp -m set --match-set white_list dst -j RETURN\n\
|
||||||
|
-A v2ray_pre -m set --match-set ssr_ignore dst -j RETURN \n\
|
||||||
|
-A v2ray_pre -p tcp -j REDIRECT --to-ports $local_port\n\
|
||||||
|
-I OUTPUT 1 -p tcp -m multiport --dports 53,80,443 -m set --match-set ssr dst -j REDIRECT --to-ports $local_port\n\
|
||||||
|
|
||||||
|
COMMIT" | iptables-restore -n
|
||||||
|
|
||||||
|
|
||||||
|
#udp
|
||||||
|
if [ "$udp_enable" == "1" ] ;then
|
||||||
|
ip rule add fwmark 1 table 100
|
||||||
|
ip route add local default dev lo table 100
|
||||||
|
iptables -t mangle -N SS_SPEC_TPROXY
|
||||||
|
|
||||||
|
iptables -t mangle -A SS_SPEC_TPROXY -p udp -m set ! --match-set ssr_ignore dst \
|
||||||
|
-j TPROXY --on-port $local_port --tproxy-mark 0x01/0x01
|
||||||
|
if [ "$menable" = "1" ]; then
|
||||||
|
iptables -t mangle -I kool_chain 1 -p udp -j SS_SPEC_TPROXY
|
||||||
|
else
|
||||||
|
iptables -t mangle -I PREROUTING 1 -p udp -j SS_SPEC_TPROXY
|
||||||
|
fi
|
||||||
|
logger -t "v2ray" "启动完毕!"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
330
v2ray/v2ray/scripts/v2ray_config.sh
Normal file
330
v2ray/v2ray/scripts/v2ray_config.sh
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
eval `dbus export v2ray_`
|
||||||
|
source /jffs/softcenter/scripts/base.sh
|
||||||
|
|
||||||
|
V2RAY_CONFIG_FILE="/tmp/etc/v2rayconfig.json"
|
||||||
|
V2RAY_CONFIG_FILE_PB="/tmp/v2rayconfig.pb"
|
||||||
|
V2RAY_CONFIG_FILE_TMP="/tmp/v2rayconfig.json"
|
||||||
|
|
||||||
|
gen_conf() {
|
||||||
|
json_data=`/jffs/softcenter/bin/jq . $V2RAY_CONFIG_FILE`
|
||||||
|
/jffs/softcenter/bin/jq -e . $V2RAY_CONFIG_FILE >/dev/null 2>&1 || return 2
|
||||||
|
local json_key="socks"
|
||||||
|
local json_value="\"dokodemo-door\""
|
||||||
|
local line_data=$(echo "$json_data" | grep -w "$json_key" )
|
||||||
|
[ "${line_data:$((${#line_data}-1))}" = "," ] && json_value="${json_value},"
|
||||||
|
local json_new_data=$(echo "$json_data" | sed "s/$line_data/ \"protocol\": $json_value/")
|
||||||
|
echo "$json_new_data" | /jffs/softcenter/bin/jq -e . >/dev/null 2>&1 || return 3
|
||||||
|
json_data="$json_new_data" && echo "$json_data" > $V2RAY_CONFIG_FILE
|
||||||
|
}
|
||||||
|
gen_conf1() {
|
||||||
|
json_data=`/jffs/softcenter/bin/jq . $V2RAY_CONFIG_FILE`
|
||||||
|
/jffs/softcenter/bin/jq -e . $V2RAY_CONFIG_FILE >/dev/null 2>&1 || return 2
|
||||||
|
local json_key="1080,"
|
||||||
|
local json_value="1234"
|
||||||
|
local line_data=$(echo "$json_data" | grep -w "$json_key" )
|
||||||
|
[ "${line_data:$((${#line_data}-1))}" = "," ] && json_value="${json_value},"
|
||||||
|
local json_new_data=$(echo "$json_data" | sed "s/$line_data/ \"port\": $json_value/")
|
||||||
|
echo "$json_new_data" | /jffs/softcenter/bin/jq -e . >/dev/null 2>&1 || return 3
|
||||||
|
json_data="$json_new_data" && echo "$json_data" > $V2RAY_CONFIG_FILE
|
||||||
|
}
|
||||||
|
gen_conf2() {
|
||||||
|
json_data=`/jffs/softcenter/bin/jq . $V2RAY_CONFIG_FILE`
|
||||||
|
/jffs/softcenter/bin/jq -e . $V2RAY_CONFIG_FILE >/dev/null 2>&1 || return 2
|
||||||
|
local json_key="127.0.0.1"
|
||||||
|
local json_value=" \"followRedirect\": true"
|
||||||
|
local line_data=$(echo "$json_data" | grep -w "$json_key" )
|
||||||
|
[ "${line_data:$((${#line_data}-1))}" = "," ] && json_value="${json_value}," && json_key="\"${json_key}\","
|
||||||
|
local json_new_data=$(echo "$json_data" | sed "s/$line_data/ \"ip\": $json_key\n$json_value/")
|
||||||
|
json_data="$json_new_data" && echo "$json_data" > $V2RAY_CONFIG_FILE
|
||||||
|
}
|
||||||
|
get_function_switch() {
|
||||||
|
case "$1" in
|
||||||
|
1)
|
||||||
|
echo "true"
|
||||||
|
;;
|
||||||
|
0|*)
|
||||||
|
echo "false"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
v2ray_serverip(){
|
||||||
|
# 检测用户json的服务器ip地址
|
||||||
|
v2ray_protocal=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.protocol`
|
||||||
|
case $v2ray_protocal in
|
||||||
|
vmess)
|
||||||
|
v2ray_server=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.settings.vnext[0].address`
|
||||||
|
;;
|
||||||
|
socks)
|
||||||
|
v2ray_server=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.settings.servers[0].address`
|
||||||
|
;;
|
||||||
|
shadowsocks)
|
||||||
|
v2ray_server=`cat "$V2RAY_CONFIG_FILE" | /jffs/softcenter/bin/jq -r .outbound.settings.servers[0].address`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
v2ray_server=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$v2ray_server" -a "$v2ray_server" != "null" ];then
|
||||||
|
IFIP_VS=`echo $v2ray_server|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||||
|
if [ -n "$IFIP_VS" ];then
|
||||||
|
v2ray_server_ip="$v2ray_server"
|
||||||
|
echo "$(date "+%F %T"): 检测到你的json配置的v2ray服务器是:$v2ray_server" >> /tmp/v2ray.log
|
||||||
|
else
|
||||||
|
echo "$(date "+%F %T"): 检测到你的json配置的v2ray服务器:$v2ray_server不是ip格式!" >> /tmp/v2ray.log
|
||||||
|
echo "$(date "+%F %T"): 为了确保v2ray的正常工作,建议配置ip格式的v2ray服务器地址!" >> /tmp/v2ray.log
|
||||||
|
echo "$(date "+%F %T"): 尝试解析v2ray服务器的ip地址..." >> /tmp/v2ray.log
|
||||||
|
v2ray_server_ip=`nslookup "$v2ray_server" 114.114.114.114 | sed '1,4d' | awk '{print $3}' | grep -v :|awk 'NR==1{print}'`
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
v2ray_server_ip=`echo $v2ray_server_ip|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||||
|
else
|
||||||
|
echo "$(date "+%F %T"): v2ray服务器域名解析失败!" >> /tmp/v2ray.log
|
||||||
|
echo "$(date "+%F %T"): 尝试用resolveip方式解析..." >> /tmp/v2ray.log
|
||||||
|
v2ray_server_ip=`resolveip -4 -t 2 $ss_basic_server|awk 'NR==1{print}'`
|
||||||
|
if [ "$?" == "0" ];then
|
||||||
|
v2ray_server_ip=`echo $v2ray_server_ip|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -n "$v2ray_server_ip" ];then
|
||||||
|
echo "$(date "+%F %T"): v2ray服务器的ip地址解析成功:$v2ray_server_ip" >> /tmp/v2ray.log
|
||||||
|
echo "address=/$v2ray_server/$v2ray_server_ip" > /etc/dnsmasq.user/ss_host.conf
|
||||||
|
v2ray_server_ip="$v2ray_server_ip"
|
||||||
|
else
|
||||||
|
echo "$(date "+%F %T"): v2ray服务器的ip地址解析失败!插件将继续运行,域名解析将由v2ray自己进行!" >> /tmp/v2ray.log
|
||||||
|
echo "$(date "+%F %T"): 请自行将v2ray服务器的ip地址填入IP/CIDR白名单中!" >> /tmp/v2ray.log
|
||||||
|
echo "$(date "+%F %T"): 为了确保v2ray的正常工作,建议配置ip格式的v2ray服务器地址!" >> /tmp/v2ray.log
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> /tmp/v2ray.log
|
||||||
|
echo "+ 没有检测到你的v2ray服务器地址,如果你确定你的配置是正确的 +" >> /tmp/v2ray.log
|
||||||
|
echo "+ 请自行将v2ray服务器的ip地址填入黑名单中,以确保正常使用 +" >> /tmp/v2ray.log
|
||||||
|
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> /tmp/v2ray.log
|
||||||
|
fi
|
||||||
|
mip=$v2ray_server_ip
|
||||||
|
}
|
||||||
|
creat_v2ray_json(){
|
||||||
|
rm -rf "$V2RAY_CONFIG_FILE_TMP"
|
||||||
|
rm -rf "$V2RAY_CONFIG_FILE"
|
||||||
|
if [ "$v2ray_use_json" == "0" ];then
|
||||||
|
echo "$(date "+%F %T")生成V2Ray配置文件... " >> /tmp/v2ray.log
|
||||||
|
local kcp="null"
|
||||||
|
local tcp="null"
|
||||||
|
local ws="null"
|
||||||
|
local h2="null"
|
||||||
|
local tls="null"
|
||||||
|
|
||||||
|
# tcp和kcp下tlsSettings为null,ws和h2下tlsSettings
|
||||||
|
[ "$v2ray_network_security" == "none" ] && local v2ray_network_security=""
|
||||||
|
#if [ "$ss_basic_v2ray_network" == "ws" -o "$ss_basic_v2ray_network" == "h2" ];then
|
||||||
|
case "$v2ray_network_security" in
|
||||||
|
tls)
|
||||||
|
local tls="{
|
||||||
|
\"allowInsecure\": true,
|
||||||
|
\"serverName\": null
|
||||||
|
}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
local tls="null"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
#fi
|
||||||
|
# incase multi-domain input
|
||||||
|
if [ "`echo $v2ray_network_host | grep ","`" ];then
|
||||||
|
v2ray_network_host=`echo $v2ray_network_host | sed 's/,/", "/g'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$v2ray_network" in
|
||||||
|
tcp)
|
||||||
|
if [ "$v2ray_headtype_tcp" == "http" ];then
|
||||||
|
local tcp="{
|
||||||
|
\"connectionReuse\": true,
|
||||||
|
\"header\": {
|
||||||
|
\"type\": \"http\",
|
||||||
|
\"request\": {
|
||||||
|
\"version\": \"1.1\",
|
||||||
|
\"method\": \"GET\",
|
||||||
|
\"path\": [\"/\"],
|
||||||
|
\"headers\": {
|
||||||
|
\"Host\": [\"$v2ray_network_host\"],
|
||||||
|
\"User-Agent\": [\"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36\",\"Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46\"],
|
||||||
|
\"Accept-Encoding\": [\"gzip, deflate\"],
|
||||||
|
\"Connection\": [\"keep-alive\"],
|
||||||
|
\"Pragma\": \"no-cache\"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
\"response\": {
|
||||||
|
\"version\": \"1.1\",
|
||||||
|
\"status\": \"200\",
|
||||||
|
\"reason\": \"OK\",
|
||||||
|
\"headers\": {
|
||||||
|
\"Content-Type\": [\"application/octet-stream\",\"video/mpeg\"],
|
||||||
|
\"Transfer-Encoding\": [\"chunked\"],
|
||||||
|
\"Connection\": [\"keep-alive\"],
|
||||||
|
\"Pragma\": \"no-cache\"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
else
|
||||||
|
local tcp="null"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
kcp)
|
||||||
|
local kcp="{
|
||||||
|
\"mtu\": 1350,
|
||||||
|
\"tti\": 50,
|
||||||
|
\"uplinkCapacity\": 12,
|
||||||
|
\"downlinkCapacity\": 100,
|
||||||
|
\"congestion\": false,
|
||||||
|
\"readBufferSize\": 2,
|
||||||
|
\"writeBufferSize\": 2,
|
||||||
|
\"header\": {
|
||||||
|
\"type\": \"$v2ray_headtype_kcp\",
|
||||||
|
\"request\": null,
|
||||||
|
\"response\": null
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
;;
|
||||||
|
ws)
|
||||||
|
local ws="{
|
||||||
|
\"connectionReuse\": true,
|
||||||
|
\"path\": $(get_path $v2ray_network_path),
|
||||||
|
\"headers\": $(get_ws_header $v2ray_network_host)
|
||||||
|
}"
|
||||||
|
;;
|
||||||
|
h2)
|
||||||
|
local h2="{
|
||||||
|
\"path\": $(get_path $v2ray_network_path),
|
||||||
|
\"host\": $(get_h2_host $v2ray_network_host)
|
||||||
|
}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
cat > "$V2RAY_CONFIG_FILE_TMP" <<-EOF
|
||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"access": "/dev/null",
|
||||||
|
"error": "/tmp/v2ray_log.log",
|
||||||
|
"loglevel": "error"
|
||||||
|
},
|
||||||
|
EOF
|
||||||
|
cat >> "$V2RAY_CONFIG_FILE_TMP" <<-EOF
|
||||||
|
"inboundDetour": [
|
||||||
|
{
|
||||||
|
"listen": "0.0.0.0",
|
||||||
|
"port": 1234,
|
||||||
|
"protocol": "dokodemo-door",
|
||||||
|
"settings": {
|
||||||
|
"network": "tcp,udp",
|
||||||
|
"followRedirect": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbound": {
|
||||||
|
"tag": "agentout",
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"vnext": [
|
||||||
|
{
|
||||||
|
"address": "`dbus get v2ray_server`",
|
||||||
|
"port": $v2ray_port,
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"id": "$v2ray_uuid",
|
||||||
|
"alterId": $v2ray_alterid,
|
||||||
|
"security": "$v2ray_security"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"servers": null
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "$v2ray_network",
|
||||||
|
"security": "$v2ray_network_security",
|
||||||
|
"tlsSettings": $tls,
|
||||||
|
"tcpSettings": $tcp,
|
||||||
|
"kcpSettings": $kcp,
|
||||||
|
"wsSettings": $ws,
|
||||||
|
"httpSettings": $h2
|
||||||
|
},
|
||||||
|
"mux": {
|
||||||
|
"enabled": $(get_function_switch $v2ray_mux_enable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
echo "$(date "+%F %T")解析V2Ray配置文件... " >> /tmp/v2ray.log
|
||||||
|
cat "$V2RAY_CONFIG_FILE_TMP" | jq --tab . > "$V2RAY_CONFIG_FILE"
|
||||||
|
echo "$(date "+%F %T")V2Ray配置文件写入成功到 $V2RAY_CONFIG_FILE" >> /tmp/v2ray.log
|
||||||
|
elif [ "$v2ray_use_json" == "1" ];then
|
||||||
|
echo "$(date "+%F %T")使用自定义的v2ray json配置文件..." >> /tmp/v2ray.log
|
||||||
|
echo "$v2ray_json" | base64_decode > "$V2RAY_CONFIG_FILE"
|
||||||
|
gen_conf
|
||||||
|
gen_conf1
|
||||||
|
gen_conf2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date "+%F %T")测试V2Ray配置文件..... " >> /tmp/v2ray.log
|
||||||
|
cd /koolshare/bin
|
||||||
|
result=$(v2ray -test -config="$V2RAY_CONFIG_FILE" | grep "Configuration OK.")
|
||||||
|
if [ -n "$result" ];then
|
||||||
|
echo "$(date "+%F %T") $result" >> /tmp/v2ray.log
|
||||||
|
echo "$(date "+%F %T") V2Ray配置文件通过测试!!!" >> /tmp/v2ray.log
|
||||||
|
/jffs/softcenter/bin/v2ctl config < "$V2RAY_CONFIG_FILE" > "$TEMP_CONFIG_FILE"
|
||||||
|
else
|
||||||
|
rm -rf "$V2RAY_CONFIG_FILE_TMP"
|
||||||
|
rm -rf "$V2RAY_CONFIG_FILE"
|
||||||
|
echo "$(date "+%F %T") V2Ray配置文件没有通过测试,请检查设置!!!" >> /tmp/v2ray.log
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
stop() {
|
||||||
|
killall -q -9 v2ray_mon.sh >/dev/null 2>&1 && killall v2ray_mon.sh >/dev/null 2>&1
|
||||||
|
killall -q -9 dns2socks 2>/dev/null && killall dns2socks 2>/dev/null
|
||||||
|
killall -q -9 v2ray 2>/dev/null && killall v2ray 2>/dev/null
|
||||||
|
killall -q pdnsd 2>/dev/null
|
||||||
|
service restart_dnsmasq >/dev/null 2>&1
|
||||||
|
[ "-e /jffs/softcenter/init.d/S99v2ray.sh" ] && rm -rf /jffs/softcenter/init.d/S99v2ray.sh
|
||||||
|
}
|
||||||
|
start_v2ray(){
|
||||||
|
illall -q -9 v2ray_mon.sh >/dev/null 2>&1
|
||||||
|
icount=`ps -w|grep v2rayconfig |grep -v grep|wc -l`
|
||||||
|
|
||||||
|
if [ $icount != 0 ] ;then
|
||||||
|
stop
|
||||||
|
sleep 2s
|
||||||
|
fi
|
||||||
|
[ "$v2ray_dns" == "0" ] && GFWCDN="208.67.222.222"
|
||||||
|
[ "$v2ray_dns" == "1" ] && GFWCDN="8.8.8.8"
|
||||||
|
if [ "$udp_enable" == "1" ];then
|
||||||
|
echo "$(date "+%F %T"): V2Ray暂不支持前端UDP转发这个选项,不影响程序继续运行!!!" >> /tmp/v2ray.log
|
||||||
|
logger -t "【v2ray】" "V2Ray暂不支持前端UDP转发这个选项,不影响程序继续运行!"
|
||||||
|
fi
|
||||||
|
if [ "$v2ray_dnsmode" == "2" ];then
|
||||||
|
/jffs/softcenter/bin/dns2socks 127.0.0.1:23456 $GFWCDN:53 127.0.0.1:7913 >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
if [ "$v2ray_dnsmode" == "0" ];then
|
||||||
|
echo "$(date "+%F %T"): V2Ray暂不支持远程解析模式,请选择其它解析模式再试!!!" >> /tmp/v2ray.log
|
||||||
|
logger -t "【v2ray】" "暂不支持远程解析模式,请选择其它解析模式再试!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
v2ray_serverip
|
||||||
|
/jffs/softcenter/bin/v2ray -format pb -config "$V2RAY_CONFIG_FILE_PB" >/dev/null 2>&1 &
|
||||||
|
/jffs/softcenter/scripts/v2ray-rules.sh $mip 1234 &
|
||||||
|
/usr/sbin/ssr-state 2>/dev/null &
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
sleep 2
|
||||||
|
if [ "`dbus get v2ray_enable`" == "1" ];then
|
||||||
|
creat_v2ray_json
|
||||||
|
start_v2ray
|
||||||
|
[ "! -e /jffs/softcenter/init.d/S99v2ray.sh" ] && cp -r /jffs/softcenter/scripts/v2ray_config.sh /jffs/softcenter/init.d/S99v2ray.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restart
|
||||||
|
|
30
v2ray/v2ray/scripts/v2ray_mon.sh
Executable file
30
v2ray/v2ray/scripts/v2ray_mon.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
check_time=120
|
||||||
|
dns_mode=`dbus get v2ray_dnsmode`
|
||||||
|
while [ "1" = "1" ]
|
||||||
|
do
|
||||||
|
sleep $check_time
|
||||||
|
|
||||||
|
#check iptables
|
||||||
|
|
||||||
|
icount=`ps -w|grep v2rayconfig |grep -v grep |wc -l`
|
||||||
|
|
||||||
|
icount2=`iptables -t nat -S|grep v2ray|wc -l`
|
||||||
|
if [ $icount = 0 -o $icount2 -lt 5 ] ;then
|
||||||
|
logger -t "v2ray" "iptables error,restart v2ray!"
|
||||||
|
/jffs/softcenter/scripts/softcenter_v2ray.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#check pdnsd
|
||||||
|
if [ "$dns_mode" = "1" ] ;then
|
||||||
|
icount=`ps -w|grep pdnsd |grep -v grep |wc -l`
|
||||||
|
if [ $icount = 0 ] ;then
|
||||||
|
logger -t "v2ray" "pdnsd error,restart v2ray!"
|
||||||
|
/jffs/softcenter/scripts/softcenter_v2ray.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
@ -24,6 +24,8 @@
|
|||||||
<script type="text/javascript" src="/js/jquery.js"></script>
|
<script type="text/javascript" src="/js/jquery.js"></script>
|
||||||
<script type="text/javascript" src="/calendar/jquery-ui.js"></script>
|
<script type="text/javascript" src="/calendar/jquery-ui.js"></script>
|
||||||
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
|
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
|
||||||
|
<script type="text/javascript" src="/res/ss-menu.js"></script>
|
||||||
|
<script type="text/javascript" src="/dbconf?p=v2ray&v=<% uptime(); %>"></script>
|
||||||
<style>
|
<style>
|
||||||
#selectable .ui-selecting { background: #FECA40; }
|
#selectable .ui-selecting { background: #FECA40; }
|
||||||
#selectable .ui-selected { background: #F39814; color: white; }
|
#selectable .ui-selected { background: #F39814; color: white; }
|
||||||
@ -92,21 +94,96 @@ top: 250px;
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
var _responseLen;
|
||||||
function initial(){
|
function initial(){
|
||||||
show_menu(menu_hook);
|
show_menu(menu_hook);
|
||||||
document.form.v2ray_srcip.value = document.form.v2ray_srcip.value.replace(/,yushi,/g,"\r\n");
|
|
||||||
show_footer();
|
show_footer();
|
||||||
|
get_log();
|
||||||
|
verifyFields();
|
||||||
|
update_v2ray_ui(db_v2ray);
|
||||||
|
}
|
||||||
|
function update_v2ray_ui(obj) {
|
||||||
|
for (var field in obj) {
|
||||||
|
var el = E(field);
|
||||||
|
|
||||||
|
if (el != null && el.getAttribute("type") == "checkbox") {
|
||||||
|
if (obj[field] != "1") {
|
||||||
|
el.checked = false;
|
||||||
|
} else {
|
||||||
|
el.checked = true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (el != null) {
|
||||||
|
el.value = obj[field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
E("v2ray_json").value = do_js_beautify(Base64.decode(E("v2ray_json").value));
|
||||||
|
}
|
||||||
|
function isJSON(str) {
|
||||||
|
if (typeof str == 'string' && str) {
|
||||||
|
try {
|
||||||
|
var obj = JSON.parse(str);
|
||||||
|
if (typeof obj == 'object' && obj) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('error:' + str + '!!!' + e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log('It is not a string!')
|
||||||
}
|
}
|
||||||
function applyRule() {
|
function applyRule() {
|
||||||
|
if (E("v2ray_use_json").checked == true){
|
||||||
|
if(E('v2ray_json').value.indexOf("vmess://") != -1){
|
||||||
|
var vmess_node = JSON.parse(Base64.decode(E('v2ray_json').value.split("//")));
|
||||||
|
console.log("use v2ray vmess://");
|
||||||
|
console.log(vmess_node);
|
||||||
|
document.form.v2ray_server.value = vmess_node.add;
|
||||||
|
document.form.v2ray_port.value = vmess_node.port;
|
||||||
|
document.form.v2ray_uuid.value = vmess_node.id;
|
||||||
|
document.form.v2ray_security.value = "auto";
|
||||||
|
document.form.v2ray_alterid.value = vmess_node.aid;
|
||||||
|
document.form.v2ray_network.value = vmess_node.net;
|
||||||
|
if(vmess_node.net == "tcp"){
|
||||||
|
document.form.v2ray_headtype_tcp.value= vmess_node.type;
|
||||||
|
}else if(vmess_node.net == "kcp"){
|
||||||
|
document.form.v2ray_headtype_kcp.value = vmess_node.type;
|
||||||
|
}
|
||||||
|
document.form.v2ray_network_host.value = vmess_node.host;
|
||||||
|
document.form.v2ray_network_path.value = vmess_node.path;
|
||||||
|
if(vmess_node.tls == "tls"){
|
||||||
|
document.form.v2ray_network_security.value = "tls";
|
||||||
|
}else{
|
||||||
|
document.form.v2ray_network_security.value = "none";
|
||||||
|
}
|
||||||
|
document.form.v2ray_mux_enable.value = 1;
|
||||||
|
document.form.v2ray_use_json.value = 0;
|
||||||
|
document.form.v2ray_json.value = "";
|
||||||
|
}
|
||||||
|
else if(isJSON(E('v2ray_json').value)){
|
||||||
|
if(E('v2ray_json').value.indexOf("outbound") != -1){
|
||||||
|
document.form.v2ray_json.value = Base64.encode(pack_js(E('v2ray_json').value));
|
||||||
|
}else{
|
||||||
|
alert("错误!你的json配置文件有误!\n正确格式请参考:https://www.v2ray.com/chapter_02/01_overview.html");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
alert("错误!检测到你输入的v2ray配置不是标准json格式!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
document.form.save_name.disabled=true;
|
document.form.save_name.disabled=true;
|
||||||
document.form.save_content.disabled=true;
|
document.form.save_content.disabled=true;
|
||||||
document.form.v2ray_srcip.value = document.form.v2ray_srcip.value.replace(/\r\n/g,",yushi,");
|
showLoading(1);
|
||||||
document.form.v2ray_srcip.value = document.form.v2ray_srcip.value.replace(/\n/g,",yushi,");
|
|
||||||
showLoading();
|
|
||||||
document.form.submit();
|
document.form.submit();
|
||||||
}
|
}
|
||||||
function reload_Soft_Center() {
|
function reload_Soft_Center() {
|
||||||
location.href = "/Softcenter.asp";
|
location.href = "/Main_Soft_center.asp";
|
||||||
}
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#radio_v2ray_enable').iphoneSwitch(document.form.v2ray_enable.value,
|
$('#radio_v2ray_enable').iphoneSwitch(document.form.v2ray_enable.value,
|
||||||
@ -128,41 +205,124 @@ document.form.v2ray_udp_enable.value = "0";
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$(document).ready(function () {
|
|
||||||
$('#radio_v2ray_user').iphoneSwitch(document.form.v2ray_user.value,
|
|
||||||
function(){
|
|
||||||
document.form.v2ray_user.value = "1";
|
|
||||||
},
|
|
||||||
function(){
|
|
||||||
document.form.v2ray_user.value = "0";
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
function menu_hook(title, tab) {
|
function menu_hook(title, tab) {
|
||||||
tabtitle[tabtitle.length -1] = new Array("", "软件中心", "离线安装", "V2RAY");
|
tabtitle[tabtitle.length -1] = new Array("", "软件中心", "离线安装", "V2RAY");
|
||||||
tablink[tablink.length -1] = new Array("", "Main_Soft_center.asp", "Main_Soft_setting.asp", "Module_v2ray.asp");
|
tablink[tablink.length -1] = new Array("", "Main_Soft_center.asp", "Main_Soft_setting.asp", "Module_v2ray.asp");
|
||||||
}
|
}
|
||||||
|
function get_log() {
|
||||||
|
$.ajax({
|
||||||
|
url: '/res/v2ray_log.htm',
|
||||||
|
dataType: 'html',
|
||||||
|
success: function(response) {
|
||||||
|
var retArea = document.getElementById("log_content1");
|
||||||
|
if (_responseLen == response.length) {
|
||||||
|
noChange++;
|
||||||
|
} else {
|
||||||
|
noChange = 0;
|
||||||
|
}
|
||||||
|
if (noChange > 6000) {
|
||||||
|
//retArea.value = "当前日志文件为空";
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
setTimeout("get_log();",400);
|
||||||
|
}
|
||||||
|
retArea.innerHTML = response
|
||||||
|
_responseLen = response.length;
|
||||||
|
if (retArea.value == "") {
|
||||||
|
document.getElementById("log_content1").value = "暂无日志信息!";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr) {
|
||||||
|
//setTimeout("get_log();", 1000);
|
||||||
|
document.getElementById("log_content1").value = "暂无日志信息!";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function done_validating() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function verifyFields(r) {
|
||||||
|
var v2ray_on = true;
|
||||||
|
//v2ray
|
||||||
|
var json_on = E("v2ray_use_json").checked == true;
|
||||||
|
var json_off = E("v2ray_use_json").checked == false;
|
||||||
|
var http_on = E("v2ray_network").value == "tcp" && E("v2ray_headtype_tcp").value == "http";
|
||||||
|
var host_on = E("v2ray_network").value == "ws" || E("v2ray_network").value == "h2" || http_on;
|
||||||
|
var path_on = E("v2ray_network").value == "ws" || E("v2ray_network").value == "h2";
|
||||||
|
showhide("v2ray_use_json_basic_tr", v2ray_on);
|
||||||
|
showhide("v2ray_uuid_basic_tr", (v2ray_on && json_off));
|
||||||
|
showhide("v2ray_alterid_basic_tr", (v2ray_on && json_off));
|
||||||
|
showhide("v2ray_security_basic_tr", (v2ray_on && json_off));
|
||||||
|
showhide("v2ray_network_basic_tr", (v2ray_on && json_off));
|
||||||
|
showhide("v2ray_headtype_tcp_basic_tr", (v2ray_on && json_off && E("v2ray_network").value == "tcp"));
|
||||||
|
showhide("v2ray_headtype_kcp_basic_tr", (v2ray_on && json_off && E("v2ray_network").value == "kcp"));
|
||||||
|
showhide("v2ray_network_host_basic_tr", (v2ray_on && json_off && host_on));
|
||||||
|
showhide("v2ray_network_path_basic_tr", (v2ray_on && json_off && path_on));
|
||||||
|
showhide("v2ray_network_security_basic_tr", (v2ray_on && json_off));
|
||||||
|
showhide("v2ray_mux_enable_basic_tr", (v2ray_on && json_off));
|
||||||
|
showhide("v2ray_json_basic_tr", (v2ray_on && json_on));
|
||||||
|
|
||||||
|
//node add/edit pannel
|
||||||
|
if(E("v2ray_use_json").checked){
|
||||||
|
E('v2ray_server_support_tr').style.display = "none";
|
||||||
|
E('v2ray_port_support_tr').style.display = "none";
|
||||||
|
E('v2ray_uuid_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_alterid_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_security_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_network_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_headtype_tcp_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_headtype_kcp_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_network_path_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_network_host_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_network_security_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_mux_enable_basic_tr').style.display = "none";
|
||||||
|
E('v2ray_json_basic_tr').style.display = "";
|
||||||
|
}else{
|
||||||
|
E('v2ray_server_support_tr').style.display = "";
|
||||||
|
E('v2ray_port_support_tr').style.display = "";
|
||||||
|
E('v2ray_uuid_basic_tr').style.display = "";
|
||||||
|
E('v2ray_alterid_basic_tr').style.display = "";
|
||||||
|
E('v2ray_security_basic_tr').style.display = "";
|
||||||
|
E('v2ray_network_basic_tr').style.display = "";
|
||||||
|
E('v2ray_headtype_tcp_basic_tr').style.display = "";
|
||||||
|
E('v2ray_headtype_kcp_basic_tr').style.display = "";
|
||||||
|
E('v2ray_network_path_basic_tr').style.display = "";
|
||||||
|
E('v2ray_network_host_basic_tr').style.display = "";
|
||||||
|
E('v2ray_network_security_basic_tr').style.display = "";
|
||||||
|
E('v2ray_mux_enable_basic_tr').style.display = "";
|
||||||
|
E('v2ray_json_basic_tr').style.display = "none";
|
||||||
|
var http_on_2 = E("v2ray_network").value == "tcp" && E("v2ray_headtype_tcp").value == "http";
|
||||||
|
var host_on_2 = E("v2ray_network").value == "ws" || E("v2ray_network").value == "h2" || http_on_2;
|
||||||
|
var path_on_2 = E("v2ray_network").value == "ws" || E("v2ray_network").value == "h2"
|
||||||
|
showhide("v2ray_headtype_tcp_basic_tr", (E("v2ray_network").value == "tcp"));
|
||||||
|
showhide("v2ray_headtype_kcp_basic_tr", (E("v2ray_network").value == "kcp"));
|
||||||
|
showhide("v2ray_network_host_basic_tr", host_on_2);
|
||||||
|
showhide("v2ray_network_path_basic_tr", path_on_2);
|
||||||
|
showhide("v2ray_json_basic_tr", (E("v2ray_use_json").checked));
|
||||||
|
}
|
||||||
|
}
|
||||||
</script></head>
|
</script></head>
|
||||||
<body onload="initial();" onunload="unload_body();" onselectstart="return false;">
|
<body onload="initial();" onunload="unload_body();" onselectstart="return false;">
|
||||||
<div id="TopBanner"></div>
|
<div id="TopBanner"></div>
|
||||||
<div id="Loading" class="popup_bg"></div>
|
<div id="Loading" class="popup_bg"></div>
|
||||||
<iframe name="hidden_frame" id="hidden_frame" width="0" height="0" frameborder="0"></iframe>
|
<iframe name="hidden_frame" id="hidden_frame" width="0" height="0" frameborder="0"></iframe>
|
||||||
<form method="post" name="form" action="/start_apply.htm" target="hidden_frame">
|
<form method="post" name="form" action="/applydb.cig?p=v2ray" target="hidden_frame">
|
||||||
<input type="hidden" name="productid" value="<% nvram_get("productid"); %>">
|
<input type="hidden" name="productid" value="<% nvram_get("productid"); %>">
|
||||||
<input type="hidden" name="current_page" value="Tools_v2ray.asp">
|
<input type="hidden" name="current_page" value="Module_v2ray.asp">
|
||||||
<input type="hidden" name="next_page" value="">
|
<input type="hidden" name="next_page" value="Module_v2ray.asp">
|
||||||
<input type="hidden" name="modified" value="0">
|
<input type="hidden" name="modified" value="0">
|
||||||
<input type="hidden" name="action_wait" value="2">
|
<input type="hidden" name="action_wait" value="2">
|
||||||
<input type="hidden" name="action_mode" value="toolscript">
|
<input type="hidden" name="action_mode" value="toolscript">
|
||||||
<input type="hidden" name="action_script" value="/jffs/softcenter/scripts/softcenter_v2ray.sh">
|
<input type="hidden" name="action_script" value="v2ray_config.sh">
|
||||||
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>" disabled>
|
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>" disabled>
|
||||||
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>">
|
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>">
|
||||||
<input type="hidden" name="v2ray_enable" value="<% nvram_get("v2ray_enable"); %>">
|
<input type="hidden" name="v2ray_enable" value="<% dbus_get_def("v2ray_enable", "0"); %>">
|
||||||
<input type="hidden" name="v2ray_udp_enable" value="<% nvram_get("v2ray_udp_enable"); %>">
|
<input type="hidden" name="v2ray_udp_enable" value="<% dbus_get_def("v2ray_udp_enable", "0"); %>">
|
||||||
<input type="hidden" name="ss_china_state" value="<% nvram_get("ss_china_state"); %>">
|
<input type="hidden" name="ss_china_state" value="<% nvram_get("ss_china_state"); %>">
|
||||||
<input type="hidden" name="ss_foreign_state" value="<% nvram_get("ss_foreign_state"); %>">
|
<input type="hidden" name="ss_foreign_state" value="<% nvram_get("ss_foreign_state"); %>">
|
||||||
<input type="hidden" name="v2ray_dns" value="<% nvram_get("v2ray_dns"); %>">
|
<input type="hidden" name="v2ray_dns" value="<% dbus_get_def("v2ray_dns", "0"); %>">
|
||||||
<input type="hidden" name="v2ray_user" value="<% nvram_get("v2ray_user"); %>">
|
<input type="hidden" name="v2ray_use_json" value="<% dbus_get_def("v2ray_use_json", "0"); %>">
|
||||||
|
<input type="hidden" name="v2ray_json" value="<% dbus_get_def("v2ray_use_json", "0"); %>">
|
||||||
<input type="hidden" name="save_name" value="">
|
<input type="hidden" name="save_name" value="">
|
||||||
<input type="hidden" name="save_content" value="">
|
<input type="hidden" name="save_content" value="">
|
||||||
<table class="content" align="center" cellpadding="0" cellspacing="0" >
|
<table class="content" align="center" cellpadding="0" cellspacing="0" >
|
||||||
@ -186,7 +346,7 @@ function menu_hook(title, tab) {
|
|||||||
<table width="730px">
|
<table width="730px">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" >
|
<td align="left" >
|
||||||
<div id="content_title" class="formfonttitle" style="width:400px">工具箱 - v2ray</div>
|
<div id="content_title" class="formfonttitle" style="width:400px"> v2ray</div>
|
||||||
<div style="float:right; width:15px; height:25px;margin-top:10px">
|
<div style="float:right; width:15px; height:25px;margin-top:10px">
|
||||||
<img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img>
|
<img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img>
|
||||||
</div>
|
</div>
|
||||||
@ -199,15 +359,15 @@ function menu_hook(title, tab) {
|
|||||||
<table width="700px" style="margin-left:25px;">
|
<table width="700px" style="margin-left:25px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div id="guest_image" style="background: url(images/New_ui/ssr.png);width: 100px;height: 87px;"></div>
|
<div id="guest_image" style="background: url(res/icon-v2ray.png);width: 60px;height: 60px;"></div>
|
||||||
</td>
|
</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td style="font-size: 14px;">
|
<td style="font-size: 14px;">
|
||||||
<span id="desc_title">使用步骤:</span>
|
<span id="desc_title">使用步骤:</span>
|
||||||
<ol>
|
<ol>
|
||||||
<li>首先打开扩展挂载并挂载虚拟内存</li>
|
<li>挂载虚拟内存</li>
|
||||||
<li>然后自行获取服务器参数</li>
|
<li>然后自行获取服务器参数</li>
|
||||||
<li>最后手动上传配置文件或在自定义配置里粘贴配置</li>
|
<li>最后填写配置或在自定义配置里粘贴配置</li>
|
||||||
</ol>
|
</ol>
|
||||||
<span id="desc_note" style="color:#FC0;">注意:</span>
|
<span id="desc_note" style="color:#FC0;">注意:</span>
|
||||||
<ol style="color:#FC0;margin:-5px 0px 3px -18px;*margin-left:18px;">
|
<ol style="color:#FC0;margin:-5px 0px 3px -18px;*margin-left:18px;">
|
||||||
@ -222,12 +382,12 @@ function menu_hook(title, tab) {
|
|||||||
<div id="edit_time_anchor"></div>
|
<div id="edit_time_anchor"></div>
|
||||||
<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
|
<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
|
||||||
<tr>
|
<tr>
|
||||||
<th id="PC_enable">启用代理</th>
|
<th id="PC_enable">启用V2ray</th>
|
||||||
<td>
|
<td>
|
||||||
<div align="center" class="left" style="width:94px; float:left; cursor:pointer;" id="radio_v2ray_enable"></div>
|
<div align="center" class="left" style="width:94px; float:left; cursor:pointer;" id="radio_v2ray_enable"></div>
|
||||||
<div class="iphone_switch_container" style="height:32px; width:74px; position: relative; overflow: hidden">
|
<div class="iphone_switch_container" style="height:32px; width:74px; position: relative; overflow: hidden">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('#radio_v2ray_enable').iphoneSwitch('<% nvram_get("v2ray_enable"); %>',
|
$('#radio_v2ray_enable').iphoneSwitch('<% dbus_get_def("v2ray_enable", "0"); %>',
|
||||||
function(){
|
function(){
|
||||||
document.form.v2ray_enable.value = 1;
|
document.form.v2ray_enable.value = 1;
|
||||||
},
|
},
|
||||||
@ -252,7 +412,7 @@ document.form.v2ray_enable.value = 0;
|
|||||||
<div align="center" class="left" style="width:94px; float:left; cursor:pointer;" id="radio_v2ray_udp_enable"></div>
|
<div align="center" class="left" style="width:94px; float:left; cursor:pointer;" id="radio_v2ray_udp_enable"></div>
|
||||||
<div class="iphone_switch_container" style="height:32px; width:74px; position: relative; overflow: hidden">
|
<div class="iphone_switch_container" style="height:32px; width:74px; position: relative; overflow: hidden">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('#radio_v2ray_udp_enable').iphoneSwitch('<% nvram_get("v2ray_udp_enable"); %>',
|
$('#radio_v2ray_udp_enable').iphoneSwitch('<% dbus_get_def("v2ray_udp_enable", "0"); %>',
|
||||||
function(){
|
function(){
|
||||||
document.form.v2ray_udp_enable.value = 1;
|
document.form.v2ray_udp_enable.value = 1;
|
||||||
},
|
},
|
||||||
@ -268,9 +428,9 @@ document.form.v2ray_udp_enable.value = 0;
|
|||||||
<th>运行模式</th>
|
<th>运行模式</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="v2ray_mode" class="input_option input_15_table">
|
<select name="v2ray_mode" class="input_option input_15_table">
|
||||||
<option value="0" <% nvram_match( "v2ray_mode", "0","selected"); %>>国外代理模式</option>
|
<option value="0" <% dbus_match( "v2ray_mode", "0","selected"); %>>国外代理模式</option>
|
||||||
<option value="1" <% nvram_match( "v2ray_mode", "1","selected"); %>>GFW列表模式</option>
|
<option value="1" <% dbus_match( "v2ray_mode", "1","selected"); %>>GFW列表模式</option>
|
||||||
<option value="2" <% nvram_match( "v2ray_mode", "2","selected"); %>>全局代理模式</option>
|
<option value="2" <% dbus_match( "v2ray_mode", "2","selected"); %>>全局代理模式</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -278,9 +438,9 @@ document.form.v2ray_udp_enable.value = 0;
|
|||||||
<th>DNS解析方式</th>
|
<th>DNS解析方式</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="v2ray_dnsmode" class="input_option input_15_table">
|
<select name="v2ray_dnsmode" class="input_option input_15_table">
|
||||||
<option value="0" <% nvram_match( "v2ray_dnsmode", "0","selected"); %>>远程解析模式</option>
|
<option value="0" <% dbus_match( "v2ray_dnsmode", "0","selected"); %>>远程解析模式</option>
|
||||||
<option value="1" <% nvram_match( "v2ray_dnsmode", "1","selected"); %>>Pdnsd解析模式</option>
|
<option value="1" <% dbus_match( "v2ray_dnsmode", "1","selected"); %>>Pdnsd解析模式</option>
|
||||||
<option value="2" <% nvram_match( "v2ray_dnsmode", "2","selected"); %>>dns2socks模式</option>
|
<option value="2" <% dbus_match( "v2ray_dnsmode", "2","selected"); %>>dns2socks模式</option>
|
||||||
</select>
|
</select>
|
||||||
<a href="http://www.ip111.cn/" target=_blank> 【 分流检测 】</a>
|
<a href="http://www.ip111.cn/" target=_blank> 【 分流检测 】</a>
|
||||||
</td>
|
</td>
|
||||||
@ -289,33 +449,119 @@ document.form.v2ray_udp_enable.value = 0;
|
|||||||
<th>国外DNS</th>
|
<th>国外DNS</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="v2ray_dns" class="input_option input_15_table">
|
<select name="v2ray_dns" class="input_option input_15_table">
|
||||||
<option value="0" <% nvram_match( "v2ray_dns", "0","selected"); %>>opendns</option>
|
<option value="0" <% dbus_match( "v2ray_dns", "0","selected"); %>>opendns</option>
|
||||||
<option value="1" <% nvram_match( "v2ray_dns", "1","selected"); %>>googledns</option>
|
<option value="1" <% dbus_match( "v2ray_dns", "1","selected"); %>>googledns</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr id="v2ray_use_json_basic_tr">
|
||||||
<th width="20%">启用v2ray配置</th>
|
<th width="35%">使用json配置</th>
|
||||||
<td align="left">
|
<td>
|
||||||
<div align="center" class="left" style="width:94px; float:left; cursor:pointer;" id="radio_v2ray_user"></div>
|
<input type="checkbox" id="v2ray_use_json" name="v2ray_use_json" onclick="verifyFields(this, 1);" value="0">
|
||||||
<div class="iphone_switch_container" style="height:32px; width:74px; position: relative; overflow: hidden">
|
|
||||||
<script type="text/javascript">
|
|
||||||
$('#radio_v2ray_user').iphoneSwitch('<% nvram_get("v2ray_user"); %>',
|
|
||||||
function(){
|
|
||||||
document.form.v2ray_user.value = 1;
|
|
||||||
},
|
|
||||||
function(){
|
|
||||||
document.form.v2ray_user.value = 0;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr id="v2ray_server_support_tr" style="display: none;">
|
||||||
<th>自定义配置</th>
|
<th width="20%">地址(address)</th>
|
||||||
|
<td align="left">
|
||||||
|
<input type="text" maxlength="64" id="v2ray_server" name="v2ray_server" value="<% dbus_get_def("v2ray_server", "abc.abc.abc"); %>" class="input_ss_table" style="width:342px;float:left;background-color: #475A5F;color:#FFFFFF;" autocorrect="off" autocapitalize="off"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_port_support_tr" style="display: none;">
|
||||||
|
<th width="20%">端口(port)</th>
|
||||||
|
<td align="left">
|
||||||
|
<input type="text" maxlength="64" id="v2ray_port" name="v2ray_port" value="<% dbus_get_def("v2ray_port", "12345"); %>" class="input_ss_table" style="width:342px;float:left;background-color: #475A5F;color:#FFFFFF;" autocomplete="off" autocorrect="off" autocapitalize="off"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_uuid_basic_tr" style="display: none;">
|
||||||
|
<th width="20%">用户id(id)</th>
|
||||||
|
<td align="left">
|
||||||
|
<input name=v2ray_uuid style="background-color: #475A5F;color:#FFFFFF;" value='<% dbus_get_def("v2ray_uuid", "12345-1123-123-123abc"); %>'>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_alterid_basic_tr" style="display: none;">
|
||||||
|
<th width="20%">额外ID (Alterld)</th>
|
||||||
|
<td align="left">
|
||||||
|
<input name=v2ray_alterid style="background-color: #475A5F;color:#FFFFFF;" value='<% dbus_get_def("v2ray_alterid", "100"); %>'>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_security_basic_tr" style="display: none;">
|
||||||
|
<th width="20%">加密方式 (security)</th>
|
||||||
|
<td align="left">
|
||||||
|
<select id="v2ray_security" name="v2ray_security" style="width:350px;margin:0px 0px 0px 2px;" class="input_option">
|
||||||
|
<option value="auto">自动</option>
|
||||||
|
<option value="aes-128-cfb">aes-128-cfb</option>
|
||||||
|
<option value="aes-128-gcm">aes-128-gcm</option>
|
||||||
|
<option value="chacha20-poly1305">chacha20-poly1305</option>
|
||||||
|
<option value="none">不加密</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_network_basic_tr" style="display: none;">
|
||||||
|
<th width="20%">传输协议 (network)</th>
|
||||||
|
<td align="left">
|
||||||
|
<select id="v2ray_network" name="v2ray_network" style="width:350px;margin:0px 0px 0px 2px;" class="input_option" onchange="verifyFields(this, 1);">
|
||||||
|
<option value="tcp">tcp</option>
|
||||||
|
<option value="kcp">kcp</option>
|
||||||
|
<option value="ws">ws</option>
|
||||||
|
<option value="h2">h2</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_headtype_tcp_basic_tr" style="display: none;">
|
||||||
|
<th width="20%"> * tcp伪装类型 (type)</th>
|
||||||
|
<td align="left">
|
||||||
|
<select id="v2ray_headtype_tcp" name="v2ray_headtype_tcp" style="width:350px;margin:0px 0px 0px 2px;" class="input_option" onchange="verifyFields(this, 1);">
|
||||||
|
<option value="none">不伪装</option>
|
||||||
|
<option value="http">伪装http</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_headtype_kcp_basic_tr" style="display: none;">
|
||||||
|
<th width="35%">* kcp伪装类型 (type)</th>
|
||||||
<td>
|
<td>
|
||||||
<textarea rows="6" cols="44" style="width:99%;background-color: #475A5F;color:#FFFFFF;" name="v2ray_srcip" maxlength="5000" placeholder="提示: 手动输入自定义配置,正常运行后请关闭启用v2ray配置选项,使用备份配置运行,不然每重启均保存一次配置。"><% nvram_show_chinese_char("v2ray_srcip"); %></textarea>
|
<select id="v2ray_headtype_kcp" name="v2ray_headtype_kcp" style="width:164px;margin:0px 0px 0px 2px;" class="input_option" onchange="verifyFields(this, 1);">
|
||||||
|
<option value="none">不伪装</option>
|
||||||
|
<option value="srtp">伪装视频通话(srtp)</option>
|
||||||
|
<option value="utp">伪装BT下载(uTP)</option>
|
||||||
|
<option value="wechat-video">伪装微信视频通话</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_network_host_basic_tr" style="display: none;">
|
||||||
|
<th width="35%">* 伪装域名 (host)</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="v2ray_network_host" id="v2ray_network_host" class="input_ss_table" placeholder="没有请留空" maxlength="300" value=""/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_network_path_basic_tr" style="display: none;">
|
||||||
|
<th width="35%">* 路径 (path)</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="v2ray_network_path" id="v2ray_network_path" class="input_ss_table" placeholder="没有请留空" maxlength="300" value=""/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_network_security_basic_tr" style="display: none;">
|
||||||
|
<th width="20%">底层传输安全</th>
|
||||||
|
<td align="left">
|
||||||
|
<select id="v2ray_network_security" name="v2ray_network_security" style="width:350px;margin:0px 0px 0px 2px;" class="input_option">
|
||||||
|
<option value="none">关闭</option>
|
||||||
|
<option value="tls">tls</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_mux_enable_basic_tr" style="display: none;">
|
||||||
|
<th width="35%">多路复用 (Mux)</th>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" id="v2ray_mux_enable" name="v2ray_mux_enable" onclick="verifyFields(this, 1);" value="0">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="v2ray_json_basic_tr" style="display: none;">
|
||||||
|
<th width="35%">v2ray json</th>
|
||||||
|
<td>
|
||||||
|
<textarea style="width:99%;background-color: #475A5F;color:#FFFFFF;" placeholder="# 此处填入v2ray json,内容可以是标准的也可以是压缩的
|
||||||
|
# 请保证你json内的outbound配置正确!!!
|
||||||
|
# ------------------------------------
|
||||||
|
# 同样支持vmess://链接填入,格式如下:
|
||||||
|
vmess://ew0KICAidiI6ICIyIiwNCiAgInBzIjogIjIzMyIsDQogICJhZGQiOiAiMjMzLjIzMy4yMzMuMjMzIiwNCiAgInBvcnQiOiAiMjMzIiwNCiAgImlkIjogImFlY2EzYzViLTc0NzktNDFjMy1hMWUzLTAyMjkzYzg2Y2EzOCIsDQogICJhaWQiOiAiMjMzIiwNCiAgIm5ldCI6ICJ3cyIsDQogICJ0eXBlIjogIm5vbmUiLA0KICAiaG9zdCI6ICJ3d3cuMjMzLmNvbSIsDQogICJwYXRoIjogIi8yMzMiLA0KICAidGxzIjogInRscyINCn0=" rows="40" style="width:99%; font-family:'Lucida Console'; font-size:12px;background:#475A5F;color:#FFFFFF;" id="v2ray_json" name="v2ray_json" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" title=""></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -338,9 +584,9 @@ document.form.v2ray_user.value = 0;
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr><td colspan="2">
|
<tr><td colspan="2">
|
||||||
<textarea cols="63" rows="25" wrap="off" readonly="readonly" id="textarea" style="width:99%;font-family:Courier New, Courier, mono; font-size:11px;background:#475A5F;color:#FFFFFF;">
|
<div id="log_content" style="margin-top:-1px;display:block;overflow:hidden;">
|
||||||
<% nvram_dump("v2ray.log",""); %>
|
<textarea cols="63" rows="36" wrap="on" readonly="readonly" id="log_content1" style="width:99%;font-family:Courier New, Courier, mono; font-size:11px;background:#475A5F;color:#FFFFFF;" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
||||||
</textarea>
|
</div>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
4.13.0
|
4.13.0
|
||||||
4ff156ed5cfd6183ac19ebca1193ba16
|
9ef8deadd029b47b4bf59a2c7f9b8a96
|
||||||
|
Loading…
Reference in New Issue
Block a user