# ntrip-client **Repository Path**: RedStoneDigital/ntrip-client ## Basic Information - **Project Name**: ntrip-client - **Description**: No description available - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-23 - **Last Updated**: 2026-06-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # NTRIP Spring Boot Client(Java 11) 工程级 NTRIP Client,兼容 NTRIP 1.0 / 2.0,用于连接 Caster 的 MountPoint,接收 RTCM 改正数并输出到本地文件。 ## 功能 - Spring Boot 2.7.x,Java 11 - 支持 NTRIP 1.0:`GET /MOUNT HTTP/1.0`,兼容 `ICY 200 OK` - 支持 NTRIP 2.0:`GET /MOUNT HTTP/1.1` + `Ntrip-Version: Ntrip/2.0` - `AUTO` 与 `V2` 请求行为一致(HTTP/1.1 + Ntrip-Version),同时兼容 `ICY 200 OK` / `HTTP/1.x 200` 成功响应 - **支持 TLS/HTTPS Caster 连接**(可选,配置 `ssl.enabled: true`) - Basic Auth 用户名密码认证 - VRS/NEAR 挂载点 GGA 周期上报 - RTCM 二进制流落盘 - 断线自动重连,指数退避 - REST 控制:启动、停止、状态查询 - 日志滚动输出 ## 配置 修改 `src/main/resources/application.yml`: ```yaml ntrip: enabled: true host: your.caster.com port: 2101 mountPoint: YOUR_MOUNT # 必须显式配置;@NotBlank 校验在启动时生效 username: your_user password: your_password version: AUTO # AUTO / V1 / V2。AUTO 与 V2 请求行为一致,并兼容 NTRIP 1.0 返回的 ICY 200 / HTTP/1.x 200 gga: enabled: true intervalSeconds: 10 sentence: "$GPGGA,080000.00,3600.000000,N,12400.000000,E,1,12,1.0,50.0,M,0.0,M,,*61" output: type: FILE filePath: ./data/rtcm/rtcm.bin append: true ``` > 注意:很多 VRS、NEAR、MAX 挂载点必须收到 rover 的 GGA 后才会持续下发 RTCM。实际项目中应把 `gga.sentence` 替换为接收机实时位置生成的 GGA。 ### TLS / HTTPS 连接 若 Caster 支持 NTRIP 2.0 over TLS(端口通常为 443),添加 `ssl` 配置: ```yaml ntrip: enabled: true host: your.caster.com port: 443 # HTTPS Caster 默认端口 mountPoint: YOUR_MOUNT username: your_user password: your_password ssl: enabled: true # trustStorePath 留空时使用系统默认信任库($JAVA_HOME/lib/security/cacerts) trustStorePath: /path/to/custom-truststore.jks trustStorePassword: trustpass trustStoreType: JKS # hostnameVerification=false 用于自签名证书测试环境(生产环境应启用) hostnameVerification: true ``` ## 运行 ```bash mvn clean package java -jar target/ntrip-client-1.0.0.jar ``` 也可以不自动连接,启动后通过接口控制: ```bash curl -X POST http://localhost:8088/api/ntrip/start curl http://localhost:8088/api/ntrip/status curl -X POST http://localhost:8088/api/ntrip/stop ``` RTCM 输出文件默认在: ```text ./data/rtcm/rtcm.bin ``` ## 常见问题 1. `Caster rejected request: HTTP/1.1 401 Unauthorized` 用户名、密码或 MountPoint 不正确。 2. `Caster returned sourcetable` 通常是 MountPoint 填错或为空,Caster 返回了源表而不是 RTCM 流。`mountPoint` 已在 `application.yml` 中默认为空,启动时 `@NotBlank` 校验会阻断——请先填入合法 MountPoint 再启动。 3. 已连接但没有 RTCM 数据 检查该挂载点是否需要 GGA;检查 GGA 坐标是否在服务覆盖范围内。 4. 文件越来越大 RTCM 是实时流,默认追加写入。可将 `output.append=false` 改为每次启动覆盖。