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
|
-module(ereproxy_config).
-export([config/0, select_destination/1]).
-include("ereproxy_config.hrl").
config() ->
#cfg{listen = [{http, 80}, {https, 443}],
ssl_opts = [{certfile, "example/cert.pem"},
{keyfile, "example/key.pem"}]
}.
%% select_destination
select_destination(HostName) ->
case lists:keysearch(HostName, 1, destination_list()) of
{value, {HostName, Destination}} -> Destination;
_UnknownHostName -> destination_default()
end.
destination_default() ->
{"192.168.130.35", 80}.
destination_list() ->
[
{"code.sotun.de", {"192.168.130.103", 80}},
{"wave.sotun.de", {"192.168.130.111", 9898}}
| [{WWW ++ "kraut" ++ Dash ++ "computing." ++ TLD,
{"192.168.130.37", 80}}
|| WWW <- ["", "www."],
Dash <- ["", "-"],
TLD <- ["com", "de", "net", "eu", "org", "at"] ]
].
|