Skip to content

Commit 0efbbe7

Browse files
committed
cleanup
1 parent 97795c7 commit 0efbbe7

File tree

7 files changed

+5
-100
lines changed

7 files changed

+5
-100
lines changed

app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ android {
1010
namespace = "org.operatorfoundation.moonbounceAndroidKotlin"
1111
applicationId "org.operatorfoundation.moonbounceAndroidKotlin"
1212
minSdk 26
13-
targetSdk 33
1413
versionCode 1
1514
versionName "1.0"
1615

app/src/androidTest/java/org/OperatorFoundation/MoonbounceAndroidKotlin/ExampleInstrumentedTest.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,4 @@ class ExampleInstrumentedTest {
2121
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2222
assertEquals("org.operatorfoundation.moonbounceAndroidKotlin", appContext.packageName)
2323
}
24-
25-
@Test
26-
fun portConnected() {
27-
28-
}
29-
3024
}

app/src/main/java/org/OperatorFoundation/MoonbounceAndroidKotlin/MainActivity.kt

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -178,95 +178,57 @@ class MainActivity : AppCompatActivity()
178178
{
179179
val appManager = AppManager(applicationContext)
180180
val installedApps = appManager.getApps()
181-
// val appIDs = mutableListOf<String>()
182181

183182
println("Installed applications:")
184183
for (app in installedApps)
185184
{
186185
println("\napp name - ${app.name}")
187186
println("app id - ${app.id}")
188-
// appIDs.add(app.id)
189187
}
190-
191-
// println("### appNames List: ${appIDs.count()} items")
192-
// val choices: Array<String> = appIDs.toTypedArray()
193-
// println("### Choices Array: ${choices.count()} items")
194-
// val preSelectedItems: BooleanArray = BooleanArray(appIDs.count(), init = {false})
195-
// val selectedItems = mutableListOf<String>()
196-
//
197-
// MaterialAlertDialogBuilder(this)
198-
// .setTitle("Installed Apps")
199-
// .setMessage("Select any apps that should not use the VPN.")
200-
//// .setMultiChoiceItems(choices, preSelectedItems) { dialog, which, checked ->
201-
//// if (checked)
202-
//// {
203-
//// selectedItems.add(choices[which])
204-
//// println("Adding ${choices[which]} to the disallowed apps list.")
205-
//// }
206-
//// }
207-
// .setPositiveButton("OK"){ _: DialogInterface, _: Int ->
208-
// println(">>>>> Apps selected to exclude: $choices")
209-
// }
210-
// .show()
211188
}
212189

213190
private fun testTCPTapped()
214191
{
215-
println("Test TCP tapped.")
216-
217192
ipAddress = ipEditText.text.toString()
218193
networkTests.host = ipAddress
219194
networkTests.tcpTest()
220195
}
221196

222197
private fun testTCPConnectTapped()
223198
{
224-
println("Test TCP Connect tapped.")
225-
226199
ipAddress = ipEditText.text.toString()
227200
networkTests.host = ipAddress
228201
networkTests.tcpConnectTest()
229202
}
230203

231204
private fun testTCPBigDataButtonTapped()
232205
{
233-
println("Test TCP Big Data tapped.")
234-
235206
ipAddress = ipEditText.text.toString()
236207
networkTests.host = ipAddress
237208
networkTests.tcpTest2k()
238209
}
239210

240211
private fun testUDPTapped()
241212
{
242-
println("Test UDP tapped.")
243-
244213
ipAddress = ipEditText.text.toString()
245214
networkTests.host = ipAddress
246215
networkTests.udpTest()
247216
}
248217

249218
private fun testHTTPTapped()
250219
{
251-
println("Test HTTP tapped.")
252-
253220
networkTests.testHTTP()
254221
}
255222

256223
private fun testResolveDNS()
257224
{
258-
println("Test Resolve DNS tapped.")
259-
260225
networkTests.testResolveDNS()
261226
}
262227

