mirror of
https://github.com/yggdrasil-network/yggdrasil-android.git
synced 2025-04-28 14:15:08 +03:00
Build 5
This commit is contained in:
parent
fa9532fb97
commit
27e1909aa2
6 changed files with 70 additions and 34 deletions
|
@ -3,6 +3,7 @@ package eu.neilalexander.yggdrasil
|
|||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
import mobile.Mobile
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
|
@ -40,6 +41,18 @@ object ConfigurationProxy {
|
|||
json.put("AdminListen", "none")
|
||||
json.put("IfName", "none")
|
||||
json.put("IfMTU", 65535)
|
||||
|
||||
if (json.getJSONArray("MulticastInterfaces").get(0) is String) {
|
||||
var ar = JSONArray()
|
||||
ar.put(0, JSONObject("""
|
||||
{
|
||||
"Regex": ".*",
|
||||
"Beacon": true,
|
||||
"Listen": true
|
||||
}
|
||||
""".trimIndent()))
|
||||
json.put("MulticastInterfaces", ar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,4 +64,20 @@ object ConfigurationProxy {
|
|||
fun getJSONByteArray(): ByteArray {
|
||||
return json.toString().toByteArray(Charsets.UTF_8)
|
||||
}
|
||||
|
||||
var multicastListen: Boolean
|
||||
get() = (json.getJSONArray("MulticastInterfaces").get(0) as JSONObject).getBoolean("Listen")
|
||||
set(value) {
|
||||
updateJSON { json ->
|
||||
(json.getJSONArray("MulticastInterfaces").get(0) as JSONObject).put("Listen", value)
|
||||
}
|
||||
}
|
||||
|
||||
var multicastBeacon: Boolean
|
||||
get() = (json.getJSONArray("MulticastInterfaces").get(0) as JSONObject).getBoolean("Beacon")
|
||||
set(value) {
|
||||
updateJSON { json ->
|
||||
(json.getJSONArray("MulticastInterfaces").get(0) as JSONObject).put("Beacon", value)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue