update documentation
This commit is contained in:
parent
33508a9732
commit
412fd96b04
@ -3,6 +3,14 @@ API client library for the Compal CH7465LG, which is a cable modem provided by v
|
|||||||
|
|
||||||
For more information, see the crate documentation.
|
For more information, see the crate documentation.
|
||||||
|
|
||||||
|
## Shell
|
||||||
|
There is a very work-in-progress shell available in the connectbox-shell crate in this repository. I will include more information about it once it's in a usable state.
|
||||||
|
|
||||||
|
### IPv6 Notice
|
||||||
|
I am running my modem in the IPv4 mode, so the options available to me are different than what IPv6 mode users see. Thus, this crate will likely not work correctly with IPv6 mode Connect Boxes.
|
||||||
|
|
||||||
|
I am always grateful for any contributions adding IPv6 support, though.
|
||||||
|
|
||||||
### Credits
|
### Credits
|
||||||
Special thanks to the authors of the following projects:
|
Special thanks to the authors of the following projects:
|
||||||
* [home-assistant-ecosystem/python-connect-box](https://github.com/home-assistant-ecosystem/python-connect-box)
|
* [home-assistant-ecosystem/python-connect-box](https://github.com/home-assistant-ecosystem/python-connect-box)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
/// The error type used globally by the library.
|
/// The error type used globally by the library
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("session token not found, are you logged in?")]
|
#[error("session token not found, are you logged in?")]
|
||||||
|
@ -15,7 +15,7 @@ use serde::de::DeserializeOwned;
|
|||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod functions;
|
mod functions;
|
||||||
/// Data structures used by the library.
|
/// Data structures used by the library
|
||||||
pub mod models;
|
pub mod models;
|
||||||
|
|
||||||
/// A Result type based on the library's Error
|
/// A Result type based on the library's Error
|
||||||
@ -167,7 +167,7 @@ impl ConnectBox {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Login to the router. This method must be called before using the client.
|
/// Log in to the router. This method must be called before using the client.
|
||||||
pub async fn login(&self) -> Result<()> {
|
pub async fn login(&self) -> Result<()> {
|
||||||
// get the session cookie
|
// get the session cookie
|
||||||
self.http
|
self.http
|
||||||
@ -178,7 +178,7 @@ impl ConnectBox {
|
|||||||
self._login().await
|
self._login().await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Logout of the router.
|
/// Log out of the router.
|
||||||
///
|
///
|
||||||
/// The Connect Box allows only one session at a time, thus you should call this method after you're done with using the client, so that other users can log in.
|
/// The Connect Box allows only one session at a time, thus you should call this method after you're done with using the client, so that other users can log in.
|
||||||
pub async fn logout(&self) -> Result<()> {
|
pub async fn logout(&self) -> Result<()> {
|
||||||
@ -201,6 +201,8 @@ impl ConnectBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Toggle or remove port forwards.
|
/// Toggle or remove port forwards.
|
||||||
|
///
|
||||||
|
/// This function accepts a predicate that will be called for every existing port forward. It should decide what to do with each port forward and return a [`PortForwardAction`].
|
||||||
pub async fn edit_port_forwards<F>(&self, mut f: F) -> Result<()>
|
pub async fn edit_port_forwards<F>(&self, mut f: F) -> Result<()>
|
||||||
where
|
where
|
||||||
F: FnMut(models::PortForwardEntry) -> PortForwardAction,
|
F: FnMut(models::PortForwardEntry) -> PortForwardAction,
|
||||||
@ -276,10 +278,15 @@ impl ConnectBox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Specifies the action to perform with a given port forward. Used in conjunction with [`ConnectBox::edit_port_forwards`]
|
||||||
pub enum PortForwardAction {
|
pub enum PortForwardAction {
|
||||||
|
/// Don't do anything with the port forward
|
||||||
Keep,
|
Keep,
|
||||||
|
/// Enable the port forward
|
||||||
Enable,
|
Enable,
|
||||||
|
/// Disable the port forward
|
||||||
Disable,
|
Disable,
|
||||||
|
/// Delete the port forward
|
||||||
Delete,
|
Delete,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user