Table of Contents

Class NetUtils

Namespace
NanoByte.Common.Net
Assembly
NanoByte.Common.dll

Provides helper methods for the System.Net subsystem.

public static class NetUtils
Inheritance
NetUtils

Methods

ApplyProxy()

Applies environment variable HTTP proxy server configuration if present.

public static void ApplyProxy()

Remarks

Uses classic Linux environment variables: http_proxy, http_proxy_user, http_proxy_pass

ConfigureTls()

Enables TLS 1.2 and TLS 1.3 support if available.

public static void ConfigureTls()

GetInternetConnectivity()

Returns the current state of the internet connection. When unsure assumes a connection is available.

public static Connectivity GetInternetConnectivity()

Returns

Connectivity

TrustCertificates(params string[])

Makes the SSL validation subsystem trust a set of certificates, even if their certificate chain is not trusted.

public static void TrustCertificates(params string[] publicKeys)

Parameters

publicKeys string[]

The public keys of the certificates to trust.

Remarks

This method affects the global state of the AppDomain. Calling it more than once is not cumulative and will overwrite previous certificates. You should call this method exactly once near the beginning of your application.