> ## Documentation Index
> Fetch the complete documentation index at: https://frp.xdr.ooo/llms.txt
> Use this file to discover all available pages before exploring further.

# 아키텍처

> Control plane, 서비스 데이터 경로, 신뢰 경계와 persistent state를 기술적으로 설명합니다.

# 아키텍처

이 페이지는 전문가/운영자를 위한 구조 설명입니다. 처음 보는 사용자라면 [개념과 동작 원리](/ko/getting-started/concepts)부터 읽는 것이 빠릅니다.

## 전체 구조

```mermaid theme={null}
flowchart LR
    U[관리자 / 인터넷 사용자]
    F[외부 Firewall / NAT\n선택]
    S[FRP Auto Deploy 서버]
    C1[Client A\nfrpc + management identity]
    C2[Client B\nfrpc + management identity]
    L1[로컬 서비스\n127.0.0.1:*]
    L2[접근 가능한 LAN 서비스\n10.x / 172.16-31.x / 192.168.x]

    U -->|published TCP port| F
    F --> S
    C1 -->|outbound FRP control| S
    C2 -->|outbound FRP control| S
    C1 --> L1
    C1 --> L2
```

FRP Auto Deploy는 공식 FRP를 대체하는 터널 엔진이 아니라 그 위의 **lightweight management layer**입니다.

## Control plane과 data plane

| 영역                      | 역할                                   | 일반 전송 방식              |
| ----------------------- | ------------------------------------ | --------------------- |
| Enrollment / management | 최초 신뢰, identity, 서비스 metadata, 관리 작업 | 검증된 HTTPS             |
| FRP control             | proxy 등록과 reverse tunnel 유지          | FRP native TLS 또는 WSS |
| Published service data  | SSH/HTTP/HTTPS/Custom TCP 실제 트래픽     | FRP proxy를 통한 TCP     |

각 영역은 서로 다른 자격 증명과 역할을 가집니다.

## Direct 모드

```mermaid theme={null}
flowchart TB
    I[Internet]
    A[Enrollment / management HTTPS\nTCP 6099]
    C[FRP control\nTCP 443]
    P[Published services\nTCP 6000-6098]
    S[FRP Auto Deploy 서버]

    I --> A --> S
    I --> C --> S
    I --> P --> S
```

## Enterprise single-443

```mermaid theme={null}
flowchart TB
    I[Internet]
    FE[Public frontend\nTCP 443]
    A[Allocator backend\n127.0.0.1:6099]
    F[FRP backend\n127.0.0.1:7000]
    P[Published services\nTCP 6000-6098]

    I --> FE
    FE -->|HTTPS enrollment| A
    FE -->|FRP control over WSS| F
    I --> P
```

single-443에서는 backend `6099`, `7000`을 인터넷에 직접 노출하면 안 됩니다.

## Identity 모델

```mermaid theme={null}
flowchart TD
    M[Machine] --> CID[Immutable CLIENT ID]
    CID --> MI[Persistent management identity]
    CID --> SV[Services]
    CID --> META[Mutable metadata]
    META --> L[label]
    META --> H[hostname]
    META --> N[note]
    META --> T[tags]
    SV --> SID[Stable Service ID]
    SID --> PP[Persistent public-port reservation]
```

## 신뢰 수립

```mermaid theme={null}
sequenceDiagram
    participant C as 새 Client
    participant S as Server

    C->>S: Bootstrap Ticket / Enrollment Code
    S-->>C: CA trust bootstrap 정보
    C->>C: CA fingerprint / X.509 검증
    C->>S: 검증된 HTTPS enrollment
    S-->>C: Persistent management identity + config
    C->>S: 이후 signed management request
```

FRP token은 FRP tunnel 인증용이며 Enrollment Code, Bootstrap Ticket, management identity와 같은 자격 증명이 아닙니다.

## 보존되는 서버 상태

```text theme={null}
/etc/frp-auto-deploy/config.json
/etc/frp-auto-deploy/pki/
/etc/frp/server_token
/var/lib/frp-auto-deploy/registry.json
```

정상적인 업데이트, 재부팅, 지원되는 restore에서는 identity, CA trust, token, registry, public-port reservation을 보존하는 것이 설계 목표입니다.

## 설계 규모

주 대상은 몇 대에서 몇십 대입니다. 수백/수천 endpoint orchestration, CMDB, endpoint compliance, HA management cluster는 현재 제품 목표가 아닙니다.
