Flutter_socks_proxy is a dart package, HTTP/Socks4/Socks5 proxy

Overview

flutter_socks_proxy

flutter_socks_proxy is a dart package, HTTP/Socks4/Socks5 proxy

Usage

Use global

previous + element); }) .then((value) => print(value)) .catchError((e) => print(e)); }); runApp(MyApp()); } ">
import 'dart:convert';
import 'dart:io';
import 'package:socks_proxy/socks_proxy.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // proxy -> "SOCKS5/SOCKS4/PROXY username:password@host:port;" or "DIRECT"
  SocksProxy.initProxy(proxy: 'SOCKS5 192.168.31.180:7891');
    await HttpClient()
        .getUrl(Uri.parse('https://raw.githubusercontent.com/tayoji-io/socks_proxy/master/README.md'))
        .then((value) {
          return value.close();
        })
        .then((value) {
          return value.transform(utf8.decoder);
        })
        .then((value) {
          return value.fold(
              '', (dynamic previous, element) => previous + element);
        })
        .then((value) => print(value))
        .catchError((e) => print(e));
  });
  runApp(MyApp());
}

Use independent

'SOCKS5 192.168.31.180:7891'; await http .getUrl(Uri.parse('https://raw.githubusercontent.com/tayoji-io/socks_proxy/master/README.md')) .then((value) { return value.close(); }) .then((value) { return value.transform(utf8.decoder); }) .then((value) { return value.fold( '', (dynamic previous, element) => previous + element); }) .then((value) => print(value)) .catchError((e) => print(e)); } ">
import 'dart:convert';
import 'dart:io';
import 'package:socks_proxy/socks_proxy.dart';

 void requset() async {
  // proxy -> "SOCKS5/SOCKS4/PROXY username:password@host:port;" or "DIRECT"
  final http = createProxyHttpClient()
    ..findProxy = (url) => 'SOCKS5 192.168.31.180:7891';
  await http
      .getUrl(Uri.parse('https://raw.githubusercontent.com/tayoji-io/socks_proxy/master/README.md'))
      .then((value) {
        return value.close();
      })
      .then((value) {
        return value.transform(utf8.decoder);
      })
      .then((value) {
        return value.fold(
            '', (dynamic previous, element) => previous + element);
      })
      .then((value) => print(value))
      .catchError((e) => print(e));
}
You might also like...

Tiny Dart logging package

Tiny Dart logging package

Aug 3, 2022

The Dart code generator for your package versions. 🎯

The Dart code generator for your package versions. 🎯

The Dart code generator for your package versions. There is no way to get the package version from the code in the Dart ecosystem. Installation Add bu

Dec 14, 2022

Pub Release is a package to assist in publishing dart/flutter packages to pub.dev.

description Pub Release is a package that automates publishing dart/flutter packages to pub.dev. README Pub Release is a package that automates publis

Oct 13, 2022

A dart package to help you parse and evaluate infix mathematical expressions into their prefix and postfix notations.

A dart package to help you parse and evaluate infix mathematical expressions into their prefix and postfix notations.

Jan 28, 2022

This package allows programmers to annotate Dart objects in order to Serialize / Deserialize them to / from JSON

This package allows programmers to annotate Dart objects in order to Serialize / Deserialize them to / from JSON. Why? Compatible with all target plat

Jan 6, 2023

A dart package for decode and encode emv QR code

A dart package for decode and encode emv QR code

Nov 15, 2022

Dart package for random strings and numbers, with weights

randomness Dart package for random strings and numbers, with weights Random strings, numbers. RNG with weights. Cryptographically secure options. Gett

Aug 6, 2022

Dart wrapper via dart:ffi for https://github.com/libusb/libusb

libusb Dart wrapper via dart:ffi for https://github.com/libusb/libusb Environment Windows(10) macOS Linux(Ubuntu 18.04 LTS) Usage Checkout example Fea

Dec 20, 2022

Extensible Dart interpreter for Dart with full interop

