Click here to Skip to main content
15,881,173 members
Articles / Programming Languages / C#

Tor.NET - A managed Tor network library

Rate me:
Please Sign up or sign in to vote.
4.96/5 (51 votes)
26 Jan 2016CPOL25 min read 160.4K   5.1K   68   64
A managed library to launch and/or connect to the Tor network for SOCKS5 communications, and for middle-man proxy hosting.

Image 1 

Table of Contents

  1. Introduction
  2. Background
    1. What is Tor?
    2. What security does Tor offer for my communications?
    3. How trustworthy are routers in the Tor network?
    4. What support is there for Tor?
    5. Why can I not use Tor directly as a HTTP proxy?
  3. Requirements
  4. Understanding the Protocols
    1. The SOCKS Port
    2. The Control Port
  5. Using the Code
    1. Getting Started
    2. Configuring the Process
    3. Using the Web Proxy
    4. Using the SOCKS5 Proxy
    5. Controlling the Process
    6. Monitoring the Process
    7. Monitoring the Logs
  6. Testing
  7. References
  8. History

Introduction

The Tor network is an ever-expanding and extremely useful utility for communicating over the network. It provides a means to not only assist in the masking of data transmission, but also serves as a method for accessing content or network destinations which would otherwise be unavailable.

The Tor process is not difficult to understand. The process listens for socket connections on two ports: the SOCKS port, and the control port. Using these ports we are able to request connection to any address (which an exit node in a circuit has access to), and control the Tor process.

The purpose of this library is to provide a managed solution for automating some of the tasks which are available using the Tor process, and to also educate on the internal processes which take place to make such a network possible.

Background

What is Tor?

Tor is a sophisticated and well-established network of routers (otherwise known as relays) which serve to route network communications, rather than connecting directly to a destination end-point. Put simply, it is a series of computers which are connected around the world, which take data and play a network equivelant of "pass the parcel".

Tor is comprised of routers which, together, form circuits. A circuit is a chain of routers which can be used to connect to a destination IP address and port number, which will securely move information between the client and server. The router which handles the actual connection to the destination is considered the "exit node", as this is the last router in the circuit which will handle the request.

When circuits have been built by the Tor process, an "OR connection" is created for one (or more) of the circuits. This OR connection is used by the application for all requests until either the circuit is closed (it expires, is manually closed, or an error occurs causing it to close) or the circuit is considered ill-equipped to handle the load requested.

A single OR connection can host multiple "streams". These streams are the communications which transport data from the client to the server. The streams often tend to have short life-spans, as some will timeout from inactivity, while others may be closed by the server. However, if a stream is closed, this does not necessarily mean that the parent OR connection will be closed.

Image 2

What security does Tor offer for my communications?

Tor is designed to encrypt content as it passes between routers. When the initial request is created and the first packet of data is transmitted, the data is encrypted before being dispatched. The Tor process generates different encryption keys for each router along the circuit so that the source of the packet remains obfuscated.

Each router along a circuit can see no further than one "hop" along the circuit. A hop is the number of routers within a chain. A router in the middle of a circuit is only able to see the previous router, and the next router: it does not understand where the original request came from.

This method of using routers along a chain assists in obfuscating where the packet originated from, and in securing the content of the packet. A malicious third-party monitoring network communications from your PC may be able to decipher information on a HTTP request by checking both the target IP address (and port number) for which a socket is connecting, and by analysing the HTTP header data (even over HTTPS a CONNECT request is dispatched indicating connection to an address.)

Using the Tor network, a request to a destination IP address (and port number) can be encrypted before even leaving your PC. From a third-party monitoring your network communications, this would be difficult to decipher. Furthermore, the third-party would only know the IP address of the first router within the circuit.

How trustworthy are routers in the Tor network?

Standard routers on the Tor network function only as middle-men, moving data from one router to another. These routers are not "exit nodes", and have no understanding of the content being transmitted (as the data is encrypted, the content is difficult to decipher.)

Exit nodes, however, are responsible for dispatching the content to the destination address. This means that the exit node must have the capability to decrypt the information which was transmitted, potentially exposing your data. Furthermore, the exit node has knowledge of the IP address and port you wish to connect to, further exposing the content of your request.

