using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace Tor.Proxy
{
///
/// A class which implements the interface to provide routing of HTTP requests.
///
public sealed class Socks5Proxy : IWebProxy
{
private readonly Client client;
private ICredentials credentials;
///
/// Initializes a new instance of the class.
///
/// The client for which this object instance belongs.
internal Socks5Proxy(Client client)
{
this.client = client;
}
#region Properties
///
/// The credentials to submit to the proxy server for authentication.
///
public ICredentials Credentials
{
get { return credentials; }
set { credentials = value; }
}
#endregion
///
/// Returns the URI of a proxy.
///
/// A that specifies the requested Internet resource.
///
/// A instance that contains the URI of the proxy used to contact .
///
public Uri GetProxy(Uri destination)
{
return new Uri(string.Format("http://127.0.0.1:{0}", client.Proxy.Port));
}
///
/// Indicates that the proxy should not be used for the specified host.
///
/// The of the host to check for proxy use.
///
/// true if the proxy server should not be used for ; otherwise, false.
///
public bool IsBypassed(Uri host)
{
return client.Proxy.IsRunning;
}
}
}