A kcp library built for a certain cute game
- 4.6+ protocol support
- Kcp version detection support
- Proxy Protocol v2 support - Extract original client IP addresses when running behind proxy servers like FRP
Add the AnimeGameServers maven repo to your build file:
repositories {
...
maven {
name = "ags-mvn-Releases"
url = uri("https://mvn.animegameservers.org/releases")
}
}Then add this to your dependencies in the gradle build file:
implementation "org.anime_game_servers:grasskcpper:0.1"This library now supports Proxy Protocol v2, enabling extraction of original client IP addresses when running behind proxy servers like FRP (Fast Reverse Proxy).
// Enable proxy protocol support
ChannelConfig config = new ChannelConfig();
config.setProxyProtocolV2Enabled(true);
// Your KCP listener will receive the original client IP
KcpListener listener = new KcpListener() {
@Override
public void onConnected(Ukcp ukcp) {
// ukcp.user().getRemoteAddress() now contains the ORIGINAL client IP
InetSocketAddress originalClient = ukcp.user().getRemoteAddress();
System.out.println("Client connected from: " + originalClient.getAddress().getHostAddress());
}
// ... other methods
};
KcpServer server = new KcpServer();
server.init(listener, config, new InetSocketAddress(9999));- Automatic Header Detection: Gracefully handles both proxied and direct connections
- IPv4 and IPv6 Support: Works with both address families
- Clean Payload Processing: Strips proxy headers and processes original game data
- FRP Compatible: Tested with Fast Reverse Proxy configurations
- Zero Configuration Fallback: Works normally when no proxy headers are present
For detailed configuration and troubleshooting, see PROXY_PROTOCOL_INTEGRATION.md.
Anime game changes: Simplxss
Version 4.6+ Changes: OcenWang-GI Commit
Original library: https://github.com/l42111996/java-Kcp