-
-
Save jashkenas/455396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sample use: node nodeproxy.js 127.0.0.1 88 127.0.0.1 80 | |
net: require 'net' | |
sys: require 'sys' | |
[proxyHost, proxyPort, proxyTargetHost, proxyTargetPort]: process.argv.slice(2) | |
proxyServer: net.createServer (source_stream) -> | |
source_stream.addListener 'connect', -> | |
target_stream: new net.Stream() | |
target_stream.addListener 'connect', -> sys.pump source_stream, target_stream | |
target_stream.connect new Number(proxyTargetPort), proxyTargetHost | |
proxyServer.listen new Number(proxyPort), proxyHost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment