diff --git a/app/build.gradle b/app/build.gradle index 22d1114..32f0f5c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,9 @@ android { applicationId "io.github.chronosx88.yggdrasil" minSdkVersion 15 targetSdkVersion 29 - versionCode 23 - versionName "2.0.3" + + versionCode 30 + versionName "2.0.12" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", project.getParent().name+"-"+versionName) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 08a84d9..687e5a4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,6 +14,7 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" + android:usesCleartextTraffic="true" tools:ignore="GoogleAppIndexingWarning"> (R.id.nodeInfoList) - val nodeInfoList = listOf(NodeInfo("IP address", ipv6Address!!), NodeInfo("Public Key", publicKey!!)); + var nodeInfoListView = findViewById(R.id.node_info_list) + val nodeInfoList = listOf(NodeInfo("IP address", ipv6Address!!), NodeInfo("Public Key", publicKey!!)); val adapter = NodeInfoListAdapter( this, diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt index 3355426..fe3a928 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt @@ -43,7 +43,7 @@ class PeerListActivity : AppCompatActivity() { companion object { const val PEER_LIST = "PEER_LIST" - const val PEER_LIST_URL = "https://publicpeers.neilalexander.dev/publicnodes.json" + const val PEER_LIST_URL = "xxx" const val CACHE_NAME = "PEER_LIST_CACHE" const val ONLINE_PEERINFO_LIST = "online_peer_info_list" const val OFFLINE_PEERINFO_LIST = "offline_peer_info_list" diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/YggApplication.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/YggApplication.kt index 67ab86b..84906b7 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/YggApplication.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/YggApplication.kt @@ -9,6 +9,11 @@ import org.acra.ktx.initAcra import org.acra.sender.HttpSender class YggApplication : Application() { + + companion object { + const val ACRA_BACKEND_URL = "xxx" + } + override fun attachBaseContext(base: Context) { super.attachBaseContext(base) @@ -18,9 +23,9 @@ class YggApplication : Application() { reportFormat = StringFormat.JSON //each plugin you chose above can be configured in a block like this: httpSender { - uri = "http:///report" - basicAuthLogin="***" - basicAuthPassword = "***" + uri = ACRA_BACKEND_URL + basicAuthLogin="KOF7CEnt5tfTqIhj" + basicAuthPassword = "F4cCIqo9EjpihcPt" httpMethod = HttpSender.Method.POST } dialog { diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt index b361eb0..f5f0c6a 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/YggdrasilTunService.kt @@ -23,6 +23,7 @@ import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.deserializeS import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.deserializeStringList2PeerInfoSet import mobile.Mobile import mobile.Yggdrasil +import org.acra.ACRA import java.io.* import java.net.Inet6Address import kotlin.concurrent.thread @@ -139,6 +140,7 @@ class YggdrasilTunService : VpnService() { private fun sendMeshPeerStatus(pi: PendingIntent?){ class Token : TypeToken>() ygg.addressString + ACRA.errorReporter.putCustomData("Peers JSON", ygg.peersJSON) var meshPeers: List = gson.fromJson(ygg.peersJSON, Token().type) val intent: Intent = Intent().putStringArrayListExtra( MainActivity.MESH_PEERS, @@ -202,6 +204,8 @@ class YggdrasilTunService : VpnService() { ygg.send(buffer.sliceArray(IntRange(0, length - 1))) } catch (e: IOException) { e.printStackTrace() + } catch (e: Exception){ + e.printStackTrace(); } } @@ -212,6 +216,8 @@ class YggdrasilTunService : VpnService() { tunOutputStream.write(buffer) } catch (e: IOException) { e.printStackTrace() + } catch (e: Exception){ + e.printStackTrace(); } } } diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/NodeInfoListAdapter.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/NodeInfoListAdapter.kt index 8c20a2d..c90803e 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/NodeInfoListAdapter.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/NodeInfoListAdapter.kt @@ -10,8 +10,9 @@ import android.widget.TextView import android.widget.Toast import androidx.recyclerview.widget.RecyclerView import io.github.chronosx88.yggdrasil.R +import io.github.chronosx88.yggdrasil.models.NodeInfo -class NodeInfoListAdapter(private val context: Context, private val infoSet: Array>) : +class NodeInfoListAdapter(private val context: Context, private val infoSet: Array) : RecyclerView.Adapter() { class ViewHolder(private val context: Context, view: View) : RecyclerView.ViewHolder(view) { @@ -50,8 +51,8 @@ class NodeInfoListAdapter(private val context: Context, private val infoSet: Arr // Get element from your dataset at this position and replace the // contents of the view with that element - viewHolder.key.text = infoSet[position].first - viewHolder.value.text = infoSet[position].second + viewHolder.key.text = infoSet[position].key + viewHolder.value.text = infoSet[position].value } // Return the size of your dataset (invoked by the layout manager) diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Peer.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Peer.kt index dd6a0ef..ad1712b 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Peer.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Peer.kt @@ -3,11 +3,11 @@ package io.github.chronosx88.yggdrasil.models.config import com.google.gson.annotations.SerializedName data class Peer ( - //Example [{"PublicKey":[154,201,118,156,19,74,134,115,94,159,76,86,36,192,221,105,220,254,226,161,108,226,17,192,75,243,225,15,42,195,155,2],"Endpoint":"(self)","BytesSent":0,"BytesRecvd":0,"Protocol":"self","Port":0,"Uptime":209900460}] - @SerializedName("Endpoint") var endpoint : String, + //Example [{"Key":"JQZIX3KIamcp/6S9rycKiAGyg9MK7U6h8UUY5ej36fY=","Root":"AAABERGfllXfKNJshDs/8uzKEIFkFEccE16dmZV/cAo=","Coords":[2,4],"Port":1,"Remote":"tcp://[fe80::5207:4518:4378:7f1%wlan0]:57541","IP":"202:d7cd:bd04:6bbc:acc6:b002:da12:86c7"},{"Key":"DCNBiKAV1xr72JAFUgNrOYfY6Qm/f0Nq6ESZTSLn1eo=","Root":"AAABERGfllXfKNJshDs/8uzKEIFkFEccE16dmZV/cAo=","Coords":[2,4,1],"Port":2,"Remote":"tcp://[fe80::1c39:839:90a5:6ef%wlan0]:1108","IP":"204:7b97:ceeb:fd45:1ca0:84ed:ff55:bf92"}] + @SerializedName("Key") var key : String, + @SerializedName("Root") var root : String, + //@SerializedName("Coords") var uptime : Long, @SerializedName("Port") var port : Int, - @SerializedName("Uptime") var uptime : Long, - @SerializedName("Protocol") var protocol : String, - @SerializedName("BytesSent") var bytesSent : Long, - @SerializedName("BytesRecvd") var bytesReceived : Long + @SerializedName("Remote") var remote : String, + @SerializedName("IP") var ip : String ) \ No newline at end of file diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Utils.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Utils.kt index 1c737ad..99ed43d 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Utils.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/models/config/Utils.kt @@ -119,22 +119,18 @@ class Utils { if (list != null) { for(s in list) { var p = gson.fromJson(s, Peer::class.java) - if(p.endpoint == "(self)"){ - out.add(PeerInfo(p.protocol, InetAddress.getByName("localhost"), p.port, null, true)) - } else { - var fixWlanPart = p.endpoint.substring(p.endpoint.indexOf('%'), p.endpoint.indexOf(']')) - var fixedUrlString = p.endpoint.replace(fixWlanPart, "") - var url = URI(fixedUrlString) - out.add( - PeerInfo( - url.scheme, - InetAddress.getByName(url.host), - url.port, - null, - true - ) + var fixWlanPart = p.remote.substring(p.remote.indexOf('%'), p.remote.indexOf(']')) + var fixedUrlString = p.remote.replace(fixWlanPart, "") + var url = URI(fixedUrlString) + out.add( + PeerInfo( + url.scheme, + InetAddress.getByName(url.host), + url.port, + null, + true ) - } + ) } } return out