update
This commit is contained in:
@@ -5,6 +5,8 @@ import 'dart:io';
|
||||
class HostAndPort {
|
||||
String host;
|
||||
int port;
|
||||
|
||||
HostAndPort({this.host, this.port});
|
||||
}
|
||||
|
||||
class ManageConfig {
|
||||
@@ -24,9 +26,29 @@ class ProxyConfig {
|
||||
|
||||
ProxyConfig parseProxyConfig(String config) {
|
||||
final jsonConfig = json.decode(config);
|
||||
|
||||
final managementConfig = jsonConfig['managementConfig'];
|
||||
print(managementConfig);
|
||||
|
||||
// print(jsonConfig);
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<ProxyConfig> loadProxyConfig(String configFile/*, {List<String> files} ?? */) async {
|
||||
HostAndPort parseHostAndPort(String hnp) {
|
||||
final indexOfC = hnp.indexOf(":");
|
||||
if (indexOfC < 0) {
|
||||
throw 'Missing port: ' + hnp;
|
||||
}
|
||||
var host = hnp.substring(0, indexOfC);
|
||||
final port = int.parse(hnp.substring(indexOfC + 1));
|
||||
if (host.isEmpty) {
|
||||
host = "0.0.0.0";
|
||||
}
|
||||
return HostAndPort(host: host, port: port);
|
||||
}
|
||||
|
||||
Future<ProxyConfig> loadProxyConfig(String configFile
|
||||
/*, {List<String> files} ?? */) async {
|
||||
final configFn = File(configFile);
|
||||
if (!await configFn.exists()) {
|
||||
throw 'Config file not found: ' + configFile;
|
||||
|
||||
Reference in New Issue
Block a user