https://github.com/lyn-euler/osproxysetting
a flutter plugin to fetch system proxy settings.
https://github.com/lyn-euler/osproxysetting
Last synced: about 2 months ago
JSON representation
a flutter plugin to fetch system proxy settings.
- Host: GitHub
- URL: https://github.com/lyn-euler/osproxysetting
- Owner: lyn-euler
- License: mit
- Created: 2020-04-28T04:41:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-07T09:00:09.000Z (about 5 years ago)
- Last Synced: 2026-01-01T01:49:08.719Z (6 months ago)
- Language: Dart
- Size: 71.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# osproxysetting
A new Flutter plugin to fetch os proxy setting.
## Getting Started
This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
## Usage
U can use this plugin to fetch system proxy settings. And can set `HttpClient`'s findProxy method, so that u can use Charles(or other tools) to wireshark.
Example in use dio in Flutter or other libary use HttpCilent.
First, add dependency to your pubspec.yaml
```yaml
osproxysetting: ^0.0.1
```
Then set findProxy function.
```Dart
if (_debugMode) {
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) async {
client.findProxy = (uri) {
final setting = OsProxySetting.cacheSetting();
if (setting == null ||
!setting.httpEnable ||
setting.port == null ||
setting.host == null) {
return "DIRECT";
}
return "PROXY ${setting.host}:${setting.port}";
};
};
}
```