Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 1
fetch-depth: 0 # required to get all tags

- name: Set up JDK 17
uses: actions/setup-java@v5
Expand Down
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Proxy Socket Java (UDP + TCP, Java 17)
# Proxy Socket Java (UDP, Java 17)

## Overview

Library providing HAProxy Proxy Protocol v2 support for UDP and TCP. Multi-module layout:

- proxy-socket-core: zero dependencies, parser, models, interfaces
- proxy-socket-udp: DatagramSocket wrapper
- proxy-socket-tcp: ServerSocket/Socket wrappers
- proxy-socket-guava: optional Guava-based cache
- proxy-socket-examples: runnable samples

Reference: [HAProxy Proxy Protocol Specifications](https://www.haproxy.org/download/3.3/doc/proxy-protocol.txt)

Expand All @@ -27,21 +25,9 @@ socket.receive(packet); // header stripped, source set to real client
socket.send(packet); // destination rewritten to LB if cached
```

## Quick start (TCP)

```java
try (var server = new net.airvantage.proxysocket.tcp.ProxyServerSocket(9998)) {
for (;;) {
var s = (net.airvantage.proxysocket.tcp.ProxySocket) server.accept();
var header = s.getHeader();
// header.getSourceAddress() is the real client address
}
}
```

## License

MIT License © 2025 Semtech. See `LICENSE`.
BSD-3-Clause License © 2025 Semtech. See [LICENSE.BSD-3-Clause](./LICENSE.BSD-3-Clause).

## Metrics hook

Expand Down
42 changes: 41 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<modelVersion>4.0.0</modelVersion>

<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-java</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
Expand Down Expand Up @@ -93,6 +93,46 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.7.3</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>ossrh</flattenMode>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>${project.artifactId}-${project.version}.pom</flattenedPomFilename>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Skip deployment of parent POM -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
<configuration>
<skip>true</skip>
</configuration>
<inherited>false</inherited>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion proxy-socket-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-java</artifactId>
<version>${revision}</version>
</parent>
Expand Down
4 changes: 2 additions & 2 deletions proxy-socket-guava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-java</artifactId>
<version>${revision}</version>
</parent>
Expand All @@ -14,7 +14,7 @@

<dependencies>
<dependency>
<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-core</artifactId>
<version>${project.version}</version>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions proxy-socket-udp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-java</artifactId>
<version>${revision}</version>
</parent>
Expand All @@ -14,12 +14,12 @@

<dependencies>
<dependency>
<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.airvantage</groupId>
<groupId>net.airvantage.proxysocket</groupId>
<artifactId>proxy-socket-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
Expand Down
Loading