0 /* See LICENSE file for copyright and license details. */
1 import std.stdio;
2 import proxy;
3 import std.concurrency;
4 import core.thread;
5 import std.file;
6 import logger;
7
8 void main()
9 {
10 string config = "/etc/rxproxy";
11 version(Windows) {
12 config = ".";
13 }
14 version(FreeBSD) {
15 config = "/usr/local/etc/rxproxy";
16 }
17
18 try {
19 isDir(config);
20 } catch(FileException) {
21 try {
22 mkdir(config);
23 } catch(FileException) {
24 Logger.error("Failed to create config folder");
25 }
26 }
27 Proxy server = new Proxy();
28 server.initialize(config~"/config.json");
29 server.listen();
30 }
31