use docker for testing
This commit is contained in:
parent
b446b6025d
commit
e8a6a0a400
8 changed files with 59 additions and 8 deletions
20
Dockerfile
20
Dockerfile
|
@ -1,14 +1,24 @@
|
||||||
FROM alpine:latest
|
FROM debian:latest
|
||||||
|
|
||||||
RUN apk add gcc g++ cmake ninja
|
# update repositories
|
||||||
RUN apk add mpg123-dev openssl-dev alsa-lib alsa-utils portaudio-dev pulseaudio-alsa alsa-plugins-pulse pulseaudio pulseaudio-utils
|
RUN apt-get update -y
|
||||||
|
RUN apt-get upgrade -y
|
||||||
|
|
||||||
RUN echo "pcm.!default pulse\nctl.!default pulse" > /root/.asoundrc
|
# install build dependencies
|
||||||
|
RUN apt-get install -y cmake gcc g++ ninja-build
|
||||||
|
# install application dependencies
|
||||||
|
RUN apt-get install -y libmpg123-dev libssl-dev portaudio19-dev
|
||||||
|
|
||||||
|
# enable sound
|
||||||
|
# RUN echo "pcm.!default pulse\nctl.!default pulse" > /root/.asoundrc
|
||||||
|
|
||||||
|
# copy the application
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
|
# build the application
|
||||||
RUN cmake -S . -B build -G Ninja
|
RUN cmake -S . -B build -G Ninja
|
||||||
RUN cmake --build build
|
RUN cmake --build build
|
||||||
|
|
||||||
CMD ["build/M2-PT-DRP"]
|
# run the application
|
||||||
|
CMD ["build/M2-PT-DRP", "--host", "::1", "--port", "15650", "--ipv6"]
|
||||||
|
|
37
docker-compose.yml
Normal file
37
docker-compose.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
services:
|
||||||
|
machine-1:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
network: host
|
||||||
|
networks:
|
||||||
|
- machines
|
||||||
|
|
||||||
|
machine-2:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
network: host
|
||||||
|
networks:
|
||||||
|
- machines
|
||||||
|
|
||||||
|
machine-3:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
network: host
|
||||||
|
networks:
|
||||||
|
- machines
|
||||||
|
|
||||||
|
machine-4:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
network: host
|
||||||
|
networks:
|
||||||
|
- machines
|
||||||
|
|
||||||
|
networks:
|
||||||
|
machines:
|
||||||
|
enable_ipv6: true
|
||||||
|
attachable: true
|
|
@ -1,6 +1,7 @@
|
||||||
#include "InfoEvent.hpp"
|
#include "InfoEvent.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <ranges>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include "packets/info/InfoPacketData.hpp"
|
#include "packets/info/InfoPacketData.hpp"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../base/BaseEvent.hpp"
|
#include "../base/BaseEvent.hpp"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace drp::event {
|
namespace drp::event {
|
||||||
|
|
|
@ -109,7 +109,7 @@ void ServerTask::handle(Context& context) {
|
||||||
packetContent.eventType = event::EventType::AUDIO;
|
packetContent.eventType = event::EventType::AUDIO;
|
||||||
packetContent.data = audioPacket.serialize();
|
packetContent.data = audioPacket.serialize();
|
||||||
|
|
||||||
packet.setContent(context, packet::base::SecurityMode::PLAIN, packetContent);
|
packet.setContent(context, packet::base::SecurityMode::AES, packetContent);
|
||||||
|
|
||||||
const auto serializedPacket = packet.serialize();
|
const auto serializedPacket = packet.serialize();
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace drp::packet::audio {
|
namespace drp::packet::audio {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace drp::packet::search {
|
namespace drp::packet::search {
|
||||||
|
|
|
@ -52,7 +52,7 @@ Type deserializeObject(std::vector<std::uint8_t>& data) {
|
||||||
* @param object the vector to serialize.
|
* @param object the vector to serialize.
|
||||||
* @return the vector data as a vector of bytes.
|
* @return the vector data as a vector of bytes.
|
||||||
*/
|
*/
|
||||||
template<typename Type, typename SizeType = std::uint32_t>
|
template<typename Type, typename SizeType = std::uint16_t>
|
||||||
std::vector<std::uint8_t> serializeVector(const std::vector<Type>& object) {
|
std::vector<std::uint8_t> serializeVector(const std::vector<Type>& object) {
|
||||||
// create a vector with enough size for the size and the data of the vector
|
// create a vector with enough size for the size and the data of the vector
|
||||||
std::vector<std::uint8_t> buffer(sizeof(SizeType) + object.size() * sizeof(Type));
|
std::vector<std::uint8_t> buffer(sizeof(SizeType) + object.size() * sizeof(Type));
|
||||||
|
@ -75,7 +75,7 @@ std::vector<std::uint8_t> serializeVector(const std::vector<Type>& object) {
|
||||||
* @param data the data in the vector
|
* @param data the data in the vector
|
||||||
* @return the vector of object
|
* @return the vector of object
|
||||||
*/
|
*/
|
||||||
template<typename Type, typename SizeType = std::uint32_t>
|
template<typename Type, typename SizeType = std::uint16_t>
|
||||||
std::vector<Type> deserializeVector(std::vector<std::uint8_t>& data) {
|
std::vector<Type> deserializeVector(std::vector<std::uint8_t>& data) {
|
||||||
// get the size of the vector
|
// get the size of the vector
|
||||||
SizeType size;
|
SizeType size;
|
||||||
|
|
Loading…
Reference in a new issue