npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugins-ths-h3c-vpn

v1.0.6

Published

H3C VPN插件

Downloads

5

Readme

cordova.plugins.H3cVpn

基于 H3C 提供的 jar 包进行二次开发的 VPN 插件(插件开发者 Mr. Liu)

2022.1.6 完成初版开发

前置工作

安装完插件后,打包前需要修改 MainActivity 代码,添加以下代码:

MainActivity 一般所在路径 android\app\src\main\java\包ID的路径\MainActivity.java

// 顶部导入
import cn.com.ths.h3cvpn.VpnUtils;

public class MainActivity extends BridgeActivity {
// 在类中添加以下方法
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Log.e("MainActivity","onActivityResult");

        if(requestCode==8300){
            VpnUtils.onSdkActivityResult(requestCode, resultCode, data);
        }

    }
}

使用示例

1 VPN 连接


  /**
   * VPN 连接
   * @param addr VPN地址,例如IP+端口,例如:219.232.203.138:8888
   * @param domain 域名,没有域名时,填空字符串
   */
(window as any).cordova.plugins.H3cVpn.vpnConnect('219.232.203.138:8888','',(res)=> {
    alert(res);
  },(err) =>{
    alert(err);
  });

2 登录VPN

/**
 * 登录VPN,需要先调用VPN连接方法,成功后调用该方法
 * @param {*} userName 用户名 
 * @param {*} password 密码
 * @param {*} dynpwd 动态密码,可为空字符串
 * @param {*} success 
 * @param {*} error 
 */
(window as any).cordova.plugins.H3cVpn.vpnLogin('1112121212','232323','',(res)=> {
    alert(res);
  },(err) =>{
    alert(err);
  });

3 VPN检查在线状态

/**
 * VPN检查在线
 * @param {*} success 
 * @param {*} error 
 */

(window as any).cordova.plugins.H3cVpn.isOnline((res)=> {
    alert(res);
  },(err) =>{
    alert(err);
  });

4 vpn 下线

/**
 *  vpn 下线
 * @param {*} success 
 * @param {*} error 
 */
(window as any).cordova.plugins.H3cVpn.vpnlogout((res)=> {
    alert(res);
  },(err) =>{
    alert(err);
  });

5 监听VPN登录状态(需要放在页面初始化位置,页面销毁,需要移除对应的监听回调)

/**
 * 监听VPN 回调消息
 * data {'vpnCallback':'succeed'} 
 * {'vpnCallback':'failed'} 
 * {'vpnCallback':'userCancelled'} 
 * {'vpnCallback':'networkError'} 
 * {'vpnCallback':'logOut'} 
 */
document.addEventListener('H3cVpn.onVpnListenerInAndroidCallback', data => {
      console.log(data);
      alert(JSON.stringify(data));
}, false);

6 常见错误