i'm trying to redirect http/https traffic to a proxy server using Android Built-in VPN API and tun2socks executable file on android which compiled with NDK .
here is my code for establishing the tun0 device .
Builder mVPNBuilder = new Builder();
mVPNBuilder.setMtu(1500);
mVPNBuilder.addRoute("0.0.0.0",0);
mVPNBuilder.addAddress("25.25.25.1",32);
mVPNBuilder.addDnsServer("8.8.8.8");
mVPNDescriptor = mVPNBuilder.setSession("TUN2SOCKS").setConfigureIntent(pendingIntent).establish();
and this is the command which i use to run tun2socks
cmd += "--netif-ipaddr 25.25.25.2 " +
"--netif-netmask 255.255.255.0 " +
"--socks-server-addr 192.168.1.200:808 " +
"--tunfd " + String.valueOf(mVPNDescriptor.getFd()) + " " +
"--tunmtu 1500 " +
"--logger stdout " +
"--loglevel 5 " +
"--pid /data/data/" + getPackageName() + "/tun2socks.pid";
and here is the output of the logcat
06-18 23:39:52.064 22084-22084/? D/tun2socks: NOTICE(tun2socks): initializing BadVPN tun2socks 1.999.127 06-18 23:39:52.064 19610-22079/net.x8thbit.tun2sockstest D/RootShell v1.3: Read all output 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(BReactor): Reactor initializing 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(BSignal): BSignal initializing 06-18 23:39:52.074 22085-22085/? D/tun2socks: NOTICE(tun2socks): entering event loop 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(BReactor): Entering event loop 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(tun2socks): lwip init 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(tun2socks): netif func init 06-18 23:39:52.074 22085-22085/? D/tun2socks: ERROR(tun2socks): device error 06-18 23:39:52.074 22085-22085/? D/tun2socks: NOTICE(tun2socks): tearing down 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(BReactor): Exiting event loop, exit code 1 06-18 23:39:52.074 22085-22085/? D/tun2socks: NOTICE(tun2socks): Free TCP connections 06-18 23:39:52.074 22085-22085/? D/tun2socks: DEBUG(BReactor): Reactor freeing 06-18 23:39:52.074 22085-22085/? D/tun2socks: NOTICE(tun2socks): exiting 06-18 23:39:55.674 19610-22079/net.x8thbit.tun2sockstest D/TUN2SOCKS: 0 06-18 23:39:55.674 19610-22079/net.x8thbit.tun2sockstest D/RootShell v1.3: Command 0 finished.
Aucun commentaire:
Enregistrer un commentaire