summary refs log tree commit diff
path: root/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'rtc')
-rw-r--r--rtc/.gitignore145
-rw-r--r--rtc/.npmignore1
-rw-r--r--rtc/.prettierrc5
-rw-r--r--rtc/CMakeLists.txt16
-rw-r--r--rtc/README.md18
-rw-r--r--rtc/config.json1
-rw-r--r--rtc/src/main.cpp47
-rw-r--r--rtc/src/mongoStub.cpp84
-rw-r--r--rtc/src/mongoStub.hpp41
-rw-r--r--rtc/src/rtcPeerHandler.cpp83
-rw-r--r--rtc/src/rtcPeerHandler.hpp32
-rw-r--r--rtc/src/rtcServer.hpp0
12 files changed, 0 insertions, 473 deletions
diff --git a/rtc/.gitignore b/rtc/.gitignore
deleted file mode 100644
index f14b4548..00000000
--- a/rtc/.gitignore
+++ /dev/null
@@ -1,145 +0,0 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-lerna-debug.log*
-
-# Diagnostic reports (https://nodejs.org/api/report.html)
-report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
-
-# Runtime data
-pids
-*.pid
-*.seed
-*.pid.lock
-
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
-*.lcov
-
-# nyc test coverage
-.nyc_output
-
-# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
-# Bower dependency directory (https://bower.io/)
-bower_components
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (https://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directories
-node_modules/
-jspm_packages/
-
-# TypeScript v1 declaration files
-typings/
-
-# TypeScript cache
-*.tsbuildinfo
-
-# Optional npm cache directory
-.npm
-
-# Optional eslint cache
-.eslintcache
-
-# Microbundle cache
-.rpt2_cache/
-.rts2_cache_cjs/
-.rts2_cache_es/
-.rts2_cache_umd/
-
-# Optional REPL history
-.node_repl_history
-
-# Output of 'npm pack'
-*.tgz
-
-# Yarn Integrity file
-.yarn-integrity
-
-# dotenv environment variables file
-.env
-.env.test
-
-# parcel-bundler cache (https://parceljs.org/)
-.cache
-
-# Next.js build output
-.next
-
-# Nuxt.js build / generate output
-.nuxt
-
-# Gatsby files
-.cache/
-# Comment in the public line in if your project uses Gatsby and *not* Next.js
-# https://nextjs.org/blog/next-9-1#public-directory-support
-# public
-
-# vuepress build output
-.vuepress/dist
-
-# Serverless directories
-.serverless/
-
-# FuseBox cache
-.fusebox/
-
-# DynamoDB Local files
-.dynamodb/
-
-# TernJS port file
-.tern-port
-.DS_Store
-
-# Compiled TypeScript code
-dist/
-# Prerequisites
-*.d
-
-# Compiled Object files
-*.slo
-*.lo
-*.o
-*.obj
-
-# Precompiled Headers
-*.gch
-*.pch
-
-# Compiled Dynamic libraries
-*.so
-*.dylib
-*.dll
-
-# Fortran module files
-*.mod
-*.smod
-
-# Compiled Static libraries
-*.lai
-*.la
-*.a
-*.lib
-
-# Executables
-*.o
-
-# Protobuffer builds
-*.pb.cc
-*.pb.h
-
-# Directories
-build/
-.vscode/
diff --git a/rtc/.npmignore b/rtc/.npmignore
deleted file mode 100644
index 05a9d0cf..00000000
--- a/rtc/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-!dist/
\ No newline at end of file
diff --git a/rtc/.prettierrc b/rtc/.prettierrc
deleted file mode 100644
index d569c548..00000000
--- a/rtc/.prettierrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-	"tabWidth": 4,
-	"useTabs": true,
-	"printWidth": 120
-}
diff --git a/rtc/CMakeLists.txt b/rtc/CMakeLists.txt
deleted file mode 100644
index 2cf5c0a6..00000000
--- a/rtc/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-cmake_minimum_required(VERSION 3.2)
-project(fosscord-media)
-
-set(CMAKE_CXX_STANDARD 17)
-
-find_package(Threads REQUIRED)
-
-find_package(mongocxx REQUIRED)
-find_package(Boost REQUIRED)
-
-
-file(GLOB SourceFiles ${PROJECT_SOURCE_DIR}/src/*.cpp)
-#include_directories("bsoncxx/v_noabi/bsoncxx/")
-add_executable(${CMAKE_PROJECT_NAME} ${SourceFiles})
-
-target_link_libraries(${CMAKE_PROJECT_NAME} datachannel mongo::mongocxx_shared Boost::boost)
\ No newline at end of file
diff --git a/rtc/README.md b/rtc/README.md
deleted file mode 100644
index ee452adf..00000000
--- a/rtc/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Fosscord-media
-
-A Fosscord media (voice and video) server
-
-## Installation
-
-### Prerequisites
-
--   Install the [libdatachannel](https://github.com/paullouisageneau/libdatachannel) library
--   Install the [libmongocxx](http://mongocxx.org/mongocxx-v3/installation/) driver and its requirements
-
-### Building
-
-```bash
-$ cmake
-$ cd build
-$ make
-```
diff --git a/rtc/config.json b/rtc/config.json
deleted file mode 100644
index 0967ef42..00000000
--- a/rtc/config.json
+++ /dev/null
@@ -1 +0,0 @@
-{}
diff --git a/rtc/src/main.cpp b/rtc/src/main.cpp
deleted file mode 100644
index 372eaa00..00000000
--- a/rtc/src/main.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//   $$$$$$\                                                                   $$\                           
-//  $$  __$$\                                                                  $$ |
-//  $$ /  \__|$$$$$$\   $$$$$$$\  $$$$$$$\  $$$$$$$\  $$$$$$\   $$$$$$\   $$$$$$$ |
-//  $$$$\    $$  __$$\ $$  _____|$$  _____|$$  _____|$$  __$$\ $$  __$$\ $$  __$$ |
-//  $$  _|   $$ /  $$ |\$$$$$$\  \$$$$$$\  $$ /      $$ /  $$ |$$ |  \__|$$ /  $$ |
-//  $$ |     $$ |  $$ | \____$$\  \____$$\ $$ |      $$ |  $$ |$$ |      $$ |  $$ |
-//  $$ |     \$$$$$$  |$$$$$$$  |$$$$$$$  |\$$$$$$$\ \$$$$$$  |$$ |      \$$$$$$$ |
-//  \__|      \______/ \_______/ \_______/  \_______| \______/ \__|       \_______|
-//
-//
-//
-//                       $$\                      $$$$$$\                                                    
-//                       \__|                    $$  __$$\                                                   
-//  $$\    $$\  $$$$$$\  $$\  $$$$$$$\  $$$$$$\  $$ /  \__| $$$$$$\   $$$$$$\ $$\    $$\  $$$$$$\   $$$$$$\  
-//  \$$\  $$  |$$  __$$\ $$ |$$  _____|$$  __$$\ \$$$$$$\  $$  __$$\ $$  __$$\\$$\  $$  |$$  __$$\ $$  __$$\ 
-//   \$$\$$  / $$ /  $$ |$$ |$$ /      $$$$$$$$ | \____$$\ $$$$$$$$ |$$ |  \__|\$$\$$  / $$$$$$$$ |$$ |  \__|
-//    \$$$  /  $$ |  $$ |$$ |$$ |      $$   ____|$$\   $$ |$$   ____|$$ |       \$$$  /  $$   ____|$$ |
-//     \$  /   \$$$$$$  |$$ |\$$$$$$$\ \$$$$$$$\ \$$$$$$  |\$$$$$$$\ $$ |        \$  /   \$$$$$$$\ $$ |
-//      \_/     \______/ \__| \_______| \_______| \______/  \_______|\__|         \_/     \_______|\__|
-//
-//
-//
-
-#include "rtcPeerHandler.hpp" //Handle peer connection requests
-#include "mongoStub.hpp"	//Handle communication with the MongoDB server
-
-int main(int argc, char **argv){
-
-	auto commsHandler = std::make_shared<rtcPeerHandler>();
-	auto mongoHandler = std::make_unique<mongoStub>();
-
-	mongocxx::options::change_stream options;
-	//voiceEvents collection watcher
-    mongocxx::change_stream colCs = mongoHandler->getCol().watch(options);
-
-	std::cout << "Server created and listening for events" << std::endl;
-
-	//Check for new messages in the collection
-	for (;;){
-		std::vector<mongoStub::mongoMessage> t = mongoHandler->getNewMessages(&colCs);
-		for(auto &i : t){
-			std::cout << "[" << i.eventName << "] " << std::endl;
-		}
-	}
-
-	return 0;
-}
\ No newline at end of file
diff --git a/rtc/src/mongoStub.cpp b/rtc/src/mongoStub.cpp
deleted file mode 100644
index ccd2abda..00000000
--- a/rtc/src/mongoStub.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "mongoStub.hpp"
-
-mongoStub::mongoStub() {
-    if (this->client) {
-        this->db = client["fosscord"];
-
-        if (this->db) {
-            this->col = db["events"];
-
-        } else {
-            std::cout << "db not found";
-            exit(-1);
-        }
-    } else {
-        std::cout << "Client couldn't be initialized";
-        exit(-1);
-    }
-}
-
-// Too slow for my liking
-std::vector<mongoStub::mongoMessage> mongoStub::getNewMessages(
-    mongocxx::change_stream* colCs) {
-    std::vector<mongoStub::mongoMessage> retVec;
-
-    for (auto&& event : *colCs) {
-        mongoStub::mongoMessage returnValue;
-
-        std::cout << bsoncxx::to_json(event) << std::endl;
-
-        // Only listen to insert events (to avoid "precondition failed: data"
-        // exception)
-        if (event["operationType"].get_utf8().value.to_string() != "insert") {
-            continue;
-        }
-
-        std::string evName = event["fullDocument"]["event"].get_utf8().value.to_string();
-
-		if(evName.substr(0, 7)=="VSERVER"){ continue; } //Ignore the event if it's been emited by a voice server
-
-        if (evName == "UDP_CONNECTION") {
-            handleUdpRequest(
-				event["fullDocument"]["data"]["d"]["address"].get_utf8().value.to_string(),
-				event["fullDocument"]["data"]["d"]["port"].get_int32().value,
-				event["fullDocument"]["data"]["d"]["mode"].get_utf8().value.to_string()
-				);
-
-        } else if (evName == "VOICE_REQUEST") {
-			//TODO
-            continue;
-        }
-
-        returnValue.eventName = evName;
-        retVec.push_back(returnValue);
-    }
-
-    return retVec;
-}
-
-
-void mongoStub::handleUdpRequest(std::string address, int port, std::string mode) {
-    using bsoncxx::builder::basic::kvp;
-    using bsoncxx::builder::basic::sub_array;
-    using bsoncxx::builder::basic::sub_document;
-
-    auto builder = bsoncxx::builder::basic::document{};
-
-	//Handle UDP socket stuff (later tho)
-	
-    builder.append(kvp("event", "VSERVER_UDP_RESPONSE"));
-    builder.append(kvp("op", "4"));
-    builder.append(kvp("d", [](sub_document subdoc) {
-		subdoc.append(kvp("mode", "CRYPT_MODE")),
-		subdoc.append(kvp("secret_key", [](sub_array subarr) {
-            subarr.append(1, 2, 3, 5);  // HOW DO I GEN A SKEY?
-        }));
-	}));
-	
-	
-	bsoncxx::stdx::optional<mongocxx::result::insert_one> r= col.insert_one(builder.view());
-}
-
-void mongoStub::handleVoiceRequest() {
-	//Is this really needed? idk
-}
\ No newline at end of file
diff --git a/rtc/src/mongoStub.hpp b/rtc/src/mongoStub.hpp
deleted file mode 100644
index 2809142f..00000000
--- a/rtc/src/mongoStub.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef MONGOSTUB_HPP
-#define MONGOSTUB_HPP
-
-#include <boost/utility.hpp>
-#include <cstdint>
-#include <iostream>
-#include <vector>
-#include <mongocxx/client.hpp>
-#include <mongocxx/instance.hpp>
-#include <mongocxx/change_stream.hpp>
-#include <bsoncxx/json.hpp>
-#include <bsoncxx/document/element.hpp>
-
-
-class mongoStub{
-	public:
-		mongoStub();
-
-		struct mongoMessage{
-			std::string eventName;
-			std::vector<std::string> data;
-		};
-
-		std::vector<mongoMessage> getNewMessages(mongocxx::change_stream* colCs);
-
-		mongocxx::collection getCol() const { return col; }
-
-		
-		
-	private:
-		mongocxx::instance instance;
-		mongocxx::client client{mongocxx::uri{}};
-		mongocxx::database db;
-		mongocxx::collection col;
-		mongocxx::change_stream* colCs = nullptr;
-
-		void handleUdpRequest(std::string address, int port, std::string mode);
-		void handleVoiceRequest();
-};
-
-#endif
diff --git a/rtc/src/rtcPeerHandler.cpp b/rtc/src/rtcPeerHandler.cpp
deleted file mode 100644
index 9bfc6466..00000000
--- a/rtc/src/rtcPeerHandler.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "rtcPeerHandler.hpp"
-
-rtcPeerHandler::rtcPeerHandler() {
-    rtc::InitLogger(rtc::LogLevel::Verbose, NULL);
-}
-
-void rtcPeerHandler::initiateConnection(std::string peerIP, int peerPort) {
-    // Socket connection between client and server
-    SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
-    sockaddr_in addr;
-    addr.sin_addr.s_addr = inet_addr(peerIP.c_str());
-    addr.sin_port = htons(peerPort);
-    addr.sin_family = AF_INET;
-
-    rtc::Configuration conf;
-    conf.enableIceTcp = false;
-    conf.disableAutoNegotiation = false;
-
-    auto pc = std::make_shared<rtc::PeerConnection>(conf);
-
-    rtc::Description::Audio media("audio",
-                                  rtc::Description::Direction::SendRecv);
-    media.addOpusCodec(96);
-    media.setBitrate(64);
-
-    auto track = pc->addTrack(media);
-
-    // auto session = std::make_shared<rtc::MediaHandler>();
-
-    // track->setMediaHandler(session);
-
-    rtc::Reliability rtcRel;
-    rtcRel.unordered = true;
-    rtcRel.type = rtc::Reliability::Type::Timed;
-    rtcRel.rexmit = 500;
-
-    rtc::DataChannelInit rtcConf;
-    rtcConf.reliability = rtcRel;
-    rtcConf.negotiated = false;
-
-    pc->onStateChange([](rtc::PeerConnection::State state) {
-        std::cout << "State: " << state << std::endl;
-        if (state == rtc::PeerConnection::State::Disconnected ||
-            state == rtc::PeerConnection::State::Failed ||
-            state == rtc::PeerConnection::State::Closed) {
-            // remove disconnected client
-        }
-    });
-
-    pc->onGatheringStateChange([](rtc::PeerConnection::GatheringState state) {
-        std::cout << "Gathering State: " << state << std::endl;
-    });
-
-    /*std::tuple<rtc::Track*, rtc::RtcpSrReporter*> addAudio(
-		
-        const std::shared_ptr<rtc::PeerConnection> pc,
-        const uint8_t payloadType, const uint32_t ssrc, const std::string cname,
-        const std::string msid, const std::function<void(void)> onOpen) {
-        auto audio = Description::Audio(cname);
-        audio.addOpusCodec(payloadType);
-        audio.addSSRC(ssrc, cname, msid, cname);
-        auto track = pc->addTrack(audio);
-        // create RTP configuration
-        auto rtpConfig = make_shared<RtpPacketizationConfig>(
-            ssrc, cname, payloadType, OpusRtpPacketizer::defaultClockRate);
-        // create packetizer
-        auto packetizer = make_shared<OpusRtpPacketizer>(rtpConfig);
-        // create opus handler
-        auto opusHandler = make_shared<OpusPacketizationHandler>(packetizer);
-
-        // add RTCP SR handler
-        auto srReporter = make_shared<RtcpSrReporter>(rtpConfig);
-        opusHandler->addToChain(srReporter);
-
-        // set handler
-        track->setMediaHandler(opusHandler);
-        track->onOpen(onOpen);
-        auto trackData = make_shared<ClientTrackData>(track, srReporter);
-        return trackData;
-    }*/
-
-    pc->createDataChannel("Fosscord voice connection", rtcConf);
-}
diff --git a/rtc/src/rtcPeerHandler.hpp b/rtc/src/rtcPeerHandler.hpp
deleted file mode 100644
index 3ba32a83..00000000
--- a/rtc/src/rtcPeerHandler.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "libdatachannel/rtc.hpp"
-#include <iostream>
-#include <memory>
-#include "nlohmann/json.hpp"
-#include <array>
-
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <arpa/inet.h>
-typedef int SOCKET;
-#endif
-
-using json = nlohmann::json;
-
-#ifndef RTCPEERHANDLER
-#define RTCPEERHANDLER
-class rtcPeerHandler{
-public:
-	rtcPeerHandler();
-	void initiateConnection(std::string peerIP, int peerPort);
-
-	struct client
-	{
-		std::shared_ptr<rtc::PeerConnection> pc;
-		std::shared_ptr<rtc::DataChannel> dc;
-	};
-
-private:
-	std::map<SOCKET, client> clients;
-};
-#endif
\ No newline at end of file
diff --git a/rtc/src/rtcServer.hpp b/rtc/src/rtcServer.hpp
deleted file mode 100644
index e69de29b..00000000
--- a/rtc/src/rtcServer.hpp
+++ /dev/null