-
Notifications
You must be signed in to change notification settings - Fork 16
/
ConfigFile.cs
322 lines (254 loc) · 9.41 KB
/
ConfigFile.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Text;
namespace WebOne
{
/// <summary>
/// Configuration file entries
/// </summary>
static class ConfigFile
{
/// <summary>
/// TCP port that should be used by the Proxy Server
/// </summary>
public static int Port = 80;
/// <summary>
/// List of domains that should be open only using HTTPS
/// </summary>
public static List<string> ForceHttps = new List<string>();
/// <summary>
/// List of URLs that should be always downloaded as UTF-8
/// </summary>
public static List<string> ForceUtf8 = new List<string>();
/// <summary>
/// List of parts of Content-Types that describing text files
/// </summary>
public static List<string> TextTypes = new List<string>() { "text/", "javascript" };
/// <summary>
/// Encoding to be used in output content
/// </summary>
public static Encoding OutputEncoding = Encoding.Default;
/// <summary>
/// Credentials for proxy authentication
/// </summary>
public static List<string> Authenticate = new List<string>();
/// <summary>
/// Hide "Can't read from client" and "Cannot return reply to the client" error messages in log
/// </summary>
public static bool HideClientErrors = false;
/// <summary>
/// Search for copies of removed sites in web.archive.org
/// </summary>
public static bool SearchInArchive = false;
/// <summary>
/// Hide HTTP 302 redirect to web.archive.org, and continue use original URL (but retrieve archived copy)
/// </summary>
public static bool HideArchiveRedirect = false;
/// <summary>
/// Set suffix of timestamp in web.archive.org URLs ("fw_" = hide toolbar, "id_" = original links, "" = default)
/// </summary>
public static string ArchiveUrlSuffix = "";
/// <summary>
/// Make Web.Archive.Org error messages laconic (for retro browsers)
/// </summary>
public static bool ShortenArchiveErrors = false;
/// <summary>
/// List of enabled file format converters
/// </summary>
public static List<Converter> Converters = new List<Converter>();
/// <summary>
/// User-agent string of the Proxy
/// </summary>
public static string UserAgent = "%Original% WebOne/%WOVer%";
/// <summary>
/// Proxy default host name (or IP)
/// </summary>
public static string DefaultHostName = Environment.MachineName;
/// <summary>
/// Break network operations when remote TLS certificate is bad
/// </summary>
public static bool ValidateCertificates = true;
/// <summary>
/// List of traffic edit sets
/// </summary>
public static List<EditSet> EditRules = new List<EditSet>(); //how about to rename to EditSets?
/// <summary>
/// Table for alphabet transliteration
/// </summary>
public static List<KeyValuePair<string, string>> TranslitTable = new List<KeyValuePair<string, string>>();
/// <summary>
/// Temporary files' directory
/// </summary>
public static string TemporaryDirectory = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar;
/// <summary>
/// Set status page display style: no, short, full
/// </summary>
public static string DisplayStatusPage = "full";
/// <summary>
/// Proxy authentication request page text
/// </summary>
public static string AuthenticateMessage = "<p>Hello! This Web 2.0-to-1.0 proxy server is private. Please reload this page and enter your credentials in browser's pop-up window.</p>";
/// <summary>
/// Proxy authentication realm (request message text)
/// </summary>
public static string AuthenticateRealm = "WebOne";
/// <summary>
/// List of banned client IP addresses
/// </summary>
public static List<string> IpBanList = new();
/// <summary>
/// List of allowed client IP addresses
/// </summary>
public static List<string> IpWhiteList = new();
/// <summary>
/// List of disallowed URLs
/// </summary>
public static List<string> UrlBlackList = new();
/// <summary>
/// List of only allowed URLs
/// </summary>
public static List<string> UrlWhiteList = new();
/// <summary>
/// List of the proxy server's host names
/// </summary>
public static List<string> HostNames = new();
/// <summary>
/// Upper limit of Web Archive page date
/// </summary>
public static int ArchiveDateLimit = 0;
/// <summary>
/// Another proxy server, used by WebOne to connect to Internet
/// </summary>
public static string UpperProxy = "";
/// <summary>
/// Proxy Automatic Configuration script
/// </summary>
public static string PAC = "";
/// <summary>
/// Internal pages style in HTML format (TEXT="#000000" BGCOLOR="#C0C0C0" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000")
/// </summary>
public static string PageStyleHtml = "";
/// <summary>
/// Internal pages style in CSS format (body { background-color: #C0C0C0; color: #000000; })
/// </summary>
public static string PageStyleCss = "";
/// <summary>
/// Allow multiple HTTP/2.0 connections to servers (faster, but may overload remote servers)
/// </summary>
public static bool MultipleHttp2Connections = true;
/// <summary>
/// Version of HTTP(S) protocol, used to communicate with servers
/// </summary>
public static string RemoteHttpVersion = "auto";
/// <summary>
/// Options for online video converting
/// </summary>
public static Dictionary<string, string> WebVideoOptions = new();
/// <summary>
/// Allow gz/deflate/br compression of remote HTTP connections
/// </summary>
public static bool AllowHttpCompression = true;
/// <summary>
/// MIME Content-Types for known file extensions
/// </summary>
public static Dictionary<string, string> MimeTypes = new();
/// <summary>
/// Enable built-in Web-FTP client
/// </summary>
public static bool EnableWebFtp = true;
/// <summary>
/// Use Microsoft HTTPAPI (HttpListener) for processing incoming traffic
/// </summary>
public static bool UseMsHttpApi = false;
/// <summary>
/// List of user agents without HTTP/1.1 support (work as HTTP/1.0)
/// </summary>
public static List<string> Http10Only = new();
/// <summary>
/// Enable http://proxy/!convert/?util=convert&url=url&dest=gif&type=image/gif tool page
/// </summary>
public static bool EnableManualConverting = true;
/// <summary>
/// Location of internal pages' HTML (CSS, JS, GIF, etc) files
/// </summary>
public static string ContentDirectory = "./html";
/// <summary>
/// Bypass client authentication for local IPs
/// </summary>
public static bool OpenForLocalIPs = false;
/// <summary>
/// Enable work with CONNECT method (enable HTTPS Proxy)
/// </summary>
public static bool SslEnable = true;
/// <summary>
/// Path to SSL/TLS Certificate (used as CA for fake certificates)
/// </summary>
public static string SslCertificate = "ssl.crt";
/// <summary>
/// Path to SSL/TLS Certificate private key (used as CA for fake certificates)
/// </summary>
public static string SslPrivateKey = "ssl.key";
/// <summary>
/// Protocols used in SSL/TLS tunnels through this Secure proxy
/// </summary>
public static SslProtocols SslProtocols = SslProtocols.None;
/// <summary>
/// Cipher Suites used in SSL/TLS tunnels through this Secure proxy
/// </summary>
public static List<TlsCipherSuite> SslCipherSuites = new();
/// <summary>
/// Cipher Suite Policy used in SSL/TLS tunnels through this Secure proxy [*nix-only]
/// </summary>
public static CipherSuitesPolicy SslCipherSuitesPolicy = null;
/// <summary>
/// Certificate hashing algorithm used in CA and sites certificates
/// </summary>
public static HashAlgorithmName SslHashAlgorithm = HashAlgorithmName.SHA1;
/// <summary>
/// Certificate subject to used in CA certificate at time of its generating
/// </summary>
public static string SslRootSubject = CertificateUtil.DefaultCASubject;
/// <summary>
/// Date after which the CA certificate should be considered valid. Used only when generating it
/// </summary>
public static DateTimeOffset SslRootValidAfter;
/// <summary>
/// Date before which the CA certificate should be considered valid. Used only when generating it
/// </summary>
public static DateTimeOffset SslRootValidBefore;
/// <summary>
/// Days before current day when site certificates are considered valid
/// </summary>
public static int SslCertVaildBeforeNow = -7;
/// <summary>
/// Days after current day when site certificates are considered valid
/// </summary>
public static int SslCertVaildAfterNow = 7;
/// <summary>
/// Path to directory with fake certificates for sites
/// </summary>
public static string SslSiteCerts = "";
/// <summary>
/// Command which creates fake site certificates
/// </summary>
public static string SslSiteCertGenerator = "";
/// <summary>
/// Allow using CONNECT method to connect to non-HTTPS servers
/// </summary>
public static bool AllowNonHttpsCONNECT = true;
/// <summary>
/// List of non-HTTPS servers with TLS, which can be accessed via CONNECT method
/// </summary>
public static List<string> NonHttpSslServers = new();
/// <summary>
/// Redirect these connections for non-HTTP protocols
/// </summary>
public static Dictionary<string, string> NonHttpConnectRedirect = new();
// Hint: All parser-related stuff known from v0.2.0 - 0.10.7 has been rewritten and moved to ConfigFileLoader class.
// Don't look for the parser here.
}
}