Top Description Inners Fields Constructors Methods
io.undertow.server.protocol.proxy

pack-priv Class ProxyProtocolReadListener

extends Object
implements ChannelListener<StreamSourceChannel>
Class Inheritance
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener
Imports
io.undertow.UndertowLogger, .UndertowMessages, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, io.undertow.protocols.ssl.UndertowXnioSsl, io.undertow.server.DelegateOpenListener, .OpenListener, io.undertow.util.NetworkUtils, .PooledAdaptor, org.xnio.ChannelListener, .IoUtils, .OptionMap, .StreamConnection, org.xnio.channels.StreamSourceChannel, org.xnio.conduits.PushBackStreamSourceConduit, org.xnio.ssl.SslConnection, java.io.IOException, java.net.InetAddress, .InetSocketAddress, .SocketAddress, java.nio.charset.StandardCharsets, java.util.concurrent.atomic.AtomicBoolean

Implementation of version 1 and 2 of the proxy protocol (https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)

Even though it is not required by the spec this implementation provides a stateful parser, that can handle fragmentation of

Authors
Stuart Douglas, Ulrich Herberg

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ByteBufferPool
private int
private boolean
private InetAddress
private int
private static final int
private static final byte[]
private final OpenListener
private boolean
private String
private static final byte[]
private InetAddress
private int
private final UndertowXnioSsl
private final OptionMap
private final StreamConnection
private StringBuilder
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv
ProxyProtocolReadListener(StreamConnection streamConnection, OpenListener openListener, UndertowXnioSsl ssl, ByteBufferPool bufferPool, OptionMap sslOptionMap)

Method Summary

Modifier and TypeMethod and Description
private void
callOpenListener(StreamConnection streamConnection, final PooledByteBuffer buffer)

public void
handleEvent(StreamSourceChannel
the channel event
streamSourceChannel
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

pack-priv static InetAddress
parseAddress(String addressString, String protocol)

private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferPoolback to summary
private final ByteBufferPool bufferPool
byteCountback to summary
private int byteCount
carriageReturnSeenback to summary
private boolean carriageReturnSeen
destAddressback to summary
private InetAddress destAddress
destPortback to summary
private int destPort
MAX_HEADER_LENGTHback to summary
private static final int MAX_HEADER_LENGTH
NAMEback to summary
private static final byte[] NAME
openListenerback to summary
private final OpenListener openListener
parsingUnknownback to summary
private boolean parsingUnknown
protocolback to summary
private String protocol
SIGback to summary
private static final byte[] SIG
sourceAddressback to summary
private InetAddress sourceAddress
sourcePortback to summary
private int sourcePort
sslback to summary
private final UndertowXnioSsl ssl
sslOptionMapback to summary
private final OptionMap sslOptionMap
streamConnectionback to summary
private final StreamConnection streamConnection
stringBuilderback to summary
private StringBuilder stringBuilder
TCP4back to summary
private static final String TCP4
TCP6back to summary
private static final String TCP6
UNKNOWNback to summary
private static final String UNKNOWN

Constructor Detail

ProxyProtocolReadListenerback to summary
pack-priv ProxyProtocolReadListener(StreamConnection streamConnection, OpenListener openListener, UndertowXnioSsl ssl, ByteBufferPool bufferPool, OptionMap sslOptionMap)

Method Detail

callOpenListenerback to summary
private void callOpenListener(StreamConnection streamConnection, final PooledByteBuffer buffer)
handleEventback to summary
public void handleEvent(StreamSourceChannel streamSourceChannel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
streamSourceChannel:StreamSourceChannel

the channel event

Annotations
@Override
parseAddressback to summary
pack-priv static InetAddress parseAddress(String addressString, String protocol) throws IOException
parseProxyProtocolV1back to summary
private void parseProxyProtocolV1(PooledByteBuffer buffer, AtomicBoolean freeBuffer) throws IOException
parseProxyProtocolV2back to summary
private void parseProxyProtocolV2(PooledByteBuffer buffer, AtomicBoolean freeBuffer) throws IOException
proxyAcceptback to summary
private void proxyAccept(SocketAddress source, SocketAddress dest, PooledByteBuffer additionalData)
io.undertow.server.protocol.proxy back to summary

private final Class ProxyProtocolReadListener.AddressWrappedConnection

extends StreamConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final StreamConnection
private final SocketAddress
private final SocketAddress

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public SocketAddress
getLocalAddress()

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address that this channel is bound to.

public SocketAddress
getPeerAddress()

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Get the peer address of this channel.

protected void
notifyReadClosed()

Overrides org.xnio.StreamConnection.notifyReadClosed.

Indicate to conduit handlers that reads have been closed.

protected void
notifyWriteClosed()

Overrides org.xnio.StreamConnection.notifyWriteClosed.

Indicate to conduit handlers that writes have been closed.

Inherited from org.xnio.StreamConnection:
getCloseListenergetCloseSettergetSinkChannelgetSourceChannelsetCloseListenersetSinkConduitsetSourceConduit

Field Detail

delegateback to summary
private final StreamConnection delegate
destback to summary
private final SocketAddress dest
sourceback to summary
private final SocketAddress source

Constructor Detail

AddressWrappedConnectionback to summary
pack-priv AddressWrappedConnection(StreamConnection delegate, SocketAddress source, SocketAddress dest)

Method Detail

getLocalAddressback to summary
public SocketAddress getLocalAddress()

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Doc from org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address that this channel is bound to.

Returns:SocketAddress

the local address

Annotations
@Override
getPeerAddressback to summary
public SocketAddress getPeerAddress()

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Doc from org.xnio.channels.ConnectedChannel.getPeerAddress.

Get the peer address of this channel.

Returns:SocketAddress

the peer address

Annotations
@Override
notifyReadClosedback to summary
protected void notifyReadClosed()

Overrides org.xnio.StreamConnection.notifyReadClosed.

Doc from org.xnio.Connection.notifyReadClosed.

Indicate to conduit handlers that reads have been closed.

Annotations
@Override
notifyWriteClosedback to summary
protected void notifyWriteClosed()

Overrides org.xnio.StreamConnection.notifyWriteClosed.

Doc from org.xnio.Connection.notifyWriteClosed.

Indicate to conduit handlers that writes have been closed.

Annotations
@Override