feat: init commit

This commit is contained in:
2021-05-08 00:42:40 +08:00
parent 8d196e48d0
commit 54297fbaa8
7 changed files with 81 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.idea/
# ---> Dart
# See https://www.dartlang.org/guides/libraries/private-files

3
CHANGELOG.md Normal file
View File

@@ -0,0 +1,3 @@
## 1.0.0
- Initial version, created by Stagehand

View File

@@ -1,2 +1,4 @@
# simple-dart-tcp-proxy
A simple command-line application.
Created from templates made available by Stagehand under a BSD-style
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).

14
analysis_options.yaml Normal file
View File

@@ -0,0 +1,14 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
# Uncomment to specify additional rules.
# linter:
# rules:
# - camel_case_types
analyzer:
# exclude:
# - path/to/excluded/files/**

25
bin/config.dart Normal file
View File

@@ -0,0 +1,25 @@
import 'dart:convert';
class HostAndPort {
String host;
int port;
}
class ManageConfig {
String listen;
}
class ProxyItemConfig {
String listen;
String backend;
List<String> allowIps;
}
class ProxyConfig {
ManageConfig managementConfig;
List<ProxyItemConfig> tcpListens;
}
ProxyConfig parseProxyConfig(String config) {
final jsonConfig = json.decode(config);
}

View File

@@ -0,0 +1,22 @@
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;
// 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) { })
});
}

13
pubspec.yaml Normal file
View File

@@ -0,0 +1,13 @@
name: simple_dart_tcp_proxy
description: A simple command-line application.
# version: 1.0.0
# homepage: https://www.example.com
environment:
sdk: '>=2.8.1 <3.0.0'
#dependencies:
# path: ^1.7.0
dev_dependencies:
pedantic: ^1.9.0