Merge Mainline

This commit is contained in:
CN_SZTL 2020-08-12 14:49:43 +08:00
commit 76c217e8df
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
23 changed files with 205 additions and 458 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.39.6
PKG_VERSION:=0.39.7
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -1128,7 +1128,7 @@ fi
done
fi
if [ "$en_mode_tun" -ne 1 ] && [ "$en_mode_tun" -ne 2 ]; then
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
#tcp
iptables -t nat -N openclash
iptables -t nat -F openclash
@ -1139,7 +1139,7 @@ if [ "$en_mode_tun" -ne 1 ] && [ "$en_mode_tun" -ne 2 ]; then
iptables -t nat -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
if [ "$en_mode_tun" -ne 3 ]; then
if [ -z "$en_mode_tun" ]; then
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j REDIRECT --to-ports "$proxy_port"
fi

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.9
PKG_RELEASE:=33
PKG_DATE:=20200810
PKG_RELEASE:=35
PKG_DATE:=20200812
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -25,7 +25,7 @@ local trojan = {
sni = node.tls_serverName,
alpn = {"h2", "http/1.1"},
reuse_session = true,
session_ticket = (node.tls_sessionTicket == "1") and true or false,
session_ticket = (node.tls_sessionTicket and node.tls_sessionTicket == "1") and true or false,
curves = ""
},
udp_timeout = 60,

View File

