pub struct Client { /* private fields */ }Expand description
Downloads game content from Steam’s content servers.
Implementations§
Source§impl Client
impl Client
Sourcepub fn from_steam_client(steam_client: &SteamClient) -> Self
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.
Sourcepub fn with_default_client() -> Result<Self, SteamError>
pub fn with_default_client() -> Result<Self, SteamError>
Creates a client with a default HTTP client.
Sourcepub fn request_timeout() -> Duration
pub fn request_timeout() -> Duration
Default timeout to use when making requests.
Sourcepub fn set_request_timeout(value: Duration)
pub fn set_request_timeout(value: Duration)
Sets the default timeout to use when making requests.
Sourcepub fn response_body_timeout() -> Duration
pub fn response_body_timeout() -> Duration
Default timeout to use when reading the response body.
Sourcepub fn set_response_body_timeout(value: Duration)
pub fn set_response_body_timeout(value: Duration)
Sets the default timeout to use when reading the response body.
Sourcepub 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>
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 asUseAsProxywhich transforms the request.cdn_auth_token- CDN auth token for CDN content server endpoints if necessary.
Sourcepub 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>
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 withClient::download_manifest_async.server- the content server to connect to.destination- the buffer to receive the chunk data. Ifdepot_keyis provided, this will be the decompressed buffer. Allocate a buffer that is equal or longer thanChunkData::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 asUseAsProxywhich 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.
Sourcepub fn build_command(
server: &Server,
command: &str,
query: Option<&str>,
proxy_server: Option<&Server>,
) -> Result<Url, SteamError>
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 asUseAsProxywhich transforms the request.
Source§impl Client
impl Client
Sourcepub fn use_lancache_server() -> bool
pub fn use_lancache_server() -> bool
Whether downloads go through a Lancache instance on the LAN instead of Steam’s CDN.
Sourcepub async fn detect_lancache_server_async() -> Result<(), SteamError>
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.
Sourcepub fn is_private_address(to_test: &IpAddr) -> bool
pub fn is_private_address(to_test: &IpAddr) -> bool
Whether an IP address is private, as defined by RFC 1918.