# 프록시 프로토콜

## 개요

<figure><img src="/files/Z2zaa97t5DyVRFehTWLT" alt=""><figcaption></figcaption></figure>

프록시 프로토콜(Proxy Protocol)은\
Wrdefense+를 통해서 플레이어가  접속할때\
**실제 접속한 클라이언트의 IP 주소를 서버에 전달해 주는 방식**이에요.

일반적인환경에서는,\
서버 로그에 실제 유저 IP가 아닌 Wrdefense+ **서버의 IP**만 표시됩니다.\
이로 인해 IP 기반 기능이 제대로 동작하지 않는 문제가 발생할 수  있어요.

## 중요 정보

프록시 프로토콜은 네트워크 설정만으로 자동 적용되지 않아요!

프록시 프로토콜을 사용하는 경우,\
별도로 **프록시 프로토콜을 인식하도록 설정해주셔야해요.**&#x20;

일부 사용 환경에서는, 접속 오류가 발생할수도 있어요.

{% content-ref url="/pages/ZZHANwKjE6DLrFRcQHjo" %}
[Paper (페이퍼)](/plus/proxyproto/paper.md)
{% endcontent-ref %}

{% content-ref url="/pages/0BfhLuRl73JcmaWUa8nN" %}
[포지 (Forge)](/plus/proxyproto/forge.md)
{% endcontent-ref %}

{% content-ref url="/pages/cgFfj5PJkZWWrtdqPTDR" %}
[패브릭](/minecraft/version/fabric.md)
{% endcontent-ref %}

## 프록시 프로토콜 활용 예시:

#### 비활성화

```log
[11:56:08] [User Authenticator #0/INFO]: UUID of player mohyomi is 5c803b2d-02d0-4f8e-8f50-965cdfc48714
[11:56:09] [Server thread/INFO]: mohyomi joined the game
[11:56:10] [Server thread/INFO]: mohyomi[/111.111.111.111:62672] logged in with entity id 44 at ([world]0, 0, 0)
```

<p align="center">플래이어  접속시, 표시되는 ip 주소 111.111.111.111는 Wrdefense+의 주소에요.</p>

<p align="center">이 경우 다음과 같은 제한이 있어요.</p>

* 모든 유저가 동일한 IP로 인식됨
* IP 밴, IP 화이트리스트가 정상적으로 작동하지 않음

#### 활성화

```log
[11:56:08] [User Authenticator #0/INFO]: UUID of player mohyomi is 5c803b2d-02d0-4f8e-8f50-965cdfc48714
[11:56:09] [Server thread/INFO]: mohyomi joined the game
[11:56:10] [Server thread/INFO]: mohyomi[/123.123.123.123:68642] logged in with entity id 44 at ([world]0, 0, 0)
```

<p align="center">프록시 프로토콜 사용시, 123.123.123.123은 접속 플래이어의 공개 ip에요.</p>

<p align="center">Wrdefense+ 뒤에 숨겨진 <strong>실제 접속 플레이어의 공개 IP</strong>를 인식할 수 있어요!</p>

<p align="center">이는 다음과 같은 이점이 있어요.</p>

* 접속 로그에 실제 유저 IP 기록
* IP 밴, 국가 차단, 접속 제한 등 IP 기반 기능 정상 작동
* 보안 및 관리 목적의 정확한 유저 식별 가능

## 추가 정보

<figure><img src="/files/difn5o6hFG7me62cBrG9" alt="" width="375"><figcaption></figcaption></figure>

<p align="center">활성화 클릭시, 나타나는 룰렛이에요.</p>

```ts
const segments = 6;
const segmentAngle = (Math.PI * 2) / segments;
```

<p align="center">룰렛은 원형이므로, 모든 위치는 <strong>각도(라디안)</strong> 로 계산해요.</p>

```ts
const successSegments = [1, 3, 5];
const targetSegmentIndex =
    successSegments[Math.floor(Math.random() * successSegments.length)];
```

<p align="center">결과는 회전 전에 이미 결정되고, <code>꽝</code> 세그먼트는 제외하고, <code>성공</code> 세그먼트만 후보로 사용해요.</p>

```ts
const segmentOffset =
    -(targetSegmentIndex * segmentAngle + segmentAngle / 2);
```

<p align="center">선택된 <code>성공</code> 세그먼트의 <strong>중앙이 화살표 아래에 오도록</strong> 목표 각도를 계산해요.</p>

```ts
const fullRotations = 8 + Math.floor(Math.random() * 5);
const totalRotation =
    fullRotations * Math.PI * 2 + segmentOffset;
```

<p align="center">자연스럽게 보이기 위해 여러 바퀴를 먼저 돌려줘요.</p>

```ts
currentRotation =
    slowDownStartRotation +
    (totalRotation - slowDownStartRotation) * easeOutCubic(progress);
```

<p align="center">룰렛이 감속하면서, 현재 회전 각도에서 <code>totalRotation</code>까지 부드럽게 이동해요.</p>

```ts
currentRotation = totalRotation;
```

<p align="center">최종적으로, 룰렛은 꽝 없이 100% 확률로 성공에서 멈춰요!</p>

<p align="center">프록시 프로토콜과 연관성이 없는 기능 및 설명으로, 단순한 시각적으로 매리트가 있는 룰렛이에요.</p>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.weirdhost.xyz/plus/proxyproto.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