The simple response is that using Tor is a risk which may or not be taken. It should not be used to transmit highly sensitive data with the knowledge that a malicious exit node could retain any information transmitted (though HTTPS requests perform over the Tor network decrease the risk.) An exit node does not understand where the data was transmitted from, or where it is sending a response to, but it could certainly be manipulated to analyse the contents of the request in order to extract sensitive information (eg. bank details.)

What support is there for Tor?

Tor has become an exceptionally popular utility for users to interact securely over the internet. Recent events (which shan't be mentioned here) have increased interest in increasing secure internet browsing, and for obfuscating content of requests.

This does not mean, however, that Tor is accepted as a universal solution to third-party monitors. There are some ISPs and websites which denounce the use of Tor as a network protocol, and actively attempt to suppress it's use. Some websites will block access if the Tor network is detected as the connection source, while some ISPs aim to block ports and communications which may be sourced from Tor.

That being said, however, the Tor network is expanding constantly. New routers and exit nodes are constantly rotating and being added in order to increase distribution: the greater the Tor network grows in size, the less likely an ISP or website is to detect that the service is the communications protocol.

Why can I not use Tor directly as a HTTP proxy?

This is a common misconception. Some people attempt to launch the Tor process on their local machine, giving the process a port number for the SOCKS port, and then configure their browser to point to the Tor process. This will not work.

Tor is a SOCKS proxy which means that it is able to connect to IP addresses and ports, but it does not understand HTTP requests. A SOCKS proxy has a series of protocols which must be followed explicitly before a connection can be established. In typical SOCKS proxies, there may be additional authentication (using credentials) which would be required before any connection attempts can even start. Tor, however, does not require any credentials when connecting.

The primary difference between a SOCKS proxy and HTTP proxy is that the latter understands HTTP requests. A HTTP proxy is capable of analysing the headers of a HTTP request to determine where information should be routed, and performs all of the operations associated with transmitting HTTP data to and from a server.

A SOCKS proxy can only do as it is instructed. It is informed that a connection is required to a certain address, after which it will attempt to establish the connection. If the connection fails, it will respond with an error packet structured according to the SOCKS protocol. If the connection succeeds, it will serve as a "buffer" stream sitting between the client and server. When the SOCKS proxy receives data, it forwards that content immediately to the opposing connection.

Therefore, when attempting to use Tor as a web proxy, it will fail because it requires a series of commands to be executed against it before it can be utilised. This managed library is designed to bridge the gap between the two.

Requirements

This library functions as a wrapper or container for the Tor process. It is responsible for connecting to, and optionally launching, the Tor application, and providing interfaces for monitoring the state of the service, and to communicate over the network.

To begin, you will need to download a copy of the Tor application. This can be done by following the instructions below:

  1. Navigate to the Tor download page.
  2. Expand the "Microsoft Windows" option.
  3. Download the "Expert Bundle"

The Expert Bundle contains all of the Tor application files, excluding the configured browser. These files are all that are necessary to begin using the Tor network with this library.

Image 3

This library requires that the path to the tor.exe executable is specified when creating a new client. Therefore, it is recommended that files included in the aforementioned bundle are either included as part of the project (with the copy setting set to Always) or are extracted to a common location where it will be accessible (program data, application data etc.)

The bundle includes the executable file which will be launched when creating our Tor network client, and includes two geographical IP address files, which can be used when resolving IP addresses to relative country codes.

Note

The Tor.NET library requires a minimum version of 0.2.0.9, as this version introduced v3 directory structures to several of the control commands. Any less than this version and the client will throw an exception.

Understanding the Protocols

The two hosted ports use different protocols for communication. The SOCKS port uses the SOCKS5 protocol standard, while the control port uses a series of ASCII communications. This section details the protocols implemented which allow the Tor.NET library to utilise the process.

The SOCKS Port

The SOCKS port hosted by the Tor process requires the use of the SOCKS5 protocol. As mentioned before, this is no straight-forward "connect and send" port, but requires some handshaking in order to establish a connection and route the data. The SOCKS5 protocol is described in full on the Internet Engineering Task Force website. But for simplicity sake, I shall briefly summarise the procedure.

When a socket is accepted on the SOCKS port, the client sends a request describing how our connection is being established. This takes the form of the bytes:

05 01 00

The 05 indicates that the socket version we're using is SOCKS5 (this would be 4 for SOCKS4.) The 01 indicates that we are providing one connection "method", which is sent as 00. A method of 00 indicates to the proxy that we are not sending any authentication method (Tor does not require proxy credentials.)

The client receives the response back from the proxy, where we expect that the socket version and accepted method align with the values dispatched. A valid response would be:

05 00

This indicates that SOCKS5 was accepted, and that the connection method was accepted as 00 (no authentication.) Any other values than these will fail.

The client then sends a request to connect to a specified target IP address and port number. This command dispatched is formatted as so:

05 01 00 01 XX XX XX XX YY YY

The 05 again indicates the socket version. The proceeding 01 indicates that the proxy should connect to a specified target. The 00 is a reserved field which is currently unused. The 01 field indicates that the address is being sent as a IPv4 address. The XX values specify the bytes corresponding to the IP address, and the YY values specify the port number.

If the address is being sent as a string (for instance, if we are specifying that the proxy should connect to a domain name, rather than an IP address) then the 01 stored in the fourth byte is changed to 03, which indicates a string length and string will proceed.

05 01 00 03 XX YY YY YY .. ZZ ZZ

In the above, the XX value indicates the number of bytes representing the address string. The YY values are the individual bytes for each character in the address. The final ZZ values specify the port number.

Once either of the above commands are sent, the client then reads the response of the connect command. The response returned back contains information on the IP address and port number which was connected to. The client already understands where it was connecting to, so it discards the values (but removes them from the buffer of the socket.)

When the connection response is received and has been validated as successful, the connection is now ready to begin exchanging data, Any bytes which are written to the proxy connection will be forwarded to the destination end-point, while bytes read from the connection are forwarded onto the client.

The implementation of this protocol is managed in the ForwardSocket and Socks5Processor classes.

The Control Port

The control port is hosted by the Tor process which functions solely as a method of interacting with the service. It does not provide any methods for establishing communications over the network, but enables interested parties to monitor for certain events, configure the client, and collect data.

The port uses standard ASCII communications: receiving textual commands and responding with text. The port almost always responds with a status code indicating the success or failure of a received command, followed by the response content. Each line is delimited using a line-feed and carriage-return, but the content of the response may span across one or more lines. This can be further determined by analysing the character returned immediately following the status code.

250 OK

The above response will be returned when a command has been received and processed. If the command was requesting information, the OK may be replaced with the response content, but it will not span over one line. The client is able to determine that this is a single-line response because a space follows the 250 status code.

250-Name=Value
250-Name=Value
250 OK

The above response indicates a series of values split over multiple lines. When the above is received, the hypen (or minus symbol) following the 250 status code indicates that the response continues on the next line. These responses are expected when dealing with commands which request multiple values. The Tor process splits the values onto multiple lines for easier processing, and to manage whitespace effectively.

250+Name=
Value 1
Value 2
.
250 OK

The above response is received when a command requests information which will almost certainly span more than one line. The multi-line response is determined by the plus symbol following the 250 status code, which informs the connected client to continue reading lines until a single period symbol is matched. The period symbol can be omitted as part of the content, but all lines prior to the symbol should be processed.

Connection to the control port requires opening a socket to the IP address and port number using the TCP protocol. The Tor process only supports TCP communications.

C#
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect("127.0.0.1", 9051);

Once connected the control port will immediately expect authentication. No other command may be dispatched to the control port until the authentication command is received. The password for authentication correlates to whatever HashedControlPassword has been configured against the process. If no control password has been assigned to the process, a blank value will be accepted.

C#
byte[] command = Encoding.ASCII.GetBytes("authenticate \"\"\r\n");
socket.Send(command);

The control port will validate the password and return a response indicating whether authentication was successful. A 250 status code indicates that the control port may now be used; otherwise, a 515 status code indicates failure.

C#
byte[] buffer = new byte[128];
int received = socket.Receive(buffer);

if (received != 0)
{
    string response = Encoding.ASCII.GetString(buffer, 0, received);

    if (response.StartsWith("250"))
        ; // success
    else
        ; // failure
}

After authentication, any of the supported control commands may now be sent to the control port, and monitored for responses. The full list of commands supported by the Tor process are documented in the Tor control specification.

Using the code

Getting Started

As mentioned previously, once the files are available in an accessible location, the client can be created. The library contains a Client class which serves as the managed wrapper for a Tor process. The Client class can be launched by invoking the Image 4 Create or Image 5 CreateFrom methods, which launch and connect to a new process, or connect to an existing process, respectively.

Launching a new Tor process

Launching a new Tor process will be necessary if it has not been installed as a system service, and if you are not connecting to an existing instance. In order to launch a new process you will need to call the Image 6 Create() method, supplying a ClientCreateParams object into the method.

C#
ClientCreateParams createParams = new ClientCreateParams();
createParams.ConfigurationFile = "/path/to/config/file";
createParams.DefaultConfigurationFile = "/path/to/default/config/file";
createParams.ControlPassword = "";
createParams.ControlPort = 9051;
createParams.Path = "/path/to/tor/exe";

Client client = Client.Create(createParams);

The client create parameters requires that the control port and application path are assigned. The control port passed into the Client object will always override whatever value is stored in the configuration files, because the library requires access to the control connection of the Tor process.

The configuration file is the path to a compatible, formatted document containing the configurations which Tor should use. Similarly, the default configuration file is a document containing the values to use when the corresponding value is not found in the configuration file. These two parameters are not required, but are useful if you plan to pre-configure your Tor client with settings.

The control password is used when authenticating with the Tor control connection. Tor does not use a control password by default, so this can be null or blank. However, if a control password has been assigned (using the HashedControlPassword configuration) then this property will need to contain the plain-text version of the password.

The library will validate the control port and application path prior to attempting to launch the process. If the process fails to launch due to permission issues or configuration issues, then it will throw a TorException.

Note

Windows Vista, 7, 8, and 10 may require additional privileges to launch a new process. If this is the case, ensure that the application manifest file specifies that the process will require elevated privileges. When debugging an application which launches the Tor process, you will need to run Visual Studio under an Administrator account. 

Connecting to an existing Tor process

To connect to an existing Tor process, the Image 7 CreateFrom() method will need to be invoked with a ClientRemoteParams object. Unlike the create parameters, you do not need to specify an executable path, or the configuration file values. Instead, a valid address must be provided which is hosting the Tor process. If the process is being hosted on the local machine, this IP address should be 127.0.0.1

C#
ClientRemoteParams remoteParams = new ClientRemoteParams();
remoteParams.Address = "127.0.0.1";
remoteParams.ControlPassword = "";
remoteParams.ControlPort = 9051;

Client client = Client.CreateFrom(remoteParams);

The control port should be that hosted by the remote Tor process. Since we are not launching a new Tor process we have no control of the control port number. Instead, you may need to manually read the Tor configuration file, or have an indication of which port number the Tor process was configured to.

Setting configuration values on launch

When launching a new Tor process, it is possible to override other configurations which exist within the configuration file, by using these values as command line arguments. For instance:

tor.exe --AvoidDiskWrites 1

The above will always override the AvoidDiskWrites configuration stored within the configuration files. This is useful for customising the process prior to being launched. Furthermore, this allows for changing the SOCKS port and control port values.

To send in configuration overrides when creating the process, the method Image 8 SetConfig() can be invoked with the target configuration and value. The value passed into this method should align with the type specified in the Tor.Config.Configuration class. For example:

createParams.SetConfig(ConfigurationNames.SocksPort, 8888);
createParams.SetConfig(ConfigurationNames.AvoidDiskWrites, true);

The above will launch the Tor process listening for SOCKS connections on port 8888, and will override the AvoidDiskWrites configuration specified in the configuration files. If an invalid value is passed into the value field (for instance, if a string is passed into a configuration expecting an integer) then an exception will be thrown.

Configuring the Process

The Client class contains different properties for interacting with the service in different ways. The Image 9Configuration property allows the user to change the configurations of the process after the process has been launched. Changing a configuration value will cause the client to dispatch the new value to the Tor process.

C#
client.Configuration.AvoidDiskWrites = true;
client.Configuration.FascistFirewall = true;

When the above properties are assigned, each assignment will result in the Configuration class connecting to the Tor control port and sending a "setconf" command. This command informs the Tor process to update the configuration it currently holds. These values are retained in memory, but do not affect the content of the configuration files. The command dispatched looks similar to below:

setconf AvoidDiskWrites=1
setconf FascistFirewall=1

In order to save the new configuration values to the configuration file of the process, the Image 10 Save() method must be called. This will dispatch a "saveconf" command to the control port, informating the Tor process that the values need serializing to the file.

C#
client.Configuration.Save();

The client is also responsible for monitoring for external changes to the configurations. It is entirely possible for more than one client to be connected to a Tor control port at any given time, which means that the configurations of the process can be changed using "setconf" commands. In order to synchronize the configurations with the process, the Configuration class listens for "CONF_CHANGED" events, and automatically updates whenever a value has been changed.

The client supports a handful of configurations, but not all values are supported. For a list of supported configurations, consult the Configuration class for the list. The list can be extended by implementing new ConfigurationNames and implementing the associated properties, however some features are completely unsupported at this stage (for instance, lists of values.)

For some configurations which use objects, in place of primitive types, converters had to be created to convert the values from objects to strings. This was accomplished by using the TypeConverter class, which is referenced in the Image 11 ReflectionHelper.Convert() method for converting values to and from string values. When implementing further objects for configurations, the TypeConverter method should be used for automatic detection.

Using the Web Proxy

As mentioned previously, the Tor network is not designed for immediate HTTP proxy communications. Instead, a web-proxy must implemented. The Tor.NET library implements a custom proxy system to handle the conversion from standard SOCKS communications to HTTP.

In order for the system to work, a TCP listener is created on a configurable port. The Client class contains a Image 12 Proxy property which contains the logic for hosting the TCP listener, with a configurable Image 13 Port property. By default, the Proxy class listens for connections on port 8182, but this can be adjusted afterward.

C#
client.Proxy.Port = 9989;

This will shut down the current TCP listener and recreate it using the new port. This will not affect connections already accepted by the previous TCP listener.

Using the web-proxy is as simple as accessing the Image 14 Proxy.WebProxy property. This is an implementation of the IWebProxy interface, which is supported by HttpWebRequest objects.

C#
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://domain.com");

if (client.Proxy.IsRunning)
    request.Proxy = client.Proxy.WebProxy;

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
    if (response.StatusCode == StatusCode.OK)
        ; // success
}

