luci-app-passwall: bump to 3.9-72
This commit is contained in:
parent
a6f339e48b
commit
f9cf2c4760
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=3.9
|
||||
PKG_RELEASE:=70
|
||||
PKG_DATE:=20201009
|
||||
PKG_RELEASE:=72
|
||||
PKG_DATE:=20201012
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@ -185,7 +185,13 @@ function socks_status()
|
||||
local index = luci.http.formvalue("index")
|
||||
local id = luci.http.formvalue("id")
|
||||
e.index = index
|
||||
e.status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep 'SOCKS_%s' > /dev/null", appname, id)) == 0
|
||||
e.socks_status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep 'SOCKS_%s' > /dev/null", appname, id)) == 0
|
||||
local use_http = ucic:get(appname, id, "http_port") or 0
|
||||
e.use_http = 0
|
||||
if tonumber(use_http) > 0 then
|
||||
e.use_http = 1
|
||||
e.http_status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep 'SOCKS2HTTP_%s' > /dev/null", appname, id)) == 0
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
@ -39,12 +39,14 @@ function gen_outbound(node, tag, relay_port)
|
||||
local node_type = (proto and proto ~= "nil") and proto or "socks"
|
||||
new_port = get_new_port()
|
||||
node.port = new_port
|
||||
sys.call(string.format('/usr/share/%s/app.sh run_socks "%s" "%s" "%s" "%s" "%s" "%s"> /dev/null',
|
||||
sys.call(string.format('/usr/share/%s/app.sh run_socks "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"> /dev/null',
|
||||
appname,
|
||||
node_id,
|
||||
"127.0.0.1",
|
||||
new_port,
|
||||
string.format("/var/etc/%s/v2_%s_%s.json", appname, node_type, node_id),
|
||||
"0",
|
||||
"nil",
|
||||
"4",
|
||||
relay_port and tostring(relay_port) or ""
|
||||
)
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
local json = require "luci.jsonc"
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
local routing = nil
|
||||
|
||||
local local_proto = arg[1]
|
||||
local local_address = arg[2]
|
||||
local local_port = arg[3]
|
||||
local server_proto = arg[4]
|
||||
local server_address = arg[5]
|
||||
local server_port = arg[6]
|
||||
local server_username = arg[7] or "nil"
|
||||
local server_password = arg[8] or "nil"
|
||||
|
||||
function gen_outbound(proto, address, port, username, password)
|
||||
local result = {
|
||||
protocol = proto,
|
||||
streamSettings = {
|
||||
network = "tcp",
|
||||
security = "none"
|
||||
},
|
||||
settings = {
|
||||
servers = {
|
||||
{
|
||||
address = address,
|
||||
port = tonumber(port),
|
||||
users = (username ~= "nil" and password ~= "nil") and {
|
||||
{
|
||||
user = username,
|
||||
pass = password
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
end
|
||||
|
||||
if local_proto ~= "nil" and local_address ~= "nil" and local_port ~= "nil" then
|
||||
local inbound = {
|
||||
listen = local_address,
|
||||
port = tonumber(local_port),
|
||||
protocol = local_proto,
|
||||
settings = {
|
||||
accounts = nil
|
||||
}
|
||||
}
|
||||
if local_proto == "socks" then
|
||||
inbound.settings.auth = "noauth"
|
||||
inbound.settings.udp = true
|
||||
elseif local_proto == "http" then
|
||||
inbound.settings.allowTransparent = false
|
||||
end
|
||||
table.insert(inbounds, inbound)
|
||||
end
|
||||
|
||||
if server_proto ~= "nil" and server_address ~= "nil" and server_port ~= "nil" then
|
||||
local outbound = gen_outbound(server_proto, server_address, server_port, server_username, server_password)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
|
||||
-- 额外传出连接
|
||||
table.insert(outbounds, {
|
||||
protocol = "freedom", tag = "direct", settings = {keep = ""}
|
||||
})
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = string.format("/var/etc/passwall/%s.log", node[".name"]),
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = inbounds,
|
||||
-- 传出连接
|
||||
outbounds = outbounds,
|
||||
-- 路由
|
||||
routing = routing
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
@ -314,7 +314,7 @@ end
|
||||
o = s:option(DummyValue, "status", translate("Status"))
|
||||
o.rawhtml = true
|
||||
o.cfgvalue = function(t, n)
|
||||
return string.format('<font class="_status" socks_id="%s"></font>', n)
|
||||
return string.format('<div class="_status" socks_id="%s"></div>', n)
|
||||
end
|
||||
|
||||
---- Enable
|
||||
@ -329,11 +329,17 @@ for i = 1, tcp_node_num, 1 do
|
||||
end
|
||||
for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end
|
||||
|
||||
o = s:option(Value, "port", translate("Listen Port"))
|
||||
o = s:option(Value, "port", "Socks" .. translate("Listen Port"))
|
||||
o.default = 9050
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
|
||||
if api.is_finded("v2ray") then
|
||||
o = s:option(Value, "http_port", "HTTP" .. translate("Listen Port") .. " " .. translate("0 is not use"))
|
||||
o.default = 0
|
||||
o.datatype = "port"
|
||||
end
|
||||
|
||||
m:append(Template(appname .. "/global/footer"))
|
||||
|
||||
--[[
|
||||
|
||||
@ -70,12 +70,14 @@ local function start()
|
||||
local type = user.type or ""
|
||||
if type == "Socks" then
|
||||
local auth = ""
|
||||
local username = user.username
|
||||
local password = user.password
|
||||
if username and username ~= "" and password and password ~= "" then
|
||||
username = "-u " .. username
|
||||
password = "-P " .. password
|
||||
auth = username .. " " .. password
|
||||
if user.auth and user.auth == "1" then
|
||||
local username = user.username or ""
|
||||
local password = user.password or ""
|
||||
if username ~= "" and password ~= "" then
|
||||
username = "-u " .. username
|
||||
password = "-P " .. password
|
||||
auth = username .. " " .. password
|
||||
end
|
||||
end
|
||||
bin = ln_start("/usr/bin/microsocks", "microsocks_" .. id, string.format("-i :: -p %s %s", port, auth))
|
||||
elseif type == "SS" or type == "SSR" then
|
||||
|
||||
@ -5,7 +5,7 @@ function gen_config(user)
|
||||
config.server_port = tonumber(user.port)
|
||||
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.fast_open = (user.tcp_fast_open and user.tcp_fast_open == "1") and true or false
|
||||
config.method = user.method
|
||||
|
||||
if user.type == "SSR" then
|
||||
|
||||
@ -8,9 +8,9 @@ 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.uuid or { user.password },
|
||||
password = user.uuid,
|
||||
log_level = 1,
|
||||
ssl = (user.stream_security == nil or user.stream_security == "tls") and {
|
||||
ssl = {
|
||||
cert = user.tls_certificateFile,
|
||||
key = user.tls_keyFile,
|
||||
key_password = "",
|
||||
@ -26,10 +26,10 @@ function gen_config(user)
|
||||
plain_http_response = "",
|
||||
curves = "",
|
||||
dhparam = ""
|
||||
} or nil,
|
||||
},
|
||||
udp_timeout = 60,
|
||||
disable_http_check = true,
|
||||
transport_plugin = user.stream_security == "none" and user.trojan_transport == "original" and {
|
||||
transport_plugin = (user.tls == nil or user.tls ~= "1") and user.trojan_transport == "original" and {
|
||||
enabled = user.plugin_type ~= nil,
|
||||
type = user.plugin_type or "plaintext",
|
||||
command = user.plugin_type ~= "plaintext" and user.plugin_cmd or nil,
|
||||
@ -52,7 +52,7 @@ function gen_config(user)
|
||||
no_delay = true,
|
||||
keep_alive = true,
|
||||
reuse_port = false,
|
||||
fast_open = (user.fast_open == "true") and true or false,
|
||||
fast_open = (user.tcp_fast_open and user.tcp_fast_open == "1") and true or false,
|
||||
fast_open_qlen = 20
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ function gen_config(user)
|
||||
for i = 1, #user.uuid do
|
||||
clients[i] = {
|
||||
id = user.uuid[i],
|
||||
flow = (user.stream_security == "xtls") and user.flow or nil,
|
||||
flow = (user.xtls and user.xtls == "1") and user.flow or nil,
|
||||
level = tonumber(user.level),
|
||||
alterId = tonumber(user.alter_id)
|
||||
}
|
||||
@ -26,24 +26,26 @@ function gen_config(user)
|
||||
end
|
||||
elseif user.protocol == "socks" then
|
||||
settings = {
|
||||
auth = (user.username == nil and user.password == nil) and "noauth" or "password",
|
||||
accounts = {
|
||||
auth = (user.auth and user.auth == "1") and "password" or "noauth",
|
||||
accounts = (user.auth and user.auth == "1") and {
|
||||
{
|
||||
user = (user.username == nil) and "" or user.username,
|
||||
pass = (user.password == nil) and "" or user.password
|
||||
user = user.username,
|
||||
pass = user.password
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif user.protocol == "http" then
|
||||
settings = {
|
||||
allowTransparent = false,
|
||||
accounts = {
|
||||
accounts = (user.auth and user.auth == "1") and {
|
||||
{
|
||||
user = (user.username == nil) and "" or user.username,
|
||||
pass = (user.password == nil) and "" or user.password
|
||||
user = user.username,
|
||||
pass = user.password
|
||||
}
|
||||
}
|
||||
}
|
||||
user.transport = "tcp"
|
||||
user.tcp_guise = "none"
|
||||
elseif user.protocol == "shadowsocks" then
|
||||
settings = {
|
||||
method = user.method,
|
||||
@ -106,8 +108,8 @@ function gen_config(user)
|
||||
settings = settings,
|
||||
streamSettings = {
|
||||
network = user.transport,
|
||||
security = user.stream_security,
|
||||
xtlsSettings = (user.stream_security == 'xtls') and {
|
||||
security = "none",
|
||||
xtlsSettings = (user.tls and user.tls == "1" and user.xtls and user.xtls == "1") and {
|
||||
--alpn = {"http/1.1"},
|
||||
disableSystemRoot = false,
|
||||
certificates = {
|
||||
@ -117,7 +119,7 @@ function gen_config(user)
|
||||
}
|
||||
}
|
||||
} or nil,
|
||||
tlsSettings = (user.stream_security == 'tls') and {
|
||||
tlsSettings = (user.tls and user.tls == "1") and {
|
||||
disableSystemRoot = false,
|
||||
certificates = {
|
||||
{
|
||||
@ -172,6 +174,14 @@ function gen_config(user)
|
||||
routing = routing
|
||||
}
|
||||
|
||||
if user.tls and user.tls == "1" then
|
||||
config.inbounds[1].streamSettings.security = "tls"
|
||||
if user.xtls and user.xtls == "1" then
|
||||
config.inbounds[1].streamSettings.security = "xtls"
|
||||
config.inbounds[1].streamSettings.tlsSettings = nil
|
||||
end
|
||||
end
|
||||
|
||||
if user.transport == "mkcp" or user.transport == "quic" then
|
||||
config.inbounds[1].streamSettings.security = "none"
|
||||
config.inbounds[1].streamSettings.tlsSettings = nil
|
||||
|
||||
@ -125,37 +125,30 @@ port = s:option(Value, "port", translate("Port"))
|
||||
port.datatype = "port"
|
||||
port.rmempty = false
|
||||
|
||||
username = s:option(Value, "username", translate("Username"))
|
||||
username.validate = function(self, value, t)
|
||||
if value then
|
||||
if not password:formvalue(t) or password:formvalue(t) == "" then
|
||||
auth = s:option(Flag, "auth", translate("Auth"))
|
||||
auth.validate = function(self, value, t)
|
||||
if value and value == "1" then
|
||||
local user_v = username:formvalue(t) or ""
|
||||
local pass_v = password:formvalue(t) or ""
|
||||
if user_v == "" or pass_v == "" then
|
||||
return nil, translate("Username and Password must be used together!")
|
||||
end
|
||||
end
|
||||
return value
|
||||
end
|
||||
username:depends("type", "Socks")
|
||||
username:depends({ type = "V2ray", protocol = "http" })
|
||||
username:depends({ type = "V2ray", protocol = "socks" })
|
||||
auth:depends("type", "Socks")
|
||||
auth:depends({ type = "V2ray", protocol = "socks" })
|
||||
auth:depends({ type = "V2ray", protocol = "http" })
|
||||
|
||||
username = s:option(Value, "username", translate("Username"))
|
||||
username:depends("auth", "1")
|
||||
|
||||
password = s:option(Value, "password", translate("Password"))
|
||||
password.password = true
|
||||
password.validate = function(self, value, t)
|
||||
if value then
|
||||
if (protocol:formvalue(t) == "http" or protocol:formvalue(t) == "socks" or type:formvalue(t) == "Socks") and (not username:formvalue(t) or username:formvalue(t) == "") then
|
||||
return nil, translate("Username and Password must be used together!")
|
||||
end
|
||||
end
|
||||
return value
|
||||
end
|
||||
password:depends("type", "Socks")
|
||||
password:depends("auth", "1")
|
||||
password:depends("type", "SS")
|
||||
password:depends("type", "SSR")
|
||||
password:depends("type", "Brook")
|
||||
password:depends("type", "Trojan")
|
||||
password:depends("type", "Trojan-Plus")
|
||||
password:depends({ type = "V2ray", protocol = "http" })
|
||||
password:depends({ type = "V2ray", protocol = "socks" })
|
||||
password:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
|
||||
mtproto_password = s:option(Value, "mtproto_password", translate("Password"), translate("The MTProto protocol must be 32 characters and can only contain characters from 0 to 9 and a to f."))
|
||||
@ -235,15 +228,6 @@ timeout.default = 300
|
||||
timeout:depends("type", "SS")
|
||||
timeout:depends("type", "SSR")
|
||||
|
||||
tcp_fast_open = s:option(ListValue, "tcp_fast_open", translate("TCP Fast Open"), translate("Need node support required"))
|
||||
tcp_fast_open:value("false")
|
||||
tcp_fast_open:value("true")
|
||||
tcp_fast_open:depends("type", "SS")
|
||||
tcp_fast_open:depends("type", "SSR")
|
||||
tcp_fast_open:depends("type", "Trojan")
|
||||
tcp_fast_open:depends("type", "Trojan-Plus")
|
||||
tcp_fast_open:depends("type", "Trojan-Go")
|
||||
|
||||
udp_forward = s:option(Flag, "udp_forward", translate("UDP Forward"))
|
||||
udp_forward.default = "1"
|
||||
udp_forward.rmempty = false
|
||||
@ -256,7 +240,9 @@ end
|
||||
uuid:depends({ type = "V2ray", protocol = "vmess" })
|
||||
uuid:depends({ type = "V2ray", protocol = "vless" })
|
||||
uuid:depends({ type = "V2ray", protocol = "trojan" })
|
||||
uuid:depends("type", "Trojan")
|
||||
uuid:depends("type", "Trojan-Go")
|
||||
uuid:depends("type", "Trojan-Plus")
|
||||
|
||||
alter_id = s:option(Value, "alter_id", translate("Alter ID"))
|
||||
alter_id.default = 16
|
||||
@ -270,56 +256,84 @@ level:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
level:depends({ type = "V2ray", protocol = "trojan" })
|
||||
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, "none" for unencrypted, "tls" for using TLS, "xtls" for using XTLS.'))
|
||||
stream_security:value("none", "none")
|
||||
stream_security:value("tls", "tls")
|
||||
stream_security:value("xtls", "xtls")
|
||||
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 = "V2ray", protocol = "trojan" })
|
||||
stream_security:depends("type", "Trojan")
|
||||
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, please choose 'tls'.")
|
||||
tls = s:option(Flag, "tls", translate("TLS"))
|
||||
tls.default = 0
|
||||
tls.validate = function(self, value, t)
|
||||
if value then
|
||||
local type = type:formvalue(t) or ""
|
||||
if value == "0" and (type == "Trojan" or type == "Trojan-Plus") then
|
||||
return nil, translate("Original Trojan only supported 'tls', please choose 'tls'.")
|
||||
end
|
||||
if value == "1" then
|
||||
local ca = tls_certificateFile:formvalue(t) or ""
|
||||
local key = tls_keyFile:formvalue(t) or ""
|
||||
if ca == "" or key == "" then
|
||||
return nil, translate("Public key and Private key path can not be empty!")
|
||||
end
|
||||
end
|
||||
return value
|
||||
end
|
||||
return value
|
||||
end
|
||||
tls:depends({ type = "V2ray", protocol = "vmess" })
|
||||
tls:depends({ type = "V2ray", protocol = "vless" })
|
||||
tls:depends({ type = "V2ray", protocol = "socks" })
|
||||
tls:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
tls:depends("type", "Trojan")
|
||||
tls:depends("type", "Trojan-Plus")
|
||||
tls:depends("type", "Trojan-Go")
|
||||
|
||||
xtls = s:option(Flag, "xtls", translate("XTLS"))
|
||||
xtls.default = 0
|
||||
xtls:depends({ type = "V2ray", protocol = "vless", tls = "1" })
|
||||
|
||||
flow = s:option(Value, "flow", translate("flow"))
|
||||
flow.default = "xtls-rprx-origin"
|
||||
flow:value("xtls-rprx-origin")
|
||||
flow:value("xtls-rprx-origin-udp443")
|
||||
flow:depends("stream_security", "xtls")
|
||||
flow:depends("xtls", "1")
|
||||
|
||||
-- [[ TLS部分 ]] --
|
||||
|
||||
tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket"))
|
||||
tls_sessionTicket.default = "0"
|
||||
tls_sessionTicket:depends({ type = "Trojan", stream_security = "tls" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Plus", stream_security = "tls" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Go", stream_security = "tls" })
|
||||
|
||||
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
|
||||
tls_serverName:depends("stream_security", "tls")
|
||||
tls_serverName:depends("stream_security", "xtls")
|
||||
|
||||
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")
|
||||
tls_allowInsecure:depends("stream_security", "xtls")
|
||||
tls_allowInsecure:depends({ type = "Trojan", tls = "1" })
|
||||
tls_allowInsecure:depends({ type = "Trojan-Plus", tls = "1" })
|
||||
tls_allowInsecure:depends({ type = "Trojan-Go", tls = "1" })
|
||||
|
||||
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
|
||||
tls_serverName:depends("tls", "1")
|
||||
|
||||
tls_certificateFile = s:option(Value, "tls_certificateFile", translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem")
|
||||
tls_certificateFile:depends("stream_security", "tls")
|
||||
tls_certificateFile:depends("stream_security", "xtls")
|
||||
tls_certificateFile.validate = function(self, value, t)
|
||||
if value and value ~= "" then
|
||||
if not nixio.fs.access(value) then
|
||||
return nil, translate("Can't find this file!")
|
||||
else
|
||||
return value
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
tls_certificateFile:depends("tls", "1")
|
||||
|
||||
tls_keyFile = s:option(Value, "tls_keyFile", translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key")
|
||||
tls_keyFile:depends("stream_security", "tls")
|
||||
tls_keyFile:depends("stream_security", "xtls")
|
||||
tls_keyFile.validate = function(self, value, t)
|
||||
if value and value ~= "" then
|
||||
if not nixio.fs.access(value) then
|
||||
return nil, translate("Can't find this file!")
|
||||
else
|
||||
return value
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
tls_keyFile:depends("tls", "1")
|
||||
|
||||
tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket"))
|
||||
tls_sessionTicket.default = "0"
|
||||
tls_sessionTicket:depends({ type = "Trojan", tls = "1" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Plus", tls = "1" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Go", tls = "1" })
|
||||
|
||||
transport = s:option(ListValue, "transport", translate("Transport"))
|
||||
transport:value("tcp", "TCP")
|
||||
@ -347,7 +361,7 @@ trojan_plugin:value("plaintext", "Plain Text")
|
||||
trojan_plugin:value("shadowsocks", "ShadowSocks")
|
||||
trojan_plugin:value("other", "Other")
|
||||
trojan_plugin.default = "plaintext"
|
||||
trojan_plugin:depends({ stream_security = "none", trojan_transport = "original" })
|
||||
trojan_plugin:depends({ tls = "0", trojan_transport = "original" })
|
||||
|
||||
trojan_plugin_cmd = s:option(Value, "plugin_cmd", translate("Plugin Binary"))
|
||||
trojan_plugin_cmd.placeholder = "eg: /usr/bin/v2ray-plugin"
|
||||
@ -364,6 +378,34 @@ trojan_plugin_arg.placeholder = "eg: [\"-config\", \"test.json\"]"
|
||||
trojan_plugin_arg:depends({ plugin_type = "shadowsocks" })
|
||||
trojan_plugin_arg:depends({ plugin_type = "other" })
|
||||
|
||||
-- [[ WebSocket部分 ]]--
|
||||
|
||||
ws_host = s:option(Value, "ws_host", translate("WebSocket Host"))
|
||||
ws_host:depends("transport", "ws")
|
||||
ws_host:depends("ss_transport", "ws")
|
||||
ws_host:depends("trojan_transport", "h2+ws")
|
||||
ws_host:depends("trojan_transport", "ws")
|
||||
|
||||
ws_path = s:option(Value, "ws_path", translate("WebSocket Path"))
|
||||
ws_path:depends("transport", "ws")
|
||||
ws_path:depends("ss_transport", "ws")
|
||||
ws_path:depends("trojan_transport", "h2+ws")
|
||||
ws_path:depends("trojan_transport", "ws")
|
||||
|
||||
-- [[ HTTP/2部分 ]]--
|
||||
|
||||
h2_host = s:option(Value, "h2_host", translate("HTTP/2 Host"))
|
||||
h2_host:depends("transport", "h2")
|
||||
h2_host:depends("ss_transport", "h2")
|
||||
h2_host:depends("trojan_transport", "h2+ws")
|
||||
h2_host:depends("trojan_transport", "h2")
|
||||
|
||||
h2_path = s:option(Value, "h2_path", translate("HTTP/2 Path"))
|
||||
h2_path:depends("transport", "h2")
|
||||
h2_path:depends("ss_transport", "h2")
|
||||
h2_path:depends("trojan_transport", "h2+ws")
|
||||
h2_path:depends("trojan_transport", "h2")
|
||||
|
||||
-- [[ TCP部分 ]]--
|
||||
|
||||
-- TCP伪装
|
||||
@ -416,34 +458,6 @@ mkcp_writeBufferSize:depends("transport", "mkcp")
|
||||
mkcp_seed = s:option(Value, "mkcp_seed", translate("KCP Seed"))
|
||||
mkcp_seed:depends("transport", "mkcp")
|
||||
|
||||
-- [[ WebSocket部分 ]]--
|
||||
|
||||
ws_host = s:option(Value, "ws_host", translate("WebSocket Host"))
|
||||
ws_host:depends("transport", "ws")
|
||||
ws_host:depends("ss_transport", "ws")
|
||||
ws_host:depends("trojan_transport", "h2+ws")
|
||||
ws_host:depends("trojan_transport", "ws")
|
||||
|
||||
ws_path = s:option(Value, "ws_path", translate("WebSocket Path"))
|
||||
ws_path:depends("transport", "ws")
|
||||
ws_path:depends("ss_transport", "ws")
|
||||
ws_path:depends("trojan_transport", "h2+ws")
|
||||
ws_path:depends("trojan_transport", "ws")
|
||||
|
||||
-- [[ HTTP/2部分 ]]--
|
||||
|
||||
h2_host = s:option(Value, "h2_host", translate("HTTP/2 Host"))
|
||||
h2_host:depends("transport", "h2")
|
||||
h2_host:depends("ss_transport", "h2")
|
||||
h2_host:depends("trojan_transport", "h2+ws")
|
||||
h2_host:depends("trojan_transport", "h2")
|
||||
|
||||
h2_path = s:option(Value, "h2_path", translate("HTTP/2 Path"))
|
||||
h2_path:depends("transport", "h2")
|
||||
h2_path:depends("ss_transport", "h2")
|
||||
h2_path:depends("trojan_transport", "h2+ws")
|
||||
h2_path:depends("trojan_transport", "h2")
|
||||
|
||||
-- [[ DomainSocket部分 ]]--
|
||||
|
||||
ds_path = s:option(Value, "ds_path", "Path", translate("A legal file path. This file must not exist before running V2Ray."))
|
||||
@ -466,7 +480,7 @@ 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:depends({ type = "V2ray", protocol = "vless", transport = "tcp", tls = "1" })
|
||||
|
||||
fallback_alpn = s:option(Value, "fallback_alpn", "Fallback alpn")
|
||||
fallback_alpn:depends("fallback", "1")
|
||||
@ -482,6 +496,27 @@ fallback_xver.default = 0
|
||||
fallback_xver:depends("fallback", "1")
|
||||
]]--
|
||||
|
||||
ss_aead = s:option(Flag, "ss_aead", translate("Shadowsocks2"))
|
||||
ss_aead:depends("type", "Trojan-Go")
|
||||
ss_aead.default = "0"
|
||||
|
||||
ss_aead_method = s:option(ListValue, "ss_aead_method", translate("Encrypt Method"))
|
||||
for _, v in ipairs(encrypt_methods_ss_aead) do ss_aead_method:value(v, v) end
|
||||
ss_aead_method.default = "aead_aes_128_gcm"
|
||||
ss_aead_method:depends("ss_aead", "1")
|
||||
|
||||
ss_aead_pwd = s:option(Value, "ss_aead_pwd", translate("Password"))
|
||||
ss_aead_pwd.password = true
|
||||
ss_aead_pwd:depends("ss_aead", "1")
|
||||
|
||||
tcp_fast_open = s:option(Flag, "tcp_fast_open", translate("TCP Fast Open"))
|
||||
tcp_fast_open.default = "0"
|
||||
tcp_fast_open:depends("type", "SS")
|
||||
tcp_fast_open:depends("type", "SSR")
|
||||
tcp_fast_open:depends("type", "Trojan")
|
||||
tcp_fast_open:depends("type", "Trojan-Plus")
|
||||
tcp_fast_open:depends("type", "Trojan-Go")
|
||||
|
||||
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
|
||||
@ -498,20 +533,14 @@ remote_port.datatype = "port"
|
||||
remote_port.default = "80"
|
||||
remote_port:depends("remote_enable", 1)
|
||||
|
||||
ss_aead = s:option(Flag, "ss_aead", translate("Shadowsocks2"))
|
||||
ss_aead:depends("type", "Trojan-Go")
|
||||
ss_aead.default = "0"
|
||||
bind_local = s:option(Flag, "bind_local", translate("Bind Local"), translate("When selected, it can only be accessed locally,It is recommended to turn on when using reverse proxies."))
|
||||
bind_local.default = "0"
|
||||
bind_local:depends("type", "V2ray")
|
||||
|
||||
ss_aead_method = s:option(ListValue, "ss_aead_method", translate("Encrypt Method"))
|
||||
for _, v in ipairs(encrypt_methods_ss_aead) do ss_aead_method:value(v, v) end
|
||||
ss_aead_method.default = "aead_aes_128_gcm"
|
||||
ss_aead_method.rmempty = false
|
||||
ss_aead_method:depends("ss_aead", "1")
|
||||
|
||||
ss_aead_pwd = s:option(Value, "ss_aead_pwd", translate("Password"))
|
||||
ss_aead_pwd.password = true
|
||||
ss_aead_pwd.rmempty = false
|
||||
ss_aead_pwd:depends("ss_aead", "1")
|
||||
accept_lan = s:option(Flag, "accept_lan", translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!"))
|
||||
accept_lan.default = "0"
|
||||
accept_lan.rmempty = false
|
||||
accept_lan:depends("type", "V2ray")
|
||||
|
||||
local nodes_table = {}
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
@ -529,13 +558,4 @@ for k, v in pairs(nodes_table) do transit_node:value(v.id, v.remarks) end
|
||||
transit_node.default = "nil"
|
||||
transit_node:depends("type", "V2ray")
|
||||
|
||||
bind_local = s:option(Flag, "bind_local", translate("Bind Local"), translate("When selected, it can only be accessed locally,It is recommended to turn on when using reverse proxies."))
|
||||
bind_local.default = "0"
|
||||
bind_local:depends("type", "V2ray")
|
||||
|
||||
accept_lan = s:option(Flag, "accept_lan", translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!"))
|
||||
accept_lan.default = "0"
|
||||
accept_lan.rmempty = false
|
||||
accept_lan:depends("type", "V2ray")
|
||||
|
||||
return m
|
||||
|
||||
@ -8,9 +8,24 @@
|
||||
id: id
|
||||
},
|
||||
function(x, result) {
|
||||
_status[result.index].setAttribute("style","font-weight:bold;");
|
||||
_status[result.index].setAttribute("color",result.status ? "green":"red");
|
||||
_status[result.index].innerHTML = (result.status ? '✓' : 'X');
|
||||
var index = result.index;
|
||||
var div = '';
|
||||
var div1 = '<font style="font-weight:bold;" color="green">✓</font> ';
|
||||
var div2 = '<font style="font-weight:bold;" color="red">X</font> ';
|
||||
|
||||
if (result.socks_status) {
|
||||
div += div1;
|
||||
} else {
|
||||
div += div2;
|
||||
}
|
||||
if (result.use_http) {
|
||||
if (result.http_status) {
|
||||
div += div1;
|
||||
} else {
|
||||
div += div2;
|
||||
}
|
||||
}
|
||||
_status[index].innerHTML = div;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -118,6 +118,12 @@ msgstr "Socks配置"
|
||||
msgid "Socks Node"
|
||||
msgstr "Socks节点"
|
||||
|
||||
msgid "Listen Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "0 is not use"
|
||||
msgstr "0为不使用"
|
||||
|
||||
msgid "Same as the tcp node"
|
||||
msgstr "与TCP节点相同"
|
||||
|
||||
@ -934,8 +940,8 @@ msgstr "传输层加密"
|
||||
msgid "Whether or not transport layer encryption is enabled, \"none\" for unencrypted, \"tls\" for using TLS, \"xtls\" for using XTLS."
|
||||
msgstr "是否启入传输层加密,支持的选项有 \"none\" 表示不加密,\"tls\" 表示使用 TLS,\"xtls\" 表示使用 XTLS。"
|
||||
|
||||
msgid "'none' not supported for original Trojan, please choose 'tls'."
|
||||
msgstr "原版Trojan不支持'none',请选择TLS。"
|
||||
msgid "Original Trojan only supported 'tls', please choose 'tls'."
|
||||
msgstr "原版Trojan只支持'tls',请选择'tls'。"
|
||||
|
||||
msgid "Domain"
|
||||
msgstr "域名"
|
||||
@ -961,6 +967,9 @@ msgstr "使用此TCP节点时,是否同时打开socks代理"
|
||||
msgid "Do not conflict with other ports"
|
||||
msgstr "端口不能冲突"
|
||||
|
||||
msgid "Auth"
|
||||
msgstr "身份认证"
|
||||
|
||||
msgid "Socks for authentication"
|
||||
msgstr "Socks认证方式"
|
||||
|
||||
@ -1039,6 +1048,12 @@ msgstr "公钥文件绝对路径"
|
||||
msgid "Private key absolute path"
|
||||
msgstr "私钥文件绝对路径"
|
||||
|
||||
msgid "Can't find this file!"
|
||||
msgstr "找不到这个文件!"
|
||||
|
||||
msgid "Public key and Private key path can not be empty!"
|
||||
msgstr "公钥和私钥文件路径不能为空!"
|
||||
|
||||
msgid "Server-Side"
|
||||
msgstr "服务器端"
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ use_udp_node_resolve_dns=0
|
||||
LUA_API_PATH=/usr/lib/lua/luci/model/cbi/$CONFIG/api
|
||||
API_GEN_SS=$LUA_API_PATH/gen_shadowsocks.lua
|
||||
API_GEN_V2RAY=$LUA_API_PATH/gen_v2ray.lua
|
||||
API_GEN_V2RAY_PROTO=$LUA_API_PATH/gen_v2ray_proto.lua
|
||||
API_GEN_TROJAN=$LUA_API_PATH/gen_trojan.lua
|
||||
API_GEN_NAIVE=$LUA_API_PATH/gen_naiveproxy.lua
|
||||
echolog() {
|
||||
@ -308,9 +309,12 @@ load_config() {
|
||||
run_socks() {
|
||||
local node=$1
|
||||
local bind=$2
|
||||
local local_port=$3
|
||||
local socks_port=$3
|
||||
local config_file=$4
|
||||
local relay_port=$6
|
||||
local http_port=$5
|
||||
local http_config_file=$6
|
||||
local id=$7
|
||||
local relay_port=$8
|
||||
local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
local remarks=$(config_n_get $node remarks)
|
||||
local server_host=$(config_n_get $node address)
|
||||
@ -334,33 +338,32 @@ run_socks() {
|
||||
fi
|
||||
|
||||
[ -n "${msg}" ] && {
|
||||
[ "$bind" != "127.0.0.1" ] && echolog " - 启动中止 ${bind}:${local_port} ${msg}"
|
||||
[ "$bind" != "127.0.0.1" ] && echolog " - 启动中止 ${bind}:${socks_port} ${msg}"
|
||||
return 1
|
||||
}
|
||||
[ "$bind" != "127.0.0.1" ] && echolog " - 启动 ${bind}:${local_port} - 节点:$remarks${tmp}"
|
||||
[ "$bind" != "127.0.0.1" ] && echolog " - 启动 ${bind}:${socks_port} - 节点:$remarks${tmp}"
|
||||
|
||||
case "$type" in
|
||||
socks)
|
||||
local _username=$(config_n_get $node username)
|
||||
local _password=$(config_n_get $node password)
|
||||
_username=$(config_n_get $node username)
|
||||
_password=$(config_n_get $node password)
|
||||
[ -n "$_username" ] && [ -n "$_password" ] && local _auth="--uname $_username --passwd $_password"
|
||||
ln_start_bin "$(first_type ssocks)" ssocks_SOCKS_$5 --listen $local_port --socks $server_host:$port $_auth
|
||||
unset _username _password _auth
|
||||
ln_start_bin "$(first_type ssocks)" ssocks_SOCKS_$id --listen $socks_port --socks $server_host:$port $_auth
|
||||
;;
|
||||
v2ray)
|
||||
lua $API_GEN_V2RAY $node nil nil $local_port > $config_file
|
||||
lua $API_GEN_V2RAY $node nil nil $socks_port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray -config="$config_file"
|
||||
;;
|
||||
trojan-go)
|
||||
lua $API_GEN_TROJAN $node client $bind $local_port $server_host $port > $config_file
|
||||
lua $API_GEN_TROJAN $node client $bind $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
lua $API_GEN_TROJAN $node client $bind $local_port $server_host $port > $config_file
|
||||
lua $API_GEN_TROJAN $node client $bind $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type ${type})" "${type}" -c "$config_file"
|
||||
;;
|
||||
naiveproxy)
|
||||
lua $API_GEN_NAIVE $node socks $bind $local_port $server_host $port > $config_file
|
||||
lua $API_GEN_NAIVE $node socks $bind $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type naive)" naive "$config_file"
|
||||
;;
|
||||
brook)
|
||||
@ -369,13 +372,20 @@ run_socks() {
|
||||
[ "$protocol" == "wsclient" ] && {
|
||||
[ "$brook_tls" == "1" ] && server_host="wss://${server_host}" || server_host="ws://${server_host}"
|
||||
}
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_SOCKS_$5" "$protocol" --socks5 "$bind:$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_SOCKS_$id" "$protocol" --socks5 "$bind:$socks_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
|
||||
;;
|
||||
ss|ssr)
|
||||
lua $API_GEN_SS $node "0.0.0.0" $local_port $server_host $port > $config_file
|
||||
lua $API_GEN_SS $node "0.0.0.0" $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type ${type}-local)" "${type}-local" -c "$config_file" -b "$bind" -u
|
||||
;;
|
||||
esac
|
||||
|
||||
# socks to http
|
||||
[ "$http_port" != "0" ] && [ "$http_config_file" != "nil" ] && {
|
||||
lua $API_GEN_V2RAY_PROTO http "0.0.0.0" $http_port socks "127.0.0.1" $socks_port $_username $_password > $http_config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray -config="$http_config_file"
|
||||
}
|
||||
unset _username _password _auth
|
||||
}
|
||||
|
||||
run_redir() {
|
||||
@ -583,9 +593,11 @@ start_socks() {
|
||||
eval node=\$TCP_NODE$num
|
||||
fi
|
||||
[ "$node" == "nil" ] && continue
|
||||
local config_file=$TMP_PATH/SOCKS_${id}.json
|
||||
local port=$(config_n_get $id port)
|
||||
run_socks $node "0.0.0.0" $port $config_file $id
|
||||
local config_file=$TMP_PATH/SOCKS_${id}.json
|
||||
local http_port=$(config_n_get $id http_port 0)
|
||||
local http_config_file=$TMP_PATH/SOCKS2HTTP_${id}.json
|
||||
run_socks $node "0.0.0.0" $port $config_file $http_port $http_config_file $id
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ test_auto_switch() {
|
||||
|
||||
status=$(test_proxy)
|
||||
if [ "$status" == 0 ]; then
|
||||
echolog "自动切换检测:${type}_${index}节点正常。"
|
||||
#echolog "自动切换检测:${type}_${index}节点正常。"
|
||||
return 0
|
||||
elif [ "$status" == 2 ]; then
|
||||
echolog "自动切换检测:无法连接到网络,请检查网络是否正常!"
|
||||
|
||||
@ -60,7 +60,8 @@ endef
|
||||
|
||||
ifeq ($(CONFIG_TROJAN_GO_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.cn
|
||||
export GOPROXY=https://goproxy.io
|
||||
#export GOPROXY=https://mirrors.aliyun.com/goproxy/
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
|
||||
Loading…
Reference in New Issue
Block a user