pub struct HightowerConnection { /* private fields */ }Expand description
Main connection to Hightower gateway with integrated WireGuard transport
Implementations§
Source§impl HightowerConnection
impl HightowerConnection
Sourcepub async fn connect(
gateway_url: impl Into<String>,
auth_token: impl Into<String>,
) -> Result<Self, ClientError>
pub async fn connect( gateway_url: impl Into<String>, auth_token: impl Into<String>, ) -> Result<Self, ClientError>
Connect to a Hightower gateway
This method handles everything:
- Generates WireGuard keypair
- Creates transport server on 0.0.0.0:0
- Discovers network info via STUN using actual bound port
- Registers with gateway
- Adds gateway as peer
Returns a ready-to-use connection with working transport
Sourcepub async fn connect_with_auth_token(
auth_token: impl Into<String>,
) -> Result<Self, ClientError>
pub async fn connect_with_auth_token( auth_token: impl Into<String>, ) -> Result<Self, ClientError>
Connect using default gateway (http://127.0.0.1:8008)
Sourcepub fn assigned_ip(&self) -> &str
pub fn assigned_ip(&self) -> &str
Get the IP address assigned by the gateway
Sourcepub fn transport(&self) -> &TransportServer
pub fn transport(&self) -> &TransportServer
Get the transport for sending/receiving data
Sourcepub async fn disconnect(self) -> Result<(), ClientError>
pub async fn disconnect(self) -> Result<(), ClientError>
Disconnect from the gateway and deregister
Auto Trait Implementations§
impl Freeze for HightowerConnection
impl !RefUnwindSafe for HightowerConnection
impl Send for HightowerConnection
impl Sync for HightowerConnection
impl Unpin for HightowerConnection
impl !UnwindSafe for HightowerConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more