// Path: src/main/java/de/hartz/vpn/main/server/ConfigState.java
// public class ConfigState implements Serializable {
// 
//     public enum Adapter {
//         OpenVPN,
//         IPsec,
//         FreeLan
//     }
// 
//     // TODO: Tcp not supported by mediator.
//     public enum Protocol {
//         TCP,
//         UDP
//     }
// 
//     // TODO: Closed tunnel not supported by software. Needs networkbridge between adapters (?)
//     public enum Tunnel {
//         CLOSED,
//         SPLIT
//     }
// 
//     // TODO: Site connections needs traffic redirection by every computer or the gateway to vpn-gateway. Not really supported by Software.
//     public enum NetworkType {
//         SITE_TO_SITE,
//         SITE_TO_END,
//         END_TO_END,
//     }
// 
//     private String networkName;
//     private Protocol protocol;
// 
//     private Mediator mediator;
// 
//     private Tunnel tunnel;
//     private Adapter adapter;
//     private NetworkType networkType;
// 
//     private boolean needsAuthentication;
// 
//     private String netaddress;
//     private short subnetmask;
// 
//     /**
//      * Default Constructor for Express Configuration.
//      */
//     public ConfigState() {
//         tunnel = Tunnel.SPLIT;
//         adapter = Adapter.OpenVPN;
//         networkType = NetworkType.END_TO_END;
//         protocol = UDP;
//         netaddress = NetworkUtilities.getRecommendedIp();
//         subnetmask = 24;
// 
//         needsAuthentication = false;
//     }
// 
//     public String getNetworkName() {
//         return networkName;
//     }
// 
//     public void setNetworkName(String networkName) {
//         this.networkName = networkName;
//     }
// 
//     public Tunnel getTunnel() {
//         return tunnel;
//     }
// 
//     public void setTunnel(Tunnel tunnel) {
//         this.tunnel = tunnel;
//     }
// 
//     public Adapter getAdapter() {
//         return adapter;
//     }
// 
//     public void setAdapter(Adapter adapter) {
//         this.adapter = adapter;
//     }
// 
//     public NetworkType getNetworkType() {
//         return networkType;
//     }
// 
//     public void setNetworkType(NetworkType networkType) {
//         this.networkType = networkType;
//     }
// 
//     public boolean isNeedsAuthentication() {
//         return needsAuthentication;
//     }
// 
//     public void setNeedsAuthentication(boolean needsAuthentication) {
//         this.needsAuthentication = needsAuthentication;
//     }
// 
//     public String getNetaddress() {
//         return netaddress;
//     }
// 
//     public String getProtocol() {
//         return protocol.name().toLowerCase();
//     }
// 
//     public void setNetaddress(String netaddress) {
//         this.netaddress = netaddress;
//     }
// 
//     public int getSubnetmask() {
//         return subnetmask;
//     }
// 
//     public void setSubnetmask(short subnetmask) {
//         this.subnetmask = subnetmask;
//     }
// 
//     public Mediator getMediator() {
//         return mediator;
//     }
// 
//     public void setMediator(Mediator mediator) {
//         this.mediator = mediator;
//     }
// 
// }
// 
// Path: src/main/java/de/hartz/vpn/mediation/Mediator.java
// public class Mediator implements Serializable {
// 
//     private String mediatorName;
//     private String url;
//     // Only needed if mediationserver hosts network specific files.
//     private int metaServerPort;
//     private int udpHolePunchingPort;
// 
//     // If true the url is a rest api showing the original ip of the mediator, needed for dynamic ips.
//     private boolean redirectFromUrl;
// 
//     public Mediator(String mediatorName,String url, int metaServerPort, int udpHolePunchingPort, boolean redirectFromUrl) {
//         this.mediatorName = mediatorName;
//         this.url = url;
//         this.metaServerPort = metaServerPort;
//         this.udpHolePunchingPort = udpHolePunchingPort;
//         this.redirectFromUrl = redirectFromUrl;
//     }
// 
//     public String getMediatorName() {
//         return mediatorName;
//     }
// 
//     public int getMetaServerPort() {
//         return metaServerPort;
//     }
// 
//     public int getUdpHolePunchingPort() {
//         return udpHolePunchingPort;
//     }
// 
//     public boolean isRedirectFromUrl() {
//         return redirectFromUrl;
//     }
// 
//     /**
//      * Get the real url or ip of the mediator server.
//      * @returns the url of the mediator.
//      */
//     public String getUrl() {
//         if (!redirectFromUrl) {
//             return url;
//         }
//         try {
//             URL whatIsMyIp = new URL(url);
//             BufferedReader in = new BufferedReader(new InputStreamReader(whatIsMyIp.openStream()));
//             String ip = in.readLine();
//             return ip;
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// }
// 
// Path: src/main/java/de/hartz/vpn/utilities/Constants.java
// public static final String USER_DATA_FILE_PATH = System.getProperty("user.home") + File.separator + "." + SOFTWARE_NAME +  File.separator + "userData.ser";


import de.hartz.vpn.main.server.ConfigState;
import de.hartz.vpn.mediation.Mediator;
import java.io.*;
import java.util.ArrayList;
import static de.hartz.vpn.utilities.Constants.USER_DATA_FILE_PATH;
package de.hartz.vpn.main;




/**
 * Hold the data for the current session of this user.
 */
public class UserData implements Serializable{

    private static UserData instance;

    private UserList userList = new UserList();
    private ArrayList<Mediator> mediatorList = new ArrayList<>();

    //client only.
    public static String serverIp;
    public static Integer serverPort;
    //END OF: client only.