The above will work provided that the Tor.NET library was able to host a TCP listener on the specified proxy port. The Image 15 IsRunning property assists in determining whether TCP connections are being accepted by the proxy.

Using the SOCKS5 Proxy

In addition to using the Tor.NET library as a HTTP proxy, there is also direct support for the SOCKS protocol. This may be used when performing other network requests which might not necessarily be HTTP requests. For instance, it would be possible to connect to an IRC network using the SOCKS protocol, provided that the IRC network has not blocked known Tor exit nodes.

C#
using (Stream stream = client.GetStream("12.34.56.789", 1234))
{
    stream.Write(..);
    stream.Read(..);
}

The Image 16 GetStream() method accepts a host address and port number to connect to. The Tor.NET library will perform all handshakes associated with connecting to the target address, and open a stream for communication.

Controlling the Process

The Client class contains a Image 17 Controller property which provides some methods for controlling elements of the service. The methods available in the class are designed to automate the connection to the control port, and the dispatch of commands. These methods also perform validation on the parameters provided.

Image 18 CleanCircuits()

This informs the service that new requests should be routed through new circuits. This prevents new requests from re-using older circuits which have been used before. This also performs a clear of the client-side DNS cache.

Image 19 CleanDNSCache()

This causes the service to clear the client-side DNS cache for hostnames.