263228
fun connectTapped()
264229
{
265-
println("Connect tapped.")
266-
267230
if (ipEditText.text.toString().isBlank() || portEditText.text.toString().isBlank())
268231
{
269-
println("A valid server IP and port are required to enable VPN services.")
270232
resultText.text = "A valid server IP and port are required to enable VPN services."
271233
vpnConnectedSwitch.isChecked = false
272234
return
@@ -302,7 +264,6 @@ class MainActivity : AppCompatActivity()
302264
fun disconnectTapped()
303265
{
304266
vpnConnectedSwitch.text = "Connect VPN"
305-
println("User request to close the tunnel.")
306267
stopService(moonbounceVPNIntent)
307268
moonbounceVPNIntent.action = STOP_VPN_ACTION
308269
startService(moonbounceVPNIntent)

moonbounceVPNService/src/androidTest/java/org/operatorfoundation/moonbouncevpnservice/ExampleInstrumentedTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class ExampleInstrumentedTest {
2626
fun pluginStopService() {
2727
// Context of the app under test.
2828
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
29-
// assertEquals("org.operatorfoundation.moonbouncevpnservice.test", appContext.packageName)
30-
31-
val moonbounceKotlin = MoonbounceKotlin(appContext, "164.92.71.230", 1234)
29+
val moonbounceKotlin = MoonbounceKotlin(appContext, "", 1234)
3230
moonbounceKotlin.startVPN()
3331
moonbounceKotlin.stopVPN()
3432
}

moonbounceVPNService/src/main/java/org/operatorfoundation/moonbouncevpnservice/MBAKVpnService.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ class MBAKVpnService : VpnService()
143143
this.shadowConnection = ShadowConnection(config, context, Logger.getLogger("MoonbounceShadowLogger"), this.transmissionConnection!!)
144144
}
145145

146-
// println("🌙 MBAKVpnService: starting ServerToVPN loop")
147146
thread(start = true)
148147
{
149148
if (this.usePluggableTransport)
@@ -156,7 +155,6 @@ class MBAKVpnService : VpnService()
156155
}
157156
}
158157

159-
// println("🌙 MBAKVpnService: starting VPNtoServer loop")
160158
thread(start = true)
161159
{
162160
if (this.usePluggableTransport)
@@ -216,7 +214,7 @@ class MBAKVpnService : VpnService()
216214
if (numberOfBytesReceived == -1)
217215
{
218216
println("vpnToServer read -1 bytes from the VPN input stream.")
219-
throw java.io.IOException()
217+
throw IOException()
220218
}
221219

222220
if (numberOfBytesReceived == 0)
@@ -238,15 +236,11 @@ class MBAKVpnService : VpnService()
238236
if (batchBuffer.size >= maxBatchSize)
239237
{
240238
serverConnection.write(batchBuffer)
241-
242-
// println("🙀🙀Wrote ${batchBuffer.size} bytes to the server connection.")
243239
batchBuffer = byteArrayOf()
244240
}
245241
else if ((now - lastPacketSentTime).inWholeMilliseconds >= timeoutDuration)
246242
{
247243
serverConnection.write(batchBuffer)
248-
249-
// println("\uD83D\uDE40\uD83D\uDE40 TIMEOUT!! Wrote ${batchBuffer.size} bytes to the server connection.")
250244
batchBuffer = byteArrayOf()
251245
}
252246

moonbounceVPNService/src/main/java/org/operatorfoundation/moonbouncevpnservice/MoonbounceKotlin.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class MoonbounceKotlin(val context: Context, var ipAddress: String, var serverPo
4747

4848
fun stopVPN(): Boolean
4949
{
50-
println("----------->>>>>>>>>>>>> Plugin Stop Service called")
51-
5250
if (vpnServiceIntent == null)
5351
{
5452
// The intent doesn't exist so there is nothing to stop

moonbounceVPNService/src/main/java/org/operatorfoundation/moonbouncevpnservice/NetworkTests.kt

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class NetworkTests (val context: Context)
7171
{
7272
val exceedMTUSize = 2500
7373
val someBytes = ByteArray(exceedMTUSize)
74-
75-
// TODO: Make tcpTest take a byte array to send
7674
}
7775

7876
fun tcpTest()
@@ -131,8 +129,6 @@ class NetworkTests (val context: Context)
131129
{
132130
try
133131
{
134-
val testString = "Catbus is TCP tops!"
135-
136132
val testConnection = TransmissionConnection(host, tcpEchoPort, ConnectionType.TCP, null)
137133
println("🌙 TCP Connect test: Transmission Connection created. TCP Connect test succeeded!")
138134
testConnection.close()
@@ -195,26 +191,14 @@ class NetworkTests (val context: Context)
195191

196192
fun testHTTP()
197193
{
198-
// // http://operatorfoundation.org/images/logo.jpg
199-
// //GET / HTTP/1.0
200-
// //\r\n\]r\n
201-
//
202-
// URL("http://operatorfoundation.org/images/logo.jpg").run {
203-
// openConnection().run {
204-
// this as HttpURLConnection
205-
// val response = inputStream.bufferedReader().readText()
206-
// println("testHTTP received a response: $response")
207-
// }
208-
// }
209-
210194
println("🌙 Launching HTTP Test")
211-
println("\uD83C\uDF19 host and port: 185.199.109.153: 80")
195+
println("\uD83C\uDF19 host and port: $host: 80")
212196

213197
thread(start = true)
214198
{
215199
try
216200
{
217-
val transmissionConnection = TransmissionConnection("185.199.109.153", 80, ConnectionType.TCP, null)
201+
val transmissionConnection = TransmissionConnection(host, 80, ConnectionType.TCP, null)
218202
println("🌙 HTTP test: Transmission Connection created.")
219203

220204
transmissionConnection.write("GET / HTTP/1.0\r\n\r\n".toByteArray())
@@ -251,7 +235,7 @@ class NetworkTests (val context: Context)
251235
val address = InetAddress.getByName("operatorfoundation.org")
252236
println("🌙 testResolveDNS: got an address from operatorfoundation.org: ${address.hostAddress}")
253237

254-
if (address.hostAddress == "185.199.110.153")
238+
if (address.hostAddress == host)
255239
{
256240
println("🌙 testResolveDNS succeeded! ✨")
257241
broadcastStatus(dnsTestNotification, DNS_TEST_STATUS, true)
@@ -271,27 +255,4 @@ class NetworkTests (val context: Context)
271255
intent.action = action
272256
context.sendBroadcast(intent)
273257
}
274-
275-
276-
277-
// fun tcpBroadcastMessage(success: Boolean)
278-
// {
279-
// println("*******BROADCASTING TCP MESSAGE")
280-
// Intent().also { intent ->
281-
// intent.action = broadcastTCPAction
282-
// intent.putExtra(isSuccessful, success)
283-
// context.sendBroadcast(intent)
284-
// }
285-
// }
286-
//
287-
// fun udpBroadcastMessage(success: Boolean)
288-
// {
289-
// println("*******BROADCASTING UDP MESSAGE")
290-
//
291-
// Intent().also { intent ->
292-
// intent.action = broadcastUDPAction
293-
// intent.putExtra(udpIsSuccessful, success)
294-
// context.sendBroadcast(intent)
295-
// }
296-
// }
297258
}

0 commit comments

Comments
 (0)