cloudSky's 小站

[Go] 实时监控日志文件的包tail

在linux中有一个tail命令,tail -f 可以实时的监控文件新增加的内容,如果用代码实现这个逻辑,可以使用这个包 go get github.com/hpcloud/tail 示例代码 package main import ( "fmt" "github.com/hpcloud/tail"

[Go] Gin异步协程

golang的高并发一大利器就是协程。gin里可以借助协程实现异步任务。 package main import ( "log" "time" "github.com/gin-gonic/gin" ) func main(){ router := gin.Default() router.GET("/sync", func(c *gin.Context) { time.Sleep(5 * time.Second) log.Println("Done! in path" + c.Request.URL.Path) }) router.GET("/async", func(c *gin.Context) { // 因为涉

lua-resty-openssl module not found

环境 OS: CentOS 8.4 OpenResty: 1.19.9.1(手动编译) OpenResty prefix: /app/nginx lua_package_path "$prefix/lualib/?.lua;;"; 报错如下 2021/12/07 18:56:11 [error] 2383822#0: *1 lua entry thread aborted: runtime error: /app/nginx//lualib/resty/openssl/pkey.lua:13: module 'resty.openssl.include.x509' not found: no field package.preload['resty.openssl.include.x509'] no file '/app/nginx//lualib/resty/openssl/include/x509.lua' no file './resty/openssl/include/x509.lua' no file '/app/nginx/luajit/share/luajit-2.1.0-beta3/resty/openssl/include/x509.lua' no file '/usr/local/share/lua/5.1/resty/openssl/include/x509.lua' no file '/usr/local/share/lua/5.1/resty/openssl/include/x509/init.lua' no file '/app/nginx/luajit/share/lua/5.1/resty/openssl/include/x509.lua' no file '/app/nginx/luajit/share/lua/5.1/resty/openssl/include/x509/init.lua' 其

使用OpenResty mTLS认证

环境 CentOS 7 OpenResty 1.19.9.1 cosocket-mtls patch ngx_lua-0.10.20_01-cosocket-mtls.patch lua-resty-core-0.1.22_01-cosocket-mtls.patch lua-resty-http 为了支持mTLS功能,折腾的够呛,OpenResty官方又没支持,基于OpenResty的APISIX和Kong都有补