Browse Source

Fix: consume client region, split tunnel, and untunneled address notices

Rod Hynes 10 years ago
parent
commit
24136caf3a

+ 6 - 2
SampleApps/Psibot/app/src/main/java/ca/psiphon/PsiphonTunnel.java

@@ -67,6 +67,7 @@ public class PsiphonTunnel extends Psi.PsiphonProvider.Stub {
         public void onConnecting();
         public void onConnecting();
         public void onConnected();
         public void onConnected();
         public void onHomepage(String url);
         public void onHomepage(String url);
+        public void onClientRegion(String region);
         public void onClientUpgradeDownloaded(String filename);
         public void onClientUpgradeDownloaded(String filename);
         public void onSplitTunnelRegion(String region);
         public void onSplitTunnelRegion(String region);
         public void onUntunneledAddress(String address);
         public void onUntunneledAddress(String address);
@@ -381,11 +382,14 @@ public class PsiphonTunnel extends Psi.PsiphonProvider.Stub {
             } else if (noticeType.equals("Homepage")) {
             } else if (noticeType.equals("Homepage")) {
                 mHostService.onHomepage(notice.getJSONObject("data").getString("url"));
                 mHostService.onHomepage(notice.getJSONObject("data").getString("url"));
 
 
+            } else if (noticeType.equals("ClientRegion")) {
+                mHostService.onClientRegion(notice.getJSONObject("data").getString("region"));
+
             } else if (noticeType.equals("SplitTunnelRegion")) {
             } else if (noticeType.equals("SplitTunnelRegion")) {
-                mHostService.onHomepage(notice.getJSONObject("data").getString("region"));
+                mHostService.onSplitTunnelRegion(notice.getJSONObject("data").getString("region"));
 
 
             } else if (noticeType.equals("UntunneledAddress")) {
             } else if (noticeType.equals("UntunneledAddress")) {
-                mHostService.onHomepage(notice.getJSONObject("data").getString("address"));
+                mHostService.onUntunneledAddress(notice.getJSONObject("data").getString("address"));
 
 
             } else if (noticeType.equals("BytesTransferred")) {
             } else if (noticeType.equals("BytesTransferred")) {
                 JSONObject data = notice.getJSONObject("data");
                 JSONObject data = notice.getJSONObject("data");

+ 5 - 0
SampleApps/Psibot/app/src/main/java/ca/psiphon/psibot/Service.java

@@ -228,6 +228,11 @@ public class Service extends VpnService
     public void onBytesTransferred(long sent, long received) {
     public void onBytesTransferred(long sent, long received) {
     }
     }
 
 
+    @Override
+    public void onClientRegion(String region) {
+        Log.addEntry("client region: " + region);
+    }
+
     private static String readInputStreamToString(InputStream inputStream) throws IOException {
     private static String readInputStreamToString(InputStream inputStream) throws IOException {
         return new String(readInputStreamToBytes(inputStream), "UTF-8");
         return new String(readInputStreamToBytes(inputStream), "UTF-8");
     }
     }