Class NetUtils
Provides helper methods for the System.Net subsystem.
Namespace: NanoByte.Common.Net
Assembly: NanoByte.Common.dll
Syntax
public static class NetUtils : Object
Properties
IsInternetConnected
Determines whether an internet connection is currently available. May return false positives.
Declaration
public static bool IsInternetConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
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()
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.