mirror of
https://github.com/yggdrasil-network/yggdrasil-android.git
synced 2025-04-28 14:15:08 +03:00
Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
222d9d90bc | ||
![]() |
6ddc878fde | ||
![]() |
055a74ea69 | ||
![]() |
94db1facd7 | ||
![]() |
e211111d60 | ||
![]() |
cdc12a8e7e | ||
![]() |
34756b2193 | ||
![]() |
060c096cdf | ||
![]() |
6a66960666 | ||
![]() |
a70563fba2 | ||
![]() |
ca45b37baa |
28 changed files with 326 additions and 93 deletions
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
repository: yggdrasil-network/yggdrasil-go
|
repository: yggdrasil-network/yggdrasil-go
|
||||||
path: yggdrasil-go
|
path: yggdrasil-go
|
||||||
ref: develop
|
ref: master
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Go environment
|
- name: Setup Go environment
|
||||||
|
|
|
@ -9,9 +9,9 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "eu.neilalexander.yggdrasil"
|
applicationId "eu.neilalexander.yggdrasil"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 34
|
||||||
versionCode 16
|
versionCode 20
|
||||||
versionName "0.1-016"
|
versionName "0.1-020"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,12 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.aar'], dir: 'libs')
|
implementation fileTree(include: ['*.aar'], dir: 'libs')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
implementation 'androidx.core:core-ktx:1.12.0'
|
implementation 'androidx.core:core-ktx:1.13.1'
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
implementation 'com.google.android.material:material:1.5.0'
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||||
testImplementation 'junit:junit:4.+'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".GlobalApplication"
|
android:name=".GlobalApplication"
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
<service
|
<service
|
||||||
android:name=".PacketTunnelProvider"
|
android:name=".PacketTunnelProvider"
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||||
|
android:foregroundServiceType="systemExempted"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.net.VpnService" />
|
<action android:name="android.net.VpnService" />
|
||||||
|
|
|
@ -55,7 +55,7 @@ object ConfigurationProxy {
|
||||||
json.put("IfMTU", 65535)
|
json.put("IfMTU", 65535)
|
||||||
|
|
||||||
if (json.getJSONArray("MulticastInterfaces").get(0) is String) {
|
if (json.getJSONArray("MulticastInterfaces").get(0) is String) {
|
||||||
var ar = JSONArray()
|
val ar = JSONArray()
|
||||||
ar.put(0, JSONObject("""
|
ar.put(0, JSONObject("""
|
||||||
{
|
{
|
||||||
"Regex": ".*",
|
"Regex": ".*",
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.preference.PreferenceManager
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
|
||||||
const val KEY_DNS_SERVERS = "dns_servers"
|
const val KEY_DNS_SERVERS = "dns_servers"
|
||||||
|
const val KEY_DNS_VERSION = "dns_version"
|
||||||
const val KEY_ENABLE_CHROME_FIX = "enable_chrome_fix"
|
const val KEY_ENABLE_CHROME_FIX = "enable_chrome_fix"
|
||||||
|
|
||||||
class DnsActivity : AppCompatActivity() {
|
class DnsActivity : AppCompatActivity() {
|
||||||
|
@ -41,10 +42,10 @@ class DnsActivity : AppCompatActivity() {
|
||||||
val descriptionRevertron = getString(R.string.dns_server_info_revertron)
|
val descriptionRevertron = getString(R.string.dns_server_info_revertron)
|
||||||
// Here we can add some other DNS servers in a future
|
// Here we can add some other DNS servers in a future
|
||||||
defaultDnsServers = hashMapOf(
|
defaultDnsServers = hashMapOf(
|
||||||
"302:7991::53" to Pair(getString(R.string.location_amsterdam), descriptionRevertron),
|
"308:62:45:62::" to Pair(getString(R.string.location_amsterdam), descriptionRevertron),
|
||||||
"302:db60::53" to Pair(getString(R.string.location_prague), descriptionRevertron),
|
"308:84:68:55::" to Pair(getString(R.string.location_frankfurt), descriptionRevertron),
|
||||||
"300:6223::53" to Pair(getString(R.string.location_bratislava), descriptionRevertron),
|
"308:25:40:bd::" to Pair(getString(R.string.location_bratislava), descriptionRevertron),
|
||||||
"301:1088::53" to Pair(getString(R.string.location_buffalo), descriptionRevertron),
|
"308:c8:48:45::" to Pair(getString(R.string.location_buffalo), descriptionRevertron),
|
||||||
)
|
)
|
||||||
|
|
||||||
serversTableLayout = findViewById(R.id.configuredDnsTableLayout)
|
serversTableLayout = findViewById(R.id.configuredDnsTableLayout)
|
||||||
|
@ -56,7 +57,7 @@ class DnsActivity : AppCompatActivity() {
|
||||||
addServerButton.setOnClickListener {
|
addServerButton.setOnClickListener {
|
||||||
val view = inflater.inflate(R.layout.dialog_add_dns_server, null)
|
val view = inflater.inflate(R.layout.dialog_add_dns_server, null)
|
||||||
val input = view.findViewById<TextInputEditText>(R.id.addDnsInput)
|
val input = view.findViewById<TextInputEditText>(R.id.addDnsInput)
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
builder.setTitle(getString(R.string.dns_add_server_dialog_title))
|
builder.setTitle(getString(R.string.dns_add_server_dialog_title))
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
builder.setPositiveButton(getString(R.string.add)) { _, _ ->
|
builder.setPositiveButton(getString(R.string.add)) { _, _ ->
|
||||||
|
@ -127,7 +128,7 @@ class DnsActivity : AppCompatActivity() {
|
||||||
view.findViewById<ImageButton>(R.id.deletePeerButton).tag = i
|
view.findViewById<ImageButton>(R.id.deletePeerButton).tag = i
|
||||||
|
|
||||||
view.findViewById<ImageButton>(R.id.deletePeerButton).setOnClickListener { button ->
|
view.findViewById<ImageButton>(R.id.deletePeerButton).setOnClickListener { button ->
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
builder.setTitle(getString(R.string.dns_remove_title, server))
|
builder.setTitle(getString(R.string.dns_remove_title, server))
|
||||||
builder.setPositiveButton(getString(R.string.remove)) { dialog, _ ->
|
builder.setPositiveButton(getString(R.string.remove)) { dialog, _ ->
|
||||||
servers.removeAt(button.tag as Int)
|
servers.removeAt(button.tag as Int)
|
||||||
|
@ -175,7 +176,7 @@ class DnsActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.setOnLongClickListener {
|
view.setOnLongClickListener {
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
builder.setTitle(getString(R.string.dns_server_info_dialog_title))
|
builder.setTitle(getString(R.string.dns_server_info_dialog_title))
|
||||||
builder.setMessage("${infoPair.first}\n\n${infoPair.second}")
|
builder.setMessage("${infoPair.first}\n\n${infoPair.second}")
|
||||||
builder.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
|
builder.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
|
||||||
|
|
|
@ -8,14 +8,16 @@ import android.os.Build
|
||||||
import android.service.quicksettings.TileService
|
import android.service.quicksettings.TileService
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
|
||||||
const val PREF_KEY_ENABLED = "enabled"
|
const val PREF_KEY_ENABLED = "enabled"
|
||||||
|
const val PREF_KEY_PEERS_NOTE = "peers_note"
|
||||||
const val MAIN_CHANNEL_ID = "Yggdrasil Service"
|
const val MAIN_CHANNEL_ID = "Yggdrasil Service"
|
||||||
|
|
||||||
class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
||||||
private lateinit var config: ConfigurationProxy
|
private lateinit var config: ConfigurationProxy
|
||||||
private var currentState: State = State.Disabled
|
private var currentState: State = State.Disabled
|
||||||
var updaterConnections: Int = 0
|
private var updaterConnections: Int = 0
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
@ -24,6 +26,7 @@ class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
||||||
callback.register()
|
callback.register()
|
||||||
val receiver = YggStateReceiver(this)
|
val receiver = YggStateReceiver(this)
|
||||||
receiver.register(this)
|
receiver.register(this)
|
||||||
|
migrateDnsServers(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun subscribe() {
|
fun subscribe() {
|
||||||
|
@ -64,6 +67,28 @@ class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun migrateDnsServers(context: Context) {
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
if (preferences.getInt(KEY_DNS_VERSION, 0) >= 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val serverString = preferences.getString(KEY_DNS_SERVERS, "")
|
||||||
|
if (serverString!!.isNotEmpty()) {
|
||||||
|
// Replacing old Revertron's servers by new ones
|
||||||
|
val newServers = serverString
|
||||||
|
.replace("300:6223::53", "308:25:40:bd::")
|
||||||
|
.replace("302:7991::53", "308:62:45:62::")
|
||||||
|
.replace("302:db60::53", "308:84:68:55::")
|
||||||
|
.replace("301:1088::53", "308:c8:48:45::")
|
||||||
|
val editor = preferences.edit()
|
||||||
|
editor.putInt(KEY_DNS_VERSION, 1)
|
||||||
|
if (newServers != serverString) {
|
||||||
|
editor.putString(KEY_DNS_SERVERS, newServers)
|
||||||
|
}
|
||||||
|
editor.apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun createServiceNotification(context: Context, state: State): Notification {
|
fun createServiceNotification(context: Context, state: State): Notification {
|
||||||
createNotificationChannels(context)
|
createNotificationChannels(context)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package eu.neilalexander.yggdrasil
|
package eu.neilalexander.yggdrasil
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.app.AlertDialog
|
||||||
import android.content.*
|
import android.content.*
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.net.Uri
|
||||||
import android.net.VpnService
|
import android.net.VpnService
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.ContextThemeWrapper
|
||||||
import android.widget.Switch
|
import android.widget.Switch
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
@ -18,18 +21,19 @@ import eu.neilalexander.yggdrasil.PacketTunnelProvider.Companion.STATE_INTENT
|
||||||
import mobile.Mobile
|
import mobile.Mobile
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
|
|
||||||
|
const val APP_WEB_URL = "https://github.com/yggdrasil-network/yggdrasil-android"
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
private lateinit var enabledSwitch: Switch
|
private lateinit var enabledSwitch: Switch
|
||||||
private lateinit var enabledLabel: TextView
|
private lateinit var enabledLabel: TextView
|
||||||
private lateinit var ipAddressLabel: TextView
|
private lateinit var ipAddressLabel: TextView
|
||||||
private lateinit var subnetLabel: TextView
|
private lateinit var subnetLabel: TextView
|
||||||
private lateinit var treeLengthLabel: TextView
|
|
||||||
private lateinit var peersLabel: TextView
|
private lateinit var peersLabel: TextView
|
||||||
private lateinit var peersRow: LinearLayoutCompat
|
private lateinit var peersRow: LinearLayoutCompat
|
||||||
private lateinit var dnsLabel: TextView
|
private lateinit var dnsLabel: TextView
|
||||||
private lateinit var dnsRow: LinearLayoutCompat
|
private lateinit var dnsRow: LinearLayoutCompat
|
||||||
private lateinit var settingsRow: LinearLayoutCompat
|
private lateinit var settingsRow: LinearLayoutCompat
|
||||||
|
private lateinit var versionRow: LinearLayoutCompat
|
||||||
|
|
||||||
private fun start() {
|
private fun start() {
|
||||||
val intent = Intent(this, PacketTunnelProvider::class.java)
|
val intent = Intent(this, PacketTunnelProvider::class.java)
|
||||||
|
@ -53,12 +57,12 @@ class MainActivity : AppCompatActivity() {
|
||||||
enabledLabel = findViewById(R.id.yggdrasilStatusLabel)
|
enabledLabel = findViewById(R.id.yggdrasilStatusLabel)
|
||||||
ipAddressLabel = findViewById(R.id.ipAddressValue)
|
ipAddressLabel = findViewById(R.id.ipAddressValue)
|
||||||
subnetLabel = findViewById(R.id.subnetValue)
|
subnetLabel = findViewById(R.id.subnetValue)
|
||||||
treeLengthLabel = findViewById(R.id.treeLengthValue)
|
|
||||||
peersLabel = findViewById(R.id.peersValue)
|
peersLabel = findViewById(R.id.peersValue)
|
||||||
peersRow = findViewById(R.id.peersTableRow)
|
peersRow = findViewById(R.id.peersTableRow)
|
||||||
dnsLabel = findViewById(R.id.dnsValue)
|
dnsLabel = findViewById(R.id.dnsValue)
|
||||||
dnsRow = findViewById(R.id.dnsTableRow)
|
dnsRow = findViewById(R.id.dnsTableRow)
|
||||||
settingsRow = findViewById(R.id.settingsTableRow)
|
settingsRow = findViewById(R.id.settingsTableRow)
|
||||||
|
versionRow = findViewById(R.id.versionTableRow)
|
||||||
|
|
||||||
enabledLabel.setTextColor(Color.GRAY)
|
enabledLabel.setTextColor(Color.GRAY)
|
||||||
|
|
||||||
|
@ -70,6 +74,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
startVpnActivity.launch(vpnIntent)
|
startVpnActivity.launch(vpnIntent)
|
||||||
} else {
|
} else {
|
||||||
start()
|
start()
|
||||||
|
enabledSwitch.isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false -> {
|
false -> {
|
||||||
|
@ -105,6 +110,11 @@ class MainActivity : AppCompatActivity() {
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
versionRow.isClickable = true
|
||||||
|
versionRow.setOnClickListener {
|
||||||
|
openUrlInBrowser(APP_WEB_URL)
|
||||||
|
}
|
||||||
|
|
||||||
ipAddressLabel.setOnLongClickListener {
|
ipAddressLabel.setOnLongClickListener {
|
||||||
val clipboard: ClipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard: ClipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clip = ClipData.newPlainText("ip", ipAddressLabel.text)
|
val clip = ClipData.newPlainText("ip", ipAddressLabel.text)
|
||||||
|
@ -153,15 +163,16 @@ class MainActivity : AppCompatActivity() {
|
||||||
override fun onReceive(context: Context?, intent: Intent) {
|
override fun onReceive(context: Context?, intent: Intent) {
|
||||||
when (intent.getStringExtra("type")) {
|
when (intent.getStringExtra("type")) {
|
||||||
"state" -> {
|
"state" -> {
|
||||||
enabledLabel.text = if (intent.getBooleanExtra("started", false)) {
|
val peerState = JSONArray(intent.getStringExtra("peers") ?: "[]")
|
||||||
var count = 0
|
var count = 0
|
||||||
if (intent.hasExtra("tree")) {
|
for (i in 0..<peerState.length()) {
|
||||||
val tree = intent.getStringExtra("tree")
|
val peer = peerState.getJSONObject(i)
|
||||||
if (tree != null && tree != "null") {
|
if (peer.getString("IP").isNotEmpty()) {
|
||||||
val treeState = JSONArray(tree)
|
count += 1
|
||||||
count = treeState.length()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
enabledLabel.text = if (intent.getBooleanExtra("started", false)) {
|
||||||
|
showPeersNoteIfNeeded(peerState.length())
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
enabledLabel.setTextColor(Color.RED)
|
enabledLabel.setTextColor(Color.RED)
|
||||||
getString(R.string.main_no_connectivity)
|
getString(R.string.main_no_connectivity)
|
||||||
|
@ -175,17 +186,52 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
ipAddressLabel.text = intent.getStringExtra("ip") ?: "N/A"
|
ipAddressLabel.text = intent.getStringExtra("ip") ?: "N/A"
|
||||||
subnetLabel.text = intent.getStringExtra("subnet") ?: "N/A"
|
subnetLabel.text = intent.getStringExtra("subnet") ?: "N/A"
|
||||||
treeLengthLabel.text = intent.getStringExtra("coords") ?: "0"
|
|
||||||
if (intent.hasExtra("peers")) {
|
if (intent.hasExtra("peers")) {
|
||||||
val peerState = JSONArray(intent.getStringExtra("peers") ?: "[]")
|
peersLabel.text = when (count) {
|
||||||
peersLabel.text = when (val count = peerState.length()) {
|
|
||||||
0 -> getString(R.string.main_no_peers)
|
0 -> getString(R.string.main_no_peers)
|
||||||
1 -> getString(R.string.main_one_peer)
|
1 -> getString(R.string.main_one_peer)
|
||||||
else -> getString(R.string.main_many_peers, count)
|
else -> getString(R.string.main_many_peers, count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!enabledSwitch.isEnabled) {
|
||||||
|
enabledSwitch.isEnabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showPeersNoteIfNeeded(peerCount: Int) {
|
||||||
|
if (peerCount > 0) return
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this@MainActivity.baseContext)
|
||||||
|
if (!preferences.getBoolean(PREF_KEY_PEERS_NOTE, false)) {
|
||||||
|
this@MainActivity.runOnUiThread {
|
||||||
|
val builder: AlertDialog.Builder =
|
||||||
|
AlertDialog.Builder(ContextThemeWrapper(this@MainActivity, R.style.YggdrasilDialogs))
|
||||||
|
builder.setTitle(getString(R.string.main_add_some_peers_title))
|
||||||
|
builder.setMessage(getString(R.string.main_add_some_peers_message))
|
||||||
|
builder.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
builder.show()
|
||||||
|
}
|
||||||
|
// Mark this note as shown
|
||||||
|
preferences.edit().apply {
|
||||||
|
putBoolean(PREF_KEY_PEERS_NOTE, true)
|
||||||
|
commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun openUrlInBrowser(url: String) {
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW).apply {
|
||||||
|
data = Uri.parse(url)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
startActivity(intent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
// Handle the exception if no browser is found
|
||||||
|
Toast.makeText(this, getText(R.string.no_browser_found_toast), Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,15 +232,14 @@ open class PacketTunnelProvider: VpnService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updater() {
|
private fun updater() {
|
||||||
Thread.sleep(500)
|
try {
|
||||||
|
Thread.sleep(500)
|
||||||
|
} catch (_: InterruptedException) {
|
||||||
|
return
|
||||||
|
}
|
||||||
var lastStateUpdate = System.currentTimeMillis()
|
var lastStateUpdate = System.currentTimeMillis()
|
||||||
updates@ while (started.get()) {
|
updates@ while (started.get()) {
|
||||||
val treeJSON = yggdrasil.treeJSON
|
val treeJSON = yggdrasil.treeJSON
|
||||||
var treeLength = 0
|
|
||||||
if (treeJSON != null && treeJSON != "null") {
|
|
||||||
val treeState = JSONArray(treeJSON)
|
|
||||||
treeLength = treeState.length()
|
|
||||||
}
|
|
||||||
if ((application as GlobalApplication).needUiUpdates()) {
|
if ((application as GlobalApplication).needUiUpdates()) {
|
||||||
val intent = Intent(STATE_INTENT)
|
val intent = Intent(STATE_INTENT)
|
||||||
intent.putExtra("type", "state")
|
intent.putExtra("type", "state")
|
||||||
|
@ -248,9 +247,7 @@ open class PacketTunnelProvider: VpnService() {
|
||||||
intent.putExtra("ip", yggdrasil.addressString)
|
intent.putExtra("ip", yggdrasil.addressString)
|
||||||
intent.putExtra("subnet", yggdrasil.subnetString)
|
intent.putExtra("subnet", yggdrasil.subnetString)
|
||||||
intent.putExtra("pubkey", yggdrasil.publicKeyString)
|
intent.putExtra("pubkey", yggdrasil.publicKeyString)
|
||||||
intent.putExtra("coords", "$treeLength")
|
|
||||||
intent.putExtra("peers", yggdrasil.peersJSON)
|
intent.putExtra("peers", yggdrasil.peersJSON)
|
||||||
intent.putExtra("tree", treeJSON)
|
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
|
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
|
||||||
}
|
}
|
||||||
val curTime = System.currentTimeMillis()
|
val curTime = System.currentTimeMillis()
|
||||||
|
|
|
@ -5,20 +5,27 @@ import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.method.LinkMovementMethod
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.ContextThemeWrapper
|
import android.view.ContextThemeWrapper
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.*
|
import android.widget.EditText
|
||||||
|
import android.widget.ImageButton
|
||||||
|
import android.widget.Switch
|
||||||
|
import android.widget.TableLayout
|
||||||
|
import android.widget.TableRow
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.widget.doOnTextChanged
|
import androidx.core.widget.doOnTextChanged
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
|
||||||
class PeersActivity : AppCompatActivity() {
|
class PeersActivity : AppCompatActivity() {
|
||||||
private lateinit var config: ConfigurationProxy
|
private lateinit var config: ConfigurationProxy
|
||||||
private lateinit var inflater: LayoutInflater
|
private lateinit var inflater: LayoutInflater
|
||||||
|
@ -47,6 +54,9 @@ class PeersActivity : AppCompatActivity() {
|
||||||
configuredTableLayout = findViewById(R.id.configuredPeersTableLayout)
|
configuredTableLayout = findViewById(R.id.configuredPeersTableLayout)
|
||||||
configuredTableLabel = findViewById(R.id.configuredPeersLabel)
|
configuredTableLabel = findViewById(R.id.configuredPeersLabel)
|
||||||
|
|
||||||
|
val discoveryLink = findViewById<TextView>(R.id.peers_discovery_link)
|
||||||
|
discoveryLink.movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
|
||||||
multicastListenSwitch = findViewById(R.id.enableMulticastListen)
|
multicastListenSwitch = findViewById(R.id.enableMulticastListen)
|
||||||
multicastListenSwitch.setOnCheckedChangeListener { button, _ ->
|
multicastListenSwitch.setOnCheckedChangeListener { button, _ ->
|
||||||
config.multicastListen = button.isChecked
|
config.multicastListen = button.isChecked
|
||||||
|
@ -95,7 +105,7 @@ class PeersActivity : AppCompatActivity() {
|
||||||
addPeerButton.setOnClickListener {
|
addPeerButton.setOnClickListener {
|
||||||
val view = inflater.inflate(R.layout.dialog_addpeer, null)
|
val view = inflater.inflate(R.layout.dialog_addpeer, null)
|
||||||
val input = view.findViewById<TextInputEditText>(R.id.addPeerInput)
|
val input = view.findViewById<TextInputEditText>(R.id.addPeerInput)
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
builder.setTitle(getString(R.string.peers_add_peer))
|
builder.setTitle(getString(R.string.peers_add_peer))
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
builder.setPositiveButton(getString(R.string.peers_add)) { dialog, _ ->
|
builder.setPositiveButton(getString(R.string.peers_add)) { dialog, _ ->
|
||||||
|
@ -149,7 +159,7 @@ class PeersActivity : AppCompatActivity() {
|
||||||
view.findViewById<ImageButton>(R.id.deletePeerButton).tag = i
|
view.findViewById<ImageButton>(R.id.deletePeerButton).tag = i
|
||||||
|
|
||||||
view.findViewById<ImageButton>(R.id.deletePeerButton).setOnClickListener { button ->
|
view.findViewById<ImageButton>(R.id.deletePeerButton).setOnClickListener { button ->
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
builder.setTitle(getString(R.string.peers_remove_title, peer))
|
builder.setTitle(getString(R.string.peers_remove_title, peer))
|
||||||
builder.setPositiveButton(getString(R.string.peers_remove)) { dialog, _ ->
|
builder.setPositiveButton(getString(R.string.peers_remove)) { dialog, _ ->
|
||||||
config.updateJSON { json ->
|
config.updateJSON { json ->
|
||||||
|
@ -176,16 +186,25 @@ class PeersActivity : AppCompatActivity() {
|
||||||
connectedTableLabel.text = getString(R.string.peers_no_connected_title)
|
connectedTableLabel.text = getString(R.string.peers_no_connected_title)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
connectedTableLayout.visibility = View.VISIBLE
|
var connected = false
|
||||||
connectedTableLabel.text = getString(R.string.peers_connected_title)
|
|
||||||
|
|
||||||
connectedTableLayout.removeAllViewsInLayout()
|
connectedTableLayout.removeAllViewsInLayout()
|
||||||
for (peer in peers) {
|
for (peer in peers) {
|
||||||
val view = inflater.inflate(R.layout.peers_connected, null)
|
val view = inflater.inflate(R.layout.peers_connected, null)
|
||||||
val ip = peer.getString("IP")
|
val ip = peer.getString("IP")
|
||||||
view.findViewById<TextView>(R.id.addressLabel).text = ip
|
// Only connected peers have IPs
|
||||||
view.findViewById<TextView>(R.id.detailsLabel).text = peer.getString("URI")
|
if (ip.isNotEmpty()) {
|
||||||
connectedTableLayout.addView(view)
|
view.findViewById<TextView>(R.id.addressLabel).text = ip
|
||||||
|
view.findViewById<TextView>(R.id.detailsLabel).text = peer.getString("URI")
|
||||||
|
connectedTableLayout.addView(view)
|
||||||
|
connected = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (connected) {
|
||||||
|
connectedTableLayout.visibility = View.VISIBLE
|
||||||
|
connectedTableLabel.text = getString(R.string.peers_connected_title)
|
||||||
|
} else {
|
||||||
|
connectedTableLayout.visibility = View.GONE
|
||||||
|
connectedTableLabel.text = getString(R.string.peers_no_connected_title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
private lateinit var deviceNameEntry: EditText
|
private lateinit var deviceNameEntry: EditText
|
||||||
private lateinit var publicKeyLabel: TextView
|
private lateinit var publicKeyLabel: TextView
|
||||||
private lateinit var resetConfigurationRow: LinearLayoutCompat
|
private lateinit var resetConfigurationRow: LinearLayoutCompat
|
||||||
|
private var publicKeyReset = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -69,7 +70,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
resetConfigurationRow.setOnClickListener {
|
resetConfigurationRow.setOnClickListener {
|
||||||
val view = inflater.inflate(R.layout.dialog_resetconfig, null)
|
val view = inflater.inflate(R.layout.dialog_resetconfig, null)
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
builder.setTitle(getString(R.string.settings_warning_title))
|
builder.setTitle(getString(R.string.settings_warning_title))
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
builder.setPositiveButton(getString(R.string.settings_reset)) { dialog, _ ->
|
builder.setPositiveButton(getString(R.string.settings_reset)) { dialog, _ ->
|
||||||
|
@ -85,12 +86,13 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
findViewById<View>(R.id.resetKeysRow).setOnClickListener {
|
findViewById<View>(R.id.resetKeysRow).setOnClickListener {
|
||||||
config.resetKeys()
|
config.resetKeys()
|
||||||
|
publicKeyReset = true
|
||||||
updateView()
|
updateView()
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById<View>(R.id.setKeysRow).setOnClickListener {
|
findViewById<View>(R.id.setKeysRow).setOnClickListener {
|
||||||
val view = inflater.inflate(R.layout.dialog_set_keys, null)
|
val view = inflater.inflate(R.layout.dialog_set_keys, null)
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.Theme_MaterialComponents_DayNight_Dialog))
|
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(this, R.style.YggdrasilDialogs))
|
||||||
val privateKey = view.findViewById<EditText>(R.id.private_key)
|
val privateKey = view.findViewById<EditText>(R.id.private_key)
|
||||||
builder.setTitle(getString(R.string.set_keys))
|
builder.setTitle(getString(R.string.set_keys))
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
|
@ -125,7 +127,11 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
deviceNameEntry.setText("", TextView.BufferType.EDITABLE)
|
deviceNameEntry.setText("", TextView.BufferType.EDITABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
publicKeyLabel.text = json.optString("PublicKey")
|
var key = json.optString("PrivateKey")
|
||||||
|
if (key.isNotEmpty()) {
|
||||||
|
key = key.substring(key.length / 2)
|
||||||
|
}
|
||||||
|
publicKeyLabel.text = key
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -145,7 +151,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
// To be able to get public key from running Yggdrasil we use this receiver, as we don't have this field in config
|
// To be able to get public key from running Yggdrasil we use this receiver, as we don't have this field in config
|
||||||
private val receiver: BroadcastReceiver = object : BroadcastReceiver() {
|
private val receiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context?, intent: Intent) {
|
override fun onReceive(context: Context?, intent: Intent) {
|
||||||
if (intent.hasExtra("pubkey")) {
|
if (intent.hasExtra("pubkey") && !publicKeyReset) {
|
||||||
val tree = intent.getStringExtra("pubkey")
|
val tree = intent.getStringExtra("pubkey")
|
||||||
if (tree != null && tree != "null") {
|
if (tree != null && tree != "null") {
|
||||||
publicKeyLabel.text = intent.getStringExtra("pubkey")
|
publicKeyLabel.text = intent.getStringExtra("pubkey")
|
||||||
|
|
|
@ -116,7 +116,7 @@
|
||||||
android:layout_height="32px" />
|
android:layout_height="32px" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/statisticsSectionLabel"
|
android:id="@+id/networkInfoSectionLabel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16pt"
|
android:layout_marginStart="16pt"
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
android:layout_marginBottom="2pt"
|
android:layout_marginBottom="2pt"
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:paddingRight="8pt"
|
android:paddingRight="8pt"
|
||||||
android:text="@string/main_statistics"
|
android:text="@string/main_network_info"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
@ -203,32 +203,6 @@
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat style="@style/SelectableItemStyle">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/coordinatesLabel"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:text="@string/main_tree_length"
|
|
||||||
android:textColor="?attr/textDefault" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/treeLengthValue"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:alpha="0.5"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:scrollHorizontally="false"
|
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="0"
|
|
||||||
android:textAlignment="viewEnd"
|
|
||||||
android:textIsSelectable="true" />
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
|
@ -377,7 +351,9 @@
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat style="@style/SelectableItemStyle">
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/versionTableRow"
|
||||||
|
style="@style/SelectableItemStyle">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/versionLabel"
|
android:id="@+id/versionLabel"
|
||||||
|
|
|
@ -137,6 +137,23 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/peers_discovery_link"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16pt"
|
||||||
|
android:layout_marginLeft="16pt"
|
||||||
|
android:layout_marginTop="4pt"
|
||||||
|
android:layout_marginEnd="8pt"
|
||||||
|
android:layout_marginRight="8pt"
|
||||||
|
android:layout_marginBottom="4pt"
|
||||||
|
android:alpha="0.7"
|
||||||
|
android:paddingRight="8pt"
|
||||||
|
android:text="@string/peers_discovery_hint"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32px" />
|
android:layout_height="32px" />
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
<string name="main_no_peers">Нет пиров</string>
|
<string name="main_no_peers">Нет пиров</string>
|
||||||
<string name="main_one_peer">1 пир</string>
|
<string name="main_one_peer">1 пир</string>
|
||||||
<string name="main_many_peers">%d пира/пиров</string>
|
<string name="main_many_peers">%d пира/пиров</string>
|
||||||
|
<string name="main_add_some_peers_title">Внимание</string>
|
||||||
|
<string name="main_add_some_peers_message">Не настроено ни одного пира. Если не будет обнаруживаемых пиров в этой сети, то вам надо будет добавить пир вручную, чтобы подключение к Yggdrasil работало как положено.</string>
|
||||||
<string name="peers_add_peer">Добавить пира в конфиг</string>
|
<string name="peers_add_peer">Добавить пира в конфиг</string>
|
||||||
<string name="peers_add">Добавить</string>
|
<string name="peers_add">Добавить</string>
|
||||||
<string name="peers_remove_title">Убрать %s?</string>
|
<string name="peers_remove_title">Убрать %s?</string>
|
||||||
|
@ -42,11 +44,10 @@
|
||||||
<string name="settings_reset">Сброс</string>
|
<string name="settings_reset">Сброс</string>
|
||||||
<string name="main_status">Состояние</string>
|
<string name="main_status">Состояние</string>
|
||||||
<string name="main_enable_yggdrasil">Включить Yggdrasil</string>
|
<string name="main_enable_yggdrasil">Включить Yggdrasil</string>
|
||||||
<string name="main_statistics">Статистика</string>
|
<string name="main_network_info">Адрес и сеть</string>
|
||||||
<string name="main_not_available">Н/Д</string>
|
<string name="main_not_available">Н/Д</string>
|
||||||
<string name="main_ip">Адрес</string>
|
<string name="main_ip">Адрес</string>
|
||||||
<string name="main_subnet">Подсеть</string>
|
<string name="main_subnet">Подсеть</string>
|
||||||
<string name="main_tree_length">Высота дерева</string>
|
|
||||||
<string name="main_configuration">Конфигурация</string>
|
<string name="main_configuration">Конфигурация</string>
|
||||||
<string name="main_peers">Пиры</string>
|
<string name="main_peers">Пиры</string>
|
||||||
<string name="main_dns_servers">Серверы DNS</string>
|
<string name="main_dns_servers">Серверы DNS</string>
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
<string name="discoverable_over_multicast">Находимый через multicast</string>
|
<string name="discoverable_over_multicast">Находимый через multicast</string>
|
||||||
<string name="search_for_multicast_peers">Искать пиров через multicast</string>
|
<string name="search_for_multicast_peers">Искать пиров через multicast</string>
|
||||||
<string name="configured_peers_hint">Yggdrasil будет пытаться подключаться к этим пирам автоматически. Если вы добавите несколько пиров, ваше устройство может быть использовано для переноса данных между другими узлами сети. Чтобы этого избежать настройте только один пир.</string>
|
<string name="configured_peers_hint">Yggdrasil будет пытаться подключаться к этим пирам автоматически. Если вы добавите несколько пиров, ваше устройство может быть использовано для переноса данных между другими узлами сети. Чтобы этого избежать настройте только один пир.</string>
|
||||||
|
<string name="peers_discovery_hint">Вы можете найти публичные пиры <a href="https://publicpeers.neilalexander.dev/">по этой ссылке</a>.</string>
|
||||||
<string name="peer_connectivity_hint">Пиры могут быть найдены с помощью Multicast если они находятся в той же Wi-Fi сети, либо через USB. У них должен быть одинаковый пароль. Трафик в мобильной сети может быть платным. Вы можете отключить мобильные данные в настройках устройства.</string>
|
<string name="peer_connectivity_hint">Пиры могут быть найдены с помощью Multicast если они находятся в той же Wi-Fi сети, либо через USB. У них должен быть одинаковый пароль. Трафик в мобильной сети может быть платным. Вы можете отключить мобильные данные в настройках устройства.</string>
|
||||||
<string name="peers_multicast_password_hint">Пароль</string>
|
<string name="peers_multicast_password_hint">Пароль</string>
|
||||||
<string name="node_info">Об узле</string>
|
<string name="node_info">Об узле</string>
|
||||||
|
@ -73,9 +75,9 @@
|
||||||
<string name="tile_enabled">Включено (Нет подключения)</string>
|
<string name="tile_enabled">Включено (Нет подключения)</string>
|
||||||
<string name="tile_connected">Подключено</string>
|
<string name="tile_connected">Подключено</string>
|
||||||
<string name="location_amsterdam">Амстердам, Нидерланды</string>
|
<string name="location_amsterdam">Амстердам, Нидерланды</string>
|
||||||
<string name="location_prague">Прага, Чехия</string>
|
<string name="location_frankfurt">Франкфурт, Германия</string>
|
||||||
<string name="location_bratislava">Братислава, Словакия</string>
|
<string name="location_bratislava">Братислава, Словакия</string>
|
||||||
<string name="location_buffalo">Баффало, США</string>
|
<string name="location_buffalo">Буффало, США</string>
|
||||||
<string name="channel_name">Сервис VPN</string>
|
<string name="channel_name">Сервис VPN</string>
|
||||||
<string name="channel_description">Главный канал нотификаций сервиса</string>
|
<string name="channel_description">Главный канал нотификаций сервиса</string>
|
||||||
<string name="permission_notification_text">Нажмите здесь чтобы включить Yggdrasil.</string>
|
<string name="permission_notification_text">Нажмите здесь чтобы включить Yggdrasil.</string>
|
||||||
|
@ -83,4 +85,5 @@
|
||||||
<string name="private_key_label">Приватный ключ:</string>
|
<string name="private_key_label">Приватный ключ:</string>
|
||||||
<string name="set_keys">Установить свой ключ</string>
|
<string name="set_keys">Установить свой ключ</string>
|
||||||
<string name="save">Сохранить</string>
|
<string name="save">Сохранить</string>
|
||||||
|
<string name="no_browser_found_toast">Не найден браузер для открытия ссылки!</string>
|
||||||
</resources>
|
</resources>
|
|
@ -5,6 +5,7 @@
|
||||||
<color name="purple_700">#FF3700B3</color>
|
<color name="purple_700">#FF3700B3</color>
|
||||||
<color name="teal_200">#FF03DAC5</color>
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="green">#5FBF9F</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
<color name="hintlight">#F2F1F5</color>
|
<color name="hintlight">#F2F1F5</color>
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
<string name="main_no_peers">No peers</string>
|
<string name="main_no_peers">No peers</string>
|
||||||
<string name="main_one_peer">1 peer</string>
|
<string name="main_one_peer">1 peer</string>
|
||||||
<string name="main_many_peers">%d peers</string>
|
<string name="main_many_peers">%d peers</string>
|
||||||
|
<string name="main_add_some_peers_title">Note</string>
|
||||||
|
<string name="main_add_some_peers_message">No peers are configured. If there are no multicast peers nearby, you will need to manually configure peers in order for Yggdrasil to connect and work properly.</string>
|
||||||
<string name="peers_add_peer">Add Configured Peer</string>
|
<string name="peers_add_peer">Add Configured Peer</string>
|
||||||
<string name="peers_add">Add</string>
|
<string name="peers_add">Add</string>
|
||||||
<string name="peers_remove_title">Remove %s?</string>
|
<string name="peers_remove_title">Remove %s?</string>
|
||||||
|
@ -42,11 +44,10 @@
|
||||||
<string name="settings_reset">Reset</string>
|
<string name="settings_reset">Reset</string>
|
||||||
<string name="main_status">Status</string>
|
<string name="main_status">Status</string>
|
||||||
<string name="main_enable_yggdrasil">Enable Yggdrasil</string>
|
<string name="main_enable_yggdrasil">Enable Yggdrasil</string>
|
||||||
<string name="main_statistics">Statistics</string>
|
<string name="main_network_info">Network info</string>
|
||||||
<string name="main_not_available">N/A</string>
|
<string name="main_not_available">N/A</string>
|
||||||
<string name="main_ip">IP</string>
|
<string name="main_ip">IP</string>
|
||||||
<string name="main_subnet">Subnet</string>
|
<string name="main_subnet">Subnet</string>
|
||||||
<string name="main_tree_length">Tree length</string>
|
|
||||||
<string name="main_configuration">Configuration</string>
|
<string name="main_configuration">Configuration</string>
|
||||||
<string name="main_peers">Peers</string>
|
<string name="main_peers">Peers</string>
|
||||||
<string name="main_dns_servers">DNS servers</string>
|
<string name="main_dns_servers">DNS servers</string>
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
<string name="discoverable_over_multicast">Discoverable over multicast</string>
|
<string name="discoverable_over_multicast">Discoverable over multicast</string>
|
||||||
<string name="search_for_multicast_peers">Search for multicast peers</string>
|
<string name="search_for_multicast_peers">Search for multicast peers</string>
|
||||||
<string name="configured_peers_hint">Yggdrasil will automatically attempt to connect to configured peers when started. If you configure more than one peer, your device may carry traffic on behalf of other network nodes. Avoid this by configuring only a single peer.</string>
|
<string name="configured_peers_hint">Yggdrasil will automatically attempt to connect to configured peers when started. If you configure more than one peer, your device may carry traffic on behalf of other network nodes. Avoid this by configuring only a single peer.</string>
|
||||||
|
<string name="peers_discovery_hint">You can find public peers by opening <a href="https://publicpeers.neilalexander.dev/">this link</a>.</string>
|
||||||
<string name="peer_connectivity_hint">Multicast peers will be discovered on the same Wi-Fi network or via USB. They must have the same password. Data charges may apply when using mobile data. You can prevent data usage in the device settings.</string>
|
<string name="peer_connectivity_hint">Multicast peers will be discovered on the same Wi-Fi network or via USB. They must have the same password. Data charges may apply when using mobile data. You can prevent data usage in the device settings.</string>
|
||||||
<string name="peers_multicast_password_hint">Password</string>
|
<string name="peers_multicast_password_hint">Password</string>
|
||||||
<string name="node_info">Node Info</string>
|
<string name="node_info">Node Info</string>
|
||||||
|
@ -73,7 +75,7 @@
|
||||||
<string name="tile_enabled">Enabled (No connectivity)</string>
|
<string name="tile_enabled">Enabled (No connectivity)</string>
|
||||||
<string name="tile_connected">Connected</string>
|
<string name="tile_connected">Connected</string>
|
||||||
<string name="location_amsterdam">Amsterdam, NL</string>
|
<string name="location_amsterdam">Amsterdam, NL</string>
|
||||||
<string name="location_prague">Prague, CZ</string>
|
<string name="location_frankfurt">Frankfurt, DE</string>
|
||||||
<string name="location_bratislava">Bratislava, SK</string>
|
<string name="location_bratislava">Bratislava, SK</string>
|
||||||
<string name="location_buffalo">Buffalo, US</string>
|
<string name="location_buffalo">Buffalo, US</string>
|
||||||
<string name="channel_name">VPN Service</string>
|
<string name="channel_name">VPN Service</string>
|
||||||
|
@ -83,4 +85,5 @@
|
||||||
<string name="private_key_label">Private key:</string>
|
<string name="private_key_label">Private key:</string>
|
||||||
<string name="set_keys">Set your own key</string>
|
<string name="set_keys">Set your own key</string>
|
||||||
<string name="save">Save</string>
|
<string name="save">Save</string>
|
||||||
|
<string name="no_browser_found_toast">No browser found to open the URL!</string>
|
||||||
</resources>
|
</resources>
|
|
@ -18,4 +18,8 @@
|
||||||
<item name="tableBackgroundColor">@color/white</item>
|
<item name="tableBackgroundColor">@color/white</item>
|
||||||
<item name="textDefault">@color/black</item>
|
<item name="textDefault">@color/black</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="YggdrasilDialogs" parent="@style/Theme.MaterialComponents.DayNight.Dialog">
|
||||||
|
<item name="colorPrimary">@color/green</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
|
@ -1,6 +1,6 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.9.10'
|
ext.kotlin_version = '1.9.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
1
fastlane/metadata/android/en-US/changelogs/17.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/17.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* Updated core Yggdrasil library to 0.5.6
|
14
fastlane/metadata/android/en-US/changelogs/18.txt
Normal file
14
fastlane/metadata/android/en-US/changelogs/18.txt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Updated core library to 0.5.7, presenting these changes:
|
||||||
|
|
||||||
|
Added
|
||||||
|
WebSocket support for peerings, by using the new ws:// scheme in Listen and Peers
|
||||||
|
Additionally, the wss:// scheme can be used to connect to a WebSocket peer behind a HTTPS reverse proxy
|
||||||
|
|
||||||
|
Changed
|
||||||
|
On Linux, the TUN adapter now uses vectorised reads/writes where possible, which should reduce the amount of CPU time spent on syscalls and potentially improve throughput
|
||||||
|
Link error handling has been improved and various link error messages have been rewritten to be clearer
|
||||||
|
Upgrade dependencies
|
||||||
|
|
||||||
|
Fixed
|
||||||
|
Multiple multicast connections to the same remote machine should now work correctly
|
||||||
|
You may get two connections in some cases, one inbound and one outbound, this is known and will not cause problems
|
23
fastlane/metadata/android/en-US/changelogs/19.txt
Normal file
23
fastlane/metadata/android/en-US/changelogs/19.txt
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
Updated core library to 0.5.9, presenting these changes:
|
||||||
|
|
||||||
|
Changed
|
||||||
|
The routing algorithm has been updated with RTT-aware link costing, which should prefer lower latency links over higher latency links where possible
|
||||||
|
The calculated cost is an average of the link RTT, but newly established links are costed higher to begin with, such that unstable peerings can be avoided
|
||||||
|
Link costs are only used where multiple next-hops are available and will be ignored if there is only one loop-free path to the destination
|
||||||
|
This is protocol-compatible with existing v0.5.x nodes but will have the best results when peering with nodes that are also running the latest version
|
||||||
|
The getPeers endpoint will now report the calculated link cost for each given peer
|
||||||
|
Upgrade dependencies
|
||||||
|
|
||||||
|
Fixed
|
||||||
|
Multicast discovery should now work again when building Yggdrasil as an Android framework
|
||||||
|
Multicast discovery will now correctly ignore interfaces that are not marked as running
|
||||||
|
Ephemeral links, such as those added by multicast, will no longer try to reconnect in a fast loop, fixing a high CPU issue
|
||||||
|
The TUN interface will no longer stop working when hitting a segment read error from vectorised reads
|
||||||
|
The AllowedPublicKeys option will once again no longer apply to multicast peerings, as was originally intended
|
||||||
|
A potential panic when shutting down peering links has been fixed
|
||||||
|
A redundant system call for setting MTU on OpenBSD has been removed
|
||||||
|
|
||||||
|
Fixes in Android app
|
||||||
|
Fixed occasional crash on start/stop
|
||||||
|
Updated some dependencies
|
||||||
|
Updated Android API to 34
|
19
fastlane/metadata/android/en-US/changelogs/20.txt
Normal file
19
fastlane/metadata/android/en-US/changelogs/20.txt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Updated core library to 0.5.12, presenting these changes:
|
||||||
|
|
||||||
|
Fixed
|
||||||
|
A timing regression which causes a higher level of idle protocol traffic on each peering has been fixed
|
||||||
|
|
||||||
|
Fixes in Android app
|
||||||
|
Some UI fixes and improvements
|
||||||
|
Updated some dependencies
|
||||||
|
|
||||||
|
Updates from previous versions:
|
||||||
|
|
||||||
|
Changed
|
||||||
|
The parent selection algorithm now only chooses a new parent if there is a larger cost benefit to doing so, which should help to stabilise the tree
|
||||||
|
The bloom filters are now repropagated periodically, to avoid nodes getting stuck with bad state
|
||||||
|
|
||||||
|
Fixed
|
||||||
|
A memory leak caused by missed cleanup of the peer response map has been fixed
|
||||||
|
Other bug fixes with bloom filter propagation for off-tree filters and zero vs one bits
|
||||||
|
TLS-based peering connections now support TLS 1.2 again
|
BIN
fastlane/metadata/android/en-US/images/icon.png
Normal file
BIN
fastlane/metadata/android/en-US/images/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
1
fastlane/metadata/android/ru/changelogs/17.txt
Normal file
1
fastlane/metadata/android/ru/changelogs/17.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* Обновлена библиотека Yggdrasil до 0.5.6
|
14
fastlane/metadata/android/ru/changelogs/18.txt
Normal file
14
fastlane/metadata/android/ru/changelogs/18.txt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Обновлена основная библиотека до версии 0.5.7, в которой представлены следующие изменения:
|
||||||
|
|
||||||
|
Добавлено
|
||||||
|
Поддержка WebSocket для пиринга с использованием новой схемы ws:// в Listen и Peers
|
||||||
|
Кроме того, схему wss:// можно использовать для подключения к узлам WebSocket за обратным прокси-сервером HTTPS вроде Nginx
|
||||||
|
|
||||||
|
Изменено
|
||||||
|
В Linux адаптер TUN теперь использует векторизованную чтение/запись, где это возможно, что должно сократить количество времени ЦП, затрачиваемого на системные вызовы, и потенциально повысить пропускную способность
|
||||||
|
Улучшена обработка ошибок соединения, а различные сообщения об ошибках соединения были переписаны для большей ясности
|
||||||
|
Обновление зависимостей
|
||||||
|
|
||||||
|
Исправлено
|
||||||
|
Несколько мультикаст подключений к одной и той же удаленной машине теперь должны работать правильно
|
||||||
|
В некоторых случаях вы можете получить два подключения, одно входящее и одно исходящее, это известное поведение и не вызовет проблем
|
23
fastlane/metadata/android/ru/changelogs/19.txt
Normal file
23
fastlane/metadata/android/ru/changelogs/19.txt
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
Обновлена основная библиотека до версии 0.5.9, в которой представлены следующие изменения:
|
||||||
|
|
||||||
|
Изменено
|
||||||
|
Алгоритм маршрутизации был обновлен с учетом стоимости соединения с RTT, что должно отдавать предпочтения соединениям с меньшей задержкой соединениям с большей задержкой, когда это возможно
|
||||||
|
Расчетная стоимость представляет собой среднее значение RTT соединения, но новые соединения изначально оцениваются выше, так что можно избежать проблем с нестабильными узлами
|
||||||
|
Стоимость соединения используется только при наличии нескольких следующих переходов и будет игнорироваться, если есть только один путь без петель к месту назначения
|
||||||
|
Эта версия совместима с существующими узлами v0.5.x, но будет иметь наилучшие результаты при пиринге с узлами, которые также работают под управлением последней версии
|
||||||
|
Команда getPeers теперь будет сообщать рассчитанную стоимость соединения для каждого заданного пира
|
||||||
|
Обновлены зависимости
|
||||||
|
|
||||||
|
Исправлено
|
||||||
|
Обнаружение локальных пиров теперь должно снова работать при сборке Yggdrasil как фреймворка Android
|
||||||
|
Обнаружение локальных пиров теперь будет правильно игнорировать интерфейсы, которые не помечены как работающие
|
||||||
|
Эфемерные соединения, такие как добавленные мультикастом, больше не будут пытаться быстро переподключаться в цикле, устранена проблема высокой загрузки ЦП
|
||||||
|
Интерфейс TUN больше не будет прекращать работу при срабатывании ошибки чтения пакета с помощью векторизованного чтения
|
||||||
|
Опция AllowedPublicKeys снова больше не будет применяться к локальным пирам, как изначально предполагалось
|
||||||
|
Потенциальный краш при отключении пиринговых соединений был исправлен
|
||||||
|
Избыточный системный вызов для установки MTU в OpenBSD был удален
|
||||||
|
|
||||||
|
Исправления в приложении для Android
|
||||||
|
Исправлен случайный сбой при запуске/остановке
|
||||||
|
Обновлены некоторые зависимости
|
||||||
|
Обновлен Android API до 34
|
19
fastlane/metadata/android/ru/changelogs/20.txt
Normal file
19
fastlane/metadata/android/ru/changelogs/20.txt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Обновлена основная библиотека до версии 0.5.12, в которой представлены следующие изменения:
|
||||||
|
|
||||||
|
Исправлено
|
||||||
|
Исправлена регрессия синхронизации, которая приводит к более высокому уровню служебного трафика в простое
|
||||||
|
|
||||||
|
Исправления в приложении Android
|
||||||
|
Исправления и улучшения пользовательского интерфейса
|
||||||
|
Обновлены некоторые зависимости
|
||||||
|
|
||||||
|
Обновления с предыдущих версий:
|
||||||
|
|
||||||
|
Изменено
|
||||||
|
Алгоритм выбора родителя теперь выбирает нового родителя только в том случае, если это дает большую экономическую выгоду, что должно помочь стабилизировать дерево
|
||||||
|
Фильтры Блума теперь периодически распространяются повторно, чтобы избежать застревания узлов в плохом состоянии
|
||||||
|
|
||||||
|
Исправлено
|
||||||
|
Утечка памяти, вызванная пропущенной очисткой карты ответов пиров
|
||||||
|
Другие исправления ошибок с распространением фильтра Блума для фильтров вне дерева
|
||||||
|
Пиринг с использованием TLS теперь снова поддерживают TLS 1.2
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6b6cd0bed553ada887632524994e4de4e839688e
|
Subproject commit 213f72b8403ff55a5e38a0fa7d1cd0a093ac4666
|
21
readme.md
21
readme.md
|
@ -1,4 +1,23 @@
|
||||||
## build instructions
|
Yggdrasil Android
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6 network. It is lightweight, self-arranging, supported on multiple platforms and allows pretty much any IPv6-capable application to communicate securely with other Yggdrasil nodes. Yggdrasil does not require you to have IPv6 Internet connectivity - it also works over IPv4.
|
||||||
|
|
||||||
|
This app allows you to connect to Yggdrasil Network and use any service located in this network. It works as VPN service, but all your usual traffic will go trough your provider, not through Yggdrasil Network.
|
||||||
|
|
||||||
|
Also, it is not a goal of the Yggdrasil project to provide anonymity. Direct peers over the Internet will be able to see your IP address and may be able to use this information to determine your location or identity. Multicast-discovered peerings on the same network will typically expose your device MAC address. Other nodes on the network may be able to discern some information about which nodes you are peered with.
|
||||||
|
|
||||||
|
All traffic sent across the Yggdrasil network is encrypted end-to-end. Assuming that our crypto is solid, it cannot be decrypted or read by any intermediate nodes, and can only be decrypted by the recipient for which it was intended. However, please note that Yggdrasil has not been officially externally audited.
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
||||||
|
alt="Get it on F-Droid"
|
||||||
|
height="80">](https://f-droid.org/packages/eu.neilalexander.yggdrasil/)
|
||||||
|
|
||||||
|
Or get the APK from the [Releases Section](https://github.com/yggdrasil-network/yggdrasil-android/releases/latest).
|
||||||
|
|
||||||
|
## Build Instructions
|
||||||
|
|
||||||
* install gomobile
|
* install gomobile
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue