diff options
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnService.java | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index 4aad9318..1cc5b2ec 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -19,6 +19,7 @@ package de.blinkt.openvpn; import java.io.IOException; import java.net.UnknownHostException; import java.util.Arrays; +import java.util.Vector; import android.app.PendingIntent; import android.content.Intent; @@ -41,6 +42,12 @@ public class OpenVpnService extends VpnService implements Handler.Callback, Runn private ParcelFileDescriptor mInterface; + private Vector<String> mDnslist=new Vector<String>(); + + private VpnProfile mProfile; + + private String mDomain=null; + @Override public void onRevoke() { managmentCommand("signal SIGINT\n"); @@ -106,6 +113,9 @@ public class OpenVpnService extends VpnService implements Handler.Callback, Runn mThread = new Thread(this, "OpenVPNThread"); mThread.start(); + String profileUUID = intent.getStringExtra(prefix + ".profileUUID"); + mProfile = ProfileManager.get(profileUUID); + if(intent.hasExtra(prefix +".PKCS12PASS")) { try { @@ -211,9 +221,14 @@ public class OpenVpnService extends VpnService implements Handler.Callback, Runn Builder builder = new Builder(); builder.addRoute("0.0.0.0", 0); builder.addAddress(localip, 24 ); - builder.addDnsServer("131.234.137.23"); - builder.addSearchDomain("blinkt.de"); - builder.setSession("OpenVPN - " + localip); + for (String dns : mDnslist ) { + builder.addDnsServer(dns); + } + + if(mDomain!=null) + builder.addSearchDomain(mDomain); + + builder.setSession(mProfile.mName + " - " + localip); Intent intent = new Intent(getBaseContext(),LogWindow.class); PendingIntent startLW = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); builder.setConfigureIntent(startLW); @@ -221,4 +236,16 @@ public class OpenVpnService extends VpnService implements Handler.Callback, Runn return mInterface; } + + + public void addDNS(String dns) { + mDnslist.add(dns); + } + + + public void setDomain(String domain) { + if(mDomain==null) { + mDomain=domain; + } + } } |