5 releases (1 stable)
Uses new Rust 2024
| new 1.0.0 | Mar 8, 2026 |
|---|---|
| 0.2.1 | Aug 29, 2025 |
| 0.2.0 | Oct 18, 2024 |
| 0.1.1 | Oct 18, 2024 |
| 0.1.0 | Oct 18, 2024 |
#46 in #router
310KB
2.5K
SLoC
zte-cpe-rs
A Rust library for interacting with ZTE devices, such as the GigaCube ZTE MF289F and ZTE G5TS.
Supported Devices
- ZTE G5TS
- GigaCube ZTE MF289F (Last tested: https://github.com/1zun4/zte-cpe-rs/commit/bdd76f850785e76be45a149a8e7d72c7eb99da11)
Features
| Feature | MF289F | G5TS |
|---|---|---|
| Device reboot | Yes | Yes |
| Get status info | Yes | Yes |
| Get device info | No | Yes |
| Get network/signal information | No | Yes |
| Get SIM card info | No | Yes |
| Connect and disconnect network | Yes | Yes |
| Set connection mode | Yes | Yes |
| Set bearer preference | Yes | Yes |
| Set LTE band lock | Yes | No |
| Set DNS mode | Yes | No |
| Configure UPnP | Yes | Yes |
| Configure DMZ | Yes | Yes |
| Get APN profiles | No | Yes |
| Modify an APN profile | No | Yes |
| Get DHCP settings | No | Yes |
| Set DHCP settings | No | Yes |
| Get MTU/MSS settings | No | Yes |
| Set MTU/MSS settings | No | Yes |
| Get SMS settings | No | Yes |
| Get connected devices | No | Yes |
Installation
Install the CLI system-wide with Cargo:
cargo install zte-cpe-rs --features cli --locked
Or add this to your Cargo.toml to use the library:
[dependencies]
zte-cpe-rs = "1.0.0"
Usage
CLI:
zte-cpe-rs --model g5ts --url https://192.168.0.1 --password YOURPASSWORD status
zte-cpe-rs --model g5ts --url https://192.168.0.1 --password YOURPASSWORD status --pretty
Code:
use std::collections::HashSet;
use anyhow::{Context, Result};
use zte_cpe_rs::{bands::LteBand, mf289f::Mf289fClient, RouterClient};
#[tokio::main]
async fn main() -> Result<()> {
let mut router = Mf289fClient::new("http://giga.cube")
.context("Failed to create MF289F client")?;
// For a G5TS, use `zte_cpe_rs::g5ts::G5tsClient` instead.
// Login
router.login("YOURPASSWORD")
.await
.context("Failed to login")?;
// Disconnect network
router.disconnect_network().await?;
// Connect network
router.connect_network().await?;
// Get status
println!("{}", router.get_status().await?);
// Set LTE band
let mut bands = HashSet::new();
bands.insert(LteBand::Band1);
bands.insert(LteBand::Band3);
bands.insert(LteBand::Band7);
router.select_lte_band(Some(bands))
.await?;
// Logout
router.logout().await?;
Ok(())
}
Acknowledgements
This project was inspired by and uses code from:
License
This project is licensed under the GNU GENERAL PUBLIC LICENSE.
Dependencies
~9–27MB
~346K SLoC