Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tayoji-io/socks_proxy
dart package,http/socks4/socks5 proxy
https://github.com/tayoji-io/socks_proxy
dart flutter proxy socks4 socks5
Last synced: 27 days ago
JSON representation
dart package,http/socks4/socks5 proxy
- Host: GitHub
- URL: https://github.com/tayoji-io/socks_proxy
- Owner: tayoji-io
- License: mit
- Created: 2021-11-22T06:21:09.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-09T16:04:25.000Z (7 months ago)
- Last Synced: 2024-09-30T09:23:59.052Z (about 1 month ago)
- Topics: dart, flutter, proxy, socks4, socks5
- Language: Dart
- Homepage:
- Size: 108 KB
- Stars: 22
- Watchers: 3
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_socks_proxy
**flutter_socks_proxy** is a dart package, HTTP/Socks4/Socks5 proxy
## Flutter version scope
| flutter_socks_proxy | Flutter |
| ------------- | ------------- |
| 0.0.1 | < 3.0 |
| 0.0.2 | >= 3.0 |## Usage
### Use global
```dart
import 'dart:convert';
import 'dart:io';
import 'package:flutter_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
``` dart
import 'dart:convert';
import 'dart:io';
import 'package:flutter_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));
}```