Image 20 CloseCircuit(Circuit)

This closes a circuit if it has not yet been closed, and has not failed. A closed circuit can no longer be used by Tor to generate OR connections or communicate streams.

Image 21 CloseStream(Stream, StreamReason)

This closes a stream if it has not yet been closed, and has not failed. This is the equivelant of terminating a socket connection.

Image 22 CreateCircuit()

This informs the service that a new circuit should be built, and that the service should be responsible for choosing which routers to use.

Image 23 CreateCircuit(string[])

This functions the same as the Image 24 CreateCircuit() method, however the method accepts an array containing nicknames or fingerprints of routers which it should use when building the circuit.

Image 25 ExtendCircuit(Circuit, string[])

This functions near the same as the the CreateCircuit(string[]) method, except that the routers specified in the argument list will be appended onto the end of an existing circuit.

Monitoring the Process

In additional to being able to control the process, the client operates event monitoring in the background to synchronize circuit, OR connection, and stream information. This works by opening a constant connection to the control port and dispatching a "setevents" command. This informs the Tor process to report events which occur in the system, such as when a circuit is built or closed, or when connections or streams change.

In order to benefit from real-time updates, event handlers can be registered against events in the Image 26 Status property of the Client class. The events which can be monitored are as follows:

Image 27 BandwidthChanged

