mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-11 05:14:46 +00:00
save
This commit is contained in:
parent
c67a6f0b6e
commit
dc87d774d3
1 changed files with 10 additions and 6 deletions
|
@ -6,18 +6,22 @@ import 'package:socks5_proxy/socks.dart';
|
||||||
import 'package:tor/tor.dart';
|
import 'package:tor/tor.dart';
|
||||||
|
|
||||||
class ProxyWrapper {
|
class ProxyWrapper {
|
||||||
// Private constructor
|
|
||||||
ProxyWrapper._privateConstructor(this.settingsStore);
|
ProxyWrapper({
|
||||||
|
required this.settingsStore,
|
||||||
|
});
|
||||||
|
|
||||||
|
// ProxyWrapper._privateConstructor();
|
||||||
|
|
||||||
// Static private instance of Tor
|
// Static private instance of Tor
|
||||||
static final ProxyWrapper _instance = ProxyWrapper._privateConstructor();
|
// static final ProxyWrapper _instance = ProxyWrapper._privateConstructor();
|
||||||
|
|
||||||
final SettingsStore settingsStore;
|
late SettingsStore settingsStore;
|
||||||
|
|
||||||
HttpClient? _torClient;
|
HttpClient? _torClient;
|
||||||
|
|
||||||
// Factory method to get the singleton instance of TorSingleton
|
// Factory method to get the singleton instance of TorSingleton
|
||||||
static ProxyWrapper get instance => _instance;
|
// static ProxyWrapper get instance => _instance;
|
||||||
|
|
||||||
static int get port => Tor.instance.port;
|
static int get port => Tor.instance.port;
|
||||||
|
|
||||||
|
@ -27,7 +31,7 @@ class ProxyWrapper {
|
||||||
bool torEnabled = false;
|
bool torEnabled = false;
|
||||||
bool torOnly = false;
|
bool torOnly = false;
|
||||||
|
|
||||||
// Method to get or create the Tor instance
|
// Method to get or create the Tor proxy instance
|
||||||
Future<HttpClient> getProxyInstance({int? portOverride}) async {
|
Future<HttpClient> getProxyInstance({int? portOverride}) async {
|
||||||
if (!started) {
|
if (!started) {
|
||||||
started = true;
|
started = true;
|
||||||
|
|
Loading…
Reference in a new issue