Open nu1ee opened 7 years ago
function china_status() local e={} e.china=luci.sys.call("echocurl -o /dev/null -s -m 10 --connect-timeout 2 -w %{http_code} 'http://www.baidu.com'`|grep 200 >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end function foreign_status() local e={} e.foreign=luci.sys.call("echo curl -o /dev/null -s -m 30 --connect-timeout 30 -w %{http_code} 'https://www.google.com.sg'|grep 200 >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end`
function china_status() local e={} e.china=luci.sys.call("echo
curl -o /dev/null -s -m 30 --connect-timeout 30 -w %{http_code} 'https://www.google.com.sg'
e=s:option(DummyValue,"china_china",translate("国内连接")) e.semplate="shadowsocks/china" e.value=translate("Collecting data...") e=s:option(DummyValue,"foreign_foreign",translate("国外连接")) e.semplate="shadowsocks/foreign" e.value=translate("Collecting data...")
<%+cbi/valueheader%> <span class="china_status"><%=pcdata(self:cfgvalue(section) or self.default or "")%></span> <%+cbi/valuefooter%>
<%+cbi/valueheader%> <span class="foreign_status"><%=pcdata(self:cfgvalue(section) or self.default or "")%></span> <%+cbi/valuefooter%>
一直显示收集数据 我这是少了什么?
curl命令是由路由器本身发出的,而默认情况下只会处理PREROUTING链的连接到SS服务器。但是你如果开“配合Adbyby或者KoolProxy”模式就会把OUTPUT链的流量也发送到SS服务器,就可以让curl命令走SS了
controller
function china_status() local e={} e.china=luci.sys.call("echo
curl -o /dev/null -s -m 10 --connect-timeout 2 -w %{http_code} 'http://www.baidu.com'`|grep 200 >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end function foreign_status() local e={} e.foreign=luci.sys.call("echocurl -o /dev/null -s -m 30 --connect-timeout 30 -w %{http_code} 'https://www.google.com.sg'
|grep 200 >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end`cbi
e=s:option(DummyValue,"china_china",translate("国内连接")) e.semplate="shadowsocks/china" e.value=translate("Collecting data...") e=s:option(DummyValue,"foreign_foreign",translate("国外连接")) e.semplate="shadowsocks/foreign" e.value=translate("Collecting data...")
view china.htm
<%+cbi/valueheader%> <span class="china_status"><%=pcdata(self:cfgvalue(section) or self.default or "")%></span> <%+cbi/valuefooter%>
foreign.htm
<%+cbi/valueheader%> <span class="foreign_status"><%=pcdata(self:cfgvalue(section) or self.default or "")%></span> <%+cbi/valuefooter%>
一直显示收集数据 我这是少了什么?