Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xomadev/ksocks5
Standard Socks5 server implementation in pure Java
https://github.com/xomadev/ksocks5
pure-java socks5 socks5-server
Last synced: about 1 month ago
JSON representation
Standard Socks5 server implementation in pure Java
- Host: GitHub
- URL: https://github.com/xomadev/ksocks5
- Owner: XomaDev
- License: apache-2.0
- Created: 2024-05-08T14:01:02.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-05T15:11:34.000Z (7 months ago)
- Last Synced: 2024-06-05T17:11:38.657Z (7 months ago)
- Topics: pure-java, socks5, socks5-server
- Language: Java
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
KSocks5
Standard Socks5 Server implementation in Java
## Features
- TCP Streaming, Bind
- Username/Password Authentication
- Intercept/Monitor incoming clients and connections
- Reverse ProxyWritten in pure Java, no additional libraries, requires Java >= 8
## Setup
```xml
space.themelon
KSocks5
1.1```
```kotlin
implementation("space.themelon:KSocks5:1.1")
```## Usage
- Spawn a simple open proxy server
```java
ProxyServer server = new ProxyServer.Builder(port).build();
...
server.close();
```- Create a proxy server with Username / Password Authentication
```java
AuthMode userPassAuth = new AuthMode((username, password) ->
username.equals("secureusername") && password.equals("securepassword"));ProxyServer proxy = new ProxyServer.Builder(port)
.auth(userPassAuth)
.build();
```- Monitor incoming client connections (`clientMonitor`)
```java
ClientCallback monitor = address -> {
System.out.println("New client " + address);
return true; // approve client
};
ProxyServer server = new ProxyServer.Builder(port)
.clientMonitor(monitor)
.build();
```- Monitor outgoing connection requests (`connectionMonitor`)
```java
ConnectionCallback monitor = (client, destination, port) -> {
if (isBlacklisted(destination)) {
System.out.println("Blocking connection to " + destination);
return false;
}
return true;
};ProxyServer server = new ProxyServer.Builder(port)
.connectionMonitor(monitor)
.build();
```- Create a reverse proxy to outside, rather than awaiting connection
```java
ProxyServer server = new ProxyServer.Builder(remoteHost, remotePort)
.reverseProxy()
.build();
```