Skip to content

Commit

Permalink
Add the modou luyoubao support
Browse files Browse the repository at this point in the history
  • Loading branch information
roubo committed Oct 22, 2014
1 parent 788f9b2 commit 0972604
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ modouSS
* 加入pdnsd,避免dns污染问题
* 修复了未加www访问某些网站时不能解析的问题
* 解决了某宽带对dns查询(tcp)的劫持问题
* 支持魔豆路由宝配置

## 缺陷

Expand Down
15 changes: 15 additions & 0 deletions conf/actions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"start_shadow_socks" : {
"id" : "start_shadow_socks",
"is_sync" : false,
"cmd" : "./init start",
"relative": true
},
"stop_shadow_socks" : {
"id" : "stop_shadow_socks",
"is_sync" : false,
"cmd" : "./init stop",
"relative": true
}
}

55 changes: 55 additions & 0 deletions conf/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"state_shadow_socks" : {
"id" : "state_shadow_socks",
"name" : "状态",
"value" : false,
"group_id" : "main_info_display",
"type" : {
"class" : "BOOL"
}
},
"service_ip_address" : {
"id" : "service_ip_address",
"name" : "服务地址",
"value" : "",
"group_id" : "main_info_display",
"type" : {
"class" : "STRING",
"min" : 7,
"max" : 15
}
},
"port_shadow_socks" : {
"id" : "port_shadow_socks",
"name" : "端口号",
"value" : 0,
"group_id" : "main_info_display",
"type" : {
"class" : "INT",
"min" : 10,
"max" : 9999999
}
},
"method_security" : {
"id" : "method_security",
"name" : "加密方式",
"value" : "",
"group_id" : "main_info_display",
"type" : {
"class" : "ENUM",
"items" : ["aes-256-cfb", "aes-192-cfb", "aes-128-cfb", "bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "rc4", "seed-cfb"],
"multiple" : false
}
},
"password_shadow_socks" : {
"id" : "password_shadow_socks",
"name" : "密码",
"value" : "",
"group_id" : "main_info_display",
"type" : {
"class" : "STRING",
"min" : 6,
"max" : 30
}
}
}
99 changes: 99 additions & 0 deletions conf/mobile_views.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"main_page_shadow_socks" : {
"id" : "main_page_shadow_socks",
"name" : "魔豆ShadowSocks",
"type" : "main",
"data" : {
"state_shadow_socks" : {
"id" : "state_shadow_socks",
"access" : "RO"
},
"service_ip_address" : {
"id" : "service_ip_address",
"access" : "RO"
},
"port_shadow_socks" : {
"id" : "port_shadow_socks",
"access" : "RO"
},
"method_security" : {
"id" : "method_security",
"access" : "RO"
},
"password_shadow_socks" : {
"id" : "password_shadow_socks",
"access" : "RO"
}
},
"menu" : {
"1" : {
"index" : 1,
"text" : "开启服务",
"type" : "COMMAND",
"action" : "start_shadow_socks",
"input" : "params"
},
"2" : {
"index" : 2,
"text" : "服务控制",
"type" : "MENU",
"items" : {
"1" : {
"index" : 1,
"text" : "开启服务",
"type" : "COMMAND",
"action" : "start_shadow_socks",
"input" : "params"
},
"2" : {
"index" : 2,
"text" : "关闭服务",
"type" : "COMMAND",
"action" : "stop_shadow_socks",
"input" : "params"
},
"3" : {
"index" : 3,
"text" : "配置账号",
"type" : "VIEW",
"viewid" : "page_account_setting"
}
}
},
"3" : {
"index" : 3,
"text" : "配置账号",
"type" : "VIEW",
"viewid" : "page_account_setting"
}
}
},
"page_account_setting" : {
"id" : "page_account_setting",
"name" : "配置账号",
"type" : "sub",
"data" : {
"state_shadow_socks" : {
"id" : "state_shadow_socks",
"access" : "RW"
},
"service_ip_address" : {
"id" : "service_ip_address",
"access" : "RW"
},
"port_shadow_socks" : {
"id" : "port_shadow_socks",
"access" : "RW"
},
"method_security" : {
"id" : "method_security",
"access" : "RW"
},
"password_shadow_socks" : {
"id" : "password_shadow_socks",
"access" : "RW"
}
}
}
}

9 changes: 5 additions & 4 deletions init
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ status()
return 0;
}

config()
set_config()
{
echo "Hello, modou"
$CURDIR/sbin/ss.sh stop
$CURDIR/sbin/ss.sh start
return 0;
}

