SaeedDev94 / Xray

Xray GUI Client For Android
MIT License
181 stars 20 forks source link

About the path and configuration of tun2socks.yml #13

Closed Cyberbolt closed 8 months ago

Cyberbolt commented 8 months ago

https://github.com/SaeedDev94/Xray/blob/57a8d92f311d15cfa0c45cb0606dcca649373d5d/app/src/main/java/com/xtls/xray/Settings.kt#L22

May I ask in which directory this file is placed?

What is the content of the configuration file? I looked at Configuration File. There should be no need to configure Tun in Android development? How did you configure it?

SaeedDev94 commented 8 months ago

May I ask in which directory this file is placed?

/data/data/com.xtls.xray/files You need root access

Cyberbolt commented 8 months ago

@SaeedDev94 In other words, it is only useful if you have root permissions to read tun2socks.yml. Otherwise, use Settings.kt to configure it directly? Can I just change the parameters here directly?

object Settings {
     var socksAddress: String = "127.0.0.1"
     var socksPort: String = "10808"
     var socksUdp: Boolean = true
     var primaryDns: String = "1.1.1.1"
     var secondaryDns: String = "1.0.0.1"
     var excludedApps: String = ""
     var useXray: Boolean = false
     var tunName: String = "tun0"
     var tunMtu: Int = 1500
     var tunGateway: String = "10.14.1.1"
     var tunAddress: String = "10.14.1.2"
     var tunPrefix: Int = 24

     // fun xrayConfig(context: Context): File = File(context.filesDir, "config.json")
     fun tun2socksConfig(context: Context): File = File(context.filesDir, "tun2socks.yml")
     // fun sharedPref(context: Context): SharedPreferences = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
}
SaeedDev94 commented 8 months ago

Can I just change the parameters here directly?

Yes you can