SocksURL constructor
SocksURL({
- required String url,
Creates a SocksURL by parsing the provided socks share link string.
Throws ArgumentError if the url does not start with socks://
or
cannot be decoded into a valid URI.
Implementation
SocksURL({required super.url}) {
if (!url.startsWith('socks://')) {
throw ArgumentError('url is invalid');
}
final temp = Uri.tryParse(url);
if (temp == null) {
throw ArgumentError('url is invalid');
}
uri = temp;
if (uri.userInfo.isNotEmpty) {
final userpass = utf8.decode(base64Decode(uri.userInfo));
username = userpass.split(':')[0];
password = userpass.substring(username!.length + 1);
} else {
username = null;
password = null;
}
}