Class NetUtils
Provides helper methods for the System.Net subsystem.
Namespace: NanoByte.Common.Net
Assembly: NanoByte.Common.dll
Syntax
public static class NetUtils : Object
Methods
ApplyProxy()
Applies environment variable HTTP proxy server configuration if present.
Declaration
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.
Declaration
public static void ConfigureTls()
GetInternetConnectivity()
Returns the current state of the internet connection. When unsure assumes a connection is available.
Declaration
public static Connectivity GetInternetConnectivity()
Returns
Type | Description |
---|---|
Connectivity |
TrustCertificates(String[])
Makes the SSL validation subsystem trust a set of certificates, even if their certificate chain is not trusted.
Declaration
public static void TrustCertificates(params string[] publicKeys)
Parameters
Type | Name | Description |
---|---|---|
String[] | publicKeys | 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.