diff --git a/src/main/java/io/vertx/ext/stomp/StompServerConnection.java b/src/main/java/io/vertx/ext/stomp/StompServerConnection.java index db25eef..bcfc335 100644 --- a/src/main/java/io/vertx/ext/stomp/StompServerConnection.java +++ b/src/main/java/io/vertx/ext/stomp/StompServerConnection.java @@ -18,11 +18,13 @@ import javax.net.ssl.SSLSession; +import io.vertx.codegen.annotations.CacheReturn; import io.vertx.codegen.annotations.Fluent; import io.vertx.codegen.annotations.GenIgnore; import io.vertx.codegen.annotations.VertxGen; import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; +import io.vertx.core.net.SocketAddress; /** * Class representing a connection between a STOMP client a the server. It keeps a references on the client socket, @@ -97,4 +99,28 @@ public interface StompServerConnection { */ void configureHeartbeat(long ping, long pong, Handler pingHandler); + /** + * @return the remote address for this connection, possibly {@code null} (e.g a server bound on a domain socket). + * If {@code useProxyProtocol} is set to {@code true}, the address returned will be of the actual connecting client. + */ + @CacheReturn + SocketAddress remoteAddress(); + + /** + * Like {@link #remoteAddress()} but returns the proxy remote address when {@code real} is {@code true} + */ + SocketAddress remoteAddress(boolean real); + + /** + * @return the local address for this connection, possibly {@code null} (e.g a server bound on a domain socket) + * If {@code useProxyProtocol} is set to {@code true}, the address returned will be of the proxy. + */ + @CacheReturn + SocketAddress localAddress(); + + /** + * Like {@link #localAddress()} ()} but returns the server local address when {@code real} is {@code true} + */ + SocketAddress localAddress(boolean real); + } diff --git a/src/main/java/io/vertx/ext/stomp/impl/StompServerTCPConnectionImpl.java b/src/main/java/io/vertx/ext/stomp/impl/StompServerTCPConnectionImpl.java index 6d90a66..1061d76 100644 --- a/src/main/java/io/vertx/ext/stomp/impl/StompServerTCPConnectionImpl.java +++ b/src/main/java/io/vertx/ext/stomp/impl/StompServerTCPConnectionImpl.java @@ -23,6 +23,7 @@ import io.vertx.core.impl.logging.Logger; import io.vertx.core.impl.logging.LoggerFactory; import io.vertx.core.net.NetSocket; +import io.vertx.core.net.SocketAddress; import io.vertx.ext.stomp.*; import java.util.Objects; @@ -150,4 +151,24 @@ public synchronized void configureHeartbeat(long ping, long pong, Handler