Line data Source code
1 : /*
2 : * Copyright (C) 2004-2026 Savoir-faire Linux Inc.
3 : *
4 : * This program is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 3 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * This program is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 : */
17 : #pragma once
18 : #include "sip/sipaccountbase_config.h"
19 :
20 : namespace jami {
21 : constexpr static std::string_view ACCOUNT_TYPE_JAMI = "RING";
22 : constexpr static const char* const DHT_DEFAULT_BOOTSTRAP = "bootstrap.jami.net";
23 : constexpr static const char* DEFAULT_TURN_SERVER = "turn.jami.net";
24 : constexpr static const char* DEFAULT_TURN_USERNAME = "ring";
25 : constexpr static const char* DEFAULT_TURN_PWD = "ring";
26 : constexpr static const char* DEFAULT_TURN_REALM = "ring";
27 :
28 : struct JamiAccountConfig : public SipAccountBaseConfig
29 : {
30 1112 : JamiAccountConfig(const std::string& id = {}, const std::filesystem::path& path = {})
31 12232 : : SipAccountBaseConfig(std::string(ACCOUNT_TYPE_JAMI), id, path)
32 : {
33 : // Default values specific to Jami accounts
34 1112 : hostname = DHT_DEFAULT_BOOTSTRAP;
35 1112 : turnServer = DEFAULT_TURN_SERVER;
36 1112 : turnServerUserName = DEFAULT_TURN_USERNAME;
37 1112 : turnServerPwd = DEFAULT_TURN_PWD;
38 1112 : turnServerRealm = DEFAULT_TURN_REALM;
39 1112 : turnEnabled = true;
40 1112 : upnpEnabled = true;
41 1112 : }
42 : void serialize(YAML::Emitter& out) const override;
43 : void unserialize(const YAML::Node& node) override;
44 : std::map<std::string, std::string> toMap() const override;
45 : void fromMap(const std::map<std::string, std::string>&) override;
46 :
47 : std::string deviceName {};
48 : uint16_t dhtPort {0};
49 : bool dhtPeerDiscovery {false};
50 : bool accountPeerDiscovery {false};
51 : bool accountPublish {false};
52 : std::string bootstrapListUrl {"https://config.jami.net/bootstrapList"};
53 :
54 : bool proxyEnabled {false};
55 : bool proxyListEnabled {true};
56 : std::string proxyServer {"dhtproxy.jami.net:[80-95]"};
57 : std::string proxyListUrl {"https://config.jami.net/proxyList"};
58 :
59 : bool dhtProxyServerEnabled {false};
60 : uint16_t dhtProxyServerPort {42443};
61 :
62 : std::string nameServer {};
63 : std::string registeredName {};
64 :
65 : bool allowPeersFromHistory {true};
66 : bool allowPeersFromContact {true};
67 : bool allowPeersFromTrusted {true};
68 : bool allowPublicIncoming {true};
69 :
70 : std::string managerUri {};
71 : std::string managerUsername {};
72 :
73 : std::string archivePath {"archive.gz"};
74 : bool archiveHasPassword {true};
75 :
76 : // not saved, only used client->daemon
77 : struct Credentials
78 : {
79 : std::string archive_password_scheme;
80 : std::string archive_password;
81 : std::string archive_path;
82 : } credentials;
83 : std::string archive_url; // TODO discuss removal or impl. This is currently unused.
84 :
85 : std::string receipt {};
86 : std::vector<uint8_t> receiptSignature {};
87 :
88 : bool dhtPublicInCalls {true};
89 : };
90 :
91 : } // namespace jami
|