summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorschwabe <devnull@localhost>2012-04-28 19:58:02 +0200
committerschwabe <devnull@localhost>2012-04-28 19:58:02 +0200
commit63e466054c2f1d66e4618ac4d73208751f1e5bd1 (patch)
tree84a00021ec486093b406ec050087ee486f6e6958 /src/de/blinkt/openvpn/OpenVpnService.java
parent031186e74c9f174d05a09c4059def7bcbc558ac6 (diff)
Almost ready for version 0.4
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java33
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;
+ }
+ }
}