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

socks5-stream

v0.2.0

Published

Convert any server into socks5 using streams

Downloads

6

Readme

SOCKS5 STREAM

A lightweight module which can transform any server into a SOCKS5 server. It does this by transforming incoming SOCKS5 stream into its respective protocol stream. It is an easily manageable and this package doesn't have any dependency. Now supports SOCKS5 Username/Password Authentication on your server.

Installation

npm install socks5-stream

Usage

The first event emiited by the stream will always be a destination host and port in format <HOSTNAME>,<PORT>. You can use this information to perform two actions -

  • Accept connection by calling sockStreamObj.acceptConnection(true)
  • Reject the connection by calling sockStreamObj.acceptConnection(false)

After this all the events will have your PROTOCOL data. This data can consumed using the 'data' event or can be further piped into other streams.

If to use SOCKS5 Username/Paswword Authentication, pass the auth details as second params. The object should contain, authType as "username" and the user specifc username, password. For further details check the bottom example.

Simple Example of accepting a connection and printing the incoming data(In this case HTTP)

const socks5Stream = require('socks5-stream');
const net = require('net');
// Server mock 

var server = net.createServer((socket) => {
  // Create a new socks5 stream without Authentication
  var sockStream = new socks5Stream(socket);

  //Create a new socks5 stream with Username and Password Authentication
  var sockStreamAuth = new socks5Stream(socket, {
    username:"username",
    password:"password",
    authType:"username"
  });

  //Piping the data to sock5 stream
  socket.pipe(sockStream).once('data', (data) => {
    console.log('<HOST>,<PORT> ==> ' + data.toString());
    sockStream.acceptConnection(true);
    sockStream.on('data', (chunk) => {
      //Actual data
      console.log(chunk.toString());
    })
  })
});

server.listen(8124, () => {
  console.log('server bound');
});

Can test the server using cURL command curl --socks5-hostname localhost:8124 http://www.google.com

Note

  • Currently, only SOCKS5 no authentication and Username/Password method are supported.

If you guys want me to support additional functionality like AUTHENTICATION and CONNECT, BIND, please create issue on this repo. I will be more than happy to continue its development.