Skip to content

Commit f6921cf

Browse files
committed
feat: 1. 包名添加tcp与http 2. 添加HTTP代理的方法定义
1 parent db8a725 commit f6921cf

File tree

8 files changed

+425
-101
lines changed

8 files changed

+425
-101
lines changed

src/main/java/top/meethigher/VertxHTTPReverseProxy.java

Lines changed: 0 additions & 90 deletions
This file was deleted.
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
package top.meethigher.proxy.http;
2+
3+
/**
4+
* 服务信息
5+
*
6+
* @author chenchuancheng
7+
* @since 2024/07/17 23:21
8+
*/
9+
public class ProxyRoute {
10+
11+
private boolean enable;
12+
13+
private String name;
14+
/**
15+
* /* represents all interfaces below proxy /, no distinction between /* and /**
16+
*/
17+
private String sourceUrl;
18+
19+
private String targetUrl;
20+
21+
private boolean forwardIp;
22+
23+
private boolean preserveCookies;
24+
25+
private boolean preserveHost;
26+
27+
private boolean followRedirects;
28+
29+
private LOG log;
30+
31+
private CORSControl corsControl;
32+
33+
34+
/**
35+
* 跨域控制
36+
*
37+
* @author chenchuancheng
38+
* @since 2024/06/29 11:59
39+
*/
40+
public static class CORSControl {
41+
/**
42+
* true表示所有的代理请求的跨域都由自己管理
43+
* false表示所有的代理请求的跨域由被代理方控制
44+
*/
45+
private boolean enable;
46+
47+
/**
48+
* 当enable=true时,该参数才会生效
49+
* 如果该参数为true表示所有经过代理的服务都允许跨域
50+
* 如果该参数为true表示所有经过代理的服务均不允许跨域
51+
*/
52+
private boolean allowCORS;
53+
54+
public boolean isEnable() {
55+
return enable;
56+
}
57+
58+
public void setEnable(boolean enable) {
59+
this.enable = enable;
60+
}
61+
62+
public boolean isAllowCORS() {
63+
return allowCORS;
64+
}
65+
66+
public void setAllowCORS(boolean allowCORS) {
67+
this.allowCORS = allowCORS;
68+
}
69+
}
70+
71+
public static class LOG {
72+
private boolean enable;
73+
/**
74+
* Configure the agent’s log format. The options are remoteAddr、remotePort、userAgent、method、source、target
75+
*/
76+
private String logFormat;
77+
78+
public boolean isEnable() {
79+
return enable;
80+
}
81+
82+
public void setEnable(boolean enable) {
83+
this.enable = enable;
84+
}
85+
86+
public String getLogFormat() {
87+
return logFormat;
88+
}
89+
90+
public void setLogFormat(String logFormat) {
91+
this.logFormat = logFormat;
92+
}
93+
}
94+
95+
96+
public String getName() {
97+
return name;
98+
}
99+
100+
public void setName(String name) {
101+
this.name = name;
102+
}
103+
104+
public String getSourceUrl() {
105+
return sourceUrl;
106+
}
107+
108+
public void setSourceUrl(String sourceUrl) {
109+
this.sourceUrl = sourceUrl;
110+
}
111+
112+
public String getTargetUrl() {
113+
return targetUrl;
114+
}
115+
116+
public void setTargetUrl(String targetUrl) {
117+
this.targetUrl = targetUrl;
118+
}
119+
120+
public boolean isForwardIp() {
121+
return forwardIp;
122+
}
123+
124+
public void setForwardIp(boolean forwardIp) {
125+
this.forwardIp = forwardIp;
126+
}
127+
128+
public boolean isPreserveCookies() {
129+
return preserveCookies;
130+
}
131+
132+
public void setPreserveCookies(boolean preserveCookies) {
133+
this.preserveCookies = preserveCookies;
134+
}
135+
136+
public boolean isPreserveHost() {
137+
return preserveHost;
138+
}
139+
140+
public void setPreserveHost(boolean preserveHost) {
141+
this.preserveHost = preserveHost;
142+
}
143+
144+
public boolean isFollowRedirects() {
145+
return followRedirects;
146+
}
147+
148+
public void setFollowRedirects(boolean followRedirects) {
149+
this.followRedirects = followRedirects;
150+
}
151+
152+
public LOG getLog() {
153+
return log;
154+
}
155+
156+
public void setLog(LOG log) {
157+
this.log = log;
158+
}
159+
160+
public CORSControl getCorsControl() {
161+
return corsControl;
162+
}
163+
164+
public void setCorsControl(CORSControl corsControl) {
165+
this.corsControl = corsControl;
166+
}
167+
}

0 commit comments

Comments
 (0)