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

@remoon.net/xhe-vpn

v0.0.4

Published

`xhe-vpn` 是一款可在浏览器中运行的 `vpn`, 基于 [`WireGuard`](https://www.wireguard.com/) 和 [`WebRTC`](https://webrtcforthecurious.com/)

Downloads

49

Readme

简介

xhe-vpn 是一款可在浏览器中运行的 vpn, 基于 WireGuardWebRTC

目的是暴露在浏览器中运行的服务. 如: 点开浏览器运行一个数据统计服务, 用户通过 xhe-vpn 直接访问浏览器中的数据统计服务, 跳过了 cdn 这些中间人保证了数据安全. (这是一个很美好的愿景, 然而现在并没有做出这样的应用, 因为是浏览器中的应用需要特别考虑应用离线的问题, 难度比较大)

使用

虽然上面说了这样的愿景, 但实际上现在在用的用途是爬虫, 所以接下来会以爬虫场景来介绍

配置服务端

注: 由于尚未完全开源, 建议在虚拟机中测试

git clone https://github.com/remoon-net/xhe-webvpn.git xhe-webvpn
# 进入仓库示例文件夹
cd xhe-webvpn/example/
# 下载 xhe-vpn 并赋予可执行权限
wget -O xhe-vpn https://github.com/remoon-net/xhe-vpn-binary/releases/download/v0.0.20240401/xhe-vpn
chmod +x xhe-vpn
# 会使用 example/xhe-vpn.yaml 配置文件进行启动
sudo ./xhe-vpn

配置浏览器端

注入 js 最好的办法就是油猴脚本, 所以将会使用油猴脚本作为示例

// ==UserScript==
// @name        vpn - Xhe Vpn
// @namespace   xhe-vpn.remoon.net
// @match       https://remoon.net/
// @version     0.0.1
// @author      -
// @require     https://unpkg.com/@remoon.net/[email protected]/dist/xhe-vpn.umd.js
// @run-at      document-start
// @description 01/04/2024, 00:00:00
// @grant       none
// ==/UserScript==

void (async function main() {
  const net = await vpn.connect({
    Key: "087ec6e14bbed210e7215cdc73468dfa23f080a1bfb8665b2fd809bd99d28379",
    Route: ["192.168.4.28/24"],
    Peer: [
      {
        Pubkey:
          "c4c8e984c5322c8184c72265b92b250fdb63688705f504ba003c88f03393cf28",
        PSK: "ba3ef732682972723e233daf6daaa748a6641e4c22b0bc726d94ca03b35055bb",
        Auto: 5,
        WHIP: ["http://127.0.0.1:2233"],
        Allow: ["192.168.4.29/32"],
      },
    ],
  });
  const srv = await net.listen("0.0.0.0:80", {
    fetch(req) {
      return new Response("ok");
    },
  });
  await net.http_proxy("0.0.0.0:1080", {});
})();

测试访问浏览器中的应用

回到服务器

curl http://192.168.4.28:80
# 应该输出 ok
# -------
# http proxy 代理模式
# -k 忽略证书错误
curl -k -x http://192.168.4.28:1080 https://remoon.net/