Line data Source code
1 : /* 2 : * Copyright (C) 2004-2025 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 920 : JamiAccountConfig(const std::string& id = {}, const std::filesystem::path& path = {}) 31 920 : : SipAccountBaseConfig(std::string(ACCOUNT_TYPE_JAMI), id, path) 32 : { 33 : // Default values specific to Jami accounts 34 920 : hostname = DHT_DEFAULT_BOOTSTRAP; 35 920 : turnServer = DEFAULT_TURN_SERVER; 36 920 : turnServerUserName = DEFAULT_TURN_USERNAME; 37 920 : turnServerPwd = DEFAULT_TURN_PWD; 38 920 : turnServerRealm = DEFAULT_TURN_REALM; 39 920 : turnEnabled = true; 40 920 : upnpEnabled = true; 41 920 : } 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 : std::string nameServer {}; 60 : std::string registeredName {}; 61 : 62 : bool allowPeersFromHistory {true}; 63 : bool allowPeersFromContact {true}; 64 : bool allowPeersFromTrusted {true}; 65 : bool allowPublicIncoming {true}; 66 : 67 : std::string managerUri {}; 68 : std::string managerUsername {}; 69 : 70 : std::string archivePath {"archive.gz"}; 71 : bool archiveHasPassword {true}; 72 : 73 : // not saved, only used client->daemon 74 : struct Credentials 75 : { 76 : std::string archive_password_scheme; 77 : std::string archive_password; 78 : std::string archive_path; 79 : } credentials; 80 : std::string archive_url; // TODO discuss removal or impl. This is currently unused. 81 : 82 : std::string receipt {}; 83 : std::vector<uint8_t> receiptSignature {}; 84 : 85 : bool dhtPublicInCalls {true}; 86 : }; 87 : 88 : } // namespace jami