本文整理匯總了Java中de.blinkt.openvpn.core.Connection類的典型用法代碼示例。如果您正苦於以下問題:Java Connection類的具體用法?Java Connection怎麽用?Java Connection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Connection類屬於de.blinkt.openvpn.core包,在下文中一共展示了Connection類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: upgradeProfile
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
public void upgradeProfile() {
if (mProfileVersion < 2) {
/* default to the behaviour the OS used */
mAllowLocalLAN = Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT;
}
if (mProfileVersion < 4) {
moveOptionsToConnection();
mAllowedAppsVpnAreDisallowed = true;
}
if (mAllowedAppsVpn == null) mAllowedAppsVpn = new HashSet<>();
if (mConnections == null) mConnections = new Connection[0];
if (mProfileVersion < 6) {
if (TextUtils.isEmpty(mProfileCreator)) mUserEditable = true;
}
mProfileVersion = CURRENT_PROFILE_VERSION;
}
示例2: checkProfile
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
int checkProfile(Context context) {
if (mAuthenticationType == TYPE_KEYSTORE || mAuthenticationType == TYPE_USERPASS_KEYSTORE) {
if (mAlias == null) return R.string.no_keystore_cert_selected;
}
if (!mUsePull || mAuthenticationType == TYPE_STATICKEYS) {
if (mIPv4Address == null || cidrToIPAndNetmask(mIPv4Address) == null) return R.string.ipv4_format_error;
}
if (!mUseDefaultRoute) {
if (!TextUtils.isEmpty(mCustomRoutes) && getCustomRoutes(mCustomRoutes).size() == 0) return R.string.custom_route_format_error;
if (!TextUtils.isEmpty(mExcludedRoutes) && getCustomRoutes(mExcludedRoutes).size() == 0) return R.string.custom_route_format_error;
}
if (mUseTLSAuth && TextUtils.isEmpty(mTLSAuthFilename)) return R.string.missing_tlsauth;
if ((mAuthenticationType == TYPE_USERPASS_CERTIFICATES || mAuthenticationType == TYPE_CERTIFICATES) && (TextUtils.isEmpty(mClientCertFilename) || TextUtils.isEmpty(mClientKeyFilename)))
return R.string.missing_certificates;
if ((mAuthenticationType == TYPE_CERTIFICATES || mAuthenticationType == TYPE_USERPASS_CERTIFICATES) && TextUtils.isEmpty(mCaFilename)) return R.string.missing_ca_certificate;
boolean noRemoteEnabled = true;
for (Connection c : mConnections)
if (c.mEnabled) noRemoteEnabled = false;
if (noRemoteEnabled) return R.string.remote_no_server_selected;
// Everything okay
return R.string.no_error_found;
}
示例3: upgradeProfile
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
public void upgradeProfile() {
if (mProfileVersion < 2) {
/* default to the behaviour the OS used */
mAllowLocalLAN = Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT;
}
if (mProfileVersion < 4) {
moveOptionsToConnection();
mAllowedAppsVpnAreDisallowed = true;
}
if (mAllowedAppsVpn == null)
mAllowedAppsVpn = new HashSet<>();
if (mConnections == null)
mConnections = new Connection[0];
if (mProfileVersion < 6) {
if (TextUtils.isEmpty(mProfileCreator))
mUserEditable = true;
}
mProfileVersion = CURRENT_PROFILE_VERSION;
}
示例4: VpnProfile
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
public VpnProfile(String name) {
mUuid = UUID.randomUUID();
mName = name;
mProfileVersion = CURRENT_PROFILE_VERSION;
mConnections = new Connection[1];
mConnections[0] = new Connection();
}
示例5: moveOptionsToConnection
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
private void moveOptionsToConnection() {
mConnections = new Connection[1];
Connection conn = new Connection();
conn.mServerName = mServerName;
conn.mServerPort = mServerPort;
conn.mUseUdp = true;
conn.mCustomConfiguration = "";
mConnections[0] = conn;
}
示例6: clone
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
@Override
protected VpnProfile clone() throws CloneNotSupportedException {
VpnProfile copy = (VpnProfile) super.clone();
copy.mUuid = UUID.randomUUID();
copy.mConnections = new Connection[mConnections.length];
int i = 0;
for (Connection conn : mConnections) {
copy.mConnections[i++] = conn.clone();
}
copy.mAllowedAppsVpn = (HashSet<String>) mAllowedAppsVpn.clone();
return copy;
}
示例7: VpnProfile
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
public VpnProfile(String name) {
mUuid = UUID.randomUUID();
mName = name;
mProfileVersion = CURRENT_PROFILE_VERSION;
mConnections = new Connection[1];
mConnections[0] = new Connection();
}
示例8: moveOptionsToConnection
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
private void moveOptionsToConnection() {
mConnections = new Connection[1];
Connection conn = new Connection();
conn.mServerName = mServerName;
conn.mServerPort = mServerPort;
conn.mUseUdp = mUseUdp;
conn.mCustomConfiguration = "";
mConnections[0] = conn;
}
示例9: moveOptionsToConnection
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
private void moveOptionsToConnection(VpnProfile profile) {
profile.mConnections = new Connection[1];
Connection conn = new Connection();
conn.mServerName = profile.mServerName;
conn.mServerPort = profile.mServerPort;
conn.mUseUdp = profile.mUseUdp;
conn.mCustomConfiguration = "";
profile.mConnections[0] = conn;
}
示例10: checkProfile
import de.blinkt.openvpn.core.Connection; //導入依賴的package包/類
public int checkProfile(Context context) {
if (mAuthenticationType == TYPE_KEYSTORE || mAuthenticationType == TYPE_USERPASS_KEYSTORE) {
if (mAlias == null)
return R.string.no_keystore_cert_selected;
}
if (!mUsePull || mAuthenticationType == TYPE_STATICKEYS) {
if (mIPv4Address == null || cidrToIPAndNetmask(mIPv4Address) == null)
return R.string.ipv4_format_error;
}
if (!mUseDefaultRoute) {
if (!TextUtils.isEmpty(mCustomRoutes) && getCustomRoutes(mCustomRoutes).size() == 0)
return R.string.custom_route_format_error;
if (!TextUtils.isEmpty(mExcludedRoutes) && getCustomRoutes(mExcludedRoutes).size() == 0)
return R.string.custom_route_format_error;
}
if (mUseTLSAuth && TextUtils.isEmpty(mTLSAuthFilename))
return R.string.missing_tlsauth;
if ((mAuthenticationType == TYPE_USERPASS_CERTIFICATES || mAuthenticationType == TYPE_CERTIFICATES)
&& (TextUtils.isEmpty(mClientCertFilename) || TextUtils.isEmpty(mClientKeyFilename)))
return R.string.missing_certificates;
if ((mAuthenticationType == TYPE_CERTIFICATES || mAuthenticationType == TYPE_USERPASS_CERTIFICATES)
&& TextUtils.isEmpty(mCaFilename))
return R.string.missing_ca_certificate;
boolean noRemoteEnabled = true;
for (Connection c : mConnections)
if (c.mEnabled)
noRemoteEnabled = false;
if (noRemoteEnabled)
return R.string.remote_no_server_selected;
// Everything okay
return R.string.no_error_found;
}