Mercurial > hg > anonet-resdb
changeset 1052:004034faf019 draft
[quicktun.socks4a] $PROTOCOL support (raw, nacl0, nacltai)
author | d3v11 <d3v11@d3v11.ano> |
---|---|
date | Sun, 04 Nov 2012 12:59:01 +0000 |
parents | 2f1173c986e6 |
children | 259a97198267 |
files | contrib/quicktun.socks4a/README contrib/quicktun.socks4a/quicktun.socks4a contrib/quicktun.socks4a/run |
diffstat | 3 files changed, 68 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/quicktun.socks4a/README Sun Nov 04 12:18:53 2012 +0000 +++ b/contrib/quicktun.socks4a/README Sun Nov 04 12:59:01 2012 +0000 @@ -1,12 +1,55 @@ hacking quicktun through socks4a: - peer one should set REMOTE_FLOAT = 0 - peer two should set REMOTE_FLOAT = 1 - - i've never actually tested this. but - it should "just work" with minimal - shit. if it's really that bad you - can complain to /relayhell/d3v11. + i've never actually tested this. but it should "just work" + with minimal shit. if it's really that bad you can complain to + /relayhell/d3v11. depends: quicktun.raw, socat, daemontools, a lot of fucking patience + +env: + $DEBUG + 1 for debugging, 0 for quiet + + $TUN_MODE + this should always be 1 + + $PROTOCOL + raw, nacl0, nacltai supported + + $INTERFACE + named interface of your tunnel + + $REMOTE_FLOAT + peer one should set REMOTE_FLOAT = 0 + peer two should set REMOTE_FLOAT = 1 + + $PRIVATE_KEY + your private key, necessary for nacl0 and nacltai + + $PUBLIC_KEY + peer's public key, necessary for nacl0 or nacltai + + $LOCAL_ADDRESS + quicktun.* will bind here + + $LOCAL_PORT + quicktun.* will bind here + + $REMOTE_ADDRESS + quicktun.socks4a listens here on UDP + + $REMOTE_PORT + quicktun.socks4a listens here on UDP + + $DST_ADDRESS + REAL REMOTE_ADDRESS + + $DST_PORT + REAL REMOTE_PORT + + $SOCKS_ADDRESS + listening address of the socks4a proxy + + $SOCKS_PORT + listening port of the socks4a proxy
--- a/contrib/quicktun.socks4a/quicktun.socks4a Sun Nov 04 12:18:53 2012 +0000 +++ b/contrib/quicktun.socks4a/quicktun.socks4a Sun Nov 04 12:59:01 2012 +0000 @@ -3,6 +3,7 @@ DEBUG = os.getenv( 'DEBUG' ,'1' ) TUN_MODE = os.getenv( 'TUN_MODE' ,'1' ) +PROTOCOL = os.getenv( 'PROTOCOL' ,'raw' ) INTERFACE = os.getenv( 'ppp-tortun' ,'1' ) REMOTE_FLOAT = int(os.getenv('REMOTE_FLOAT' ,'1' )) @@ -18,20 +19,11 @@ SOCKS_ADDRESS = os.getenv( 'LOCAL_ADDRESS' ,'127.0.0.1' ) SOCKS_PORT = os.getenv( 'LOCAL_PORT' ,'9050' ) -tcp = socket.socket( - socket.AF_INET,socket.SOCK_STREAM) -tcp.setsockopt (socket.SOL_SOCKET,socket.SO_REUSEADDR,1 ) -tcp.setblocking (0 ) -tcp.bind ((LOCAL_ADDRESS,LOCAL_PORT )) -tcp.listen (1 ) -tcp_poll = select.poll( ) -tcp_poll.register(tcp.fileno(),select.POLLIN|select.POLLPRI ) - udp = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) udp.setsockopt (socket.SOL_SOCKET,socket.SO_REUSEADDR,1 ) udp.setblocking (0 ) udp.bind ((REMOTE_ADDRESS,REMOTE_PORT )) -udp_poll = select.poll( ) +udp_poll = select.poll( ) udp_poll.register(udp.fileno(),select.POLLIN|select.POLLPRI ) if REMOTE_FLOAT==0: @@ -49,6 +41,15 @@ tun.stdout.fileno(), select.POLLIN|select.POLLPRI) while REMOTE_FLOAT==1: + tcp = socket.socket( + socket.AF_INET,socket.SOCK_STREAM) + tcp.setsockopt (socket.SOL_SOCKET,socket.SO_REUSEADDR,1 ) + tcp.setblocking (0 ) + tcp.bind ((LOCAL_ADDRESS,LOCAL_PORT )) + tcp.listen (1 ) + tcp_poll = select.poll( ) + tcp_poll.register(tcp.fileno(),select.POLLIN|select.POLLPRI ) + if len(tcp_poll.poll(65536))>0: tun = tcp.accept ()[0] tun_stdout = tun.fileno ( ) @@ -63,7 +64,8 @@ fcntl.fcntl(tun_stdout,fcntl.F_SETFL,fcntl.fcntl( tun_stdout,fcntl.F_GETFL)&~os.O_NONBLOCK|os.O_NONBLOCK) -tun = subprocess.Popen(['/usr/sbin/quicktun.raw'], +tun = subprocess.Popen( + ['/usr/sbin/quicktun.'+PROTOCOL], stdout = subprocess.PIPE, stdin = subprocess.PIPE ) @@ -102,10 +104,7 @@ if ex.errno!=11: break - if len(sendq)>65536*128: - break - - if len(recvq)>65536*128: + if len(sendq)>65536*128 or len(recvq)>65536*128: break tun.terminate( )
--- a/contrib/quicktun.socks4a/run Sun Nov 04 12:18:53 2012 +0000 +++ b/contrib/quicktun.socks4a/run Sun Nov 04 12:59:01 2012 +0000 @@ -2,9 +2,13 @@ export DEBUG='1' export TUN_MODE='1' +export PROTOCOL='nacltai' export INTERFACE='ppp-tortun' export REMOTE_FLOAT='1' +export PRIVATE_KEY='0000000000000000000000000000000000000000000000000000000000000000' +export PUBLIC_KEY='2fe57da347cd62431528daac5fbb290730fff684afc4cfc2ed90995f58cb3b74' + export LOCAL_ADDRESS='127.0.0.1' export LOCAL_PORT='2998'