Paste: m00

Author: zimbatm
Mode: factor
Date: Tue, 17 Feb 2009 21:02:33
Plain Text |
USING: accessors io io.servers.connection calendar calendar.format ;
IN: transparent-proxy

! TUPLE: conn in out log host


! "conn_%03d.txt" ascii <file-writer>


! Pseudo-code:
! accept connections on localhost:8080
! for each connection, open logfile (%03d), read HTTP header, find server
! connect to server
! for each line, forward to server, forward to logfile
! close all

! TODO
: proxy-handler ( -- )
  now timestamp>rfc822 print
  ;
 
: new-proxy-server ( -- threaded-server )
  <threaded-server>
  "proxy-server" >>name
  8080 local-server >>insecure
  \ proxy-handler >>handler
  ;

: run-proxy ( -- )
  new-proxy-server start-server*
  ;

! Usage: start server, redirect dport:80 from eth1 to localhost:8080, connect via eth0
MAIN: run-proxy

New Annotation

Summary:
Author:
Mode:
Body: