Amna | 3876830 | 2023-08-21 11:51:56 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2023 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 | #include <opendht/crypto.h> |
Adrien Béraud | 6c6a962 | 2023-08-27 12:49:31 -0400 | [diff] [blame] | 18 | #include "connectionmanager.h" |
| 19 | #include "multiplexed_socket.h" |
| 20 | #include "ice_transport_factory.h" |
| 21 | #include "certstore.h" |
Amna | 3876830 | 2023-08-21 11:51:56 -0400 | [diff] [blame] | 22 | |
| 23 | namespace dhtnet { |
| 24 | |
| 25 | using Buffer = std::shared_ptr<std::vector<uint8_t>>; |
| 26 | |
| 27 | /** |
| 28 | * Attempt to retrieve the identity from the .ssh directory, and if none is found, generate a new |
| 29 | * certification. |
| 30 | * @return dht::crypto::Identity |
| 31 | */ |
Adrien Béraud | ecde63f | 2023-08-26 18:11:21 -0400 | [diff] [blame] | 32 | dht::crypto::Identity loadIdentity(const std::filesystem::path& path); |
Amna | 3876830 | 2023-08-21 11:51:56 -0400 | [diff] [blame] | 33 | // add certstore to the config |
Adrien Béraud | ecde63f | 2023-08-26 18:11:21 -0400 | [diff] [blame] | 34 | std::unique_ptr<ConnectionManager::Config> connectionManagerConfig(const std::filesystem::path& path, |
| 35 | dht::crypto::Identity identity, |
| 36 | const std::string& bootstrap, |
Amna | 3876830 | 2023-08-21 11:51:56 -0400 | [diff] [blame] | 37 | std::shared_ptr<Logger> logger, |
| 38 | tls::CertificateStore& certStore, |
| 39 | std::shared_ptr<asio::io_context> ioContext, |
| 40 | IceTransportFactory& iceFactory); |
| 41 | // add ioContext to readFromStdin |
| 42 | |
| 43 | template <typename T> |
| 44 | void readFromPipe(std::shared_ptr<ChannelSocket> socket, T input, Buffer buffer); |
| 45 | |
| 46 | } // namespace dhtnet |