blob: 1181ee0fe01e47fcf23bc178d2c29157ed3b3d94 [file] [log] [blame]
Amna38768302023-08-21 11:51:56 -04001/*
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>
18
19
20namespace dhtnet {
21
22using Buffer = std::shared_ptr<std::vector<uint8_t>>;
23
24/**
25 * Attempt to retrieve the identity from the .ssh directory, and if none is found, generate a new
26 * certification.
27 * @return dht::crypto::Identity
28 */
Adrien Béraudecde63f2023-08-26 18:11:21 -040029dht::crypto::Identity loadIdentity(const std::filesystem::path& path);
Amna38768302023-08-21 11:51:56 -040030// add certstore to the config
Adrien Béraudecde63f2023-08-26 18:11:21 -040031std::unique_ptr<ConnectionManager::Config> connectionManagerConfig(const std::filesystem::path& path,
32 dht::crypto::Identity identity,
33 const std::string& bootstrap,
Amna38768302023-08-21 11:51:56 -040034 std::shared_ptr<Logger> logger,
35 tls::CertificateStore& certStore,
36 std::shared_ptr<asio::io_context> ioContext,
37 IceTransportFactory& iceFactory);
38// add ioContext to readFromStdin
39
40template <typename T>
41void readFromPipe(std::shared_ptr<ChannelSocket> socket, T input, Buffer buffer);
42
43} // namespace dhtnet