Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparation for release 0.5.7 #62

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "eu.neilalexander.yggdrasil"
minSdkVersion 21
targetSdkVersion 33
versionCode 17
versionName "0.1-017"
versionCode 18
versionName "0.1-018"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/eu/neilalexander/yggdrasil/DnsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.preference.PreferenceManager
import com.google.android.material.textfield.TextInputEditText

const val KEY_DNS_SERVERS = "dns_servers"
const val KEY_DNS_VERSION = "dns_version"
const val KEY_ENABLE_CHROME_FIX = "enable_chrome_fix"

class DnsActivity : AppCompatActivity() {
Expand Down Expand Up @@ -41,10 +42,10 @@ class DnsActivity : AppCompatActivity() {
val descriptionRevertron = getString(R.string.dns_server_info_revertron)
// Here we can add some other DNS servers in a future
defaultDnsServers = hashMapOf(
"302:7991::53" to Pair(getString(R.string.location_amsterdam), descriptionRevertron),
"302:db60::53" to Pair(getString(R.string.location_prague), descriptionRevertron),
"300:6223::53" to Pair(getString(R.string.location_bratislava), descriptionRevertron),
"301:1088::53" to Pair(getString(R.string.location_buffalo), descriptionRevertron),
"308:62:45:62::" to Pair(getString(R.string.location_amsterdam), descriptionRevertron),
"308:84:68:55::" to Pair(getString(R.string.location_frankfurt), descriptionRevertron),
"308:25:40:bd::" to Pair(getString(R.string.location_bratislava), descriptionRevertron),
"308:c8:48:45::" to Pair(getString(R.string.location_buffalo), descriptionRevertron),
)

serversTableLayout = findViewById(R.id.configuredDnsTableLayout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import android.os.Build
import android.service.quicksettings.TileService
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.preference.PreferenceManager

const val PREF_KEY_ENABLED = "enabled"
const val MAIN_CHANNEL_ID = "Yggdrasil Service"

class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
private lateinit var config: ConfigurationProxy
private var currentState: State = State.Disabled
var updaterConnections: Int = 0
private var updaterConnections: Int = 0

override fun onCreate() {
super.onCreate()
Expand All @@ -24,6 +25,7 @@ class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
callback.register()
val receiver = YggStateReceiver(this)
receiver.register(this)
migrateDnsServers(this)
}

fun subscribe() {
Expand Down Expand Up @@ -64,6 +66,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 {
createNotificationChannels(context)

Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/eu/neilalexander/yggdrasil/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class MainActivity : AppCompatActivity() {
private lateinit var enabledLabel: TextView
private lateinit var ipAddressLabel: TextView
private lateinit var subnetLabel: TextView
private lateinit var treeLengthLabel: TextView
private lateinit var peersLabel: TextView
private lateinit var peersRow: LinearLayoutCompat
private lateinit var dnsLabel: TextView
Expand Down Expand Up @@ -53,7 +52,6 @@ class MainActivity : AppCompatActivity() {
enabledLabel = findViewById(R.id.yggdrasilStatusLabel)
ipAddressLabel = findViewById(R.id.ipAddressValue)
subnetLabel = findViewById(R.id.subnetValue)
treeLengthLabel = findViewById(R.id.treeLengthValue)
peersLabel = findViewById(R.id.peersValue)
peersRow = findViewById(R.id.peersTableRow)
dnsLabel = findViewById(R.id.dnsValue)
Expand Down Expand Up @@ -175,7 +173,6 @@ class MainActivity : AppCompatActivity() {
}
ipAddressLabel.text = intent.getStringExtra("ip") ?: "N/A"
subnetLabel.text = intent.getStringExtra("subnet") ?: "N/A"
treeLengthLabel.text = intent.getStringExtra("coords") ?: "0"
if (intent.hasExtra("peers")) {
val peerState = JSONArray(intent.getStringExtra("peers") ?: "[]")
peersLabel.text = when (val count = peerState.length()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,14 @@ open class PacketTunnelProvider: VpnService() {
var lastStateUpdate = System.currentTimeMillis()
updates@ while (started.get()) {
val treeJSON = yggdrasil.treeJSON
var treeLength = 0
if (treeJSON != null && treeJSON != "null") {
val treeState = JSONArray(treeJSON)
treeLength = treeState.length()
}
if ((application as GlobalApplication).needUiUpdates()) {
val intent = Intent(STATE_INTENT)
intent.putExtra("type", "state")
intent.putExtra("started", true)
intent.putExtra("ip", yggdrasil.addressString)
intent.putExtra("subnet", yggdrasil.subnetString)
intent.putExtra("pubkey", yggdrasil.publicKeyString)
intent.putExtra("coords", "$treeLength")
intent.putExtra("peers", yggdrasil.peersJSON)
intent.putExtra("tree", treeJSON)
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
}
val curTime = System.currentTimeMillis()
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/eu/neilalexander/yggdrasil/PeersActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.content.Intent
import android.content.IntentFilter
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.util.Log
import android.view.ContextThemeWrapper
import android.view.KeyEvent
Expand Down Expand Up @@ -47,6 +48,9 @@ class PeersActivity : AppCompatActivity() {
configuredTableLayout = findViewById(R.id.configuredPeersTableLayout)
configuredTableLabel = findViewById(R.id.configuredPeersLabel)

val discoveryLink = findViewById<TextView>(R.id.peers_discovery_link)
discoveryLink.movementMethod = LinkMovementMethod.getInstance()

multicastListenSwitch = findViewById(R.id.enableMulticastListen)
multicastListenSwitch.setOnCheckedChangeListener { button, _ ->
config.multicastListen = button.isChecked
Expand Down
30 changes: 2 additions & 28 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
android:layout_height="32px" />

<TextView
android:id="@+id/statisticsSectionLabel"
android:id="@+id/networkInfoSectionLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16pt"
Expand All @@ -126,7 +126,7 @@
android:layout_marginBottom="2pt"
android:alpha="0.7"
android:paddingRight="8pt"
android:text="@string/main_statistics"
android:text="@string/main_network_info"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp" />
Expand Down Expand Up @@ -203,32 +203,6 @@

</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>

<Space
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/layout/activity_peers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,23 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
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
android:layout_width="match_parent"
android:layout_height="32px" />
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
<string name="settings_reset">Сброс</string>
<string name="main_status">Состояние</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_ip">Адрес</string>
<string name="main_subnet">Подсеть</string>
<string name="main_tree_length">Высота дерева</string>
<string name="main_configuration">Конфигурация</string>
<string name="main_peers">Пиры</string>
<string name="main_dns_servers">Серверы DNS</string>
Expand All @@ -58,6 +57,7 @@
<string name="discoverable_over_multicast">Находимый через multicast</string>
<string name="search_for_multicast_peers">Искать пиров через multicast</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="peers_multicast_password_hint">Пароль</string>
<string name="node_info">Об узле</string>
Expand All @@ -73,9 +73,9 @@
<string name="tile_enabled">Включено (Нет подключения)</string>
<string name="tile_connected">Подключено</string>
<string name="location_amsterdam">Амстердам, Нидерланды</string>
<string name="location_prague">Прага, Чехия</string>
<string name="location_frankfurt">Франкфурт, Германия</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_description">Главный канал нотификаций сервиса</string>
<string name="permission_notification_text">Нажмите здесь чтобы включить Yggdrasil.</string>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
<string name="settings_reset">Reset</string>
<string name="main_status">Status</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_ip">IP</string>
<string name="main_subnet">Subnet</string>
<string name="main_tree_length">Tree length</string>
<string name="main_configuration">Configuration</string>
<string name="main_peers">Peers</string>
<string name="main_dns_servers">DNS servers</string>
Expand All @@ -58,6 +57,7 @@
<string name="discoverable_over_multicast">Discoverable over multicast</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="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="peers_multicast_password_hint">Password</string>
<string name="node_info">Node Info</string>
Expand All @@ -73,7 +73,7 @@
<string name="tile_enabled">Enabled (No connectivity)</string>
<string name="tile_connected">Connected</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_buffalo">Buffalo, US</string>
<string name="channel_name">VPN Service</string>
Expand Down
14 changes: 14 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/18.txt
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions fastlane/metadata/android/ru/changelogs/18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Обновлена основная библиотека до версии 0.5.7, в которой представлены следующие изменения:

Добавлено
Поддержка WebSocket для пиринга с использованием новой схемы ws:// в Listen и Peers
Кроме того, схему wss:// можно использовать для подключения к узлам WebSocket за обратным прокси-сервером HTTPS вроде Nginx

Изменено
В Linux адаптер TUN теперь использует векторизованную чтение/запись, где это возможно, что должно сократить количество времени ЦП, затрачиваемого на системные вызовы, и потенциально повысить пропускную способность
Улучшена обработка ошибок соединения, а различные сообщения об ошибках соединения были переписаны для большей ясности
Обновление зависимостей

Исправлено
Несколько мультикаст подключений к одной и той же удаленной машине теперь должны работать правильно
В некоторых случаях вы можете получить два подключения, одно входящее и одно исходящее, это известное поведение и не вызовет проблем
Loading