gentrojanconfig.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. local ucursor = require "luci.model.uci".cursor()
  2. local json = require "luci.jsonc"
  3. local server_section = arg[1]
  4. local proto = arg[2]
  5. local local_port = arg[3]
  6. local server = ucursor:get_all("shadowsocksr", server_section)
  7. local trojan = {
  8. log_level = 3,
  9. run_type = proto,
  10. local_addr = "0.0.0.0",
  11. local_port = tonumber(local_port),
  12. remote_addr = server.server,
  13. remote_port = tonumber(server.server_port),
  14. udp_timeout = 60,
  15. -- 传入连接
  16. password = {server.password},
  17. -- 传出连接
  18. ssl = {
  19. verify = (server.insecure == "0") and true or false,
  20. verify_hostname = (server.tls == "1") and true or false,
  21. cert = "",
  22. cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA",
  23. cipher_tls13 = "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
  24. sni = server.tls_host,
  25. alpn = {"h2", "http/1.1"},
  26. curve = "",
  27. reuse_session = true,
  28. session_ticket = false,
  29. },
  30. tcp = {
  31. no_delay = true,
  32. keep_alive = true,
  33. reuse_port = true,
  34. fast_open = (server.fast_open == "1") and true or false,
  35. fast_open_qlen = 20
  36. }
  37. }
  38. print(json.stringify(trojan, 1))