Struct tsnet::ServerBuilder

source ·
pub struct ServerBuilder { /* private fields */ }
Expand description

Server factory, which can be used to configure the properties of a new server.

Methods can be chained on it in order to configure it.

Example

use tsnet::ServerBuilder;

let server = ServerBuilder::new().ephemeral().build().unwrap();

Implementations§

source§

impl ServerBuilder

source

pub fn new() -> ServerBuilder

Generates the base configuration for a new server, from which configuration methods can be chained.

Call ServerBuilder::build to start the server.

source

pub fn dir(self, dir: PathBuf) -> Self

Specifies the name of the directory to use for state. If unset, a directory is selected automatically under the user’s configuration directory (see https://golang.org/pkg/os/#UserConfigDir), based on the name of the binary.

source

pub fn hostname(self, hostname: &str) -> Self

The hostname to present to the control server. If unset, the binary name is used.

source

pub fn authkey(self, authkey: String) -> Self

AuthKey, if set, is the auth key to create the node and will be preferred over the TS_AUTHKEY environment variable. If the node is already created (from state previously stored in in Store), then this field is not used.

source

pub fn control_url(self, control_url: String) -> Self

Specifies the coordination server URL. If unset, the Tailscale default is used.

source

pub fn ephemeral(self) -> Self

Specifies that the instance should register as an Ephemeral node (see https://tailscale.com/kb/1111/ephemeral-nodes/)

source

pub fn redirect_log(self) -> Self

Redirect libtailscale logging to log.

  • This starts a new thread to handle logs.
  • Everything from libtailscale is logged at INFO level.
  • Use an appropriate logger to handle log output further.
source

pub fn disable_log(self) -> Self

Disable libtailscale logging.

See also ServerBuilder::redirect_log to rely on the Rust log facade.

source

pub fn build(self) -> Result<Server>

Start the server using the configured options.

Trait Implementations§

source§

impl Default for ServerBuilder

source§

fn default() -> ServerBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, 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.