feat: 버전 독립 P2P 터널 모드 초기 구현
Some checks failed
build / build (push) Has been cancelled

jar 하나로 모든 마인크래프트 버전을 지원해야 한다는 요구를 만족시키기 위해
마인크래프트 클래스를 전혀 참조하지 않는 구조로 설계했다. 26.1부터 게임이
비난독화되면서 Yarn/intermediary 가 폐지돼, 게임 클래스를 참조하는 jar 는
1.21.x 와 26.x 경계를 넘을 수 없다 — 버전별 빌드를 피할 유일한 길이다.

게임에서 필요한 두 가지를 자바 API 대신 네트워크 프로토콜로 얻는다.
호스트의 통합 서버 포트는 바닐라 "LAN 에 공개" 가 쏘는 멀티캐스트 비콘에서
읽고, 참가자에게는 같은 비콘을 우리가 쏘아 LAN 목록에 방을 띄운다. 덕분에
믹스인 0개, 버전 분기 0개, Loom·매핑 없는 평범한 자바 빌드가 됐다.

전송은 순수 자바 QUIC(Kwik)을 골랐다. 네이티브 WebRTC 대비 번들이 30MB →
0.71MB 로 줄고 아키텍처 제약이 사라진다. NAT 우회는 후보를 병렬로 시도하되
직결에 600ms 유예를 줘서, 항상 먼저 성공하는 중계가 직결을 밀어내지 않게 했다.
중계는 UDP 데이터그램을 그대로 넘기므로 직결과 터널 코드가 동일하고 QUIC
TLS 1.3 이 종단간이라 중계 서버는 트래픽을 읽을 수 없다.

초대코드는 120비트 난수 자체이고 서버에 등록되는 방 ID 는 그 해시에서
파생된다. 시그널링 서버 운영자도 방에 참가하거나 호스트를 사칭할 수 없다.

검증: 57개 테스트 전부 통과. 직결·중계 양쪽에서 터널이 실제 소켓으로 왕복하고,
512KB 전송, 초대코드 불일치 거절, 지문 불일치 차단, 실제 멀티캐스트 비콘
송수신, 시그널링 프로토콜, 웹 콘솔 HTTP 를 포함한다. 마인크래프트 클래스
참조 0개는 컴파일된 클래스의 상수 풀을 뒤지는 테스트로 강제한다.

실제 게임 클라이언트 접속과 실 NAT 홀펀칭 성공률은 아직 미검증이며
docs/DESIGN.md 에 남은 과제로 정리했다.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-09-28 11:29:25 +09:00
parent ff5aa0f0dc
commit bacc2e91d3
44 changed files with 5656 additions and 0 deletions

93
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,93 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega