1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-31 23:53:01 +00:00

secure telnet

This commit is contained in:
kepler155c@gmail.com
2019-06-29 23:43:21 -04:00
parent 1c29197983
commit 67779ab814
6 changed files with 51 additions and 41 deletions

View File

@@ -5,7 +5,8 @@
* background read buffering
]]--
local Event = require('opus.event')
local Crypto = require('opus.crypto.chacha20')
local Event = require('opus.event')
local network = _G.network
local os = _G.os
@@ -32,7 +33,10 @@ end
function transport.read(socket)
local data = table.remove(socket.messages, 1)
if data then
return unpack(data)
if socket.options.ENCRYPT then
return table.unpack(Crypto.decrypt(data[1], socket.enckey)), data[2]
end
return table.unpack(data)
end
end