2011年4月2日 星期六

android 使用proxy連接至網路

http://forum.xda-developers.com/showthread.php?t=766569
http://darkk.net.ru/redsocks/


in nexus one(cyanogenmod 7):
  eth0/wl0.1
    wifi/softap(BCM4329)
  lo
    loopback
  rmnet0
    3G

in rooted and installed superuser phone, if run "su root", the superuser program will ask user to confirm root access via UI.

transproxy.apk
  This program use redsock internal
     This tool allows you to redirect any TCP connection to SOCKS or HTTPS proxy using your firewall, so redirection is system-wide.

  after install this program, some file will be placed in data/data/com.hasbox.tproxy/, I found there are some scripts in "files" directory
    enable transproxy
      sh data/data/com.hasbox.tproxy/files/proxy.sh start /data/data/com.hasbox.tproxy/files type=http host= port= auth=false user= pass=
      sh data/data/com.hasbox.tproxy/files/redirect.sh start http
    disable transproxy
      sh data/data/com.hasbox.tproxy/files/proxy.sh stop /data/data/com.hasbox.tproxy/files
      sh data/data/com.hasbox.tproxy/files/redirect.sh stop

  when execution /data/data/com.hasbox.tproxy/files/redirect.sh,because android bionic libc not implement getprotobyname(), so there some warning messabe
    in my environment, 3G need use proxy but wifi can direct access , so modify redirect.sh, add " -o rmnet0" in each rule, only 3G access use proxy

  bugs
    android's netd will reset ipatbles when disable tethering(ether wifi or usb), so the setting by transproxy will gone.
      must set transproxy.apk after disable tethering
 

沒有留言: