Line data Source code
1 : /* 2 : * Copyright (C) 2004-2024 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 1121 : JamiAccountConfig(const std::string& id = {}, const std::filesystem::path& path = {}) 30 1121 : : SipAccountBaseConfig(std::string(ACCOUNT_TYPE_JAMI), id, path) 31 : { 32 : // Default values specific to Jami accounts 33 1121 : hostname = DHT_DEFAULT_BOOTSTRAP; 34 1121 : turnServer = DEFAULT_TURN_SERVER; 35 1121 : turnServerUserName = DEFAULT_TURN_USERNAME; 36 1121 : turnServerPwd = DEFAULT_TURN_PWD; 37 1121 : turnServerRealm = DEFAULT_TURN_REALM; 38 1121 : turnEnabled = true; 39 1121 : upnpEnabled = true; 40 1121 : } 41 : void serialize(YAML::Emitter& out) const override; 42 : void unserialize(const YAML::Node& node) override; 43 : std::map<std::string, std::string> toMap() const override; 44 : void fromMap(const std::map<std::string, std::string>&) override; 45 : 46 : std::string deviceName {}; 47 : uint16_t dhtPort {0}; 48 : bool dhtPeerDiscovery {false}; 49 : bool accountPeerDiscovery {false}; 50 : bool accountPublish {false}; 51 : std::string bootstrapListUrl {"https://config.jami.net/bootstrapList"}; 52 : 53 : bool proxyEnabled {false}; 54 : bool proxyListEnabled {true}; 55 : std::string proxyServer {"dhtproxy.jami.net:[80-95]"}; 56 : std::string proxyListUrl {"https://config.jami.net/proxyList"}; 57 : 58 : std::string nameServer {}; 59 : std::string registeredName {}; 60 : 61 : bool allowPeersFromHistory {true}; 62 : bool allowPeersFromContact {true}; 63 : bool allowPeersFromTrusted {true}; 64 : bool allowPublicIncoming {true}; 65 : 66 : std::string managerUri {}; 67 : std::string managerUsername {}; 68 : 69 : std::string archivePath {"archive.gz"}; 70 : bool archiveHasPassword {true}; 71 : // not saved, only used client->daemon 72 : struct Credentials { 73 : std::string archive_password_scheme; 74 : std::string archive_password; 75 : std::string archive_pin; 76 : std::string archive_path; 77 : } credentials; 78 : 79 : std::string receipt {}; 80 : std::vector<uint8_t> receiptSignature {}; 81 : 82 : bool dhtPublicInCalls {true}; 83 : }; 84 : 85 : }