简体   繁体   English

是否可以通过 Apache Mina SSHD ServerSession 获取 SSH/SFTP 客户端的 IP 地址?

[英]Is it possible to get IP address of SSH/SFTP client via Apache Mina SSHD ServerSession?

I create SFTP server using Apache Mina SSHD.我使用 Apache Mina SSHD 创建 SFTP 服务器。 I want to find out the client IP when they connect to my server (via FileZilla, WinSCP).我想在他们连接到我的服务器时找出客户端 IP(通过 FileZilla、WinSCP)。 However, while I tried to found it in ServerSession , I could not.然而,虽然我试图在ServerSession找到它,但我不能。

Where can I find this information?我在哪里可以找到这些信息?

Thank you.谢谢你。

Use ServerSession.getIoSession to retrieve an IoSession instance.使用ServerSession.getIoSession来检索IoSession实例。 And on that, call IoSession.getRemoteAddress()然后调用IoSession.getRemoteAddress()

serverSession.getIoSession().getRemoteAddress()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM