1. fixed buffer overhead

This commit is contained in:
vadym 2020-06-15 13:38:14 -07:00
parent 9cc1f5a7f9
commit 754dca90ef

View File

@ -87,22 +87,6 @@ class YggdrasilTunService : VpnService() {
pi.send(this, MainActivity.STATUS_FINISH, intent) pi.send(this, MainActivity.STATUS_FINISH, intent)
} }
private fun getNonVpnNetworks(Address: String): Array<Network> {
val cm =
getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val networks = cm.allNetworks
for (network in networks) {
val linkProperties = cm.getLinkProperties(network)
val addresses = linkProperties.linkAddresses
for (addr in addresses) {
if (addr.toString().startsWith(Address)) {
return arrayOf(network)
}
}
}
return emptyArray<Network>()
}
private fun fixConfig(config: MutableMap<Any?, Any?>): MutableMap<Any?, Any?> { private fun fixConfig(config: MutableMap<Any?, Any?>): MutableMap<Any?, Any?> {
val peers = arrayListOf<String>(); val peers = arrayListOf<String>();
peers.add("tcp://194.177.21.156:5066") peers.add("tcp://194.177.21.156:5066")
@ -139,7 +123,7 @@ class YggdrasilTunService : VpnService() {
private fun readPacketsFromTun() { private fun readPacketsFromTun() {
if(tunInputStream != null) { if(tunInputStream != null) {
var packet: ByteArray = ByteArray(MAX_PACKET_SIZE) var packet = ByteArray(2048)
// Read the outgoing packet from the input stream. // Read the outgoing packet from the input stream.
var length = tunInputStream!!.read(packet) var length = tunInputStream!!.read(packet)