mirror of
https://github.com/XeonSquared/OC-Copper.git
synced 2024-11-23 09:58:06 +11:00
Those changes lost in the midst of testing.
This commit is contained in:
parent
eeb01821c3
commit
bf3ec0ec26
@ -57,10 +57,10 @@ if outbound then
|
|||||||
return "<" .. from
|
return "<" .. from
|
||||||
end
|
end
|
||||||
processTo = function (nto)
|
processTo = function (nto)
|
||||||
if from:sub(1, netname:len()) ~= netname then
|
if nto:sub(1, netname:len()) ~= netname then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return from:sub(netname:len() + 1)
|
return nto:sub(netname:len() + 1)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
processFrom = function (from)
|
processFrom = function (from)
|
||||||
@ -70,14 +70,15 @@ else
|
|||||||
return netname .. from
|
return netname .. from
|
||||||
end
|
end
|
||||||
processTo = function (nto)
|
processTo = function (nto)
|
||||||
if from:sub(1, 1) ~= "<" then
|
if nto:sub(1, 1) ~= "<" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return from:sub(2)
|
return nto:sub(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkLen(s)
|
local function checkLen(s)
|
||||||
|
if not s then return end
|
||||||
if s:len() == 0 then return end
|
if s:len() == 0 then return end
|
||||||
if s:len() > 256 then return end
|
if s:len() > 256 then return end
|
||||||
return s
|
return s
|
||||||
@ -98,9 +99,10 @@ while true do
|
|||||||
elseif e[2] == modem.address then
|
elseif e[2] == modem.address then
|
||||||
-- Process it, then give to tunnel
|
-- Process it, then give to tunnel
|
||||||
if hops ~= 255 then
|
if hops ~= 255 then
|
||||||
local tfrom, tto = checkLen(processFrom(nfrom)), checkLen(processTo(nto))
|
local tfrom, tto = checkLen(processFrom(nfrom)), checkLen(processTo(nto))
|
||||||
if tfrom and tto then
|
if tfrom and tto then
|
||||||
tunnel.send("copper", cdlib.encode(hops + 1, tfrom, tto, data))
|
tunnel.send("copper", cdlib.encode(hops + 1, tfrom, tto, data))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user