提交 ea10dce2 编写于 作者: X xujie

Fix review issue

Change-Id: Iad7f353a3a7f18378810c6e291d5721e58e0e16d
Signed-off-by: Nxujie <xujie223@huawei.com>
上级 8ac74376
...@@ -49,7 +49,7 @@ let VpnConnection = vpn.createVpnConnection(globalThis.context) ...@@ -49,7 +49,7 @@ let VpnConnection = vpn.createVpnConnection(globalThis.context)
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State message: string = 'Toy VPN' @State message: string = 'Test VPN'
CreateTunnel() { CreateTunnel() {
TunnelFd = vpn_client.tcpConnect("192.168.43.208", 8888) TunnelFd = vpn_client.tcpConnect("192.168.43.208", 8888)
......
...@@ -174,8 +174,8 @@ setUp(config: VpnConfig): Promise\<number\>; ...@@ -174,8 +174,8 @@ setUp(config: VpnConfig): Promise\<number\>;
dnsAddresses:[ dnsAddresses:[
"114.114.114.114" "114.114.114.114"
], ],
acceptedApplications:[], trustedApplications:[],
refusedApplications:[] blockedApplications:[]
} }
VpnConnection.setUp(config).then((data) => { VpnConnection.setUp(config).then((data) => {
console.info(TAG + "setUp success, tunfd: " + JSON.stringify(data)) console.info(TAG + "setUp success, tunfd: " + JSON.stringify(data))
...@@ -236,9 +236,8 @@ protect(socketFd: number, callback: AsyncCallback\<void\>): void; ...@@ -236,9 +236,8 @@ protect(socketFd: number, callback: AsyncCallback\<void\>): void;
}) })
tcp.getSocketFd().then((tunnelfd) => { tcp.getSocketFd().then((tunnelfd) => {
console.info("tunenlfd: " + tunnelfd); console.info("tunenlfd: " + tunnelfd);
VpnConnection.protect(tunnelfd, (error, data) => { VpnConnection.protect(tunnelfd, (error) => {
console.info(JSON.stringify(error)); console.info(JSON.stringify(error));
console.info(JSON.stringify(data));
}) })
}) })
``` ```
...@@ -300,8 +299,8 @@ protect(socketFd: number): Promise\<void\>; ...@@ -300,8 +299,8 @@ protect(socketFd: number): Promise\<void\>;
}) })
tcp.getSocketFd().then((tunnelfd) => { tcp.getSocketFd().then((tunnelfd) => {
console.info("tunenlfd: " + tunnelfd); console.info("tunenlfd: " + tunnelfd);
VpnConnection.protect(tunnelfd).then((data) => { VpnConnection.protect(tunnelfd).then(() => {
console.info("protect success" + JSON.stringify(data)) console.info("protect success.")
}).catch(err => { }).catch(err => {
console.info("protect fail" + JSON.stringify(err)) console.info("protect fail" + JSON.stringify(err))
}) })
...@@ -341,9 +340,8 @@ destroy(callback: AsyncCallback\<void\>): void; ...@@ -341,9 +340,8 @@ destroy(callback: AsyncCallback\<void\>): void;
**示例:** **示例:**
```js ```js
VpnConnection.destroy((error, data) => { VpnConnection.destroy((error) => {
console.info(JSON.stringify(error)); console.info(JSON.stringify(error));
console.info(JSON.stringify(data));
}) })
``` ```
...@@ -373,15 +371,14 @@ destroy(): Promise\<void\>; ...@@ -373,15 +371,14 @@ destroy(): Promise\<void\>;
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. | | 2200002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. | | 2100003 | System internal error. |
**示例:** **示例:**
```js ```js
VpnConnection.destroy().then((data) => { VpnConnection.destroy().then(() => {
console.info("destroy success" + JSON.stringify(data)) console.info("destroy success.")
}).catch(err => { }).catch(err => {
console.info("destroy fail" + JSON.stringify(err)) console.info("destroy fail" + JSON.stringify(err))
}); });
......
...@@ -31,7 +31,7 @@ VPN exist already, please execute destroy first. ...@@ -31,7 +31,7 @@ VPN exist already, please execute destroy first.
**错误描述** **错误描述**
VPN已经存在,请先执行destory接口 VPN连接已存在,请先调用destroy接口销毁VPN连接
**可能原因** **可能原因**
...@@ -58,4 +58,4 @@ tcp链路建立失败。 ...@@ -58,4 +58,4 @@ tcp链路建立失败。
**处理步骤** **处理步骤**
检查tcp链路是否建立成功。 检查socket链路是否建立成功。
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册