dart_eval is an extensible interpreter for the Dart language, written in Dart. It's powered under the hood by the Dart analyzer, so it achieves 100% c

Dec 28, 2022
Comments
  • can't access non ssl (http) api while set socks4/5 proxy

    can't access non ssl (http) api while set socks4/5 proxy

    when i set socks4/5 external proxy like 192.111.139.165:4145

     SocksProxy.initProxy(
        proxy: 'SOCKS5 192.111.139.165:4145',
        onCreate: (client) {
          client.badCertificateCallback =
              (X509Certificate cert, String host, int port) => true;
        },
    

    then i cant access http aips and get this error

    Unhandled Exception: Connection reset by peer

    by setting internal proxy like 127.0.0.1:2081, i get different error

    Unhandled Exception: Connection closed before full header was received

    it woks fine with https apis and i don't have this problem with http PROXY IP:PORT proxies.

    opened by EmperorofWeb 0
  • Unhandled exception: Null check operator used on a null value

    Unhandled exception: Null check operator used on a null value

    SocksProxy.initProxy(proxy: 'SOCKS5 185.105.89.38:27022');
      await HttpClient()
          .getUrl(Uri.parse(
              'https://raw.githubusercontent.com/tayoji-io/socks_proxy/master/README.md'))
          .then((value) {
            return value.close();
          })
          .then((value) {
            return value.transform(utf8.decoder);
          })
          .then((value) {
            return value.fold(
                '', (dynamic previous, element) => previous + element);
          })
          .then((value) => print(value))
          .catchError((e) => print(e));
    

    library code: image error: image

    fix: image

    I do not know if it is correct but it works

    opened by Waitrum 1
Owner
null
Dio Package in Flutter - HTTP Requests and Interceptors.

Dio Package in Flutter - HTTP Requests and Interceptors. Learn how to use Flutter Dio package to make http requests, deal with interceptors and take care of unexpected server responses and failures in Flutter apps.

Sandip Pramanik 14 Nov 18, 2022
Future based HTTP client for the Dart and Flutter

Uno Future based HTTP client for the Dart and Flutter. Uno, inspired by Axios, bringing a simple and robust experience to the crossplatform apps in Fl

Flutterando 56 Dec 16, 2022
An http request client, which supports Manageable Requests Cancellation, Request Policy (Timeout and Retry), Easier Multipart Requests, etc.

A wrapper around Dart's http package, which supports Manageable Requests Cancellation, Request Policy (Timeout and Retry), Easier Multipart Requests, Error Handling, etc.

Iandi Santulus 5 Oct 10, 2021
A Dart package which supports checking if a current package is up-to-date.

pub_updater A Dart package which enables checking whether packages are up to date and supports updating them. Intended for use in CLIs for prompting u

Very Good Open Source 47 Oct 27, 2022
null 2 Apr 17, 2022
A Dart build script that downloads the Protobuf compiler and Dart plugin to streamline .proto to .dart compilation.

A Dart build script that downloads the Protobuf compiler and Dart plugin to streamline .proto to .dart compilation.

Julien Scholz 10 Oct 26, 2022
A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully

Muhammad Hamza 20 Jun 7, 2022
A Dart package to web scraping data from websites easily and faster using less code lines.

Chaleno A flutter package to webscraping data from websites This package contains a set of high-level functions that make it easy to webscrap websites

António Nicolau 30 Dec 29, 2022
A pure dart package to apply useful rate limiting strategies on regular functions.

Rate limiting is a strategy for limiting an action. It puts a cap on how often someone can repeat an action within a certain timeframe. Using rate_limiter we made it easier than ever to apply these strategies on regular dart functions.

Stream 24 Dec 14, 2022
This package binds to Cronet's native API to expose them in Dart.

Experimental Cronet Dart bindings This package binds to Cronet's native API to expose them in Dart. This is an HTTP Client Package with almost the sam

Google 103 Dec 9, 2022