• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16export default class VpnConstant {
17  static readonly VPN_NAME_MAX_LENGTH: number = 30;
18  static readonly VPN_USER_NAME_MAX_LENGTH: number = 30;
19  static readonly VPN_PASSWORD_MAX_LENGTH: number = 30;
20  static readonly INPUT_MAX_LENGTH: number = 100;
21
22  static readonly STORAGE_KEY_CONNECT_STATE: string = 'vpnConnectState';
23
24  static readonly VPN_STATE_NONE: number = 0;
25  static readonly VPN_STATE_CONNECTING: number = 1;  // connecting
26  static readonly VPN_STATE_CONNECTED: number = 2; // connect success
27  static readonly VPN_STATE_DISCONNECTING: number = 3;  // not connect
28  static readonly VPN_STATE_DISCONNECTED: number = 4;  // not connect
29  static readonly VPN_STATE_CONNECT_FAILED: number = 5; // connect failed
30
31  static readonly VPN_CONNECT_TIME_OUT_DURATION: number = 60000;
32
33  static readonly REGEX_IP: RegExp = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
34  static readonly REGEX_PORT: RegExp = /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/;
35
36  static readonly OVPN_AUTH_TYPE_TLS: number = 0;
37  static readonly OVPN_AUTH_TYPE_PWD: number = 1;
38  static readonly OVPN_AUTH_TYPE_TLS_PWD: number = 2;
39}