473,791 Members | 2,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advice on a TCP passthru daemon for HTTP proxy rotation

Hey there

Soon we will have many squid proxies on many seperate connections for use
by our services. I want to make them available to users via a single HTTP
proxy - however, I want fine-grained control over how the squid proxies
are selected for each connection. This is so I can collect statistics,
control usage on each proxy, monitor what's going on - etc. However I
don't want to implement the HTTP proxy protocol in Python, and would
much rather let my daemon run as a man-in-the-middle for TCP, similar to
this netcat command:

rob@aranea:~$ mknod backpipe p
rob@aranea:~$ nc -l -p 8080 < backpipe | nc ganesh 8080 backpipe

Basically when my daemon received a connection (call it "c1"), it makes a
connection to one of my squid proxies ("c2"), then all data which gets
read from c1 is written to c2 - all data read from c2 is written to c1.
I'm pretty sure there's an elegant way to do this but I was wondering if
anyone had any input? I've tried GIYF'ing this but it's difficult to
search for :P

Thanks guys

-Rob
Aug 10 '06 #1
2 2899

Robin Haswell wrote:
Hey there

Soon we will have many squid proxies on many seperate connections for use
by our services. I want to make them available to users via a single HTTP
proxy - however, I want fine-grained control over how the squid proxies
are selected for each connection. This is so I can collect statistics,
control usage on each proxy, monitor what's going on - etc. However I
don't want to implement the HTTP proxy protocol in Python, and would
much rather let my daemon run as a man-in-the-middle for TCP, similar to
this netcat command:

rob@aranea:~$ mknod backpipe p
rob@aranea:~$ nc -l -p 8080 < backpipe | nc ganesh 8080 backpipe

Basically when my daemon received a connection (call it "c1"), it makes a
connection to one of my squid proxies ("c2"), then all data which gets
read from c1 is written to c2 - all data read from c2 is written to c1.
I'm pretty sure there's an elegant way to do this but I was wondering if
anyone had any input? I've tried GIYF'ing this but it's difficult to
search for :P
Maybe this is what you're looking for:

http://aspn.activestate.com/ASPN/Coo.../Recipe/483732

Regards,
Rob

Aug 10 '06 #2
Robin Haswell wrote:
Hey there

Soon we will have many squid proxies on many seperate connections for use
by our services. I want to make them available to users via a single HTTP
proxy - however, I want fine-grained control over how the squid proxies
are selected for each connection. This is so I can collect statistics,
control usage on each proxy, monitor what's going on - etc. However I
don't want to implement the HTTP proxy protocol in Python, and would
much rather let my daemon run as a man-in-the-middle for TCP, similar to
this netcat command:

rob@aranea:~$ mknod backpipe p
rob@aranea:~$ nc -l -p 8080 < backpipe | nc ganesh 8080 backpipe

Basically when my daemon received a connection (call it "c1"), it makes a
connection to one of my squid proxies ("c2"), then all data which gets
read from c1 is written to c2 - all data read from c2 is written to c1.
I'm pretty sure there's an elegant way to do this but I was wondering if
anyone had any input? I've tried GIYF'ing this but it's difficult to
search for :P
Try searching for "port forwarding". Basic port forwarding is
a straightforward sockets programming exercise, but there are
trickier considerations in building it to face the Internet
and front a large number of of servers. Sounds like your TCP
proxy will be a potential single point of failure, and is the
first machine to which users connect. Not the place to try
out new stuff.

You might look into existing proxies and "load balancers"
before coding your own. There's no rule against fronting
Squid proxies with Squid proxies. You may want different
statistics from what they log, but proxying at the TCP
level, you're limited as to what information you can get.

May I ask why you need many Squid proxies? Unless you're
using them to terminating SSL/TLS connections, just one of
them can probably out-run a Python port-forwarder. Squid
usually serves a large percentage of the volume from its
memory cache, while a port forwarder has to read it all
from TCP connections, which is more work.
--
--Bryan
Aug 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7172
by: Rafal 'Raf256' Maj | last post by:
Hi, Warning: passthru() has been disabled for security reasons in ... how can I change my php.ini file (php4/apache/winxp server) to enable this function? How can I best work around if I can't use this function? -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~l-.~~~~~~~~~~~~~~~~~~~
0
2217
by: Yemi | last post by:
Hi There. I seem to be getting some inconsistent results when using passthru() in safe mode. They appear to be related to the fact that passthru should treat all command arguments as one single argument when safe mode is on. Everything works just fine on my MacOS X webserver ( Apache 1.3.29 with PHP 4.3.6 ). But on my Linux Enterprise 3.0 production server (running Apache 2.0.46 with PHP 4.3.2) things are different.
3
3387
by: Jerry | last post by:
I've found a problem with exec, passthru, shell_exec & system. I'm trying to run the following exec("sort -r -n -k2,2 r1.txt > r2.txt") with r1.txt being a numeric file. The file looks like this: 237 291 845 152 585 3 193 810 173 484 151 3
2
5295
by: Greg Chapman | last post by:
I am at my wit's end trying to get information out of Streamline.net's support dept about my problem. They reply quickly enough, but seem to try and give out the least possible amount of info each time. The transcript so far is reproduced for your amusement below. To summarise: I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in a php script to solve a puzzle and output the solution. It works fine with...
2
2841
by: Martin Kofahl | last post by:
Hello, I'm slightly confused with the passthru() command. The program I call writes html headers itself. However, passthru() makes apache sending some generated headers first. There's no fault with spaches in the code etc, I think. Here's an simplified example: $ cat /www/example.php <?
3
5665
by: Rob Hunter | last post by:
Hi all. I want to run a Python daemon that manages a "to-do" queue. I want it so that the daemon is always running, where its running consists of looking at the queue to see if it has any jobs, and if it does, remove the job from the queue and "do the job". This all seems quite doable using the synchronized Queue.py module and this page (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012) which
2
1460
by: nitrogenycs | last post by:
Hello, I need a way to get a notification whenever a variable of an object changes. The approach should be non-intrusive so that I can use existing objects without modifying them. I want to be notified no matter who or what did change the wrapped object - even whenever an object internal methods changes the variables. So I coded the piece of code shown below (just copy and paste it, it's ready-to-run).
6
1876
by: Eric Guthmann | last post by:
Hello all We have an SOA application that includes an ASP.NET webservice and WinForms client. My question is regarding the use of Add Web Reference in Visual Studio. The tool is nice because it easilly creates and updates the client-side proxies that we need to communicate with the webservice. The problem is that our webservice methods accept and return business objects and when generating the proxies, VS creates scoped versions of...
1
2596
by: George | last post by:
My desktop application (C# 2.0) works just fine and makes tons of requests via WebRequest and WebClient objects. However, users that are behind Proxy servers are not able to use the app. I'm sure my head is not right on this issue and i need to seek advice. First, I dont really understand why I (the programmer) have to worry about these details - shouldnt this be somewhere below me on the ISO stack? But that sounds like complaining,...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10155
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.