switched to https and added main.md

This commit is contained in:
2024-05-20 20:40:11 -07:00
parent e2d2a3f1b7
commit a57fd25990
3 changed files with 25 additions and 5 deletions

View File

@ -1,16 +1,29 @@
(local socket (require :socket))
(local ssl (require :ssl))
(local handle-client (. (require :client-handler) :handle-client))
(local port 8080)
(local port 50625)
(local server (socket.tcp))
(server:bind "*" port)
(server:listen)
(local params {:mode "server"
:protocol "tlsv1_2"
:key "../privkey.pem"
:certificate "../fullchain.pem"
:cafile "../chain.pem"
:verify "none"
:options "all"})
(while true
(local client (server:accept))
(var client (server:accept))
(local co (coroutine.create (fn [] (handle-client client))))
(set (_G.client-address _G.client-port) (client:getpeername))
(coroutine.resume co))
(set client (ssl.wrap client params))
(client:dohandshake)
(let [co (coroutine.create (fn [] (handle-client client)))]
(coroutine.resume co)))