pass the tun fd directly to tun2socks
This commit is contained in:
@@ -123,7 +123,7 @@ object Shadowsocks {
|
||||
val FEATRUE_PREFS = Array(Key.route, Key.isGlobalProxy, Key.proxyedApps,
|
||||
Key.isUdpDns, Key.isAutoConnect)
|
||||
|
||||
val EXECUTABLES = Array(Executable.PDNSD, Executable.REDSOCKS, Executable.SS_TUNNEL, Executable.SS_LOCAL)
|
||||
val EXECUTABLES = Array(Executable.PDNSD, Executable.REDSOCKS, Executable.SS_TUNNEL, Executable.SS_LOCAL, Executable.TUN2SOCKS)
|
||||
|
||||
// Helper functions
|
||||
def updateListPreference(pref: Preference, value: String) {
|
||||
|
||||
@@ -322,25 +322,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
|
||||
|
||||
Tun2Socks.start(cmd.split(" "))
|
||||
}
|
||||
|
||||
def startTunFdServer() {
|
||||
spawn {
|
||||
val fdServer = new LocalServerSocket("tun2socks")
|
||||
try {
|
||||
val localSocket = fdServer.accept()
|
||||
localSocket.setFileDescriptorsForSend(Array(conn.getFileDescriptor))
|
||||
val output = localSocket.getOutputStream
|
||||
output.write(1)
|
||||
output.flush()
|
||||
output.close()
|
||||
localSocket.close()
|
||||
fdServer.close()
|
||||
} catch {
|
||||
case ex: Exception => Log.e(TAG, "Exception", ex) // Ignored
|
||||
}
|
||||
}
|
||||
System.exec(cmd);
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
|
||||
Reference in New Issue
Block a user