This is raised whenever the download and update rates, estimated for within the last second, have changed within the Tor service. When requests are being dispatched across a connection these values reflect the number of bytes downloaded and uploaded, on average, since the last event.

Image 28 CircuitsChanged

This is raised whenever circuits have been altered in the Tor service. When the event is raised, this signals that the Image 29 Circuits property contains new information.

Image 30 ORConnectionsChanged

This is raised whenever OR connections have been altered in the Tor service. When the event is raised, this signals that the Image 31 ORConnections property contains new information.

Image 32 StreamsChanged

This is raised whenever streams have been altered in the Tor service. When the event is raised, this signals that the Image 33 Streams property contains new information.

The Status property also provides basic properties and methods for retrieving the current status of the service. For instance, the Image 34 GetAllRouters() method is an expensive function which downloads a complete register of all routers which the Tor process cares to know about.

The properties all perform requests to the control port, so execution may not be instantaneous. If the Tor client cannot connect to the control port of the Tor process, then these values may not be representative of the actual values in the process.

There are events which have not been implemented which could easily be integrated into the library. For instance, the "ADDRMAP" event is raised when an address has been resolved.

Monitoring the Logs

The Tor application generates internal log messages which can be received through the control port. This information can be useful for diagnosing issues with the client. The available logging levels are:

  • Debug
  • Notice
  • Info
  • Warn
  • Error

