Code Monkey home page Code Monkey logo

dart_socks5_io's Introduction

socks5_io

Pub Version

IO based socks5 implementation written in dart.

Install

Add dependency to pubspec.yaml.

dependencies:
  socks5_io: ^0.2.0

Quick Start

final dialer = Socks5ClientDialer("127.0.0.1", 7890);
dialer.connect("example.org", 80).then((socks5) {

  // handle remote server response
  socks5.getReader().listen((buffer) {
    print(ascii.decode(buffer));
    socks5.close();
  },
    onError: (err) => {/* handle transfer error */},
    onDone: () => {/* handle target closed */},
  );

  // send request (non-blocking)
  socks5.getWriter().add(ascii.encode([
    "GET / HTTP/1.1",
    "Host: example.org:80",
    "User-Agent: socks5_io/0.2.0",
    "Accept: */*",
    "\r\n",
  ].join("\r\n")));

}).catchError((err) {/* handle connect error */});

See more at folder example/.

Acknowledgement

LICENSE

MIT

dart_socks5_io's People

Contributors

luo3house avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

simonesestito

dart_socks5_io's Issues

LateInitializationError if socket refused the connection

Hi, I was using this library to connect to a SOCKS5 proxy and I find it very useful.

However, I encountered the following bug.

Steps to reproduce

// Connect to a socks5 that is not listening -> The connection will be refused
final proxy = Socks5ClientDialer("127.0.0.1", 9150);

// Get the socket
try {
    final socket = await proxy.connect("example.com", 80);
} catch (err, stackTrace) {
    print(err);
    print(stackTrace);
}

Expected result

The thrown error should be SocketException

Actual result

The thrown error is:

LateInitializationError: Local 'socket' has not been initialized.
#0      LateError._throwLocalNotInitialized (dart:_internal-patch/internal_patch.dart:189:5)
#1      Socks5ClientDialer.connect (package:socks5_io/src/client_dialer.dart:53:11)
<asynchronous suspension>

Wrong number for AuthMethod.notRequired

Expected value

According to RFC 1928, the number for "Authentication not required" is 0x00.

      o  X'00' NO AUTHENTICATION REQUIRED
      o  X'01' GSSAPI
      o  X'02' USERNAME/PASSWORD
      o  X'03' to X'7F' IANA ASSIGNED
      o  X'80' to X'FE' RESERVED FOR PRIVATE METHODS
      o  X'FF' NO ACCEPTABLE METHODS

Actual value

From socks.dart:

enum AuthMethod {
  notRequired(0x01),
  // [...]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.