@litert/socks5
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

LiteRT/Socks5

Strict TypeScript Checked npm version License GitHub issues GitHub Releases

The socks5 protocol library for LiteRT.

Currently, only client-side CONNECT is supported.

Installation

npm install @litert/socks5 --save

Usage

import * as Socks5 from '@litert/socks5';

(async () => {

    const socket = await Socks5.connect({
        'server': {
            'host': '127.0.0.1', // hostname of socks5 server
            'port': 1080, // port of socks5 server
            'auth': { // optional auth info, set to null or omit it if unnecessary
                'username': 'user1',
                'password': 'my-password'
            }
        },
        'target': {
            /**
             * The type of hostname is optional.
             *
             * If omitted, the lib will detect it automatically
             */
            // 'type': Socks5.Constants.ETargetHostnameType.IPV4,
            'host': '1.1.1.1', // Or a domain
            'port': 443,
        }
    });

    // now a socket connected to 1.1.1.1:443 through socks5 server 127.0.0.1:1080 is created and ready.
    // feel free to use it.

})();

Requirements

  • Node.js v14.x (Or newer)
  • TypeScript v5.0.x (Or newer)

License

This library is published under Apache-2.0 license.

Readme

Keywords

Package Sidebar

Install

npm i @litert/socks5

Weekly Downloads

1

Version

0.1.1

License

Apache-2.0

Unpacked Size

68.2 kB

Total Files

29

Last publish

Collaborators

  • fenying