Struct outline_api::OutlineVPN

source ·
pub struct OutlineVPN<'a> { /* private fields */ }
Expand description

Represents a client for interacting with the Outline VPN Server API.

The OutlineVPN struct provides methods to perform various operations on the Outline VPN server such as retrieving server information, changing settings, creating access keys, and more.

Fields

  • api_url: A reference to a string representing the URL (including secret) of the Outline VPN server API.
  • session: A reqwest HTTP client used to make API requests.
  • request_timeout_in_sec: The time to set the timeout for API requests.

Implementations§

source§

impl OutlineVPN<'_>

source

pub fn get_server_info(&self) -> Result<Value, String>

Get server information.

Responses:

  • 200 – Server information.
source

pub fn change_hostname_for_access_keys( &self, hostname: &str ) -> Result<(), String>

Change hostname for access keys.

Responses:

  • 204 – The hostname was successfully changed.
  • 400 – An invalid hostname or IP address was provided.
  • 500 – An internal error occurred. This could be thrown if there were network errors while validating the hostname.
source

pub fn change_default_port_for_newly_created_access( &self, port: &str ) -> Result<(), String>

Change default port for newly created access keys.

Responses:

  • 204 – The default port was successfully changed.
  • 400 – The requested port wasn’t an integer from 1 through 65535, or the request had no port parameter.
  • 409 – The requested port was already in use by another service.
source

pub fn set_data_transfer_limit_for_all_access_keys( &self, byte: &u64 ) -> Result<(), String>

Set data transfer limit (in bytes) for all access keys.

Responses:

  • 204 – Access key data limit set successfully.
  • 400 – Invalid data limit.
source

pub fn remove_data_limit_for_all_access_keys(&self) -> Result<(), String>

Remove data transfer limit for all access keys.

Responses:

  • 204 – Access key limit deleted successfully.
source

pub fn rename_server(&self, name: &str) -> Result<(), String>

Rename server.

Responses:

  • 204 – Server renamed successfully.
  • 400 – Invalid name.
source

pub fn create_access_key(&self) -> Result<Value, String>

Create new access key.

Responses:

  • 201 – The newly created access key.
source

pub fn list_access_keys(&self) -> Result<Value, String>

Display complete list of the access keys.

Responses:

  • 200 – List of access keys.
source

pub fn delete_access_key_by_id(&self, id: &u16) -> Result<(), String>

Delete access key by ID.

Responses:

  • 204 – Access key deleted successfully.
  • 404 – Access key inexistent.
source

pub fn change_name_for_access_key( &self, id: &u16, username: &str ) -> Result<(), String>

Change name for access key (by ID).

Responses:

  • 204 – Access key renamed successfully.
  • 404 – Access key inexistent.
source

pub fn set_data_transfer_limit_by_id( &self, id: &u16, byte: &u64 ) -> Result<(), String>

Set data transfer limit by ID.

Responses:

  • 204 – Access key limit set successfully.
  • 400 – Invalid data limit.
  • 404 – Access key inexistent.
source

pub fn del_data_transfer_limit_by_id(&self, id: &u16) -> Result<(), String>

Remove data transfer limit by ID.

Responses:

  • 204 – Access key limit deleted successfully.
  • 404 – Access key inexistent.
source

pub fn get_each_access_key_data_transferred(&self) -> Result<Value, String>

Get data transfer stats for each access key in bytes.

Responses:

  • 200 – The data transferred by each access key.
source

pub fn get_whether_metrics_is_being_shared(&self) -> Result<Value, String>

Get ‘Share anonymous metrics’ status.

Responses:

  • 200 – The metrics enabled setting.
source

pub fn enable_or_disable_sharing_metrics( &self, metrics_enabled: bool ) -> Result<(), String>

Enable or disable ‘Share anonymous metrics’ setting.

Responses:

  • 204 – Setting successful.
  • 400 – Invalid request.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for OutlineVPN<'a>

§

impl<'a> Send for OutlineVPN<'a>

§

impl<'a> Sync for OutlineVPN<'a>

§

impl<'a> Unpin for OutlineVPN<'a>

§

impl<'a> !UnwindSafe for OutlineVPN<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more