gen_config.lua 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. #!/usr/bin/lua
  2. local ucursor = require "luci.model.uci".cursor()
  3. local json = require "luci.jsonc"
  4. local server_section = arg[1]
  5. local proto = arg[2]
  6. local local_port = arg[3] or "0"
  7. local socks_port = arg[4] or "0"
  8. local chain = arg[5] or "0"
  9. local chain_local_port = string.split(chain, "/")[2] or "0"
  10. local server = ucursor:get_all("shadowsocksr", server_section)
  11. local outbound_settings = nil
  12. function vmess_vless()
  13. outbound_settings = {
  14. vnext = {
  15. {
  16. address = server.server,
  17. port = tonumber(server.server_port),
  18. users = {
  19. {
  20. id = server.vmess_id,
  21. alterId = (server.v2ray_protocol == "vmess" or not server.v2ray_protocol) and tonumber(server.alter_id) or nil,
  22. security = (server.v2ray_protocol == "vmess" or not server.v2ray_protocol) and server.security or nil,
  23. encryption = (server.v2ray_protocol == "vless") and server.vless_encryption or nil,
  24. flow = ((server.xtls == '1') or (server.tls == '1') or (server.reality == '1')) and server.tls_flow or nil
  25. }
  26. }
  27. }
  28. }
  29. }
  30. end
  31. function trojan_shadowsocks()
  32. outbound_settings = {
  33. servers = {
  34. {
  35. address = server.server,
  36. port = tonumber(server.server_port),
  37. password = server.password,
  38. method = ((server.v2ray_protocol == "shadowsocks") and server.encrypt_method_ss) or nil,
  39. uot = (server.v2ray_protocol == "shadowsocks") and (server.uot == '1') or nil,
  40. ivCheck = (server.v2ray_protocol == "shadowsocks") and (server.ivCheck == '1') or nil,
  41. }
  42. }
  43. }
  44. end
  45. function socks_http()
  46. outbound_settings = {
  47. version = server.socks_ver or nil,
  48. servers = {
  49. {
  50. address = server.server,
  51. port = tonumber(server.server_port),
  52. users = (server.auth_enable == "1") and {
  53. {
  54. user = server.username,
  55. pass = server.password
  56. }
  57. } or nil
  58. }
  59. }
  60. }
  61. end
  62. function wireguard()
  63. outbound_settings = {
  64. secretKey = server.private_key,
  65. address = server.local_addresses,
  66. peers = {
  67. {
  68. publicKey = server.peer_pubkey,
  69. preSharedKey = server.preshared_key,
  70. endpoint = server.server .. ":" .. server.server_port,
  71. keepAlive = tonumber(server.keepaliveperiod),
  72. allowedIPs = (server.allowedips) or nil,
  73. }
  74. },
  75. noKernelTun = (server.kernelmode == "1") and true or false,
  76. reserved = {server.reserved} or nil,
  77. mtu = tonumber(server.mtu)
  78. }
  79. end
  80. local outbound = {}
  81. function outbound:new(o)
  82. o = o or {}
  83. setmetatable(o, self)
  84. self.__index = self
  85. return o
  86. end
  87. function outbound:handleIndex(index)
  88. local switch = {
  89. vmess = function()
  90. vmess_vless()
  91. end,
  92. vless = function()
  93. vmess_vless()
  94. end,
  95. trojan = function()
  96. trojan_shadowsocks()
  97. end,
  98. shadowsocks = function()
  99. trojan_shadowsocks()
  100. end,
  101. socks = function()
  102. socks_http()
  103. end,
  104. http = function()
  105. socks_http()
  106. end,
  107. wireguard = function()
  108. wireguard()
  109. end
  110. }
  111. if switch[index] then
  112. switch[index]()
  113. end
  114. end
  115. local settings = outbound:new()
  116. settings:handleIndex(server.v2ray_protocol)
  117. local Xray = {
  118. log = {
  119. -- error = "/var/ssrplus.log",
  120. loglevel = "warning"
  121. },
  122. -- 初始化 inbounds 表
  123. inbounds = {},
  124. }
  125. -- 传入连接
  126. -- 添加 dokodemo-door 配置,如果 local_port 不为 0
  127. if local_port ~= "0" then
  128. table.insert(Xray.inbounds, {
  129. -- listening
  130. port = tonumber(local_port),
  131. protocol = "dokodemo-door",
  132. settings = {network = proto, followRedirect = true},
  133. sniffing = {
  134. enabled = true,
  135. destOverride = {"http", "tls", "quic"},
  136. metadataOnly = false,
  137. domainsExcluded = {
  138. "courier.push.apple.com",
  139. "rbsxbxp-mim.vivox.com",
  140. "rbsxbxp.www.vivox.com",
  141. "rbsxbxp-ws.vivox.com",
  142. "rbspsxp.www.vivox.com",
  143. "rbspsxp-mim.vivox.com",
  144. "rbspsxp-ws.vivox.com",
  145. "rbswxp.www.vivox.com",
  146. "rbswxp-mim.vivox.com",
  147. "disp-rbspsp-5-1.vivox.com",
  148. "disp-rbsxbp-5-1.vivox.com",
  149. "proxy.rbsxbp.vivox.com",
  150. "proxy.rbspsp.vivox.com",
  151. "proxy.rbswp.vivox.com",
  152. "rbswp.vivox.com",
  153. "rbsxbp.vivox.com",
  154. "rbspsp.vivox.com",
  155. "rbspsp.www.vivox.com",
  156. "rbswp.www.vivox.com",
  157. "rbsxbp.www.vivox.com",
  158. "rbsxbxp.vivox.com",
  159. "rbspsxp.vivox.com",
  160. "rbswxp.vivox.com",
  161. "Mijia Cloud",
  162. "dlg.io.mi.com"
  163. }
  164. }
  165. })
  166. end
  167. -- 开启 socks 代理
  168. -- 检查是否启用 socks 代理
  169. if proto:find("tcp") and socks_port ~= "0" then
  170. table.insert(Xray.inbounds, {
  171. -- socks
  172. protocol = "socks",
  173. port = tonumber(socks_port),
  174. settings = {auth = "noauth", udp = true}
  175. })
  176. end
  177. -- 传出连接
  178. Xray.outbounds = {
  179. {
  180. protocol = server.v2ray_protocol,
  181. settings = outbound_settings,
  182. -- 底层传输配置
  183. streamSettings = (server.v2ray_protocol ~= "wireguard") and {
  184. network = server.transport or "tcp",
  185. security = (server.xtls == '1') and "xtls" or (server.tls == '1') and "tls" or (server.reality == '1') and "reality" or nil,
  186. tlsSettings = (server.tls == '1') and {
  187. -- tls
  188. alpn = server.tls_alpn,
  189. fingerprint = server.fingerprint,
  190. allowInsecure = (server.insecure == "1"),
  191. serverName = server.tls_host,
  192. certificates = server.certificate and {
  193. usage = "verify",
  194. certificateFile = server.certpath
  195. } or nil,
  196. } or nil,
  197. xtlsSettings = (server.xtls == '1') and server.tls_host and {
  198. -- xtls
  199. allowInsecure = (server.insecure == "1") and true or nil,
  200. serverName = server.tls_host,
  201. minVersion = "1.3"
  202. } or nil,
  203. realitySettings = (server.reality == '1') and {
  204. publicKey = server.reality_publickey,
  205. shortId = server.reality_shortid,
  206. spiderX = server.reality_spiderx,
  207. fingerprint = server.fingerprint,
  208. serverName = server.tls_host
  209. } or nil,
  210. tcpSettings = (server.transport == "tcp" and server.tcp_guise == "http") and {
  211. -- tcp
  212. header = {
  213. type = server.tcp_guise,
  214. request = {
  215. -- request
  216. path = {server.http_path} or {"/"},
  217. headers = {Host = {server.http_host} or {}}
  218. }
  219. }
  220. } or nil,
  221. kcpSettings = (server.transport == "kcp") and {
  222. -- kcp
  223. mtu = tonumber(server.mtu),
  224. tti = tonumber(server.tti),
  225. uplinkCapacity = tonumber(server.uplink_capacity),
  226. downlinkCapacity = tonumber(server.downlink_capacity),
  227. congestion = (server.congestion == "1") and true or false,
  228. readBufferSize = tonumber(server.read_buffer_size),
  229. writeBufferSize = tonumber(server.write_buffer_size),
  230. header = {type = server.kcp_guise},
  231. seed = server.seed or nil
  232. } or nil,
  233. wsSettings = (server.transport == "ws") and (server.ws_path or server.ws_host or server.tls_host) and {
  234. -- ws
  235. headers = (server.ws_host or server.tls_host) and {
  236. -- headers
  237. Host = server.ws_host or server.tls_host
  238. } or nil,
  239. path = server.ws_path,
  240. maxEarlyData = tonumber(server.ws_ed) or nil,
  241. earlyDataHeaderName = server.ws_ed_header or nil
  242. } or nil,
  243. httpupgradeSettings = (server.transport == "httpupgrade") and {
  244. -- httpupgrade
  245. host = (server.httpupgrade_host or server.tls_host) or nil,
  246. path = server.httpupgrade_path or ""
  247. } or nil,
  248. splithttpSettings = (server.transport == "splithttp") and {
  249. -- splithttp
  250. host = (server.splithttp_host or server.tls_host) or nil,
  251. path = server.splithttp_path or "/"
  252. } or nil,
  253. httpSettings = (server.transport == "h2") and {
  254. -- h2
  255. path = server.h2_path or "",
  256. host = {server.h2_host} or nil,
  257. read_idle_timeout = tonumber(server.read_idle_timeout) or nil,
  258. health_check_timeout = tonumber(server.health_check_timeout) or nil
  259. } or nil,
  260. quicSettings = (server.transport == "quic") and {
  261. -- quic
  262. security = server.quic_security,
  263. key = server.quic_key,
  264. header = {type = server.quic_guise}
  265. } or nil,
  266. grpcSettings = (server.transport == "grpc") and {
  267. -- grpc
  268. serviceName = server.serviceName or "",
  269. multiMode = (server.grpc_mode == "multi") and true or false,
  270. idle_timeout = tonumber(server.idle_timeout) or nil,
  271. health_check_timeout = tonumber(server.health_check_timeout) or nil,
  272. permit_without_stream = (server.permit_without_stream == "1") and true or nil,
  273. initial_windows_size = tonumber(server.initial_windows_size) or nil
  274. } or nil,
  275. sockopt = {
  276. tcpMptcp = (server.mptcp == "1") and true or false, -- MPTCP
  277. tcpNoDelay = (server.mptcp == "1") and true or false, -- MPTCP
  278. tcpcongestion = server.custom_tcpcongestion -- 连接服务器节点的 TCP 拥塞控制算法
  279. }
  280. } or nil,
  281. mux = (server.v2ray_protocol ~= "wireguard") and {
  282. -- mux
  283. enabled = (server.mux == "1") and true or false, -- Mux
  284. concurrency = tonumber(server.concurrency), -- TCP 最大并发连接数
  285. xudpConcurrency = tonumber(server.xudpConcurrency), -- UDP 最大并发连接数
  286. xudpProxyUDP443 = server.xudpProxyUDP443 -- 对被代理的 UDP/443 流量处理方式
  287. } or nil
  288. }
  289. }
  290. local 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"
  291. local cipher13 = "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384"
  292. local trojan = {
  293. log_level = 3,
  294. run_type = (proto == "nat" or proto == "tcp") and "nat" or "client",
  295. local_addr = "0.0.0.0",
  296. local_port = tonumber(local_port),
  297. remote_addr = server.server,
  298. remote_port = tonumber(server.server_port),
  299. udp_timeout = 60,
  300. -- 传入连接
  301. password = {server.password},
  302. -- 传出连接
  303. ssl = {
  304. verify = (server.insecure == "0") and true or false,
  305. verify_hostname = (server.tls == "1") and true or false,
  306. cert = (server.certificate) and server.certpath or nil,
  307. cipher = cipher,
  308. cipher_tls13 = cipher13,
  309. sni = server.tls_host,
  310. alpn = server.tls_alpn or {"h2", "http/1.1"},
  311. curve = "",
  312. reuse_session = true,
  313. session_ticket = (server.tls_sessionTicket == "1") and true or false
  314. },
  315. udp_timeout = 60,
  316. tcp = {
  317. -- tcp
  318. no_delay = true,
  319. keep_alive = true,
  320. reuse_port = true,
  321. fast_open = (server.fast_open == "1") and true or false,
  322. fast_open_qlen = 20
  323. }
  324. }
  325. local naiveproxy = {
  326. proxy = (server.username and server.password and server.server and server.server_port) and "https://" .. server.username .. ":" .. server.password .. "@" .. server.server .. ":" .. server.server_port,
  327. listen = (proto == "redir") and "redir" .. "://0.0.0.0:" .. tonumber(local_port) or "socks" .. "://0.0.0.0:" .. tonumber(local_port),
  328. ["insecure-concurrency"] = tonumber(server.concurrency) or 1
  329. }
  330. local ss = {
  331. server = (server.kcp_enable == "1") and "127.0.0.1" or server.server,
  332. server_port = tonumber(server.server_port),
  333. local_address = "0.0.0.0",
  334. local_port = tonumber(local_port),
  335. mode = (proto == "tcp,udp") and "tcp_and_udp" or proto .. "_only",
  336. password = server.password,
  337. method = server.encrypt_method_ss,
  338. timeout = tonumber(server.timeout),
  339. fast_open = (server.fast_open == "1") and true or false,
  340. reuse_port = true
  341. }
  342. local hysteria = {
  343. server = (server.server_port and (server.port_range and (server.server .. ":" .. server.server_port .. "," .. server.port_range) or server.server .. ":" .. server.server_port) or (server.port_range and server.server .. ":" .. server.port_range or server.server .. ":443")),
  344. bandwidth = (server.uplink_capacity or server.downlink_capacity) and {
  345. up = tonumber(server.uplink_capacity) and tonumber(server.uplink_capacity) .. " mbps" or nil,
  346. down = tonumber(server.downlink_capacity) and tonumber(server.downlink_capacity) .. " mbps" or nil
  347. },
  348. socks5 = (proto:find("tcp") and tonumber(socks_port) and tonumber(socks_port) ~= 0) and {
  349. listen = "0.0.0.0:" .. tonumber(socks_port),
  350. disable_udp = false
  351. } or nil,
  352. transport = (server.transport_protocol) and {
  353. type = (server.transport_protocol) or udp,
  354. udp = (server.port_range and (server.hopinterval) and {
  355. hopInterval = (server.port_range and (tonumber(server.hopinterval) .. "s") or nil)
  356. } or nil)
  357. } or nil,
  358. --[[
  359. tcpTProxy = (proto:find("tcp") and local_port ~= "0") and {
  360. listen = "0.0.0.0:" .. tonumber(local_port)
  361. } or nil,
  362. ]]--
  363. tcpRedirect = (proto:find("tcp") and local_port ~= "0") and {
  364. listen = "0.0.0.0:" .. tonumber(local_port)
  365. } or nil,
  366. udpTProxy = (proto:find("udp") and local_port ~= "0") and {
  367. listen = "0.0.0.0:" .. tonumber(local_port)
  368. } or nil,
  369. obfs = (server.flag_obfs == "1") and {
  370. type = server.obfs_type,
  371. salamander = { password = server.salamander }
  372. } or nil,
  373. quic = (server.flag_quicparam == "1" ) and {
  374. initStreamReceiveWindow = (server.initstreamreceivewindow and server.initstreamreceivewindow or nil),
  375. maxStreamReceiveWindow = (server.maxstreamseceivewindow and server.maxstreamseceivewindow or nil),
  376. initConnReceiveWindow = (server.initconnreceivewindow and server.initconnreceivewindow or nil),
  377. maxConnReceiveWindow = (server.maxconnreceivewindow and server.maxconnreceivewindow or nil),
  378. maxIdleTimeout = (tonumber(server.maxidletimeout) and tonumber(server.maxidletimeout) .. "s" or nil),
  379. keepAlivePeriod = (tonumber(server.keepaliveperiod) and tonumber(server.keepaliveperiod) .. "s" or nil),
  380. disablePathMTUDiscovery = (server.disablepathmtudiscovery == "1") and true or false
  381. } or nil,
  382. auth = server.hy2_auth,
  383. tls = (server.tls_host) and {
  384. sni = server.tls_host,
  385. --alpn = server.tls_alpn or nil,
  386. insecure = (server.insecure == "1") and true or false,
  387. pinSHA256 = (server.insecure == "1") and server.pinsha256 or nil
  388. } or {
  389. sni = server.server,
  390. insecure = (server.insecure == "1") and true or false
  391. },
  392. fast_open = (server.fast_open == "1") and true or false,
  393. lazy = (server.lazy_mode == "1") and true or false
  394. }
  395. local shadowtls = {
  396. client = {
  397. server_addr = server.server_port and server.server .. ":" .. server.server_port or nil,
  398. listen = "127.0.0.1:" .. tonumber(local_port),
  399. tls_names = server.shadowtls_sni,
  400. password = server.password
  401. },
  402. v3 = (server.shadowtls_protocol == "v3") and true or false,
  403. disable_nodelay = (server.disable_nodelay == "1") and true or false,
  404. fastopen = (server.fastopen == "1") and true or false,
  405. strict = (server.strict == "1") and true or false
  406. }
  407. local chain_sslocal = {
  408. locals = local_port ~= "0" and {
  409. {
  410. local_address = "0.0.0.0",
  411. local_port = (chain_local_port == "0" and tonumber(server.local_port) or tonumber(chain_local_port)),
  412. mode = (proto:find("tcp,udp") and "tcp_and_udp") or proto .. "_only",
  413. protocol = "redir",
  414. tcp_redir = "redirect",
  415. --tcp_redir = "tproxy",
  416. udp_redir = "tproxy"
  417. },
  418. socks_port ~= "0" and {
  419. protocol = "socks",
  420. local_address = "0.0.0.0",
  421. local_port = tonumber(socks_port)
  422. } or nil
  423. } or {{
  424. protocol = "socks",
  425. local_address = "0.0.0.0",
  426. ocal_port = tonumber(socks_port)
  427. }},
  428. servers = {
  429. {
  430. server = "127.0.0.1",
  431. server_port = (tonumber(local_port) == 0 and tonumber(chain_local_port) or tonumber(local_port)),
  432. method = server.sslocal_method,
  433. password = server.sslocal_password
  434. }
  435. }
  436. }
  437. local chain_vmess = {
  438. inbounds = (local_port ~= "0") and {
  439. {
  440. port = (chain_local_port == "0" and tonumber(server.local_port) or tonumber(chain_local_port)),
  441. protocol = "dokodemo-door",
  442. settings = {
  443. network = proto,
  444. followRedirect = true
  445. },
  446. streamSettings = {
  447. sockopt = {tproxy = "redirect"}
  448. },
  449. sniffing = {
  450. enable = true,
  451. destOverride = {"http","tls"}
  452. }
  453. },
  454. (proto:find("tcp") and socks_port ~= "0") and {
  455. protocol = "socks",
  456. port = tonumber(socks_port)
  457. } or nil
  458. } or { protocol = "socks",port = tonumber(socks_port) },
  459. outbound = {
  460. protocol = "vmess",
  461. settings = {
  462. vnext = {{
  463. address = "127.0.0.1",
  464. port = (tonumber(local_port) == 0 and tonumber(chain_local_port) or tonumber(local_port)),
  465. users = {{
  466. id = (server.vmess_uuid),
  467. security = server.vmess_method,
  468. level = 0
  469. }}
  470. }}
  471. }
  472. }
  473. }
  474. local tuic = {
  475. relay = {
  476. server = server.server_port and server.server .. ":" .. server.server_port,
  477. ip = server.tuic_ip,
  478. uuid = server.tuic_uuid,
  479. password = server.tuic_passwd,
  480. certificates = server.certificate and { server.certpath } or nil,
  481. udp_relay_mode = server.udp_relay_mode,
  482. congestion_control = server.congestion_control,
  483. heartbeat = server.heartbeat and server.heartbeat .. "s" or nil,
  484. timeout = server.timeout and server.timeout .. "s" or nil,
  485. gc_interval = server.gc_interval and server.gc_interval .. "s" or nil,
  486. gc_lifetime = server.gc_lifetime and server.gc_lifetime .. "s" or nil,
  487. alpn = server.tls_alpn,
  488. disable_sni = (server.disable_sni == "1") and true or false,
  489. zero_rtt_handshake = (server.zero_rtt_handshake == "1") and true or false,
  490. send_window = tonumber(server.send_window),
  491. receive_window = tonumber(server.receive_window)
  492. },
  493. ["local"] = {
  494. server = tonumber(socks_port) and "[::]:" .. (socks_port == "0" and local_port or tonumber(socks_port)),
  495. dual_stack = (server.tuic_dual_stack == "1") and true or nil,
  496. max_packet_size = tonumber(server.tuic_max_package_size)
  497. }
  498. }
  499. local config = {}
  500. function config:new(o)
  501. o = o or {}
  502. setmetatable(o, self)
  503. self.__index = self
  504. return o
  505. end
  506. function config:handleIndex(index)
  507. local switch = {
  508. ss = function()
  509. ss.protocol = socks_port
  510. if server.plugin and server.plugin ~= "none" then
  511. ss.plugin = server.plugin
  512. ss.plugin_opts = server.plugin_opts or nil
  513. end
  514. print(json.stringify(ss, 1))
  515. end,
  516. ssr = function()
  517. ss.protocol = server.protocol
  518. ss.protocol_param = server.protocol_param
  519. ss.method = server.encrypt_method
  520. ss.obfs = server.obfs
  521. ss.obfs_param = server.obfs_param
  522. print(json.stringify(ss, 1))
  523. end,
  524. v2ray = function()
  525. print(json.stringify(Xray, 1))
  526. end,
  527. trojan = function()
  528. print(json.stringify(trojan, 1))
  529. end,
  530. naiveproxy = function()
  531. print(json.stringify(naiveproxy, 1))
  532. end,
  533. hysteria = function()
  534. print(json.stringify(hysteria, 1))
  535. end,
  536. shadowtls = function()
  537. local chain_switch = {
  538. sslocal = function()
  539. if (chain:find("chain")) then
  540. print(json.stringify(chain_sslocal, 1))
  541. else
  542. print(json.stringify(shadowtls, 1))
  543. end
  544. end,
  545. vmess = function()
  546. if (chain:find("chain")) then
  547. print(json.stringify(chain_vmess, 1))
  548. else
  549. print(json.stringify(shadowtls, 1))
  550. end
  551. end
  552. }
  553. local ChainType = server.chain_type
  554. if chain_switch[ChainType] then
  555. chain_switch[ChainType]()
  556. end
  557. end,
  558. tuic = function()
  559. print(json.stringify(tuic, 1))
  560. end
  561. }
  562. if switch[index] then
  563. switch[index]()
  564. end
  565. end
  566. local f = config:new()
  567. f:handleIndex(server.type)