Skip to content

sbernard31/luadtls

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
tinydtls @ 1fba423
 
 
 
 
 
 
 
 
 
 
 
 

luadtls

luadtls is a lua binding for tinydtls library .

luadtls contains 2 modules :

A dtls/luasocket sample :

local dtls = require 'dtls'
local socket = require 'socket'

-- create UDP socket
local udp = socket.udp();
udp:setsockname('*', 5683)

-- change UDP socket in DTLS socket
dtls.wrap(udp, {security = "PSK", identity = "Client_identity", key = "secretPSK"})

-- DTLS handshake in automaticaly do at first sendto
udp:sendto("my clear data","127.0.0.1", 5684)
repeat
  local data, host, port, msg = udp:receivefrom()
  -- receive clear data
  print ("receive clear data",data, host, port)
until false

More samples available in sample folder.

Compile & Test

Get the code : (--recursive is need because of use of git submodule.)

git clone --recursive git@github.com:sbernard31/luadtls.git luadtls

Compile it : (You need lua header files from package liblua5.1-0-dev and the tools cmake and autoconf -_-! ...)

mkdir [builddir]
cd [builddir]
cmake [luadtls source directory]
make

Test it : (Lua 5.1 and luasocket is needed, you can use californium.sandium server implementation to test.)

lua -e "package.path = './?/init.lua;' .. package.path" sample.lua

Limitation

luadtls binding is still in development. For now, it is only compatible with Lua 5.1 and linux.

About

Binding Lua for tinydtls library (http://tinydtls.sourceforge.net), a tiny implementation of DTLS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published