Each logging level is registered using the "setevents" command, and the responses are routed through the Image 35 Logging property within the Client class. This property contains events for automatically registering interest in any of the above log messages. Each event raised contains an EventArgs class implementation (LogEventArgs) containing the message which was received.

Registering the notifications for any of the specified log levels is as simple as adding event handlers to the corresponding event. If you wish to unsubscribe from log messages, ensure that all event handlers are removed from an event.

client.Logging.DebugReceived += (s, e) => Console.WriteLine("[DEBUG] " + e.Message);
client.Logging.ErrorReceived += (s, e) => Console.WriteLine("[ERROR] " + e.Message);
Note

This feature is available in Tor.NET 1.0.2 onwards.

Note

Using the logging feature can impact performance of the Tor.NET client, and associated event dispatchers. It is recommended to avoid registering for log messages for all except "Error" and "Warn".

Testing

The attached project file contains a Tor.Tests project, containing a simple WinForms application which utilises the Tor.NET library. It launches the Tor process and registers event handlers against the Image 36 Status property. There is also a PropertyGrid control connected to the Image 37 Configuration property, so that the configurations of the application can be played with.

Image 38

The Program.cs file contains a host of imports and structures for native internet control. These methods are used to set the default proxy for the application, which instructs the WebBrowser control to route requests through the Tor proxy. If intending to use the Tor.NET library with the WebBrowser control, I recommend copying the code from this class and integrating it into your application.

Points of Interest

This library was designed as an entry point to using the Tor network. There are control commands and events which have not been implemented, and the primary reason for this is that implementing all possible methods would result in an enormous library, saturated with methods and events. I have tried to keep the library relatively small, and relatively simple, as it is primarily designed to launch the Tor process and provide a bridge for communications.

That being said, if demand becomes high for the addition of extra features, events, and configurations, then I may extend the capabilities of the library as such.

References

History

  • Version 1.0.0 - Initial version of Tor.NET and article
  • Version 1.0.1 - Library update for fixes and additions:
    • Fixed an issue where using a "remote" client ignored the target address.
    • Added configurations "CircuitBuildTimeout", "CircuitIdleTimeout", "HardwareAcceleration", "LearnCircuitBuildTimeout"
  • Version 1.0.2 - Library update for fixes and additions:
    • Fixed an issue where client would never close the process unless Dispose() was raised.
    • Fixed an issue where a null router response would raise an exception in the Circuit class.
    • Added logging event handling.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
