feat: *
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'config.dart';
|
||||
|
||||
@@ -8,34 +7,15 @@ int upstreamBytes = 0;
|
||||
int downstreamBytes = 0;
|
||||
Map<int, bool> createdConnectionMap = <int, bool>{};
|
||||
|
||||
void main(List<String> arguments) {
|
||||
final listenAddress = "127.0.0.1";
|
||||
final listenPort = 8801;
|
||||
final targetHost = "";
|
||||
final targetPort = 443;
|
||||
Future<void> main(List<String> arguments) async {
|
||||
print('Arguments: ' + arguments.toString());
|
||||
final proxyConfig = await loadProxyConfig(arguments[0]);
|
||||
|
||||
parseProxyConfig('''{
|
||||
"managementConfig": { "listen": "127.0.0.1:8888" },
|
||||
"tcpListens": [
|
||||
{
|
||||
"listen": ":8443",
|
||||
"backend": "101.132.122.240:443",
|
||||
"allowIps": ["127.0.0.1"]
|
||||
}
|
||||
]
|
||||
}''');
|
||||
parseProxyConfig('''{
|
||||
"tcpListens": [
|
||||
{
|
||||
"listen": ":8443",
|
||||
"backend": "101.132.122.240:443",
|
||||
"allowIps": ["127.0.0.1"]
|
||||
}
|
||||
]
|
||||
}''');
|
||||
|
||||
// TODO ...
|
||||
print('Hello world!');
|
||||
for (final tcpListen in proxyConfig.tcpListens) {
|
||||
final listen = parseHostAndPort(tcpListen.listen);
|
||||
final target = parseHostAndPort(tcpListen.backend);
|
||||
startListen(listen, target);
|
||||
}
|
||||
}
|
||||
|
||||
void startListen(HostAndPort listen, HostAndPort target) {
|
||||
|
||||
Reference in New Issue
Block a user