ntrip-core
An async NTRIP client library for Rust.
Features
- Protocol Support: NTRIP v1 (ICY) and v2 (HTTP/1.1 chunked)
- Security: TLS/HTTPS via rustls (no OpenSSL dependency)
- Discovery: Sourcetable retrieval and nearest mountpoint selection
- Async: Built on Tokio for efficient async I/O
- Robust: Read timeouts, automatic reconnection (configurable), proper error handling
- Proxy: HTTP proxy support via CONNECT tunneling
See the API documentation for complete usage details.
Why ntrip-core?
- No OpenSSL dependency - TLS via rustls simplifies cross-compilation and deployment
- Async-native - Built on Tokio from the ground up, not blocking wrappers
- Complete protocol support - Both NTRIP v1 and v2 with automatic version detection
- Sourcetable discovery - Parse sourcetables and find nearest mountpoint by coordinates
- HTTP proxy support - CONNECT tunneling with optional proxy authentication
- Cancellation-safe - Works naturally with
tokio::select!for timeouts and shutdown - GGA position reporting - Both in-stream and v2 header methods supported
- Automatic reconnection - Configurable retry with GGA state preservation
Quick Start
use ;
async
Automatic Reconnection
By default, the client will automatically attempt to reconnect up to 3 times on connection loss or timeout:
// Default: 3 reconnection attempts with 1 second delay
let config = new;
// Custom reconnection settings
let config = new
.with_reconnect; // 5 attempts, 2 second delay
// Disable automatic reconnection
let config = new
.without_reconnect;
When reconnection occurs, the client automatically resends the last GGA position to maintain VRS/nearest-base selection.
TLS/HTTPS Connections
TLS capability is always compiled in (via tokio-rustls). To connect to a TLS-enabled caster:
let config = new
.with_tls // Enable TLS for this connection
.with_credentials;
By default, connections use plain TCP. Call .with_tls() to enable TLS.
HTTP Proxy
Connect through an HTTP proxy using the CONNECT method:
use ;
// Explicit proxy configuration
let proxy = new
.with_credentials;
let config = new
.with_proxy;
// Or read from $HTTP_PROXY environment variable
let config = new
.with_proxy_from_env;
Sourcetable Discovery
use ;
let config = new;
let table = get_sourcetable.await?;
// Find nearest mountpoint
if let Some = table.nearest_rtcm_stream
Examples
# Fetch sourcetable from a caster
# Find nearest mountpoint to a location
# Connect and stream RTCM data
Testing
# Run unit tests
# Run integration tests against real public casters (no credentials needed)
# or: cargo test --test integration -- --ignored
# Run shell-based test suite against real casters
The integration tests fetch sourcetables from all public casters listed below, and include dynamic connection tests that find active mountpoints and stream real RTCM data from RTK2go and Centipede - no private credentials required.
For the shell-based connection tests, copy scripts/credentials.env.template to scripts/credentials.env and fill in your credentials.
Logging
This crate uses tracing for structured logging. Enable with a subscriber:
init;
Tested Casters
This library is regularly tested against these public NTRIP casters:
| Caster | Host | Auth | Notes |
|---|---|---|---|
| RTK2go | rtk2go.com:2101 | Email/none | Large public caster, 1000+ streams |
| Centipede | caster.centipede.fr:2101 | None | Open French/EU RTK network |
| EUREF | euref-ip.net:2101 | None* | European reference stations |
| IGS | igs-ip.net:2101 | None* | International GNSS Service |
| SNIP Demo | ntrip.use-snip.com:2101 | None | Demo caster for testing |
| AUSCORS | ntrip.data.gnss.ga.gov.au:443 | Required | Geoscience Australia (HTTPS) |
* Some streams may require registration
Development
We use Just as a command runner:
Minimum Supported Rust Version
MSRV is 1.75.
License
Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)