summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/PtClientBuilder.java
blob: 945e3d7aa38a10f39697abc405c565ed53e97998 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package se.leap.bitmaskclient.pluggableTransports;

import de.blinkt.openvpn.core.connection.Connection;
import de.blinkt.openvpn.core.connection.Obfs4Connection;
import de.blinkt.openvpn.core.connection.Obfs4HopConnection;

public class PtClientBuilder {
    public static PtClientInterface getPtClient(Connection connection) throws IllegalStateException {
        switch (connection.getTransportType()) {
            case OBFS4:
                return new ObfsVpnClient(((Obfs4Connection) connection).getObfs4Options());
            case OBFS4_HOP:
                return new HoppingObfsVpnClient(((Obfs4HopConnection) connection).getObfs4Options());
            default:
                throw new IllegalStateException("Unexpected pluggable transport " + connection.getTransportType());
        }
    }
}