takproto
A Rust library for sending TAK (Team Awareness Kit) Protocol messages to TAK servers with full mTLS support.
Features
- ✅ TAK Protocol Version 1 - Protocol Buffer-based messaging
- ✅ mTLS Support - Client certificate authentication
- ✅ Protocol Negotiation - Automatic handshake with TAK servers
- ✅ XML Mode - Legacy Protocol Version 0 support
- ✅ Async/Await - Built on Tokio for efficient I/O
- ✅ Type-Safe - Generated protobuf types with prost
- ✅ Builder Pattern - Ergonomic CotEventBuilder for easy event creation
- ✅ Detail Helpers - Contact, track, group, status, and more
- ✅ Helper Functions - Easy marker and URL creation
Quick Start
Add to your Cargo.toml:
[]
= "0.4"
= { = "1", = ["full"] }
Feature Flags
openssl-p12: Enable full PKCS#12 support using OpenSSL (recommended for legacy TAK P12 files)
[]
= { = "0.4", = ["openssl-p12"] }
Certificate Validation Options
For development, testing, or working with self-signed certificates, use TlsConfigBuilder to customize validation:
use TlsConfigBuilder;
// Accept self-signed server certificates (with client auth)
let tls_config = new
.with_p12?
.danger_accept_invalid_certs
.build?;
// Disable hostname verification (useful for IP-based connections)
let tls_config = new
.with_p12?
.danger_disable_hostname_verification
.build?;
// Both options together (very insecure - testing only!)
let tls_config = new
.with_p12?
.danger_accept_invalid_certs
.danger_disable_hostname_verification
.build?;
// Also works with PEM certificates
let tls_config = new
.with_client_cert?
.danger_accept_invalid_certs
.build?;
⚠️ WARNING: These options reduce security and should only be used in trusted networks or during development.
Note: Client authentication (mTLS) is fully supported with all validation options.
Example: Send a Position Report with Builder
Using PKCS#12 Certificate (Recommended for TAK)
Important: Legacy TAK Server P12 files use RC2-40-CBC encryption which is disabled in OpenSSL 3.x. You must convert them to a modern format first:
# Convert legacy TAK Server P12 to modern format
Or use the provided conversion script:
use ;
use ;
async
Using Separate PEM Files
use ;
use ;
async
Example: Create Markers with URLs (iTAK Compatible)
use ;
use ;
// Put URL in marker name for visibility
let event = CotEvent ;
// Send as XML for maximum compatibility
client.send_cot_event_xml.await?;
CoT Event Types
Common CoT types for markers:
| Type | Description | Icon |
|---|---|---|
a-f-G-U-C |
Friendly ground unit | Soldier |
a-f-A-M-F |
Friendly aircraft | Aircraft |
a-h-G-U-C |
Hostile ground unit | Enemy |
b-m-p-s-m |
Map marker | Pin |
Protocol Modes
Protobuf Mode (Recommended for high-frequency updates)
// Negotiate protocol
client.negotiate_protocol.await?;
// Send as protobuf
client.send_cot_event.await?;
XML Mode (Recommended for markers with details)
// No negotiation needed - stays in XML mode
// Send as XML
client.send_cot_event_xml.await?;
Helper Functions
The library includes helpers for common tasks:
Detail Helpers (Protobuf messages)
use *;
// Contact information
let c = contact;
// Movement tracking
let t = track; // 15 m/s heading west (270°)
// Group affiliation
let g = group;
// Device status
let s = status; // 85% battery
// TAK version info
let tv = takv;
// GPS precision
let p = precision_location;
XML Helpers
use *;
// Convert URL to clean UID
let uid = url_to_uid; // "example.com"
// Create colored marker
let xml = format!;
// Create remarks with URLs
let xml = remarks_with_urls;
Platform Support
| Platform | Client Certificate | Protocol Negotiation | XML Mode | Protobuf Mode |
|---|---|---|---|---|
| iTAK 2.12.3 | ✅ | ✅ | ✅ | ✅ |
| ATAK | ✅ | ✅ | ✅ | ✅ |
| WinTAK | ✅ | ✅ | ✅ | ✅ |
Documentation
Examples
The repository includes comprehensive examples:
send_position_tls.rs- Basic mTLS connection and position reportbest_practice_itak.rs- iTAK-compatible markers with URLslisten_tls.rs- Receive messages from TAK server- And many more in the
examples/directory
Run an example:
Security
This library supports:
- mTLS - Mutual TLS authentication with client certificates
- TLS 1.2/1.3 - Modern TLS protocols via rustls
- Certificate validation - Proper CA certificate chain validation
Requirements
- Rust 1.70 or later
- TAK server (FreeTAKServer, TAK Server, etc.)
- Client certificates for mTLS (if required by server)
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Related Projects
- TAK Protocol Specification
- ATAK - Android Team Awareness Kit
- iTAK - iOS Team Awareness Kit
- FreeTAKServer - Open source TAK server
Acknowledgments
Based on the TAK Protocol specification. Protocol Buffer definitions from the official TAK protocol documentation.