@ -41,15 +41,20 @@ local function gen_outbound(node, tag)
end
node.stream_security = "none"
end
if node.transport == "mkcp" or node.transport == "ds" or node.transport == "quic" then
node.stream_security = "none"
end
result = {
tag = tag,
protocol = node.protocol or "vmess",
protocol = node.protocol,
mux = {
enabled = (node.mux == "1") and true or false,
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
},
-- 底层传输配置
streamSettings = (node.protocol == "vmess" or node.protocol == "socks" or node.protocol == "shadowsocks") and {
streamSettings = (node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks") and {
network = node.transport,
security = node.stream_security,
tlsSettings = (node.stream_security == "tls") and {
@ -96,16 +101,17 @@ local function gen_outbound(node, tag)
} or nil
} or nil,
settings = {
vnext = (node.protocol == "vmess") and {
vnext = (node.protocol == "vmess" or node.protocol == "vless") and {
{
address = node.address,
port = tonumber(node.port),
users = {
{
id = node.vmess_id,
id = node.uuid,
alterId = tonumber(node.alter_id),
level = tonumber(node.vmess_level),
security = node.security
level = node.level and tonumber(node.level) or 0,
security = node.security,
encryption = node.encryption or "none"
}
}
}
@ -125,11 +131,6 @@ local function gen_outbound(node, tag)
}
end
if node.transport == "mkcp" or node.transport == "ds" or node.transport == "quic" then
result.streamSettings.security = "none"
result.streamSettings.tlsSettings = nil
end
return result
end

View File

@ -97,6 +97,7 @@ end
protocol = s:option(ListValue, "protocol", translate("Protocol"))
protocol:value("vmess", translate("Vmess"))
protocol:value("vless", translate("VLESS"))
protocol:value("http", translate("HTTP"))
protocol:value("socks", translate("Socks"))
protocol:value("shadowsocks", translate("Shadowsocks"))
@ -159,6 +160,7 @@ address:depends("type", "Socks")
address:depends("type", "SS")
address:depends("type", "SSR")
address:depends({ type = "V2ray", protocol = "vmess" })
address:depends({ type = "V2ray", protocol = "vless" })
address:depends({ type = "V2ray", protocol = "http" })
address:depends({ type = "V2ray", protocol = "socks" })
address:depends({ type = "V2ray", protocol = "shadowsocks" })
@ -174,6 +176,7 @@ use_ipv6:depends("type", "Socks")
use_ipv6:depends("type", "SS")
use_ipv6:depends("type", "SSR")
use_ipv6:depends({ type = "V2ray", protocol = "vmess" })
use_ipv6:depends({ type = "V2ray", protocol = "vless" })
use_ipv6:depends({ type = "V2ray", protocol = "http" })
use_ipv6:depends({ type = "V2ray", protocol = "socks" })
use_ipv6:depends({ type = "V2ray", protocol = "shadowsocks" })
@ -190,6 +193,7 @@ port:depends("type", "Socks")
port:depends("type", "SS")
port:depends("type", "SSR")
port:depends({ type = "V2ray", protocol = "vmess" })
port:depends({ type = "V2ray", protocol = "vless" })
port:depends({ type = "V2ray", protocol = "http" })
port:depends({ type = "V2ray", protocol = "socks" })
port:depends({ type = "V2ray", protocol = "shadowsocks" })
@ -240,6 +244,10 @@ security = s:option(ListValue, "security", translate("Encrypt Method"))
for a, t in ipairs(security_list) do security:value(t) end
security:depends("protocol", "vmess")
encryption = s:option(Value, "encryption", translate("Encrypt Method"))
encryption.default = "none"
encryption:depends("protocol", "vless")
v_ss_encrypt_method = s:option(ListValue, "v_ss_encrypt_method", translate("Encrypt Method"))
for a, t in ipairs(v_ss_encrypt_method_list) do v_ss_encrypt_method:value(t) end
v_ss_encrypt_method:depends("protocol", "shadowsocks")
@ -336,22 +344,25 @@ kcp_opts = s:option(TextValue, "kcp_opts", translate("Kcptun Config"), translate
kcp_opts.placeholder = "--crypt aes192 --key abc123 --mtu 1350 --sndwnd 128 --rcvwnd 1024 --mode fast"
kcp_opts:depends("use_kcp", "1")
vmess_id = s:option(Value, "vmess_id", translate("ID"))
vmess_id.password = true
vmess_id:depends("protocol", "vmess")
uuid = s:option(Value, "uuid", translate("ID"))
uuid.password = true
uuid:depends("protocol", "vmess")
uuid:depends("protocol", "vless")
alter_id = s:option(Value, "alter_id", translate("Alter ID"))
alter_id:depends("protocol", "vmess")
vmess_level = s:option(Value, "vmess_level", translate("User Level"))
vmess_level.default = 1
vmess_level:depends("protocol", "vmess")
level = s:option(Value, "level", translate("User Level"))
level.default = 1
level:depends("protocol", "vmess")
level:depends("protocol", "vless")
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted (default) and "TLS" for using TLS.'))
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted and "TLS" for using TLS.'))
stream_security:value("none", "none")
stream_security:value("tls", "tls")
stream_security.default = "tls"
stream_security:depends("protocol", "vmess")
stream_security:depends("protocol", "vless")
stream_security:depends("protocol", "socks")
stream_security:depends("protocol", "shadowsocks")
stream_security:depends("type", "Trojan")
@ -359,7 +370,7 @@ stream_security:depends("type", "Trojan-Plus")
stream_security:depends("type", "Trojan-Go")
stream_security.validate = function(self, value)
if value == "none" and (type:formvalue(arg[1]) == "Trojan" or type:formvalue(arg[1]) == "Trojan-Plus") then
return nil, translate("'none' not supported for original Trojan.")
return nil, translate("'none' not supported for original Trojan, please choose 'tls'.")
end
return value
end
@ -378,7 +389,7 @@ trojan_force_fp:depends({ type = "Trojan-Go", stream_security = "tls" })
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
tls_serverName:depends("stream_security", "tls")
tls_allowInsecure = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, V2Ray does not check the validity of the TLS certificate provided by the remote host."))
tls_allowInsecure = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
tls_allowInsecure.default = "0"
tls_allowInsecure:depends("stream_security", "tls")
@ -425,6 +436,7 @@ transport:value("h2", "HTTP/2")
transport:value("ds", "DomainSocket")
transport:value("quic", "QUIC")
transport:depends("protocol", "vmess")
transport:depends("protocol", "vless")
transport:depends("protocol", "socks")
transport:depends("protocol", "shadowsocks")
@ -549,6 +561,7 @@ ss_aead_pwd:depends("ss_aead", "1")
-- [[ Mux ]]--
mux = s:option(Flag, "mux", translate("Mux"))
mux:depends({ type = "V2ray", protocol = "vmess" })
mux:depends({ type = "V2ray", protocol = "vless" })
mux:depends({ type = "V2ray", protocol = "http" })
mux:depends({ type = "V2ray", protocol = "socks" })
mux:depends({ type = "V2ray", protocol = "shadowsocks" })

View File

@ -57,7 +57,7 @@ o = s:option(Flag, "filter_keyword_discarded", translate("Filter keyword discard
o.default = "1"
o.rmempty = false
o = s:option(Flag, "allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, V2Ray does not check the validity of the TLS certificate provided by the remote host by default."))
o = s:option(Flag, "allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
o.default = "1"
o.rmempty = false

View File

@ -89,7 +89,7 @@ local function start()
config = require("luci.model.cbi.passwall.server.api.trojan").gen_config(user)
bin = ln_start(_api.get_trojan_go_path(), "trojan-go", "-config " .. config_file)
elseif type == "Brook" then
local brook_protocol = user.brook_protocol
local brook_protocol = user.protocol
local brook_password = user.password
bin = ln_start(_api.get_brook_path(), "brook_" .. id, string.format("%s -l :%s -p %s", brook_protocol, port, brook_password))
end

View File

@ -6,8 +6,8 @@ function gen_config(user)
config.password = user.password
config.timeout = tonumber(user.timeout)
config.fast_open = (user.tcp_fast_open and user.tcp_fast_open == "true") and true or false
config.method = user.ssr_encrypt_method
config.protocol = user.ssr_protocol
config.method = user.method
config.protocol = user.protocol
config.protocol_param = user.protocol_param
config.obfs = user.obfs
config.obfs_param = user.obfs_param

View File

@ -8,7 +8,7 @@ function gen_config(user)
local_port = tonumber(user.port),
remote_addr = (user.remote_enable == "1" and user.remote_address) and user.remote_address or nil,
remote_port = (user.remote_enable == "1" and user.remote_port) and tonumber(user.remote_port) or nil,
password = user.type == "Trojan-Go" and user.passwords or { user.password },
password = user.type == "Trojan-Go" and user.uuid or { user.password },
log_level = 1,
ssl = (user.stream_security == nil or user.stream_security == "tls") and {
cert = user.tls_certificateFile,

View File

@ -8,17 +8,20 @@ function gen_config(user)
{protocol = "freedom", tag = "direct"}, {protocol = "blackhole", tag = "blocked"}
}
if user.protocol == "vmess" then
if user.vmess_id then
if user.protocol == "vmess" or user.protocol == "vless" then
if user.uuid then
local clients = {}
for i = 1, #user.vmess_id do
for i = 1, #user.uuid do
clients[i] = {
id = user.vmess_id[i],
id = user.uuid[i],
level = tonumber(user.level),
alterId = tonumber(user.alter_id)
}
end
settings = {clients = clients}
settings = {
clients = clients,
decryption = user.decryption or "none"
}
end
elseif user.protocol == "socks" then
settings = {
@ -73,9 +76,12 @@ function gen_config(user)
if user.transit_node and user.transit_node ~= "nil" then
local node = ucic:get_all("passwall", user.transit_node)
if node and node ~= "nil" and node.type and node.type == "V2ray" then
if node.transport == "mkcp" or node.transport == "ds" or node.transport == "quic" then
node.stream_security = "none"
end
local transit_node = {
tag = "transit",
protocol = node.protocol or "vmess",
protocol = node.protocol,
mux = {
enabled = (node.mux == "1") and true or false,
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
@ -128,16 +134,17 @@ function gen_config(user)
} or nil
},
settings = {
vnext = (node.protocol == "vmess") and {
vnext = (node.protocol == "vmess" or node.protocol == "vless") and {
{
address = node.address,
port = tonumber(node.port),
users = {
{
id = node.vmess_id,
id = node.uuid,
alterId = tonumber(node.alter_id),
level = tonumber(node.level),
security = node.security
level = node.level and tonumber(node.level) or 0,
security = node.security,
encryption = node.encryption or "none"
}
}
}
@ -160,12 +167,6 @@ function gen_config(user)
} or nil
}
}
if node.transport == "mkcp" or node.transport == "ds" or node.transport == "quic" then
transit_node.streamSettings.security = "none"
transit_node.streamSettings.tlsSettings = nil
end
table.insert(outbounds, 1, transit_node)
end
end

View File

@ -39,10 +39,10 @@ local encrypt_methods_ss_aead = {
"aes-256-gcm",
}
map = Map("passwall_server", translate("Server Config"))
map.redirect = d.build_url("admin", "services", "passwall", "server")
m = Map("passwall_server", translate("Server Config"))
m.redirect = d.build_url("admin", "services", "passwall", "server")
s = map:section(NamedSection, arg[1], "user", "")
s = m:section(NamedSection, arg[1], "user", "")
s.addremove = false
s.dynamic = false
@ -81,6 +81,7 @@ end
protocol = s:option(ListValue, "protocol", translate("Protocol"))
protocol:value("vmess", "Vmess")
protocol:value("vless", "VLESS")
protocol:value("http", "HTTP")
protocol:value("socks", "Socks")
protocol:value("shadowsocks", "Shadowsocks")
@ -92,6 +93,12 @@ brook_protocol = s:option(ListValue, "brook_protocol", translate("Brook Protocol
brook_protocol:value("server", "Brook")
brook_protocol:value("wsserver", "WebSocket")
brook_protocol:depends("type", "Brook")
function brook_protocol.cfgvalue(self, section)
return m:get(section, "protocol")
end
function brook_protocol.write(self, section, value)
m:set(section, "protocol", value)
end
brook_tls = s:option(Flag, "brook_tls", translate("Use TLS"))
brook_tls:depends("brook_protocol", "wsserver")
@ -115,20 +122,29 @@ password:depends({ type = "V2ray", protocol = "socks" })
password:depends({ type = "V2ray", protocol = "shadowsocks" })
password:depends({ type = "V2ray", protocol = "mtproto" })
passwords = s:option(DynamicList, "passwords", translate("Password"))
for i = 1, 3 do
local uuid = luci.sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
passwords:value(uuid)
end
passwords:depends("type", "Trojan-Go")
decryption = s:option(Value, "decryption", translate("Encrypt Method"))
decryption.default = "none"
decryption:depends("protocol", "vless")
ssr_encrypt_method = s:option(ListValue, "ssr_encrypt_method", translate("Encrypt Method"))
for a, t in ipairs(ssr_encrypt_method_list) do ssr_encrypt_method:value(t) end
ssr_encrypt_method:depends("type", "SSR")
function ssr_encrypt_method.cfgvalue(self, section)
return m:get(section, "method")
end
function ssr_encrypt_method.write(self, section, value)
m:set(section, "method", value)
end
v_ss_encrypt_method = s:option(ListValue, "v_ss_encrypt_method", translate("Encrypt Method"))
for a, t in ipairs(v_ss_encrypt_method_list) do v_ss_encrypt_method:value(t) end
v_ss_encrypt_method:depends("protocol", "shadowsocks")
function v_ss_encrypt_method.cfgvalue(self, section)
return m:get(section, "method")
end
function v_ss_encrypt_method.write(self, section, value)
m:set(section, "method", value)
end
ss_network = s:option(ListValue, "ss_network", translate("Transport"))
ss_network.default = "tcp,udp"
@ -137,16 +153,28 @@ ss_network:value("udp", "UDP")
ss_network:value("tcp,udp", "TCP,UDP")
ss_network:depends("protocol", "shadowsocks")
ss_ota = s:option(Flag, "ss_ota", translate("OTA"), translate("When OTA is enabled, V2Ray will reject connections that are not OTA enabled. This option is invalid when using AEAD encryption."))
ss_ota = s:option(Flag, "ss_ota", translate("OTA"), translate("When OTA is enabled, a connection that is not OTA enabled is rejected. This option is invalid when using AEAD encryption."))
ss_ota.default = "0"
ss_ota:depends("protocol", "shadowsocks")
function ss_ota.cfgvalue(self, section)
return m:get(section, "ota")
end
function ss_ota.write(self, section, value)
m:set(section, "ota", value)
end
ssr_protocol = s:option(ListValue, "ssr_protocol", translate("Protocol"))
for a, t in ipairs(ssr_protocol_list) do ssr_protocol:value(t) end
ssr_protocol:depends("type", "SSR")
function ssr_protocol.cfgvalue(self, section)
return m:get(section, "protocol")
end
function ssr_protocol.write(self, section, value)
m:set(section, "protocol", value)
end
ssr_protocol_param = s:option(Value, "protocol_param", translate("Protocol_param"))
ssr_protocol_param:depends("type", "SSR")
protocol_param = s:option(Value, "protocol_param", translate("Protocol_param"))
protocol_param:depends("type", "SSR")
obfs = s:option(ListValue, "obfs", translate("Obfs"))
for a, t in ipairs(ssr_obfs_list) do obfs:value(t) end
@ -173,12 +201,13 @@ udp_forward.default = "1"
udp_forward.rmempty = false
udp_forward:depends("type", "SSR")
vmess_id = s:option(DynamicList, "vmess_id", translate("ID"))
uuid = s:option(DynamicList, "uuid", translate("ID"))
for i = 1, 3 do
local uuid = luci.sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
vmess_id:value(uuid)
uuid:value(api.gen_uuid())
end
vmess_id:depends({ type = "V2ray", protocol = "vmess" })
uuid:depends({ type = "V2ray", protocol = "vmess" })
uuid:depends({ type = "V2ray", protocol = "vless" })
uuid:depends("type", "Trojan-Go")
alter_id = s:option(Value, "alter_id", translate("Alter ID"))
alter_id.default = 16
@ -187,15 +216,16 @@ alter_id:depends({ type = "V2ray", protocol = "vmess" })
level = s:option(Value, "level", translate("User Level"))
level.default = 1
level:depends({ type = "V2ray", protocol = "vmess" })
level:depends({ type = "V2ray", protocol = "vless" })
level:depends({ type = "V2ray", protocol = "shadowsocks" })
level:depends({ type = "V2ray", protocol = "mtproto" })
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted (default) and "TLS" for using TLS.'))
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted and "TLS" for using TLS.'))
stream_security:value("none", "none")
stream_security:value("tls", "tls")
stream_security.default = "tls"
stream_security:depends({ type = "V2ray", protocol = "vmess", transport = "ws" })
stream_security:depends({ type = "V2ray", protocol = "vmess", transport = "h2" })
stream_security.default = "none"
stream_security:depends({ type = "V2ray", protocol = "vmess" })
stream_security:depends({ type = "V2ray", protocol = "vless" })
stream_security:depends({ type = "V2ray", protocol = "socks" })
stream_security:depends({ type = "V2ray", protocol = "shadowsocks" })
stream_security:depends("type", "Trojan")
@ -203,7 +233,7 @@ stream_security:depends("type", "Trojan-Plus")
stream_security:depends("type", "Trojan-Go")
stream_security.validate = function(self, value)
if value == "none" and (type:formvalue(arg[1]) == "Trojan" or type:formvalue(arg[1]) == "Trojan-Plus") then
return nil, translate("'none' not supported for original Trojan.")
return nil, translate("'none' not supported for original Trojan, please choose 'tls'.")
end
return value
end
@ -234,6 +264,7 @@ transport:value("h2", "HTTP/2")
transport:value("ds", "DomainSocket")
transport:value("quic", "QUIC")
transport:depends({ type = "V2ray", protocol = "vmess" })
transport:depends({ type = "V2ray", protocol = "vless" })
transport:depends({ type = "V2ray", protocol = "socks" })
transport:depends({ type = "V2ray", protocol = "shadowsocks" })
@ -366,6 +397,26 @@ quic_guise = s:option(ListValue, "quic_guise", translate("Camouflage Type"))
for a, t in ipairs(header_type_list) do quic_guise:value(t) end
quic_guise:depends("transport", "quic")
-- [[ VLESS Fallback部分 ]]--
--[[
fallback = s:option(Flag, "fallback", translate("Fallback"))
fallback:depends({ type = "V2ray", protocol = "vless", transport = "tcp", stream_security = "tls" })
fallback_addr = s:option(Value, "fallback_addr", "Fallback" .. translate("Address (Support Domain Name)"))
fallback_addr:depends("fallback", "1")
fallback_port = s:option(Value, "fallback_port", "Fallback" .. translate("Port"))
fallback_port.datatype = "port"
fallback_port:depends("fallback", "1")
fallback_unix = s:option(Value, "fallback_unix", "Fallback UNIX domain socket", translate("UNIX domain socket, absolute path, you can add @ at the beginning to represent abstract, and it is empty by default. If this value is filled in, addr and port will be ignored."))
fallback_unix:depends("fallback", "1")
fallback_xver = s:option(Value, "fallback_xver", "Fallback xver")
fallback_xver.default = 0
fallback_xver:depends("fallback", "1")
]]--
remote_enable = s:option(Flag, "remote_enable", translate("Enable Remote"), translate("You can forward to Nginx/Caddy/V2ray WebSocket and more."))
remote_enable.default = "1"
remote_enable.rmempty = false
@ -422,4 +473,4 @@ accept_lan.default = "0"
accept_lan.rmempty = false
accept_lan:depends("type", "V2ray")
return map
return m

View File

@ -11,7 +11,7 @@
}
);
}
XHR.poll(2, '<%=url([[admin]], [[services]], [[passwall]], [[get_log]])%>', null,
XHR.poll(30, '<%=url([[admin]], [[services]], [[passwall]], [[get_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');

View File

@ -490,6 +490,9 @@ msgstr "TCP转发端口"
msgid "UDP Redir Ports"
msgstr "UDP转发端口"
msgid "No patterns are used"
msgstr "不使用"
msgid "All"
msgstr "所有"
@ -589,6 +592,9 @@ msgstr "负载比重"
msgid "Export Of Multi WAN"
msgstr "多WAN指定出口"
msgid "Main"
msgstr "主要"
msgid "Mode"
msgstr "模式"
@ -727,9 +733,6 @@ msgstr "关键字丢弃"
msgid "When checked, the keywords in the list are discarded. Otherwise, it is not discarded."
msgstr "当勾选时,将丢弃包含列表里的关键字的节点。否则,将保留列表的关键字的节点(反过来)。"
msgid "Whether unsafe connections are allowed. When checked, V2Ray does not check the validity of the TLS certificate provided by the remote host by default."
msgstr "是否允许不安全连接。当勾选时,缺省情况下客户端不会检查远端主机所提供的 TLS 证书的有效性。"
msgid "Add"
msgstr "添加"
@ -856,14 +859,17 @@ msgstr "伪装类型"
msgid "Transport Layer Encryption"
msgstr "传输层加密"
msgid "Whether or not transport layer encryption is enabled, the supported options are \"none\" for unencrypted (default) and \"TLS\" for using TLS."
msgstr "是否启入传输层加密,支持的选项有 \"none\" 表示不加密(默认值),\"tls\" 表示使用 TLS。"
msgid "Whether or not transport layer encryption is enabled, the supported options are \"none\" for unencrypted and \"TLS\" for using TLS."
msgstr "是否启入传输层加密,支持的选项有 \"none\" 表示不加密,\"tls\" 表示使用 TLS。"
msgid "'none' not supported for original Trojan, please choose 'tls'."
msgstr "原版Trojan不支持'none'请选择TLS。"
msgid "Domain"
msgstr "域名"
msgid "Whether unsafe connections are allowed. When checked, V2Ray does not check the validity of the TLS certificate provided by the remote host."
msgstr "是否允许不安全连接。当勾选时,V2Ray 不会检查远端主机所提供的 TLS 证书的有效性。"
msgid "Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."
msgstr "是否允许不安全连接。当勾选时,将跳过证书验证。"
msgid "<br />none: default, no masquerade, data sent is packets with no characteristics.<br />srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).<br />utp: packets disguised as uTP will be recognized as bittorrent downloaded data.<br />wechat-video: packets disguised as WeChat video calls.<br />dtls: disguised as DTLS 1.2 packet.<br />wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)"
msgstr "<br />none默认值不进行伪装发送的数据是没有特征的数据包。<br />srtp伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime。<br />utp伪装成 uTP 数据包,会被识别为 BT 下载数据。<br />wechat-video伪装成微信视频通话的数据包。<br />dtls伪装成 DTLS 1.2 数据包。<br />wireguard伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)"
@ -871,6 +877,9 @@ msgstr "<br />none默认值不进行伪装发送的数据是没有特
msgid "A legal file path. This file must not exist before running V2Ray."
msgstr "一个合法的文件路径。在运行 V2Ray 之前,这个文件必须不存在。"
msgid "UNIX domain socket, absolute path, you can add @ at the beginning to represent abstract, and it is empty by default. If this value is filled in, addr and port will be ignored."
msgstr "UNIX domain socket绝对路径可在开头加 @ 代表 abstract默认为空。若填写了该值addr 和 port 将被忽略。"
msgid "TCP Open Socks"
msgstr "开启Socks"
@ -913,8 +922,8 @@ msgstr "隐藏菜单方法,地址栏输入例:"
msgid "After the hidden to the display, input example in the address bar:"
msgstr "当你隐藏后想再次显示,地址栏输入例:"
msgid "When OTA is enabled, V2Ray will reject connections that are not OTA enabled. This option is invalid when using AEAD encryption."
msgstr "开启 OTA 后,V2Ray 会拒绝未启用 OTA 的连接。当使用 AEAD 加密时,该选项无效。"
msgid "When OTA is enabled, a connection that is not OTA enabled is rejected. This option is invalid when using AEAD encryption."
msgstr "开启 OTA 后,拒绝未启用 OTA 的连接。当使用 AEAD 加密时,该选项无效。"
msgid "transit node"
msgstr "中转到此节点"

View File

@ -618,7 +618,7 @@ stop_crontab() {
start_dns() {
local dns2socks_socks_server dns2socks_forward dns2sock_cache pdnsd_port pdnsd_forward other_port up_trust_pdnsd_dns msg
local chnlist returnhome china_ng_chn china_ng_gfw chnlist_param gfwlist_param extra_mode up_trust_chinadns_ng_dns
local global chnlist returnhome china_ng_chn china_ng_gfw chnlist_param gfwlist_param extra_mode up_trust_chinadns_ng_dns
dns2socks_socks_server=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g")
dns2socks_forward=$(get_first_dns DNS_FORWARD 53 | sed 's/#/:/g')
dns2socks_listen="127.0.0.1:${DNS_PORT}"
@ -629,6 +629,9 @@ start_dns() {
other_port=$(expr $DNS_PORT + 1)
china_ng_gfw="127.0.0.1#${other_port}"
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global")
chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute")
[ -n "${returnhome}" ] && china_ng_chn="${china_ng_gfw}" && china_ng_gfw="${LOCAL_DNS}"
sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
echolog "过滤服务配置:准备接管域名解析[$?]..."
case "$DNS_MODE" in
@ -642,7 +645,7 @@ start_dns() {
pdnsd)
up_trust_pdnsd_dns=$(config_t_get global up_trust_pdnsd_dns "nil")
if [ "$up_trust_pdnsd_dns" = "dns2socks" ]; then
pdnsd_forward=${china_ng_gfw}
[ -n "${returnhome}" ] && pdnsd_forward=${china_ng_chn} || pdnsd_forward=${china_ng_gfw}
dns2socks_listen=${pdnsd_forward}
msg="dns2socks"
elif [ "$up_trust_pdnsd_dns" = "udp" ]; then
@ -655,39 +658,44 @@ start_dns() {
;;
chinadns-ng)
up_trust_chinadns_ng_dns=$(config_t_get global up_trust_chinadns_ng_dns "pdnsd")
echolog " | - (chinadns-ng) 只支持2~4级的域名过滤..."
[ -z "${global}${chnlist}" ] && echolog " | - (chinadns-ng) 此模式下列表外的域名查询会同时发送给本地DNS(可切换到Pdnsd + TCP节点模式解决)..."
[ -n "${returnhome}" ] && msg="本地" || msg="代理"
[ -z "${global}${chnlist}" ] && echolog " | - (chinadns-ng) 列表外域名查询的结果不在中国IP段内(chnroute/chnroute6)时,只采信${msg} DNS 的应答..."
echolog " | - (chinadns-ng) 上游 DNS (${china_ng_gfw}) 有一定概率会比 DNS (${china_ng_chn}) 先返回的话(比如 DNS 的本地查询缓存),启用 '公平模式' 可以优先接受${msg} DNS 的中国IP段内(chnroute/chnroute6)的应答..."
if [ "$up_trust_chinadns_ng_dns" = "pdnsd" ]; then
pdnsd_port=${other_port}
msg="pdnsd"
echolog " | - (chinadns-ng) 只支持2~4级的域名过滤列表外的域名查询会同时发送给本地DNS(可切换到Pdnsd + TCP节点模式解决)..."
echolog " | - (chinadns-ng) 虽然列表外域名查询的结果不在中国IP段内(chnroute/chnroute6)时,只采信上游代理 DNS 的应答..."
echolog " | - (chinadns-ng) 上游代理 DNS 有一定概率会比本地 DNS 先返回的话(比如上游代理 DNS 的本地查询缓存),启用 '公平模式' 可以优先接受本地 DNS 的中国IP段内(chnroute/chnroute6)的应答..."
elif [ "$up_trust_chinadns_ng_dns" = "dns2socks" ]; then
dns2socks_listen=${china_ng_gfw}
TUN_DNS="${dns2socks_listen}"
[ -n "${global}${chnlist}" ] && TUN_DNS="${dns2socks_listen}"
msg="dns2socks"
elif [ "$up_trust_chinadns_ng_dns" = "udp" ]; then
use_udp_node_resolve_dns=1
china_ng_gfw=${DNS_FORWARD}
[ -z "${returnhome}" ] || china_ng_chn="${china_ng_gfw}"
if [ -z "${returnhome}" ]; then
china_ng_gfw=${DNS_FORWARD}
else
china_ng_chn="${DNS_FORWARD}"
fi
msg="udp"
fi
cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/gfwlist.txt"
echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表"
gfwlist_param="${TMP_PATH}/gfwlist.txt"
cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist"
if [ -z "${returnhome}" ]; then
cat "${RULES_PATH}/direct_host" >> "${TMP_PATH}/chnlist"
echolog " | - [$?](chinadns-ng) 域名白名单合并到中国域名表"
cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/gfwlist.txt"
echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表"
gfwlist_param="${TMP_PATH}/gfwlist.txt"
else
echolog " | - (chinadns-ng) 白名单不与中国域名表合并"
china_ng_chn=${china_ng_gfw}
cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/chnlist"
echolog " | - [$?](chinadns-ng) 忽略防火墙域名表,代理域名表合并到中国域名表"
fi
chnlist_param="${TMP_PATH}/chnlist"
[ "$(config_t_get global fair_mode 1)" = "1" ] && extra_mode="-f"
ln_start_bin "$(first_type chinadns-ng)" chinadns-ng -l "${DNS_PORT}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param:+-m "${chnlist_param}" -M} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} $extra_mode
echolog " + 过滤服务ChinaDNS-NG(:${DNS_PORT}${extra_mode}):中国域名列表:${china_ng_chn:-D114.114.114.114},防火域名列表:${china_ng_gfw:-D8.8.8.8} ${msg}"
echolog " + 过滤服务ChinaDNS-NG(:${DNS_PORT}${extra_mode}) + ${msg}:中国域名列表:${china_ng_chn:-D114.114.114.114},防火墙域名列表:${china_ng_gfw:-D8.8.8.8}"
[ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${china_ng_gfw}"
;;
*)
TUN_DNS="$(echo ${DNS_MODE} | sed 's/:/#/g')"
@ -703,6 +711,7 @@ start_dns() {
dns2socks_listen=$(echo "${dns2socks_listen}" | sed 's/#/:/g')
ln_start_bin "$(first_type dns2socks)" dns2socks "$dns2socks_socks_server" "$dns2socks_forward" "$dns2socks_listen" $dns2sock_cache
echolog " - dns2sock(${dns2socks_listen}${dns2sock_cache})${dns2socks_socks_server:-127.0.0.1:9050} -> ${dns2socks_forward-D46.182.19.48:53}"
[ "${DNS_MODE}" = "chinadns-ng" ] && [ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${dns2socks_listen}"
fi
[ "${use_udp_node_resolve_dns}" = "1" ] && echolog " * 要求代理 DNS 请求,如上游 DNS 非直连地址,确保 UDP 代理打开,并且已经正确转发"
[ "${use_tcp_node_resolve_dns}" = "1" ] && echolog " * 请确认上游 DNS 支持 TCP 查询,如非直连地址,确保 TCP 代理打开,并且已经正确转发"
@ -733,7 +742,8 @@ add_dnsmasq() {
fwd_dns="${LOCAL_DNS}"
[ -z "${global}" ] && {
[ -z "${chnlist}" ] || [ -n "${returnhome}" ] && [ -n "${force_local}" ] && [ "${filtered_dns}" != "1" ] && unset fwd_dns
[ -z "${chnlist}" ] || [ -n "${returnhome}" ] && [ -n "${force_local}" ] && unset fwd_dns
[ "${DNS_MODE}" = "other_dns" ] && fwd_dns="${TUN_DNS}"
sort -u "${RULES_PATH}/direct_host" | gen_dnsmasq_items "whitelist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/direct_host.conf"
echolog " - [$?]域名白名单(whitelist)${fwd_dns:-默认}"
}
@ -745,9 +755,8 @@ add_dnsmasq() {
[ -n "${returnhome}" ] || [ "${filtered_dns}" = "1" ] && {
[ -n "${gfwlist}" ] && fwd_dns="${LOCAL_DNS}"
[ "${filtered_dns}" = "1" ] && [ -z "${chnlist}" ] && unset fwd_dns
[ "${DNS_MODE}" = "chinadns-ng" ] && fwd_dns="127.0.0.1#${DNS_PORT}"
[ -n "${returnhome}" ] && fwd_dns="${TUN_DNS}"
[ "${filtered_dns}" = "1" ] && [ -z "${chnlist}" ] && unset fwd_dns
[ -n "${global}" ] && unset fwd_dns
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
@ -755,8 +764,8 @@ add_dnsmasq() {
fwd_dns="${TUN_DNS}"
[ "${filtered_dns}" = "1" ] && [ -z "${returnhome}" ] && unset fwd_dns
[ -n "${global}" ] && unset fwd_dns
sort -u "${RULES_PATH}/proxy_host" | sed 's/^\.\(.*\)$/\1/g' | gen_dnsmasq_items "blacklist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/proxy_host.conf"
[ "${DNS_MODE}" = "chinadns-ng" ] || [ -n "${global}" ] && [ -z "${returnhome}" ] && unset fwd_dns
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
[ -n "${gfwlist}" ] || [ "${filtered_dns}" = "1" ] && [ -z "${returnhome}" ] && {
@ -778,10 +787,12 @@ add_dnsmasq() {
msg="ISP"
servers="${LOCAL_DNS}"
echo "conf-dir=${TMP_DNSMASQ_PATH}" > "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf"
echo "conf-dir=$TMP_DNSMASQ_PATH" > "${DNSMASQ_PATH}/dnsmasq-${CONFIG}.conf"
echo "conf-dir=${TMP_DNSMASQ_PATH}" > "${DNSMASQ_PATH}/dnsmasq-${CONFIG}.conf"
[ "${filtered_dns}" = "1" ] && servers="${TUN_DNS}"
[ "${DNS_MODE}" = "chinadns-ng" ] && servers="127.0.0.1#${DNS_PORT}" && msg="chinadns-ng"
[ "${filtered_dns}" = "1" ] && [ -z "${returnhome}" ] && servers="${TUN_DNS}"
if [ "${DNS_MODE}" = "chinadns-ng" ]; then
[ -z "${global}${chnlist}" ] && servers="127.0.0.1#${DNS_PORT}" && msg="chinadns-ng"
fi
[ -n "${chnlist}" ] && msg="中国列表以外"
[ -n "${returnhome}" ] && msg="中国列表"
[ -n "${global}" ] && msg="全局"

View File

@ -145,7 +145,7 @@ load_acl() {
eval tcp_port=\$TCP_REDIR_PORT$tcp_node
eval TCP_NODE_TYPE=$(echo $(config_n_get $TCP_NODE type) | tr 'A-Z' 'a-z')
[ "$TCP_NODE_TYPE" == "brook" ] && [ "$(config_n_get $TCP_NODE protocol client)" == "client" ] && is_tproxy=1
[ "$TCP_NODE_TYPE" == "trojan-go" ] && is_tproxy=1
#[ "$TCP_NODE_TYPE" == "trojan-go" ] && is_tproxy=1
msg2="${msg}使用TCP节点${tcp_node} [$(get_action_chain_name $tcp_proxy_mode)]"
if [ -n "${is_tproxy}" ]; then
msg2="${msg2}(TPROXY:${tcp_port})代理"
@ -191,7 +191,7 @@ load_acl() {
[ "$TCP_NODE1" != "nil" ] && [ "$TCP_PROXY_MODE" != "disable" ] && {
local TCP_NODE1_TYPE=$(echo $(config_n_get $TCP_NODE1 type) | tr 'A-Z' 'a-z')
[ "$TCP_NODE1_TYPE" == "brook" ] && [ "$(config_n_get $TCP_NODE1 protocol client)" == "client" ] && is_tproxy=1
[ "$TCP_NODE1_TYPE" == "trojan-go" ] && is_tproxy=1
#[ "$TCP_NODE1_TYPE" == "trojan-go" ] && is_tproxy=1
msg="TCP默认代理使用TCP节点1 [$(get_action_chain_name $TCP_PROXY_MODE)]"
if [ -n "$is_tproxy" ]; then
ipt_tmp=$ipt_m && is_tproxy="TPROXY"
@ -245,7 +245,7 @@ filter_node() {
ip6t_tmp=$ip6t_n
[ "$stream" == "udp" ] && is_tproxy=1
[ "$type" == "brook" ] && [ "$(config_n_get $node protocol client)" == "client" ] && is_tproxy=1
[ "$type" == "trojan-go" ] && is_tproxy=1
#[ "$type" == "trojan-go" ] && is_tproxy=1
if [ -n "$is_tproxy" ]; then
ipt_tmp=$ipt_m
ip6t_tmp=$ip6t_m

View File

@ -339,7 +339,7 @@ local function processData(szType, content, add_mode)
result.protocol = 'vmess'
result.transport = info.net
result.alter_id = info.aid
result.vmess_id = info.id
result.uuid = info.id
result.remarks = info.ps
-- result.mux = 1
-- result.mux_concurrency = 8

View File

@ -245,19 +245,15 @@ mtdsplit_uimage_parse_generic(struct mtd_info *master,
uimage_verify_default);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
static const struct of_device_id mtdsplit_uimage_of_match_table[] = {
{ .compatible = "denx,uimage" },
{},
};
#endif
static struct mtd_part_parser uimage_generic_parser = {
.owner = THIS_MODULE,
.name = "uimage-fw",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
.of_match_table = mtdsplit_uimage_of_match_table,
#endif
.parse_fn = mtdsplit_uimage_parse_generic,
.type = MTD_PARSER_TYPE_FIRMWARE,
};
@ -312,19 +308,15 @@ mtdsplit_uimage_parse_netgear(struct mtd_info *master,
uimage_verify_wndr3700);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
static const struct of_device_id mtdsplit_uimage_netgear_of_match_table[] = {
{ .compatible = "netgear,uimage" },
{},
};
#endif
static struct mtd_part_parser uimage_netgear_parser = {
.owner = THIS_MODULE,
.name = "netgear-fw",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
.of_match_table = mtdsplit_uimage_netgear_of_match_table,
#endif
.parse_fn = mtdsplit_uimage_parse_netgear,
.type = MTD_PARSER_TYPE_FIRMWARE,
};
@ -364,19 +356,15 @@ mtdsplit_uimage_parse_edimax(struct mtd_info *master,
uimage_find_edimax);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
static const struct of_device_id mtdsplit_uimage_edimax_of_match_table[] = {
{ .compatible = "edimax,uimage" },
{},
};
#endif
static struct mtd_part_parser uimage_edimax_parser = {
.owner = THIS_MODULE,
.name = "edimax-fw",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
.of_match_table = mtdsplit_uimage_edimax_of_match_table,
#endif
.parse_fn = mtdsplit_uimage_parse_edimax,
.type = MTD_PARSER_TYPE_FIRMWARE,
};
@ -407,61 +395,53 @@ mtdsplit_uimage_parse_fonfxc(struct mtd_info *master,
uimage_find_fonfxc);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
static const struct of_device_id mtdsplit_uimage_fonfxc_of_match_table[] = {
{ .compatible = "fonfxc,uimage" },
{},
};
#endif
static struct mtd_part_parser uimage_fonfxc_parser = {
.owner = THIS_MODULE,
.name = "fonfxc-fw",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
.of_match_table = mtdsplit_uimage_fonfxc_of_match_table,
#endif
.parse_fn = mtdsplit_uimage_parse_fonfxc,
};
/**************************************************
* ubootpad96
* SGE (T&W) Shenzhen Gongjin Electronics
**************************************************/
#define ubootpad96_PAD_LEN 96
#define SGE_PAD_LEN 96
static ssize_t uimage_find_ubootpad96(u_char *buf, size_t len, int *extralen)
static ssize_t uimage_find_sge(u_char *buf, size_t len, int *extralen)
{
if (uimage_verify_default(buf, len, extralen) < 0)
return -EINVAL;
*extralen = ubootpad96_PAD_LEN;
*extralen = SGE_PAD_LEN;
return 0;
}
static int
mtdsplit_uimage_parse_ubootpad96(struct mtd_info *master,
mtdsplit_uimage_parse_sge(struct mtd_info *master,
const struct mtd_partition **pparts,
struct mtd_part_parser_data *data)
{
return __mtdsplit_parse_uimage(master, pparts, data,
uimage_find_ubootpad96);
uimage_find_sge);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
static const struct of_device_id mtdsplit_uimage_ubootpad96_of_match_table[] = {
{ .compatible = "ubootpad96,uimage" },
static const struct of_device_id mtdsplit_uimage_sge_of_match_table[] = {
{ .compatible = "sge,uimage" },
{},
};
#endif
static struct mtd_part_parser uimage_ubootpad96_parser = {
static struct mtd_part_parser uimage_sge_parser = {
.owner = THIS_MODULE,
.name = "ubootpad96-fw",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
.of_match_table = mtdsplit_uimage_ubootpad96_of_match_table,
#endif
.parse_fn = mtdsplit_uimage_parse_ubootpad96,
.name = "sge-fw",
.of_match_table = mtdsplit_uimage_sge_of_match_table,
.parse_fn = mtdsplit_uimage_parse_sge,
};
/**************************************************
@ -505,19 +485,15 @@ mtdsplit_uimage_parse_okli(struct mtd_info *master,
uimage_verify_okli);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
static const struct of_device_id mtdsplit_uimage_okli_of_match_table[] = {
{ .compatible = "openwrt,okli" },
{},
};
#endif
static struct mtd_part_parser uimage_okli_parser = {
.owner = THIS_MODULE,
.name = "okli-fw",
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
.of_match_table = mtdsplit_uimage_okli_of_match_table,
#endif
.parse_fn = mtdsplit_uimage_parse_okli,
};
@ -531,7 +507,7 @@ static int __init mtdsplit_uimage_init(void)
register_mtd_parser(&uimage_netgear_parser);
register_mtd_parser(&uimage_edimax_parser);
register_mtd_parser(&uimage_fonfxc_parser);
register_mtd_parser(&uimage_ubootpad96_parser);
register_mtd_parser(&uimage_sge_parser);
register_mtd_parser(&uimage_okli_parser);
return 0;

View File

@ -1,6 +1,5 @@
#
# Copyright (C) 2016 lede-project.org
# Copyright (C) 2020 AnYun
#
ruijie_do_flash() {

View File

@ -1,4 +1,3 @@
CONFIG_AHCI_IPQ=y
CONFIG_ALIGNMENT_TRAP=y
# CONFIG_AMBA_PL08X is not set
# CONFIG_APQ_GCC_8084 is not set

View File

@ -1,308 +0,0 @@
From c5ea64dcf7b5d45e402e78b9f291d521669b7b80 Mon Sep 17 00:00:00 2001
From: Kumar Gala <galak@codeaurora.org>
Date: Fri, 30 May 2014 15:35:40 -0500
Subject: [PATCH] ata: Add Qualcomm ARM SoC AHCI SATA host controller driver
Add support for the Qualcomm AHCI SATA controller that exists on several
SoC and specifically the IPQ806x family of chips. The IPQ806x SATA support
requires the associated IPQ806x SATA PHY Driver to be enabled as well.
Signed-off-by: Kumar Gala <galak@codeaurora.org>
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
---
drivers/ata/ahci.h | 2 +-
drivers/ata/ahci_ipq.c | 248 ++++++++++++++++++++++++++++++++++++++
drivers/ata/Kconfig | 8 ++++++++
drivers/ata/Makefile | 1 +
4 files changed, 258 insertions(+), 1 deletions(-)
create mode 100644 drivers/ata/ahci_ipq.c
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -54,7 +54,7 @@
enum {
AHCI_MAX_PORTS = 32,
- AHCI_MAX_CLKS = 5,
+ AHCI_MAX_CLKS = 6,
AHCI_MAX_SG = 168, /* hardware max is 64K */
AHCI_DMA_BOUNDARY = 0xffffffff,
AHCI_MAX_CMDS = 32,
--- /dev/null
+++ b/drivers/ata/ahci_ipq.c
@@ -0,0 +1,248 @@
+/* Copyright (c) 2015 - 2017, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/device.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/libata.h>
+#include <linux/ahci_platform.h>
+#include <linux/acpi.h>
+#include <linux/pci_ids.h>
+#include "libata.h"
+#include "ahci.h"
+
+#define IPQ_DRV_NAME "ahci-ipq"
+
+struct ipq_ahci_priv {
+ struct platform_device *ahci_pdev;
+ struct ahci_host_priv *hpriv;
+ void *preg_reset;
+ int pstate;
+};
+
+struct ipq_ahci_priv *ipqpriv;
+
+static const struct ata_port_info ipq_ahci_port_info = {
+ .flags = AHCI_FLAG_COMMON,
+ .pio_mask = ATA_PIO4,
+ .udma_mask = ATA_UDMA6,
+ .port_ops = &ahci_platform_ops,
+};
+
+static struct scsi_host_template ahci_platform_sht = {
+ AHCI_SHT(IPQ_DRV_NAME),
+};
+
+#define SATA_PWR_STATE_DOWN 0x1
+#define SATA_PWR_STATE_UP 0x2
+#define SATA_RESET 0x00902c1c
+
+static void ipq_ahci_hard_reset(struct device *dev)
+{
+ u32 reg;
+
+ reg = readl_relaxed(ipqpriv->preg_reset);
+ writel_relaxed(reg | BIT(0), ipqpriv->preg_reset);
+ /* To make sure the write is complete before we move on */
+ mb();
+
+ reg = readl_relaxed(ipqpriv->preg_reset);
+ writel_relaxed(reg & (~BIT(0)), ipqpriv->preg_reset);
+ /* To make sure the write is complete before we move on */
+ mb();
+}
+
+static int ipq_ahci_suspend(struct device *dev)
+{
+ struct ata_host *host = dev_get_drvdata(dev);
+ struct device_type *apt = &ata_port_type;
+ const struct dev_pm_ops *pm = apt->pm;
+ struct ata_port *ap;
+ int ret = 0, i;
+
+ if (ipqpriv->pstate == SATA_PWR_STATE_UP) {
+ for (i = 0; i < host->n_ports; i++) {
+ ap = host->ports[i];
+ /* Issue Port PM Suspend */
+ ret = pm->runtime_suspend(&ap->tdev);
+ if (ret) {
+ dev_err(dev, "SATA controller port suspend failed\n");
+ return ret;
+ }
+ }
+
+ /* Issue Contoller PM Suspend */
+ ret = ahci_platform_suspend_host(dev);
+ if (ret) {
+ dev_err(dev, "SATA controller host suspend failed\n");
+ return ret;
+ }
+
+ for (i = 0; i < ipqpriv->hpriv->nports; i++) {
+ if (!ipqpriv->hpriv->phys[i])
+ continue;
+
+ phy_power_off(ipqpriv->hpriv->phys[i]);
+ phy_exit(ipqpriv->hpriv->phys[i]);
+ }
+
+ ahci_platform_disable_clks(ipqpriv->hpriv);
+ ipqpriv->pstate = SATA_PWR_STATE_DOWN;
+ } else {
+ dev_warn(dev, "SATA device already in suspended state");
+ }
+
+ return ret;
+}
+
+static int ipq_ahci_resume(struct device *dev)
+{
+ struct ata_host *host = dev_get_drvdata(dev);
+ struct device_type *apt = &ata_port_type;
+ const struct dev_pm_ops *pm = apt->pm;
+ struct ata_port *ap;
+ int ret = 0, i;
+
+ if (ipqpriv->pstate == SATA_PWR_STATE_DOWN) {
+
+ ahci_platform_enable_clks(ipqpriv->hpriv);
+
+ /* Issue SATA clock hard reset */
+ ipq_ahci_hard_reset(dev);
+
+ for (i = 0; i < ipqpriv->hpriv->nports; i++) {
+ if (!ipqpriv->hpriv->phys[i])
+ continue;
+
+ phy_init(ipqpriv->hpriv->phys[i]);
+ phy_power_on(ipqpriv->hpriv->phys[i]);
+ }
+
+ /* Issue Contoller PM Resume */
+ ret = ahci_platform_resume_host(dev);
+ if (ret) {
+ dev_err(dev, "SATA controller resume failed\n");
+ return ret;
+ }
+
+ for (i = 0; i < host->n_ports; i++) {
+ /* Issue Port PM Resume */
+ ap = host->ports[i];
+ ret = pm->runtime_resume(&ap->tdev);
+ if (ret) {
+ dev_err(dev, "SATA controller port resume failed\n");
+ return ret;
+ }
+ }
+ ipqpriv->pstate = SATA_PWR_STATE_UP;
+ } else {
+ dev_warn(dev, "SATA device already in resume state");
+ }
+
+ return ret;
+}
+
+static int ipq_ahci_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct ahci_host_priv *hpriv;
+ int rc;
+
+ hpriv = ahci_platform_get_resources(pdev);
+ if (IS_ERR(hpriv))
+ return PTR_ERR(hpriv);
+
+ rc = ahci_platform_enable_resources(hpriv);
+ if (rc)
+ return rc;
+
+ of_property_read_u32(dev->of_node,
+ "ports-implemented", &hpriv->force_port_map);
+
+ rc = ahci_platform_init_host(pdev, hpriv, &ipq_ahci_port_info,
+ &ahci_platform_sht);
+
+ if (rc)
+ goto disable_resources;
+
+ ipqpriv = devm_kzalloc(dev, sizeof(*ipqpriv), GFP_KERNEL);
+ if (!ipqpriv) {
+ dev_err(dev, "can't alloc ahci_host_priv\n");
+ rc = -ENOMEM;
+ goto disable_resources;
+ }
+
+ ipqpriv->ahci_pdev = pdev;
+ ipqpriv->hpriv = hpriv;
+ ipqpriv->pstate = SATA_PWR_STATE_UP;
+
+ ipqpriv->preg_reset = devm_ioremap(dev, SATA_RESET,
+ sizeof(*(ipqpriv->preg_reset)));
+
+ if (IS_ERR(ipqpriv->preg_reset)) {
+ dev_err(dev, "can't ioremap for preg_reset\n");
+ rc = -ENOMEM;
+ goto disable_resources;
+ }
+
+ return 0;
+
+ disable_resources:
+ ahci_platform_disable_resources(hpriv);
+ return rc;
+}
+
+int ipq_ahci_remove(struct platform_device *pdev)
+{
+ ata_platform_remove_one(pdev);
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(ipq_ahci_pm_ops, ahci_platform_suspend,
+ ahci_platform_resume);
+
+static const struct of_device_id ipq_ahci_of_match[] = {
+ { .compatible = "qcom,ipq806x-ahci", },
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, ipq_ahci_of_match);
+
+static const struct acpi_device_id ahci_acpi_match[] = {
+ { ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) },
+ {},
+};
+
+MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
+
+static struct platform_driver ipq_ahci_driver = {
+ .probe = ipq_ahci_probe,
+ .remove = ipq_ahci_remove,
+ .driver = {
+ .name = IPQ_DRV_NAME,
+ .of_match_table = ipq_ahci_of_match,
+ .acpi_match_table = ahci_acpi_match,
+ .pm = &ipq_ahci_pm_ops,
+ },
+};
+
+module_platform_driver(ipq_ahci_driver);
+
+MODULE_DESCRIPTION("IPQ806x AHCI SATA platform driver");
+MODULE_ALIAS("platform:ahci-ipq");
+MODULE_LICENSE("Dual BSD/GPL");
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -162,6 +162,14 @@ config AHCI_IMX
If unsure, say N.
+config AHCI_IPQ
+ tristate "Qualcomm Atheros IPQ806X AHCI SATA support"
+ help
+ This option enables support for the IPQ806X SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
+
config AHCI_CEVA
tristate "CEVA AHCI SATA support"
depends on OF
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_AHCI_CEVA) += ahci_ceva.o
obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_DM816) += ahci_dm816.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o
+obj-$(CONFIG_AHCI_IPQ) += ahci_ipq.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_MTK) += ahci_mtk.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_OCTEON) += ahci_octeon.o

View File

@ -81,11 +81,6 @@ define Build/iodata-mstc-header
)
endef
define Build/ubootpad96
uimage_padhdr -i $@ -o $@.new -l 96
mv $@.new $@
endef
define Build/ubnt-erx-factory-image
if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \
echo '21001:7' > $(1).compat; \