Interface IProxyConnector
- Namespace
- VpnHood.Core.Proxies.Management.Abstractions
- Assembly
- VpnHood.Core.Proxies.Management.Abstractions.dll
Defines how the VPN connects to its servers through proxies: through one given proxy, or through a managed list that rates and rotates its endpoints.
public interface IProxyConnector : IAsyncDisposable
- Inherited Members
Properties
IsEnabled
Gets a value indicating whether the connector has a proxy to connect through.
bool IsEnabled { get; }
Property Value
Progress
Gets the progress of a check of the endpoints under way, or null.
ProgressStatus? Progress { get; }
Property Value
Status
Gets the connector's state, made at each read.
ProxyConnectorStatus Status { get; }
Property Value
UseRecentSucceeded
Gets or sets a value indicating whether connections use only the endpoints that have succeeded since the connector was made, where there is a list to choose from.
bool UseRecentSucceeded { get; set; }
Property Value
Methods
CheckServers(ISocketFactory, CancellationToken)
Checks the endpoints, where the connector has a list to check, and records what it finds.
Task CheckServers(ISocketFactory socketFactory, CancellationToken cancellationToken)
Parameters
socketFactoryISocketFactoryThe factory of the sockets to the proxies, which keeps them out of the tunnel.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.
ConnectAsync(ISocketFactory, IPEndPoint, Action?, CancellationToken)
Connects to an endpoint through a proxy.
Task<TcpClient> ConnectAsync(ISocketFactory socketFactory, IPEndPoint ipEndPoint, Action? onAttempt, CancellationToken cancellationToken)
Parameters
socketFactoryISocketFactoryThe factory of the sockets to the proxies: the caller's, which keeps them out of the tunnel.
ipEndPointIPEndPointThe endpoint to reach through the proxy.
onAttemptActionCalled after each proxy the connector tried, or null.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task<TcpClient>
A task whose result is the connection, through the proxy, which the caller owns. Its stream is the raw TCP one, not an HTTPS proxy's TLS tunnel.
Flush(CancellationToken)
Saves the endpoints' statuses not saved yet, where the connector keeps any.
Task Flush(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.
RecordFailed(TcpClient, Exception)
Records a failure of a connection ConnectAsync(ISocketFactory, IPEndPoint, Action?, CancellationToken) made, after it was made, as in a TLS handshake over it, against the proxy that made it.
void RecordFailed(TcpClient tcpClient, Exception ex)
Parameters
UpdateOptions(ProxyOptions, CancellationToken)
Takes new options.
Task UpdateOptions(ProxyOptions proxyOptions, CancellationToken cancellationToken)
Parameters
proxyOptionsProxyOptionsThe options.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.