• 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
16import vpn from '@ohos.net.vpn';
17import { VpnTypeModel } from './VpnTypeModel';
18
19/**
20 * extend system VpnConig
21 */
22export default class VpnConfig implements vpn.SysVpnConfig {
23  // vpnConfig
24  addresses: Array<vpn.LinkAddress> = [];
25  routes?: Array<vpn.RouteInfo>;
26  dnsAddresses?: Array<string>;
27  searchDomains?: Array<string>;
28  isLegacy: boolean = true;
29
30  // sysVpnConfig
31  vpnId: string = '';
32  vpnName: string = '';
33  vpnType: vpn.SysVpnType = VpnTypeModel.TYPE_IKEV2_IPSEC_MSCHAPv2;
34  userName?: string;
35  password?: string;
36  saveLogin: boolean = false;
37  userId?: number;
38  forwardingRoutes?: string;
39}
40
41export class OpenVpnConfig extends VpnConfig implements vpn.OpenVpnConfig {
42  ovpnConfigFilePath?: string // openVpn file name
43  ovpnConfigContent?: string // openVpn config
44  ovpnConfig?: string // openVpn config base64
45  ovpnAuthType: number = 0 // openvpn auth type
46  ovpnProtocolFileRaw?: string // Protocol
47  ovpnProtocol: number = 0 // 0:tcp 1:udp
48  ovpnAddressPortFileRaw?: string // port
49  ovpnPort?: string // openvpn port
50  askpass: string // private key password
51  ovpnCaCertFilePath?: string // openVpn CA FilePath
52  ovpnUserCertFilePath?: string // openVpn USER FilePath
53  ovpnPrivateKeyFilePath?: string // openVpn private key  FilePath
54  ovpnCaCertFileRaw?: string // ca raw data
55  ovpnCaCert?: string // CA data
56  ovpnUserCertFileRaw?: string //
57  ovpnUserCert?: string //
58  ovpnPrivateKeyFileRaw?: string // private key raw data
59  ovpnPrivateKey?: string // private key data
60  ovpnUserPassFileRaw?: string // userpass raw d
61  ovpnProxyHostFileRaw?: string // host raw data
62  ovpnProxyHost?: string //ovpn host
63  ovpnProxyPort?: string //ovpn port
64  ovpnProxyUserPassFileRaw?: string // userpass data
65  ovpnProxyUser?: string //ovpn user
66  ovpnProxyPass?: string //ovpn pass
67}
68
69export class IpsecVpnConfig extends VpnConfig implements vpn.IpsecVpnConfig {
70  ipsecIdentifier?: string // ipsec identifier
71  ipsecPreSharedKey?: string // ipsec pre sharedKey
72  l2tpSharedKey?: string // L2TP secret
73  ipsecPublicUserCertConfig?: string // public userCert config
74  ipsecPublicUserCertFilePath?: string // public userCert FilePath
75  ipsecPrivateUserCertConfig?: string // private userCert config
76  ipsecPrivateUserCertFilePath?: string // private userCert FilePath
77  ipsecCaCertConfig?: string // ca config
78  ipsecCaCertFilePath?: string // ca FilePath
79  ipsecPublicServerCertConfig?: string // public serverCert config
80  ipsecPublicServerCertFilePath?: string // public serverCert FilePath
81  ipsecPrivateServerCertConfig?: string // private serverCert config
82  ipsecPrivateServerCertFilePath?: string // private serverCert FilePath
83  swanctlConfig?: string // swanctl config base64
84  strongSwanConfig?: string // strongswan config base64
85  optionsL2tpdClient?: string // optionsL2tpd Client base64
86  xl2tpdConfig?: string // xl2tpd config base64
87  ipsecConfig?: string // swanctl config base64
88  ipsecSecrets?: string // swanctl config base64
89}
90
91export class VpnListItem {
92  vpnName: string //vpnName
93  vpnId: string //UUID
94}