43 lines
925 B
Dart
43 lines
925 B
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
import 'config.dart';
|
|
|
|
void main(List<String> arguments) {
|
|
final listenAddress = "127.0.0.1";
|
|
final listenPort = 8801;
|
|
final targetHost = "";
|
|
final targetPort = 443;
|
|
|
|
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!');
|
|
}
|
|
|
|
void startListen(HostAndPort listen, HostAndPort target) {
|
|
ServerSocket.bind(listen.host, listen.port).then((serverSocket) {
|
|
Socket.connect(target.host, target.port).then((clientSocket) {
|
|
// TODO ...
|
|
});
|
|
// serverSocket.listen((event) { })
|
|
});
|
|
}
|