forked from coolsnowwolf/lede
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luci-app-ssr-plus: add Trojan support
- Loading branch information
1 parent
db5d264
commit ece2c7c
Showing
6 changed files
with
100 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gentrojanconfig.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
local ucursor = require "luci.model.uci".cursor() | ||
local json = require "luci.jsonc" | ||
local server_section = arg[1] | ||
local proto = arg[2] | ||
local usr_dns = arg[3] | ||
local usr_port = arg[4] | ||
local local_port = arg[5] | ||
|
||
local server = ucursor:get_all("shadowsocksr", server_section) | ||
|
||
local trojan = { | ||
-- error = "/var/ssrplus.log", | ||
log_level = 3, | ||
run_type = proto, | ||
local_addr = "0.0.0.0", | ||
local_port = tonumber(local_port), | ||
remote_addr = server.server, | ||
remote_port = tonumber(server.server_port), | ||
target_addr = usr_dns, | ||
target_port = tonumber(usr_port), | ||
udp_timeout = 60, | ||
-- 传入连接 | ||
password = {server.password}, | ||
-- 传出连接 | ||
ssl = (server.tls) and { | ||
verify = (server.insecure == "1") and false or true, | ||
verify_hostname = (server.insecure == "1") and false or true, | ||
cert = "", | ||
ciper = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RSA-AES128-GCM-SHA256:RSA-AES256-GCM-SHA384:RSA-AES128-SHA:RSA-AES256-SHA:RSA-3DES-EDE-SHA", | ||
sni = server.tls_host, | ||
alpn = {"h2", "http/1.1"}, | ||
curve = "", | ||
reuse_session = true, | ||
session_ticket = false, | ||
}, | ||
tcp = { | ||
no_delay = true, | ||
keep_alive = true, | ||
fast_open = (server.fast_open == "1") and true or false, | ||
fast_open_qlen = 20 | ||
} | ||
} | ||
print(json.stringify(trojan, 1)) |