1 |
|
%%% eturnal STUN/TURN server. |
2 |
|
%%% |
3 |
|
%%% Copyright (c) 2020 Holger Weiss <holger@zedat.fu-berlin.de>. |
4 |
|
%%% Copyright (c) 2020 ProcessOne, SARL. |
5 |
|
%%% All rights reserved. |
6 |
|
%%% |
7 |
|
%%% Licensed under the Apache License, Version 2.0 (the "License"); |
8 |
|
%%% you may not use this file except in compliance with the License. |
9 |
|
%%% You may obtain a copy of the License at |
10 |
|
%%% |
11 |
|
%%% http://www.apache.org/licenses/LICENSE-2.0 |
12 |
|
%%% |
13 |
|
%%% Unless required by applicable law or agreed to in writing, software |
14 |
|
%%% distributed under the License is distributed on an "AS IS" BASIS, |
15 |
|
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 |
|
%%% See the License for the specific language governing permissions and |
17 |
|
%%% limitations under the License. |
18 |
|
|
19 |
|
-module(eturnal_sup). |
20 |
|
-behaviour(supervisor). |
21 |
|
-export([start_link/0, |
22 |
|
init/1]). |
23 |
|
|
24 |
|
-include_lib("kernel/include/logger.hrl"). |
25 |
|
-define(SERVER, ?MODULE). |
26 |
|
|
27 |
|
%% API. |
28 |
|
|
29 |
|
-spec start_link() -> {ok, pid()} | {error, term()}. |
30 |
|
start_link() -> |
31 |
1 |
?LOG_DEBUG("Starting supervisor: ~s", [?SERVER]), |
32 |
1 |
supervisor:start_link({local, ?SERVER}, ?MODULE, []). |
33 |
|
|
34 |
|
-spec init([]) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}. |
35 |
|
init([]) -> |
36 |
1 |
SupFlags = #{}, |
37 |
1 |
ChildSpecs = [#{id => systemd, start => {eturnal_systemd, start_link, []}}, |
38 |
|
#{id => eturnal, start => {eturnal, start_link, []}}], |
39 |
1 |
?LOG_DEBUG("Configuring ~s supervisor: ~p", [?MODULE, ChildSpecs]), |
40 |
1 |
{ok, {SupFlags, ChildSpecs}}. |