blob: 09ab147a23b09977dd29741b60da4e66383df951 [file] [log] [blame]
Amna4a70f5c2023-09-14 17:32:05 -04001/*
2 * Copyright (C) 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 "connectionmanager.h"
18#include "multiplexed_socket.h"
19#include "ice_transport_factory.h"
20#include "certstore.h"
21
22#include <asio.hpp>
23
24namespace dhtnet {
25
26class Dsh
27{
28public:
29 // Build a server
30 Dsh(const std::filesystem::path& path,
31 dht::crypto::Identity identity,
32 const std::string& bootstrap);
33 // Build a client
34 Dsh(const std::filesystem::path& path,
35 dht::crypto::Identity identity,
36 const std::string& bootstrap,
37 dht::InfoHash peer_id,
38 const std::string& binary);
39 ~Dsh();
40 void run();
41
42private:
43 std::unique_ptr<ConnectionManager> connectionManager;
44 std::shared_ptr<Logger> logger;
45 std::shared_ptr<tls::CertificateStore> certStore {nullptr};
46 std::shared_ptr<dhtnet::IceTransportFactory> factory {nullptr};
47 std::shared_ptr<asio::io_context> ioContext;
48 std::thread ioContextRunner;
49};
50
51} // namespace dhtnet