From f18c78d892f06675766c8d0f7915553343032acc Mon Sep 17 00:00:00 2001 From: "Vyacheslav N. Boyko" Date: Sat, 27 Oct 2018 19:09:38 +0300 Subject: [PATCH] implemented web UI for managing multiple proxy servers instances --- .gitignore | 4 +- jProxy.ipr | 1091 ++++++++++++++++- jProxy.iws | 759 ++++++++++-- jproxy.iml | 114 ++ pom.xml | 149 ++- src/main/java/ru/bvn13/jproxy/JProxy.java | 10 - src/main/java/ru/bvn13/jproxy/JproxyApp.java | 12 + .../bvn13/jproxy/beans/ProxyInstanceList.java | 36 + .../bvn13/jproxy/config/SecurityConfig.java | 72 ++ .../jproxy/controllers/IndexController.java | 33 + .../jproxy/controllers/ProxyController.java | 53 + .../controllers/ProxyListController.java | 22 + .../jproxy/{ => engine}/ClientListener.java | 19 +- .../jproxy/{ => engine}/ProxyServer.java | 24 +- .../bvn13/jproxy/entities/ProxyInstance.java | 62 + .../entities/dtos/ProxyInstanceDTO.java | 43 + .../exceptions/ProxyAlreadyEnabled.java | 21 + .../jproxy/mapping/MappingConfiguration.java | 28 + .../repositories/ProxyInstanceRepository.java | 17 + .../jproxy/services/ProxyInstanceService.java | 83 ++ .../jproxy/services/ProxyManagerService.java | 104 ++ src/main/resources/application.properties | 29 + .../templates/decorators/footer.html | 12 + .../templates/decorators/header.html | 11 + .../templates/decorators/proxyForm.html | 44 + src/main/resources/templates/index.html | 11 + src/main/resources/templates/logout.html | 16 + src/main/resources/templates/proxyForm.html | 16 + src/main/resources/templates/proxylist.html | 61 + src/test/java/ru/bvn13/JProxyTest.java | 7 +- 30 files changed, 2773 insertions(+), 190 deletions(-) delete mode 100644 src/main/java/ru/bvn13/jproxy/JProxy.java create mode 100644 src/main/java/ru/bvn13/jproxy/JproxyApp.java create mode 100644 src/main/java/ru/bvn13/jproxy/beans/ProxyInstanceList.java create mode 100644 src/main/java/ru/bvn13/jproxy/config/SecurityConfig.java create mode 100644 src/main/java/ru/bvn13/jproxy/controllers/IndexController.java create mode 100644 src/main/java/ru/bvn13/jproxy/controllers/ProxyController.java create mode 100644 src/main/java/ru/bvn13/jproxy/controllers/ProxyListController.java rename src/main/java/ru/bvn13/jproxy/{ => engine}/ClientListener.java (88%) rename src/main/java/ru/bvn13/jproxy/{ => engine}/ProxyServer.java (52%) create mode 100644 src/main/java/ru/bvn13/jproxy/entities/ProxyInstance.java create mode 100644 src/main/java/ru/bvn13/jproxy/entities/dtos/ProxyInstanceDTO.java create mode 100644 src/main/java/ru/bvn13/jproxy/exceptions/ProxyAlreadyEnabled.java create mode 100644 src/main/java/ru/bvn13/jproxy/mapping/MappingConfiguration.java create mode 100644 src/main/java/ru/bvn13/jproxy/repositories/ProxyInstanceRepository.java create mode 100644 src/main/java/ru/bvn13/jproxy/services/ProxyInstanceService.java create mode 100644 src/main/java/ru/bvn13/jproxy/services/ProxyManagerService.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/templates/decorators/footer.html create mode 100644 src/main/resources/templates/decorators/header.html create mode 100644 src/main/resources/templates/decorators/proxyForm.html create mode 100644 src/main/resources/templates/index.html create mode 100644 src/main/resources/templates/logout.html create mode 100644 src/main/resources/templates/proxyForm.html create mode 100644 src/main/resources/templates/proxylist.html diff --git a/.gitignore b/.gitignore index c2c4a5a..0f0d827 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -target/** \ No newline at end of file +target/** +db/** +.ideaDataSources/** \ No newline at end of file diff --git a/jProxy.ipr b/jProxy.ipr index 9437849..ca4b88a 100644 --- a/jProxy.ipr +++ b/jProxy.ipr @@ -10,9 +10,17 @@ - + + + + h2.unified + true + org.h2.Driver + jdbc:h2:file:$PROJECT_DIR$/../proxy/db/jproxy.h2db + + @@ -159,7 +167,285 @@ + + + + + + + " + + + master_key + sa + *:*|@:@|JPROXY.H2DB:* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -171,6 +457,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -182,5 +611,665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jProxy.iws b/jProxy.iws index 059efad..97a50b7 100644 --- a/jProxy.iws +++ b/jProxy.iws @@ -1,7 +1,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -152,10 +279,11 @@ - + @@ -170,6 +298,11 @@ + + + + + @@ -200,22 +333,98 @@ - + + + + - + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + +

+

+ + +

+

+ + +

+

+ + +

+

+ + +

+ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html new file mode 100644 index 0000000..0ae252f --- /dev/null +++ b/src/main/resources/templates/index.html @@ -0,0 +1,11 @@ + + + + + Hello + + +

Hello, !

+ + \ No newline at end of file diff --git a/src/main/resources/templates/logout.html b/src/main/resources/templates/logout.html new file mode 100644 index 0000000..b2c0f25 --- /dev/null +++ b/src/main/resources/templates/logout.html @@ -0,0 +1,16 @@ + + + + + Logout form + + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/proxyForm.html b/src/main/resources/templates/proxyForm.html new file mode 100644 index 0000000..6d404e1 --- /dev/null +++ b/src/main/resources/templates/proxyForm.html @@ -0,0 +1,16 @@ + + + + + + <th:block th:if="${proxyInstance.id} == 0">New proxy</th:block> + <th:block th:if="${proxyInstance.id} == 0" th:text="'Proxy #'+${proxyInstance.id}"></th:block> + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/proxylist.html b/src/main/resources/templates/proxylist.html new file mode 100644 index 0000000..35deb4a --- /dev/null +++ b/src/main/resources/templates/proxylist.html @@ -0,0 +1,61 @@ + + + + + Proxy list + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RunningEnabledNameLocal hostLocal portRemote hostRemote portManage
+ + V + + NameLocal hostLocal portRemote hostRemote port + + + + disable + + + enable + + +   + edit +
+ +

+ Add proxy +

+ + + \ No newline at end of file diff --git a/src/test/java/ru/bvn13/JProxyTest.java b/src/test/java/ru/bvn13/JProxyTest.java index 3835396..d11d163 100644 --- a/src/test/java/ru/bvn13/JProxyTest.java +++ b/src/test/java/ru/bvn13/JProxyTest.java @@ -4,8 +4,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; -import ru.bvn13.jproxy.JProxy; -import ru.bvn13.jproxy.ProxyServer; +import ru.bvn13.jproxy.engine.ProxyServer; import java.io.DataInputStream; import java.io.DataOutputStream; @@ -29,11 +28,11 @@ public class JProxyTest "Host: yandex.ru\n" + "Accept-Language: en-us\n" + "Accept-Encoding: gzip, deflate\n" + - "Connection: Keep-Alive"; + "Connection: Keep-Alive\n"+ + "\n"; @Before public void before() { - //proxy = new ProxyServer(8099, "yandex.ru", 80); } @Test