Skip to content

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

License

Notifications You must be signed in to change notification settings

LacticWhale/socks_dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages