openresty lua 文件处理的一些技巧

luajit 字节码加载

  • 功能
    代码j简单防护处理,以及一些优化,注意jit编译的字节码,明文很容易看到大致的处理,
  • 参考使用
 
./luajit -bg  /opt/lua/acc.lua /opt/lua/acc.ljbc // 可以按照实际添加g 参数,时候保留debug 信息

静态链接

对于的确需要隐藏处理的,可以在编译时带入
参考

 
./luajit -bg foo.lua foo.o

编译openresty 时

 ./configure --with-ld-opt="/path/to/foo.o" ...

使用

 local foo = require "foo"
 foo.go()

对于包含. 的处理,比如 resty.foo
文件需要命名为resty_foo.lua

说明

luajit 的字节码以及静态链接需要使用的luajit 版本与openresty 的一致,否则会有加载的问题

参考资料

https://github.com/openresty/lua-nginx-module#nginx-api-for-lua
https://luajit.org/running.html#opt_b

posted on   荣锋亮  阅读(76)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2021-05-01 cubestore 使用需要注意的一些问题
2021-05-01 cubestore 运行试用
2021-05-01 cube.js cubestore 生产可用了
2020-05-01 lightproxy 阿里巴巴开源的基于proxy 的web debug 工具
2020-05-01 chartjs-plugin-datasource-prometheus 展示prometheus 数据
2020-05-01 Autopilot Pattern Applications 开发模式
2020-05-01 containerpilot 容器应用的自动服务发现

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示