All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.littleshoot.proxy.extras.ProxyProtocolMessage Maven / Gradle / Ivy

Go to download

LittleProxy is a high performance HTTP proxy written in Java and using the Netty networking framework.

There is a newer version: 2.3.2
Show newest version
package org.littleshoot.proxy.extras;

import io.netty.handler.codec.haproxy.HAProxyCommand;
import io.netty.handler.codec.haproxy.HAProxyMessage;
import io.netty.handler.codec.haproxy.HAProxyProtocolVersion;
import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol;

public class ProxyProtocolMessage {

    private final HAProxyProtocolVersion protocolVersion;
    private final HAProxyCommand command;
    private final HAProxyProxiedProtocol proxiedProtocol;
    private final String sourceAddress;
    private final String destinationAddress;
    private final int sourcePort;
    private final int destinationPort;

    public ProxyProtocolMessage(HAProxyProtocolVersion protocolVersion, HAProxyCommand command, HAProxyProxiedProtocol proxiedProtocol, String sourceAddress, String destinationAddress
        , int sourcePort, int destinationPort) {
        this.protocolVersion = protocolVersion;
        this.command = command;
        this.proxiedProtocol = proxiedProtocol;
        this.sourceAddress = sourceAddress;
        this.destinationAddress = destinationAddress;
        this.sourcePort = sourcePort;
        this.destinationPort = destinationPort;
    }

    public ProxyProtocolMessage(HAProxyMessage haProxyMessage) {
        protocolVersion = haProxyMessage.protocolVersion();
        command = haProxyMessage.command();
        proxiedProtocol = haProxyMessage.proxiedProtocol();
        sourceAddress = haProxyMessage.sourceAddress();
        destinationAddress = haProxyMessage.destinationAddress();
        sourcePort = haProxyMessage.sourcePort();
        destinationPort = haProxyMessage.destinationPort();
    }

    public HAProxyProtocolVersion getProtocolVersion() {
        return protocolVersion;
    }

    public HAProxyCommand getCommand() {
        return command;
    }

    public HAProxyProxiedProtocol getProxiedProtocol() {
        return proxiedProtocol;
    }

    public String getSourceAddress() {
        return sourceAddress;
    }

    public String getDestinationAddress() {
        return destinationAddress;
    }

    public int getSourcePort() {
        return sourcePort;
    }

    public int getDestinationPort() {
        return destinationPort;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy