Refactor and restructure core components

- Removed obsolete files: `hanle_multi.go`, `logger.go`, `handle_com.go`, `handle_list.go`, `server.go`, and `utils.go` from the `general_server` and `sv1` packages.
- Introduced new implementations for the `GeneralServer` and `HandlerV1` in the `core` package, enhancing the overall architecture.
- Updated the `go.mod` and `go.sum` files to include new dependencies.
- Added a new configuration structure in `config.yaml` and `config.go` for better management of application settings.
- Implemented a Lua command handling mechanism in `handle_com.go` and `handle_list.go` for improved command execution.
- Enhanced logging capabilities with a new logger setup in `logger.go`.
- Added a new Lua script `http.lua` for handling HTTP requests.
This commit is contained in:
alex
2025-06-26 16:50:35 +03:00
parent 9f7f046a07
commit 96fb13e3c7
15 changed files with 214 additions and 145 deletions

View File

@@ -1,4 +1,5 @@
package.path = "./com/?.lua;" .. package.path
package.path = package.path .. ";/usr/lib64/lua/5.1/?.lua;/usr/local/share/lua/5.1/?.lua" .. ";./com/?.lua;"
package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so"
print = function() end
io.write = function(...) end

15
com/http.lua Normal file
View File

@@ -0,0 +1,15 @@
package.path = package.path .. ";/usr/lib64/lua/5.1/?.lua;/usr/local/share/lua/5.1/?.lua;" .. ";./com/?.lua;"
package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;"
local https = require("ssl.https")
local ltn12 = require("ltn12")
local response = {}
local res, code, headers = https.request{
url = "https://localhost:8080/api/v1/echo?msg=sigma",
sink = ltn12.sink.table(response)
}
Result.msg = table.concat(response)
Result.status = "ok"