    private boolean clientInstallation = true;
// Path: src/main/java/de/hartz/vpn/main/server/ConfigState.java
// public class ConfigState implements Serializable {
// 
//     public enum Adapter {
//         OpenVPN,
//         IPsec,
//         FreeLan
//     }
// 
//     // TODO: Tcp not supported by mediator.
//     public enum Protocol {
//         TCP,
//         UDP
//     }
// 
//     // TODO: Closed tunnel not supported by software. Needs networkbridge between adapters (?)
//     public enum Tunnel {
//         CLOSED,
//         SPLIT
//     }
// 
//     // TODO: Site connections needs traffic redirection by every computer or the gateway to vpn-gateway. Not really supported by Software.
//     public enum NetworkType {
//         SITE_TO_SITE,
//         SITE_TO_END,
//         END_TO_END,
//     }
// 
//     private String networkName;
//     private Protocol protocol;
// 
//     private Mediator mediator;
// 
//     private Tunnel tunnel;
//     private Adapter adapter;
//     private NetworkType networkType;
// 
//     private boolean needsAuthentication;
// 
//     private String netaddress;
//     private short subnetmask;
// 
//     /**
//      * Default Constructor for Express Configuration.
//      */
//     public ConfigState() {
//         tunnel = Tunnel.SPLIT;
//         adapter = Adapter.OpenVPN;
//         networkType = NetworkType.END_TO_END;
//         protocol = UDP;
//         netaddress = NetworkUtilities.getRecommendedIp();
//         subnetmask = 24;
// 
//         needsAuthentication = false;
//     }
// 
//     public String getNetworkName() {
//         return networkName;
//     }
// 
//     public void setNetworkName(String networkName) {
//         this.networkName = networkName;
//     }
// 
//     public Tunnel getTunnel() {
//         return tunnel;
//     }
// 
//     public void setTunnel(Tunnel tunnel) {
//         this.tunnel = tunnel;
//     }
// 
//     public Adapter getAdapter() {
//         return adapter;
//     }
// 
//     public void setAdapter(Adapter adapter) {
//         this.adapter = adapter;
//     }
// 
//     public NetworkType getNetworkType() {
//         return networkType;
//     }
// 
//     public void setNetworkType(NetworkType networkType) {
//         this.networkType = networkType;
//     }
// 
//     public boolean isNeedsAuthentication() {
//         return needsAuthentication;
//     }
// 
//     public void setNeedsAuthentication(boolean needsAuthentication) {
//         this.needsAuthentication = needsAuthentication;
//     }
// 
//     public String getNetaddress() {
//         return netaddress;
//     }
// 
//     public String getProtocol() {
//         return protocol.name().toLowerCase();
//     }
// 
//     public void setNetaddress(String netaddress) {
//         this.netaddress = netaddress;
//     }
// 
//     public int getSubnetmask() {
//         return subnetmask;
//     }
// 
//     public void setSubnetmask(short subnetmask) {
//         this.subnetmask = subnetmask;
//     }
// 
//     public Mediator getMediator() {
//         return mediator;
//     }
// 
//     public void setMediator(Mediator mediator) {
//         this.mediator = mediator;
//     }
// 
// }
// 
// Path: src/main/java/de/hartz/vpn/mediation/Mediator.java
// public class Mediator implements Serializable {
// 
//     private String mediatorName;
//     private String url;
//     // Only needed if mediationserver hosts network specific files.
//     private int metaServerPort;
//     private int udpHolePunchingPort;
// 
//     // If true the url is a rest api showing the original ip of the mediator, needed for dynamic ips.
//     private boolean redirectFromUrl;
// 
//     public Mediator(String mediatorName,String url, int metaServerPort, int udpHolePunchingPort, boolean redirectFromUrl) {
//         this.mediatorName = mediatorName;
//         this.url = url;
//         this.metaServerPort = metaServerPort;
//         this.udpHolePunchingPort = udpHolePunchingPort;
//         this.redirectFromUrl = redirectFromUrl;
//     }
// 
//     public String getMediatorName() {
//         return mediatorName;
//     }
// 
//     public int getMetaServerPort() {
//         return metaServerPort;
//     }
// 
//     public int getUdpHolePunchingPort() {
//         return udpHolePunchingPort;
//     }
// 
//     public boolean isRedirectFromUrl() {
//         return redirectFromUrl;
//     }
// 
//     /**
//      * Get the real url or ip of the mediator server.
//      * @returns the url of the mediator.
//      */
//     public String getUrl() {
//         if (!redirectFromUrl) {
//             return url;
//         }
//         try {
//             URL whatIsMyIp = new URL(url);
//             BufferedReader in = new BufferedReader(new InputStreamReader(whatIsMyIp.openStream()));
//             String ip = in.readLine();
//             return ip;
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// }
// 
// Path: src/main/java/de/hartz/vpn/utilities/Constants.java
// public static final String USER_DATA_FILE_PATH = System.getProperty("user.home") + File.separator + "." + SOFTWARE_NAME +  File.separator + "userData.ser";


// Path: src/main/java/de/hartz/vpn/main/UserData.java
import de.hartz.vpn.main.server.ConfigState;
import de.hartz.vpn.mediation.Mediator;
import java.io.*;
import java.util.ArrayList;
import static de.hartz.vpn.utilities.Constants.USER_DATA_FILE_PATH;

package de.hartz.vpn.main;




/**
 * Hold the data for the current session of this user.
 */
public class UserData implements Serializable{

    private static UserData instance;

    private UserList userList = new UserList();
    private ArrayList<Mediator> mediatorList = new ArrayList<>();

    //client only.
    public static String serverIp;
    public static Integer serverPort;
    //END OF: client only.

    private boolean clientInstallation = true;
    private ConfigState vpnConfigState;