Compare commits

..

9 Commits

7 changed files with 62 additions and 22 deletions

View File

@ -7,7 +7,7 @@ on:
branches:
- master
jobs:
build:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -18,7 +18,23 @@ jobs:
- name: cmake
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=1
- name: make
run: (cd build; make)
run: (cd build; make -j2)
- name: test
run: ./build/tests
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: install packages
run: brew install gnutls nettle
- name: submodules
run: git submodule update --init --recursive
- name: cmake
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=1
env:
# hack to bypass EPERM issue on sendto()
CFLAGS: -DJUICE_ENABLE_ADDRS_LOCALHOST
- name: make
run: (cd build; make -j2)
- name: test
run: ./build/tests

View File

@ -7,7 +7,7 @@ on:
branches:
- master
jobs:
build:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -18,7 +18,7 @@ jobs:
- name: cmake
run: cmake -B build -DUSE_JUICE=0 -DUSE_GNUTLS=1
- name: make
run: (cd build; make)
run: (cd build; make -j2)
- name: test
run: ./build/tests

View File

@ -7,7 +7,7 @@ on:
branches:
- master
jobs:
build:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -18,7 +18,25 @@ jobs:
- name: cmake
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=0
- name: make
run: (cd build; make)
run: (cd build; make -j2)
- name: test
run: ./build/tests
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: install packages
run: brew reinstall openssl@1.1
- name: submodules
run: git submodule update --init --recursive
- name: cmake
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=0
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
OPENSSL_LIBRARIES: /usr/local/opt/openssl/lib
# hack to bypass EPERM issue on sendto()
CFLAGS: -DJUICE_ENABLE_ADDRS_LOCALHOST
- name: make
run: (cd build; make -j2)
- name: test
run: ./build/tests

View File

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.7)
project (libdatachannel
DESCRIPTION "WebRTC DataChannels Library"
VERSION 0.5.0
VERSION 0.5.1
LANGUAGES CXX)
option(USE_GNUTLS "Use GnuTLS instead of OpenSSL" OFF)

2
deps/libjuice vendored

View File

@ -60,12 +60,19 @@ bool Candidate::resolve(ResolveMode mode) {
if (mIsResolved)
return true;
PLOG_VERBOSE << "Resolving candidate (mode="
<< (mode == ResolveMode::Simple ? "simple" : "lookup")
<< "): " << mCandidate;
// See RFC 8445 for format
std::stringstream ss(mCandidate);
std::istringstream iss(mCandidate);
int component{0}, priority{0};
string foundation, transport, node, service, typ_, type;
if (ss >> foundation >> component >> transport >> priority &&
ss >> node >> service >> typ_ >> type && typ_ == "typ") {
if (iss >> foundation >> component >> transport >> priority &&
iss >> node >> service >> typ_ >> type && typ_ == "typ") {
string left;
std::getline(iss, left);
// Try to resolve the node
struct addrinfo hints = {};
@ -94,15 +101,13 @@ bool Candidate::resolve(ResolveMode mode) {
if (getnameinfo(p->ai_addr, p->ai_addrlen, nodebuffer, MAX_NUMERICNODE_LEN,
servbuffer, MAX_NUMERICSERV_LEN,
NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
string left;
std::getline(ss, left);
const char sp{' '};
ss.clear();
ss << foundation << sp << component << sp << transport << sp << priority;
ss << sp << nodebuffer << sp << servbuffer << sp << "typ" << sp << type;
if (!left.empty())
ss << left;
mCandidate = ss.str();
std::ostringstream oss;
oss << foundation << sp << component << sp << transport << sp << priority;
oss << sp << nodebuffer << sp << servbuffer << sp << "typ" << sp << type;
oss << left;
mCandidate = oss.str();
PLOG_VERBOSE << "Resolved candidate: " << mCandidate;
return mIsResolved = true;
}
}

View File

@ -254,7 +254,8 @@ certificate_ptr make_certificate_impl(string commonName) {
throw std::runtime_error("Unable to generate key pair");
const size_t serialSize = 16;
const auto *commonNameBytes = reinterpret_cast<const unsigned char *>(commonName.c_str());
auto *commonNameBytes =
reinterpret_cast<unsigned char *>(const_cast<char *>(commonName.c_str()));
if (!X509_gmtime_adj(X509_get_notBefore(x509.get()), 3600 * -1) ||
!X509_gmtime_adj(X509_get_notAfter(x509.get()), 3600 * 24 * 365) ||