Expand Down Expand Up @@ -94,8 +95,8 @@ case "$1" in
fi
exit 0;
;;
"config")
config;
"set_config")
set_config;
if [ "0" != "$?" ]; then
exit 1;
fi
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"package_id" : "com.modouwifi.vpnss",
"os_version" : "0.6.33",
"os_version" : "0.6.38",
"name" : "魔豆shadowsocks",
"author" : "yinkeedai",
"author_mail" : "[email protected]",
"homepage" : "shadowsocks.org",
"version" : "0.2.2",
"version" : "0.3.0",
"release_date" : "2014.10.13",
"icon" : "./res/icon.png",
"location" : "internal",
Expand Down
21 changes: 17 additions & 4 deletions sbin/ss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
CURWDIR=$(cd $(dirname $0) && pwd) CUSTOMCONF="$CURWDIR/../conf/custom.conf"
SETCONFDEF="$CURWDIR/../conf/set.def"
SETCONF="$CURWDIR/../conf/set.conf"
DATAJSON="$CURWDIR/../conf/data.json"
PDNSDCONFILE="$CURWDIR/../conf/pdnsd.conf"
PIDFILE="$CURWDIR/../conf/custom.pid"
SSBIN="$CURWDIR/../bin/ss-redir"
Expand Down Expand Up @@ -95,8 +96,10 @@ genCustomContent()

if [ "$isserverstart" == "1" ]; then
contentbody="**服务已启动**"
/system/sbin/json4sh.sh "set" $DATAJSON state_shadow_socks value true
else
contentbody="**服务未启动**"
/system/sbin/json4sh.sh "set" $DATAJSON state_shadow_socks value false
fi

if [ "$isserverconfig" == "1" ]; then
Expand Down Expand Up @@ -168,6 +171,14 @@ ssTpStart()
ssConfig()
{
generate-config-file $SETCONFDEF
serveraddr=`head -n 1 $SETCONFDEF | cut -d ' ' -f2-`;
serverport=`head -n 2 $SETCONFDEF | tail -n 1 | cut -d ' ' -f2-`;
secmode=`head -n 3 $SETCONFDEF | tail -n 1 | cut -d ' ' -f2-`;
passwd=`head -n 4 $SETCONFDEF | tail -n 1 | cut -d ' ' -f2-`;
/system/sbin/json4sh.sh "set" $DATAJSON service_ip_address value $serveraddr
/system/sbin/json4sh.sh "set" $DATAJSON port_shadow_socks value $serverport
/system/sbin/json4sh.sh "set" $DATAJSON method_security value $secmode
/system/sbin/json4sh.sh "set" $DATAJSON password_shadow_socks value $passwd
cp $SETCONFDEF $SETCONF
genCustomConfig;
pid=`cat $PIDFILE 2>/dev/null`;
Expand All @@ -178,10 +189,10 @@ ssConfig()
ssStart()
{
pdnsdEnable;
serveraddr=`head -n 1 $SETCONF | cut -d ' ' -f2-`;
serverport=`head -n 2 $SETCONF | tail -n 1 | cut -d ' ' -f2-`;
secmode=`head -n 3 $SETCONF | tail -n 1 | cut -d ' ' -f2-`;
passwd=`head -n 4 $SETCONF | tail -n 1 | cut -d ' ' -f2-`;
serveraddr=`/system/sbin/json4sh.sh "get" $DATAJSON service_ip_address value`
serverport=`/system/sbin/json4sh.sh "get" $DATAJSON port_shadow_socks value`
secmode=`/system/sbin/json4sh.sh "get" $DATAJSON method_security value`
passwd=`/system/sbin/json4sh.sh "get" $DATAJSON password_shadow_socks value`
$SSSHELL $serveraddr $serverport $secmode $passwd &
chown matrix $PDNSDCONFILE 1>/dev/null 2>&1
$PDNSDBIN -c $PDNSDCONFILE &
Expand All @@ -196,6 +207,8 @@ ssStop()
{
pdnsdDisable;
killall ss-redir 1>/dev/null 2>&1;
killall sswhitelist.sh 1>/dev/null 2>&1;
killall ss-transp.sh 1>/dev/null 2>&1;
iptables -t nat -F PDNSD 1>/dev/null 2>&1
iptables -t nat -D OUTPUT -p tcp -j PDNSD 1>/dev/null 2>&1
iptables -t nat -F SHADOWSOCKS 1>/dev/null 2>&1
Expand Down

0 comments on commit 0972604

Please sign in to comment.