LiteRT/Socks5
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.