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, or (at your option) 7 : * 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 772 : JamiAccountConfig(const std::string& id = {}, const std::filesystem::path& path = {}) 30 772 : : SipAccountBaseConfig(std::string(ACCOUNT_TYPE_JAMI), id, path) 31 : { 32 : // Default values specific to Jami accounts 33 772 : hostname = DHT_DEFAULT_BOOTSTRAP; 34 772 : turnServer = DEFAULT_TURN_SERVER; 35 772 : turnServerUserName = DEFAULT_TURN_USERNAME; 36 772 : turnServerPwd = DEFAULT_TURN_PWD; 37 772 : turnServerRealm = DEFAULT_TURN_REALM; 38 772 : turnEnabled = true; 39 772 : upnpEnabled = true; 40 772 : } 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 : std::string proxyServer {"dhtproxy.jami.net:[80-95]"}; 55 : std::string proxyListUrl {"https://config.jami.net/proxyList"}; 56 : 57 : std::string nameServer {}; 58 : std::string registeredName {}; 59 : 60 : bool allowPeersFromHistory {true}; 61 : bool allowPeersFromContact {true}; 62 : bool allowPeersFromTrusted {true}; 63 : bool allowPublicIncoming {true}; 64 : 65 : std::string managerUri {}; 66 : std::string managerUsername {}; 67 : 68 : std::string archivePath {"archive.gz"}; 69 : bool archiveHasPassword {true}; 70 : // not saved, only used client->daemon 71 : std::string archive_password_scheme; 72 : std::string archive_password; 73 : std::string archive_pin; 74 : std::string archive_path; 75 : 76 : std::string receipt {}; 77 : std::vector<uint8_t> receiptSignature {}; 78 : 79 : bool dhtPublicInCalls {true}; 80 : }; 81 : 82 : }