United Kingdom United Kingdom
Software developer for 18 years, established in both Java and C# development. Ambitious, rambunctious, perhaps a little bit impracticable. Spaghetti toast.

Comments and Discussions

 
Questionis it connect using same ip or generate new one? Pin
is_vlb5028-Aug-20 2:07
is_vlb5028-Aug-20 2:07 
QuestionVB.NET Port Pin
Fox Chronos22-Jun-20 22:13
professionalFox Chronos22-Jun-20 22:13 
GeneralMy vote of 5 Pin
NaMaCk2-May-19 6:10
NaMaCk2-May-19 6:10 
QuestionCan this library be used with .NET framework version 2? If not, how hard would it be to alter? Pin
Member 1419258122-Mar-19 7:22
Member 1419258122-Mar-19 7:22 
QuestionLimit Access to Tor client Pin
Member 1302537829-Jun-18 5:24
Member 1302537829-Jun-18 5:24 
QuestionExample doesn't work; doesn't use TOR Pin
Member 122828727-Dec-17 3:24
Member 122828727-Dec-17 3:24 
AnswerRe: Example doesn't work; doesn't use TOR Pin
Rob Rook20-Dec-17 12:50
Rob Rook20-Dec-17 12:50 
NewsTor proxy app Pin
aspriddell19-Aug-17 9:28
aspriddell19-Aug-17 9:28 
QuestionNot able to use dynamic proxy in console app using TorClient.Proxy.WebProxy; Returns my own IP [see below code] Pin
kulesh jha3-Jul-17 23:38
kulesh jha3-Jul-17 23:38 
QuestionDoesn't work with HttpWebRequest :( Pin
Member 131032383-Apr-17 10:25
Member 131032383-Apr-17 10:25 
AnswerRe: Doesn't work with HttpWebRequest :( Pin
Rob Rook20-Dec-17 12:51
Rob Rook20-Dec-17 12:51 
Question[Answered] How can I run multiple TOR instances? Pin
PsykotropyK11-Mar-17 14:03
PsykotropyK11-Mar-17 14:03 
AnswerRe: How can I run multiple TOR instances? Pin
PsykotropyK12-Mar-17 14:16
PsykotropyK12-Mar-17 14:16 
GeneralNice library, but it seems it does not work with new "tor" version Pin
Member 36013453-Mar-17 6:18
Member 36013453-Mar-17 6:18 
QuestionSystem.FormatException Pin
Jimmy Watson20-Dec-16 1:46
Jimmy Watson20-Dec-16 1:46 
QuestionSystem.NullReferenceException: 'Object reference not set to an instance of an object.' Pin
Dương Thái15-Dec-16 10:41
Dương Thái15-Dec-16 10:41 
QuestionSimple test fails (IP does not change) Pin
Ádám Ficsór12-Dec-16 8:03
Ádám Ficsór12-Dec-16 8:03 
QuestionPlease add support for StrictNodes, ExitNodes, EntryNodes, ExcludeNodes Pin
duketwo20-Oct-16 10:08
duketwo20-Oct-16 10:08 
QuestionTor error Pin
Member 1258453522-Sep-16 2:41
Member 1258453522-Sep-16 2:41 
QuestionShow an example of the use of web proxy Pin
Member 1168546517-Sep-16 2:40
Member 1168546517-Sep-16 2:40 
AnswerRe: Show an example of the use of web proxy Pin
Chris Copeland23-Sep-16 3:20
mveChris Copeland23-Sep-16 3:20 
GeneralRe: Show an example of the use of web proxy Pin
Member 1168546523-Sep-16 5:57
Member 1168546523-Sep-16 5:57 
QuestionUploaded on Github Pin
Sharp Browser13-Aug-16 22:15
Sharp Browser13-Aug-16 22:15 
AnswerRe: Uploaded on Github Pin
Chris Copeland23-Sep-16 3:18
mveChris Copeland23-Sep-16 3:18 
AnswerRe: Uploaded on Github Pin
PsykotropyK12-Mar-17 14:27
PsykotropyK12-Mar-17 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.