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

kleintube

v1.0.3

Published

A simple proxy server/client based on socks5, websocket and chacha20-poly1305.

Downloads

7

Readme

KleinTube

A simple proxy server/client written in nodejs based on socks5, websocket and chacha20-poly1305.

简介

KleinTube(克莱因管)命名源自克莱因瓶——没有“内部”和“外部”之分的平面,表示没有服务端和客户端之分的“管道”,亦表示可以同时运行为服务端和客户端的网络代理工具。

目前的网络代理工具已有很多,却几乎都具有以下缺点之一:安装配置复杂、协议复杂、有效载荷比率低、易于被探测、代码结构繁杂、速度慢。

本项目的目的是开发一个功能单一、代码简洁、性能优越、抗监测性强、安装配置简单,对用户和开发者皆友好的网络代理工具。

客户端和服务端的连接使用基于WebSocket的自创协议,化繁为简,数据的加密和验证采用AEAD算法,具有高安全性和低冗余度,并将身份验证和代理请求融为一体,使得数据和连接没有任何特征,难于被监测。

目前所有代码仅500余行,可运行于Linux、Windows及Mac OS等支持nodejs的系统,速度略快于著名代理工具v2ray。安卓客户端正在开发中。

客户端为本地提供socks5代理,通过WebSocket连接至服务端,数据传输采用chacha20-poly1305加密。客户端可同时监听多个端口提供socks5代理,各端口可分别转发至不同服务端;服务端亦可同时监听多个端口。

安装

Linux

  • sudo npm i -g kleintube

Windows

  • npm i kleintube

参数

所有参数均在文件config.json中设置,server字段的内容是作为服务端的配置参数,client字段的内容是作为客户端的配置参数,可以仅保留server或client字段以单独作为服务端或客户端,也可以保留两者同时作为服务端和客户端。

参数文件也可在运行tube.js时通过第一个参数指定。

运行

配置文件

运行前建议修改配置文件config.json中的参数,包括端口、密码等,此文件为JSON格式,具体介绍如下:

server字段

此字段是程序作为服务端的配置,支持同时监听多个端口,数组的每一项为一个端口的配置:port为所监听的端口号,key为对应的连接密码。

client字段

client字段是程序作为客户端,通过WebSocket加密连接至服务端,并在本地开启socks5服务的配置,可同时开启多个端口提供socks5服务:

host为允许使用客户端socks5服务的主机,设置为localhost时仅允许本机上的程序使用socks5服务,设置为0.0.0.0时允许网络上所有主机的连接;

port为客户端开启的socks5服务的端口号;

remote_host为服务端主机的地址,客户端加密连接至运行于此主机的服务端;

remote_port为服务端的端口号;

key为连接至服务端的密码。

程序可同时运行为服务端和客户端;若仅作为服务端,建议删除client字段;若仅作为客户端,建议删除server字段。

服务端和客户端的时钟须保持同步,偏差不得大于50秒。

TCP fastopen

Linux系统可开启TCP fastopen以加快TCP连接的建立:

切换至root,运行以下命令立即开启:

  • echo 3 > /proc/sys/net/ipv4/tcp_fastopen

设置为自动开启:

  • echo "net.ipv4.tcp_fastopen = 3" >> /etc/sysctl.conf

Debian/Ubuntu

将tube.servie拷贝至/etc/systemd/system/目录,运行以下命令启动服务:

  • sudo systemctl start tube

RHEL/CentOS

将tube.servie中的Group=nogroup修改为Group=nobody,然后拷贝至/etc/systemd/system/目录,运行以下命令启动服务:

  • sudo systemctl start tube

Windows

运行方式一:直接运行

  • node.exe path\to\kleintube\tube.js

运行方式二:添加至系统服务(推荐)

首先安装node-windows:

  • npm i node-windows

然后运行service.js将Kleintube添加至系统服务,此命令只需运行一次:

  • node.exe path\to\kleintube\service.js

Kleintube将出现在系统服务中,可以随系统自动启动: image

注意

安装NodeJS更新之前须手动停止此服务,更新之后再启动此服务,否则无法安装更新。

参考链接

为何 shadowsocks 要弃用一次性验证 (OTA)