Groups
Groups
Sign in
Groups
Groups
openresty
Conversations
Labels
About
Send feedback
Help
使用 stream-lua-nginx-module 模块如何获取对方的ip地址?
221 views
cosocket
lua
openresty
Skip to first unread message
luke
unread,
Jan 5, 2018, 1:48:20 AM
1/5/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
Hi~
如题,如果在 content_by_lua_block 的lua代码中,如何获取 ngx.req.socket(true) 对应客户端的 tcp的 ip 地址和连接端口呢?
直接用 lua 的 socket 库通过 cosocket获取的原生套接字获取麽?
tokers
unread,
Jan 5, 2018, 2:04:53 AM
1/5/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
Hi!
strem-lua-nginx-module 不是很了解,但是要拿客户端的 ip 和 port,
应该是 ngx.var.remote_addr 和 ngx.var.remote_port 就可以了,我看 stream 子系统里有这两个变量的。
luke
unread,
Jan 5, 2018, 2:17:58 AM
1/5/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
的确如此,感谢!
在 2018年1月5日星期五 UTC+8下午3:04:53,tokers写道:
Reply all
Reply to author
Forward
0 new messages