shadowsocks / luci-app-shadowsocks

OpenWrt/LEDE LuCI for Shadowsocks-libev
GNU General Public License v3.0
1.15k stars 422 forks source link

请问access-control访问非常缓慢是什么原因造成的? #32

Closed zcracker closed 8 years ago

zcracker commented 8 years ago

请问access-control访问非常缓慢是什么原因造成的?其他页面均正常,。谢谢

pexcn commented 8 years ago

当你重启路由器,再访问这个页面,确实是有这个问题。@aa65535

aa65535 commented 8 years ago

如果是只有重启后第一次访问慢,应该是初始化和生成缓存导致。

zcracker commented 8 years ago

LuCI 中「网络 - DHCP/DNS」 「基本设置」 本地服务器 填写 127.0.0.1#5353改为/lan/马上就好了,不知何故

aa65535 commented 8 years ago

改回 127.0.0.1#5353 是否可以复现?

zcracker commented 8 years ago

时快时慢。chrome浏览器和IE11,我是NETGEAR WNDR4300,我是源码打包编译进固件的luci-app-ChinaDNS,luci-app-shadowsocks.,和dhcp文件,刚刚刷机后无法进入,重启后无法进入,该127.0.0.1#5353改为/lan/马上就好了,让后可以进入,保存一次后再设置127.0.0.1#5353,好像也是时快时慢,不知何故

aa65535 commented 8 years ago

@ztechie

试试将 /usr/lib/lua/luci/model/cbi/shadowsocks/access-control.lua 改成下面的代码,然后打开一次 access-control,看一下系统日志里关于 access-control 的内容,注意每条日志的打印时间。

-- Copyright (C) 2016 Jian Chang <aa65535@live.com>
-- Licensed to the public under the GNU General Public License v3.

local m, s, o
local shadowsocks = "shadowsocks"
local uci = luci.model.uci.cursor()
os.execute("logger -t access-control -p7 0")
local nwm = require("luci.model.network").init()
local chnroute = uci:get_first("chinadns", "chinadns", "chnroute")

os.execute("logger -t access-control -p7 1")
m = Map(shadowsocks, "%s - %s" %{translate("ShadowSocks"), translate("Access Control")})
-- [[ Zone WAN ]]--
s = m:section(TypedSection, "access_control", translate("Zone WAN"))
s.anonymous = true

o = s:option(Value, "wan_bp_list", translate("Bypassed IP List"))
o:value("/dev/null", translate("NULL - As Global Proxy"))
if chnroute then o:value(chnroute, translate("ChinaDNS CHNRoute")) end
o.datatype = "or(file, '/dev/null')"
o.default = chnroute or "/dev/null"
o.rmempty = false

o = s:option(DynamicList, "wan_bp_ips", translate("Bypassed IP"))
o.datatype = "ip4addr"
o.rmempty = true

o = s:option(DynamicList, "wan_fw_ips", translate("Forwarded IP"))
o.datatype = "ip4addr"
o.rmempty = true

-- [[ Zone LAN ]]--
s = m:section(TypedSection, "access_control", translate("Zone LAN"))
s.anonymous = true

os.execute("logger -t access-control -p7 2")
o = s:option(MultiValue, "lan_ifaces", translate("Interface"))
for _, net in ipairs(nwm:get_networks()) do
    if net:name() ~= "loopback" and string.find(net:name(), "wan") ~= 1 then
        net = nwm:get_network(net:name())
        local device = net and net:get_interface()
        if device then
            o:value(device:name(), device:get_i18n())
        end
    end
end

os.execute("logger -t access-control -p7 3")
o = s:option(ListValue, "lan_target", translate("Proxy Type"))
o:value("SS_SPEC_WAN_AC", translate("Normal"))
o:value("RETURN", translate("Direct"))
o:value("SS_SPEC_WAN_FW", translate("Global"))
o.rmempty = false

-- [[ LAN Hosts ]]--
s = m:section(TypedSection, "lan_hosts", translate("LAN Hosts"))
s.template  = "cbi/tblsection"
s.addremove = true
s.anonymous = true

os.execute("logger -t access-control -p7 4")
o = s:option(Value, "host", translate("Host"))
luci.sys.net.ipv4_hints(function(ip, name)
    o:value(ip, "%s (%s)" %{ip, name})
end)
o.datatype = "ip4addr"
o.rmempty  = false

os.execute("logger -t access-control -p7 5")
o = s:option(ListValue, "type", translate("Proxy Type"))
o:value("b", translatef("Direct"))
o:value("g", translatef("Global"))
o:value("n", translatef("Normal"))
o.rmempty  = false

o = s:option(Flag, "enable", translate("Enable"))
o.default = 1
o.rmempty = false

return m
millionart commented 8 years ago

Fri Sep 23 16:36:07 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:08 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:13 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:19 2016 user.debug access-control: 0 Fri Sep 23 16:36:19 2016 user.debug access-control: 1 Fri Sep 23 16:36:19 2016 user.debug access-control: 2 Fri Sep 23 16:36:19 2016 user.debug access-control: 3 Fri Sep 23 16:36:19 2016 user.debug access-control: 4 Fri Sep 23 16:36:35 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:41 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:43 2016 user.debug access-control: 5 Fri Sep 23 16:36:45 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:46 2016 kern.info ss-redir[20075]: Request did not begin with TLS handshake. Fri Sep 23 16:36:46 2016 kern.err ss-redir[20075]: server recv: Connection reset by peer

kingyan commented 8 years ago

Fri Sep 23 19:25:25 2016 kern.info ss-redir[23352]: Request did not begin with TLS handshake. Fri Sep 23 19:25:25 2016 kern.info ss-redir[23352]: Request did not begin with TLS handshake. Fri Sep 23 19:25:26 2016 user.debug access-control: 0 Fri Sep 23 19:25:26 2016 user.debug access-control: 1 Fri Sep 23 19:25:26 2016 user.debug access-control: 2 Fri Sep 23 19:25:26 2016 user.debug access-control: 3 Fri Sep 23 19:25:26 2016 user.debug access-control: 4 Fri Sep 23 19:25:32 2016 user.debug access-control: 5

tacuar commented 6 years ago

actually i've done some tests and the latest verion still have this problem and don't know what's the reason, is it due to lede itself or the updated version compatibility.

I use lede17.01.4 stable release and compile with ss v3.0.3-1 and luci v1.6.0, the problem solved,don't know why.