socks5_proxy 1.0.5+dev.2 copy "socks5_proxy: ^1.0.5+dev.2" to clipboard
socks5_proxy: ^1.0.5+dev.2 copied to clipboard

Socks5 server and client with ability to catch packet in both direction, chain proxies and more.

Socks5 proxy #

Features #

  • Easy to use proxy server (both tcp and udp) and client (only tcp).
  • Server/Client password authentication.
  • Chained proxy on client.
  • Redirected proxy on server.
  • Traffic spoofing.

Usage #

Import the package:

import 'package:socks_proxy/socks5.dart';

Creating proxy server:

import 'dart:async';
import 'dart:io';

import 'package:socks_proxy/socks_server.dart';

void main() {
  // Create server instance
  final proxy = SocksServer();

  // Listen to all tcp and udp connections
  proxy.connections.listen((connection) async {
    // Apply default handler
    await connection.forward();
  }).onError(print);

  // Bind servers
  unawaited(proxy.bind(InternetAddress.loopbackIPv4, 1080));
  unawaited(proxy.bind(InternetAddress.loopbackIPv4, 1081));
}

Creating proxy client:

import 'dart:convert';
import 'dart:io';

import 'package:socks_proxy/socks_client.dart';

void main() {
    // Create HttpClient object
    final client = HttpClient();

    // Assign connection factory
    SocksTCPClient.assignToHttpClient(client, [
      ProxySettings(InternetAddress.loopbackIPv4, 1080),
    ]);

    // GET request
    final request = await client.getUrl(Uri.parse('https://example.com/'));
    final response = await request.close();
    // Print response
    print(await utf8.decodeStream(response));
    // Close client
    client.close();
}

See more usage at example folder.

License #

  • MIT License
3
likes
130
pub points
88%
popularity

Publisher

unverified uploader

Socks5 server and client with ability to catch packet in both direction, chain proxies and more.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

async, meta

More

Packages that depend on socks5_proxy