Namespace NanoByte.Common.Net
Network communication and credential handling.
Downloads
DownloadFile downloads a file via HTTP(S) as an ITask, providing progress reporting and cancellation via the standard task system.
HttpClientExtensions adds helper methods on top of HttpClient.
Credentials
ICredentialProvider abstracts the source of HTTP credentials, decoupling network code from any specific UI or storage backend. Implementations include:
- NetrcCredentialProvider reads credentials from a
.netrcfile (parsed via Netrc). - WindowsCliCredentialProvider prompts the user on the console using the Windows Credential Manager UI.
- WindowsGuiCredentialProvider prompts the user with a graphical credential dialog.
- WindowsNonInteractiveCredentialProvider reads stored credentials from the Windows Credential Manager without prompting.
API
Classes
- AnsiCliCredentialProvider
Asks the user for NetworkCredentials using an ANSI console prompt.
- DownloadFile
Downloads a file from a specific internet address to a stream.
- HttpClientExtensions
Provides extension methods for HttpClient and related classes.
- HttpServer
A simple HTTP server.
- MicroServer
A minimalistic HTTP server that only serves a single file on localhost. Useful for unit tests.
- NetUtils
Provides helper methods for the System.Net subsystem.
- Netrc
Represents data loaded from a .netrc file as a map from host names to credentials.
- NetrcCredentialProvider
Gets credentials from Netrc if possible. Falls back to another provider otherwise.
- NetworkCredentialExtension
Provides extension methods for NetworkCredentials.
- UriExtensions
Provides extension methods for Uris.
- WebProxyExtensions
Provides extension methods for IWebProxys.
- WindowsCliCredentialProvider
Asks the user for NetworkCredentials using the Windows Credential Manager command-line interface.
- WindowsCredentialProvider
Gets NetworkCredentials using the Windows Credential Manager.
- WindowsGuiCredentialProvider
Asks the user for NetworkCredentials using the Windows Credential Manager GUI.
- WindowsNonInteractiveCredentialProvider
Gets NetworkCredentials stored in the Windows Credential Manager. Does not prompt for new credentials.
Interfaces
- ICredentialProvider
Asks the user or a keyring for NetworkCredentials for specific Uris.
Enums
- Connectivity
State of a network connection.