You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/08/17 07:30:38 UTC

[GitHub] [james-project] ouvtam commented on a diff in pull request #1132: JAMES-3788 Implement SMTP proxy support for incoming connections usin…

ouvtam commented on code in PR #1132:
URL: https://github.com/apache/james-project/pull/1132#discussion_r947547367


##########
protocols/netty/pom.xml:
##########
@@ -50,6 +50,11 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-codec-haproxy</artifactId>
+            <version>4.1.72.Final</version>

Review Comment:
   I will fix it.



##########
protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java:
##########
@@ -158,6 +163,21 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
         try (Closeable closeable = mdc(ctx).build()) {
             ProtocolSession pSession = (ProtocolSession) ctx.channel().attr(SESSION_ATTRIBUTE_KEY).get();
 
+            if (msg instanceof HAProxyMessage) {
+                HAProxyMessage haproxyMsg = (HAProxyMessage) msg;
+
+                if (haproxyMsg.proxiedProtocol().equals(HAProxyProxiedProtocol.TCP4) || haproxyMsg.proxiedProtocol().equals(HAProxyProxiedProtocol.TCP6)) {
+                    pSession.setProxyDestinationAddress(new InetSocketAddress(haproxyMsg.destinationAddress(), haproxyMsg.destinationPort()));
+                    pSession.setProxySourceAddress(new InetSocketAddress(haproxyMsg.sourceAddress(), haproxyMsg.sourcePort()));
+                } else {
+                    // TODO how to handle?

Review Comment:
   Will do so.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org