Skip to content

Commit

Permalink
Merge pull request #174 from Quicr/mv2moq
Browse files Browse the repository at this point in the history
Implement draft-ietf-moq-transport-04
  • Loading branch information
TimEvens committed Jun 29, 2024
2 parents 79599e5 + bed1bb5 commit d4229d8
Show file tree
Hide file tree
Showing 24 changed files with 9,301 additions and 136 deletions.
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ Language: Cpp
BasedOnStyle: Mozilla

BreakAfterAttributes: Leave
ColumnLimit: 120
IndentWidth: 4
NamespaceIndentation: All
BraceWrapping:
AfterFunction: false
...

101 changes: 17 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,46 @@
libquicr
========

[![CMake](https://github.com/Quicr/libquicr/actions/workflows/cmake.yml/badge.svg?branch=main)](https://github.com/Quicr/libquicr/actions/workflows/cmake.yml)
[![Build](https://github.com/Quicr/libquicr/actions/workflows/cmake.yml/badge.svg?branch=main)](https://github.com/Quicr/libquicr/actions/workflows/cmake.yml)

Implementation of transport layer api based on QuicR.
Please see for further details
[QuicR Protocol](https://www.ietf.org/id/draft-jennings-moq-quicr-proto-01.html)

The actual protocol implementation is covered [here](https://github.com/Quicr/quicrq).

Quickstart
----------
An API library that implements publish/subscribe protocol [draft-ietf-moq-transport-04](https://datatracker.ietf.org/doc/html/draft-ietf-moq-transport-04).
The API supports both client and server. Server is intended to be implemented as a relay.

### Build
Use `make` to build libquicr.

Use `make test` to run tests.

### Build without InfluxDB

To build without InfluxDB, run `cmake` with `-DLIBQUICR_WITHOUT_INFLUXDB=ON`

### Cmake FetchContent

All the dependecies are now fetched via cmake and below steps should
build libquicr.a

```
brew install openssl
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
git clone git@github.com:Quicr/libquicr.git
cd libquicr
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make all
```

### Build Docker Dev Image
If building docker image is the preferred option, please follow the below steps

The developer image contains ```picotls```, ```picoquic``` and ```quicrq```, which are required
for many other builds. The container works by running it with a volume mount ```/ws/src```
to the source to be compiled. The above libraries are in the ```/ws/``` directory, which is expected for builds.

While ```quicrq``` is included under ```/ws/quicrq```, the container can be used to develop and compile
it by mounting ```quicrq``` directory to ```/ws/src```.

The docker container has been tested to work for both ARM (M1/Apple Silicon) and x86.
Use `make cclean` to clean build files.

```
git clone git@github.com:Quicr/libquicr.git
cd libquicr
tar -c -C ../ ./quicrq ./libquicr \
| docker buildx build --progress=plain \
--output type=docker \
-f libquicr/build.Dockerfile -t quicr/libquicr:latest -
```

```
cd <libquicr directory>
rm -rf $(pwd)/build
docker run --rm \
-v $(pwd):/ws/src \
quicr/libquicr:latest make all
```

For now, it's best to run the binaries in interactive shell. The images have been built for linux. Run
the image in interactive mode to access the shell prompt. From there you can access the binaries.
```quicrq``` and others are located under ```/ws/```. For example, you can run ```/ws/quircq/quicrq_app``` binary.

```
docker run --rm -it \
-v $(pwd):/ws/src \
quicr/libquicr:latest bash
```
### Build without InfluxDB

Running Examples
--------------
To build without InfluxDB, run `cmake` with `-DLIBQUICR_WITHOUT_INFLUXDB=ON`

### Running Relays/Etc.
### Self-signed Certificate

In order to test QUIC, the server/```really``` needs to have a certificate. The program expects
the
Server requires a TLS certificate and key file. For development and testing, use a self-signed certificate. Below
are the steps to create a self-signed certificate and private ey.

Generate self-signed certificate for really server to test with.
#### OpenSSL/BorningSSL

```
cd build/cmd/really
cd build/cmd/moq-example
openssl req -nodes -x509 -newkey rsa:2048 -days 365 \
-subj "/C=US/ST=CA/L=San Jose/O=Cisco/CN=test.quicr.ctgpoc.com" \
-subj "/C=US/ST=CA/L=San Jose/O=Cisco/CN=test.m10x.org" \
-keyout server-key.pem -out server-cert.pem
```

#### MbedTLS cert
#### MbedTLS

```
openssl req -nodes -x509 -newkey ec:<(openssl ecparam -name secp256r1) -days 365 \
-subj "/C=US/ST=CA/L=San Jose/O=Cisco/CN=test.quicr.ctgpoc.com" \
-subj "/C=US/ST=CA/L=San Jose/O=Cisco/CN=test.m10x.org" \
-keyout server-key.pem -out server-cert.pem
```

Run:

```
cd build/cmd/really
./really

./reallyTest
### MOQ Implementation Documentation

See [MOQ Implementation](docs/moq-implementation.md)
2 changes: 1 addition & 1 deletion cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#add_subdirectory(qcurl)
add_subdirectory(really)

add_subdirectory(moq-example)
48 changes: 48 additions & 0 deletions cmd/moq-example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

add_executable(qserver
server.cpp
)
target_link_libraries(qserver PRIVATE quicr)

if(NOT LIBQUICR_WITHOUT_INFLUXDB)
target_link_libraries(qserver
PRIVATE InfluxData::InfluxDB)
endif()


target_compile_options(qserver
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<CXX_COMPILER_ID:MSVC>: >)

set_target_properties(qserver
PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS ON)

if(CLANG_TIDY_EXE)
set_target_properties(quicr PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
endif()


add_executable(qclient client.cpp)

target_link_libraries(qclient PRIVATE quicr)

if(NOT LIBQUICR_WITHOUT_INFLUXDB)
target_link_libraries(qclient
PRIVATE InfluxData::InfluxDB)
endif()

target_compile_options(qclient
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<CXX_COMPILER_ID:MSVC>: >)


set_target_properties(qclient
PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS OFF)
Loading

0 comments on commit d4229d8

Please sign in to comment.