Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Downloads game content from Steam’s content servers.

Implementations§

Source§

impl Client

Source

pub fn new(http_client: Client) -> Self

Creates a client that uses the given HTTP client.

Source

pub fn from_steam_client(steam_client: &SteamClient) -> Self

Creates a client using the HTTP client the Steam client’s configuration provides for CDN requests.

Source

pub fn with_default_client() -> Result<Self, SteamError>

Creates a client with a default HTTP client.

Source

pub fn request_timeout() -> Duration

Default timeout to use when making requests.

Source

pub fn set_request_timeout(value: Duration)

Sets the default timeout to use when making requests.

Source

pub fn response_body_timeout() -> Duration

Default timeout to use when reading the response body.

Source

pub fn set_response_body_timeout(value: Duration)

Sets the default timeout to use when reading the response body.

Source

pub async fn download_manifest_async( &self, depot_id: u32, manifest_id: u64, manifest_request_code: u64, server: &Server, depot_key: Option<&[u8]>, proxy_server: Option<&Server>, cdn_auth_token: Option<&str>, ) -> Result<DepotManifest, SteamError>

Downloads the depot manifest specified by the given manifest ID, and optionally decrypts the manifest’s filenames if the depot decryption key has been provided.

  • depot_id - the id of the depot being accessed.
  • manifest_id - the unique identifier of the manifest to be downloaded.
  • manifest_request_code - the manifest request code for the manifest that is being downloaded.
  • server - the content server to connect to.
  • depot_key - the depot decryption key for the depot that will be downloaded. This is used for decrypting filenames (if needed) in depot manifests.
  • proxy_server - optional content server marked as UseAsProxy which transforms the request.
  • cdn_auth_token - CDN auth token for CDN content server endpoints if necessary.
Source

pub async fn download_depot_chunk_async( &self, depot_id: u32, chunk: &ChunkData, server: &Server, destination: &mut [u8], depot_key: Option<&[u8]>, proxy_server: Option<&Server>, cdn_auth_token: Option<&str>, ) -> Result<usize, SteamError>

Downloads the specified depot chunk, and optionally processes the chunk and verifies the checksum if the depot decryption key has been provided.

This function will also validate the length of the downloaded chunk with the value of ChunkData::compressed_length, if it has been assigned a value.

  • depot_id - the id of the depot being accessed.
  • chunk - the chunk to download. This value should come from a manifest downloaded with Client::download_manifest_async.
  • server - the content server to connect to.
  • destination - the buffer to receive the chunk data. If depot_key is provided, this will be the decompressed buffer. Allocate a buffer that is equal or longer than ChunkData::uncompressed_length.
  • depot_key - the depot decryption key for the depot that will be downloaded. This is used to process the chunk data.
  • proxy_server - optional content server marked as UseAsProxy which transforms the request.
  • cdn_auth_token - CDN auth token for CDN content server endpoints if necessary.

Returns the total number of bytes written to destination.

Source

pub fn build_command( server: &Server, command: &str, query: Option<&str>, proxy_server: Option<&Server>, ) -> Result<Url, SteamError>

Builds the request URL for a CDN command.

  • server - the content server to connect to.
  • command - the command (path) to request.
  • query - the query string of the request, for example a CDN auth token.
  • proxy_server - optional content server marked as UseAsProxy which transforms the request.
Source§

impl Client

Source

pub fn use_lancache_server() -> bool

Whether downloads go through a Lancache instance on the LAN instead of Steam’s CDN.

Source

pub async fn detect_lancache_server_async() -> Result<(), SteamError>

Tries to find a Lancache on the local network, through its poisoned DNS entry for lancache.steamcontent.com. If one is found, all downloads go through it instead of Steam’s CDN.

Based on https://github.com/tpill90/lancache-prefill-common/blob/main/dotnet/LancacheIpResolver.cs.

Source

pub fn is_private_address(to_test: &IpAddr) -> bool

Whether an IP address is private, as defined by RFC 1918.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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