{"id":21392052,"url":"https://github.com/montag451/ltun","last_synced_at":"2025-10-07T11:30:58.083Z","repository":{"id":13976896,"uuid":"16677646","full_name":"montag451/ltun","owner":"montag451","description":"Linux TUN/TAP module for Lua","archived":false,"fork":false,"pushed_at":"2023-05-07T19:44:48.000Z","size":148,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-16T16:32:10.993Z","etag":null,"topics":["c","lua","luajit","networking","tunnel","tuntap"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/montag451.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-09T22:36:54.000Z","updated_at":"2023-04-16T17:55:47.000Z","dependencies_parsed_at":"2024-11-22T13:39:07.884Z","dependency_job_id":null,"html_url":"https://github.com/montag451/ltun","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montag451%2Fltun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montag451%2Fltun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montag451%2Fltun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montag451%2Fltun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/montag451","download_url":"https://codeload.github.com/montag451/ltun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235621547,"owners_count":19019520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","lua","luajit","networking","tunnel","tuntap"],"created_at":"2024-11-22T13:38:59.629Z","updated_at":"2025-10-07T11:30:57.674Z","avatar_url":"https://github.com/montag451.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Linux TUN/TAP module for Lua\n============================\n\n``ltun`` is a Lua module which let you create TUN/TAP device very easily.\n\nLicense: MIT (see LICENSE)\n\nDependencies\n------------\n\nLua \u003e= 5.1\n\nCompilation\n-----------\n\nTo compile, just type the following command in the terminal::\n\n    make\n\nIf you are on a debian-like system and you have installed all the required\ndependencies, it should work as-is. If you are out of luck, you can tweak the\ncompilation process using the following variables:\n\n- LUA_VERSION\n- LUA_CFLAGS\n\nFor example, say that you want to compile ``ltun`` for Lua 5.1 (by default\n``ltun`` is compiled for Lua 5.2) you can try::\n\n    make LUA_VERSION=5.1\n\nOr for LuaJIT::\n\n    make LUA_VERSION=jit\n\nIf the Lua development headers are not in a common location, you can try::\n\n    make LUA_CFLAGS=\"-I/path/to/lua/headers\"\n\nDocumentation\n-------------\n\nNOTE: On most distributions you will need to be root to create TUN/TAP devices.\n\nTo create a TUN device::\n\n    local ltun = require('ltun')\n\n    local tun = ltun.create()\n\nTo create a TAP device::\n\n    local ltun = require('ltun')\n\n    local tap = ltun.create(ltun.IFF_TAP)\n\nTo create a TUN/TAP device with a custom name::\n\n    local tun = ltun.create('mytun')\n\nTo specify additional flags::\n\n    local tun = ltun.create('mytun', ltun.IFF_TUN, ltun.IFF_NO_PI)\n\nOr just::\n\n    local tun = ltun.create(ltun.IFF_TUN, ltun.IFF_NO_PI)\n\nYou can get/set some parameters of the device directly::\n\n    print(tun.name)\n    tun.addr = '10.8.0.1'\n    tun.dstaddr = '10.8.0.2'\n    tun.netmask = '255.255.255.0'\n    tun.mtu = 1500\n\nIf the device is a TAP you can also get/set its MAC address::\n\n    tap.hwaddr = '\\x00\\x11\\x22\\x33\\x44\\x55'\n    print(tap.hwaddr)\n\nTo make the device persistent::\n\n    tun:persist(true)\n\nTo bring up the device::\n\n    tun:up()\n\nTo bring down the device::\n\n    tun:down()\n\nTo read/write to the device, use the methods ``read(size)`` and\n``write(buf)``::\n\n    buf = tun:read(tun.mtu)\n    tun:write(buf)\n\nTo close the device::\n\n    tun:close()\n\nYou can also get the file descriptor associated with a TUN/TAP device::\n\n    tun:fileno()\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontag451%2Fltun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmontag451%2Fltun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontag451%2Fltun/lists"}