diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-07-24 12:32:40 -0500 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-25 02:05:11 +0200 |
commit | 8e0835e57084be1216e3ef1e71941295b2df909d (patch) | |
tree | 570f81ddc7b189e2a736f2ba669ab8ed553586d3 /app/src/main/java/com/wireguard/config | |
parent | bb20c89cd5c75dceb591898fef733539092dba0b (diff) |
Added QR code scanner as tunnel import method
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/config')
-rw-r--r-- | app/src/main/java/com/wireguard/config/Config.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/config/Config.java b/app/src/main/java/com/wireguard/config/Config.java index 0599dec3..db8c2fc7 100644 --- a/app/src/main/java/com/wireguard/config/Config.java +++ b/app/src/main/java/com/wireguard/config/Config.java @@ -20,6 +20,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.StringReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -32,6 +33,10 @@ public class Config { private final Interface interfaceSection = new Interface(); private List<Peer> peers = new ArrayList<>(); + public static Config from(final String string) throws IOException { + return from(new BufferedReader(new StringReader(string))); + } + public static Config from(final InputStream stream) throws IOException { return from(new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))); } |