mirror of
https://github.com/outbackdingo/parodus.git
synced 2026-01-28 02:20:02 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e66c984146 | ||
|
|
fb24b899f7 | ||
|
|
e04c5a106a | ||
|
|
34cacec824 | ||
|
|
96403b76b6 | ||
|
|
eb481cdd4b | ||
|
|
3077125fa9 | ||
|
|
193706c21c |
1
.github/workflows/push.yml
vendored
1
.github/workflows/push.yml
vendored
@@ -16,7 +16,6 @@ on:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -10,7 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- Fix Parodus connection stuck on interface up down received together
|
||||
- Update to use nopoll version 1.0.3
|
||||
|
||||
## [1.1.4]
|
||||
## [v1.1.5]
|
||||
- Add additional HTTP headers for call to Themis from Convey
|
||||
- Change default branch name to `main`
|
||||
|
||||
## [v1.1.4]
|
||||
- on connect retry, requery jwt only if it failed before
|
||||
- put two timestamps in connection health file; start conn and current
|
||||
- change health file update interval to 240sec
|
||||
@@ -105,8 +109,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
### Added
|
||||
- Initial creation
|
||||
|
||||
[Unreleased]: https://github.com/Comcast/parodus/compare/1.1.4...HEAD
|
||||
[1.1.4]: https://github.com/Comcast/parodus/compare/1.1.3...1.1.4
|
||||
[Unreleased]: https://github.com/Comcast/parodus/compare/v1.1.5...HEAD
|
||||
[1.1.5]: https://github.com/Comcast/parodus/compare/v1.1.4...v1.1.5
|
||||
[1.1.4]: https://github.com/Comcast/parodus/compare/1.1.3...v1.1.4
|
||||
[1.1.3]: https://github.com/Comcast/parodus/compare/1.1.2...1.1.3
|
||||
[1.1.2]: https://github.com/Comcast/parodus/compare/1.1.1...1.1.2
|
||||
[1.1.1]: https://github.com/Comcast/parodus/compare/1.0.4...1.1.1
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
#project(parodus VERSION 1.1.15)
|
||||
#project(parodus VERSION 1.1.5)
|
||||
project(parodus)
|
||||
|
||||
include(ExternalProject)
|
||||
@@ -226,6 +226,42 @@ ExternalProject_Add(cjwt
|
||||
add_library(libcjwt STATIC SHARED IMPORTED)
|
||||
add_dependencies(libcjwt cjwt)
|
||||
|
||||
# libmsh3 external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
ExternalProject_Add(msh3
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/msh3
|
||||
GIT_REPOSITORY https://github.com/nibanks/msh3.git
|
||||
GIT_TAG "v0.6.0"
|
||||
GIT_SUBMODULES_RECURSE true
|
||||
CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -G "Unix Makefiles" -DBUILD_TESTING=OFF
|
||||
)
|
||||
add_library(libmsh3 STATIC SHARED IMPORTED)
|
||||
add_dependencies(libmsh3 msh3)
|
||||
|
||||
|
||||
# libmsquic external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
# ExternalProject_Add(msquic
|
||||
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/msquic
|
||||
# GIT_REPOSITORY https://github.com/microsoft/msquic.git
|
||||
# GIT_TAG "v2.1.8"
|
||||
# CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
|
||||
# )
|
||||
# add_library(libmsquic STATIC SHARED IMPORTED)
|
||||
# add_dependencies(libmsquic msquic)
|
||||
|
||||
# # libnghttp3 external dependency
|
||||
# #-------------------------------------------------------------------------------
|
||||
# ExternalProject_Add(nghttp3
|
||||
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/nghttp3
|
||||
|
||||
# GIT_REPOSITORY https://github.com/ngtcp2/nghttp3.git
|
||||
# GIT_TAG "v0.10.0"
|
||||
# CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
|
||||
# )
|
||||
# add_library(libnghttp3 STATIC SHARED IMPORTED)
|
||||
# add_dependencies(libnghttp3 nghttp3)
|
||||
|
||||
if (FEATURE_DNS_QUERY)
|
||||
# libucresolv external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
# build stage
|
||||
FROM alpine:3.12
|
||||
|
||||
RUN \
|
||||
apk add --no-cache bsd-compat-headers linux-headers cmake autoconf make musl-dev gcc g++ openssl openssl-dev git cunit cunit-dev automake libtool util-linux-dev && \
|
||||
mkdir -p build
|
||||
|
||||
|
||||
COPY src src
|
||||
COPY patches patches
|
||||
COPY tests tests
|
||||
COPY CMakeLists.txt .
|
||||
COPY run.sh .
|
||||
|
||||
|
||||
RUN cd build && \
|
||||
cmake .. && make
|
||||
|
||||
CMD ["build/src/parodus"]
|
||||
78
run.sh
Executable file
78
run.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
parodus_port=16014d
|
||||
|
||||
if [[ -z "${URL}" ]]; then
|
||||
URL="http://petasos:6400"
|
||||
fi
|
||||
|
||||
if [[ -z "${FIRMWARE}" ]]; then
|
||||
FIRMWARE="mock-rdkb-firmware"
|
||||
fi
|
||||
|
||||
if [[ -z "${BOOT_TIME}" ]]; then
|
||||
BOOT_TIME=$(date +%s)
|
||||
fi
|
||||
|
||||
if [[ -z "${HW_MANUFACTURER}" ]]; then
|
||||
HW_MANUFACTURER="Example Inc."
|
||||
fi
|
||||
|
||||
if [[ -z "${REBOOT_REASON}" ]]; then
|
||||
REBOOT_REASON="unknown"
|
||||
fi
|
||||
|
||||
if [[ -z "${SERIAL_NUMBER}" ]]; then
|
||||
SERIAL_NUMBER="mock-rdkb-simulator"
|
||||
fi
|
||||
|
||||
if [[ -z "${PARTNER_ID}" ]]; then
|
||||
PARTNER_ID="comcast"
|
||||
fi
|
||||
|
||||
if [[ -z "${CMAC}" ]]; then
|
||||
CMAC="112233445566"
|
||||
fi
|
||||
|
||||
if [[ -z "${TOKEN_SERVER_URL}" ]]; then
|
||||
TOKEN_SERVER_URL="http://themis:6501/issue"
|
||||
fi
|
||||
|
||||
if [[ -z "${SSL_CERT_PATH}" ]]; then
|
||||
SSL_CERT_PATH="/etc/ssl/certs/ca-certificates.crt"
|
||||
fi
|
||||
|
||||
#In this docker-compose cluster, themis has mtls disabled so
|
||||
#feel free to ignore the --client-cert-path flag value
|
||||
#it is required by parodus to fetch a token
|
||||
if [[ -z "${CLIENT_CERT_PATH}" ]]; then
|
||||
CLIENT_CERT_PATH="/etc/ssl/certs/ca-certificates.crt"
|
||||
fi
|
||||
|
||||
# MTLS_CLIENT_* is used to authenticate with talaria.
|
||||
if [[ -z "${MTLS_CLIENT_CERT_PATH}" ]]; then
|
||||
MTLS_CLIENT_CERT_PATH=""
|
||||
fi
|
||||
|
||||
if [[ -z "${MTLS_CLIENT_KEY_PATH}" ]]; then
|
||||
MTLS_CLIENT_KEY_PATH=""
|
||||
fi
|
||||
|
||||
build/src/parodus --hw-model=aker-testing \
|
||||
--ssl-cert-path=$SSL_CERT_PATH \
|
||||
--client-cert-path=$CLIENT_CERT_PATH \
|
||||
--mtls-client-cert-path=$MTLS_CLIENT_CERT_PATH \
|
||||
--mtls-client-key-path=$MTLS_CLIENT_KEY_PATH \
|
||||
--hw-serial-number=$SERIAL_NUMBER \
|
||||
--hw-manufacturer=$HW_MANUFACTURER \
|
||||
--hw-mac=$CMAC \
|
||||
--hw-last-reboot-reason=$REBOOT_REASON \
|
||||
--fw-name=$FIRMWARE \
|
||||
--boot-time=$BOOT_TIME \
|
||||
--partner-id=$PARTNER_ID \
|
||||
--parodus-local-url=tcp://127.0.0.1:$parodus_port \
|
||||
--webpa-ping-timeout=60 \
|
||||
--token-server-url=$TOKEN_SERVER_URL \
|
||||
--webpa-backoff-max=2 \
|
||||
--webpa-interface-used=eth0 \
|
||||
--webpa-url=$URL \
|
||||
--force-ipv4
|
||||
138
src/connection_http3.cpp
Normal file
138
src/connection_http3.cpp
Normal file
@@ -0,0 +1,138 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT License.
|
||||
|
||||
--*/
|
||||
|
||||
#include "msh3.hpp"
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
|
||||
using namespace std;
|
||||
|
||||
char * host = "nginx";
|
||||
//char * path = "/api/v2/devices"
|
||||
char * path = "/"
|
||||
|
||||
struct Arguments {
|
||||
const char* Host { host };
|
||||
MsH3Addr Address {443};
|
||||
vector<const char*> Paths {path};
|
||||
bool Unsecure { true };
|
||||
bool Print { true };
|
||||
uint32_t Count { 1 };
|
||||
} Args;
|
||||
|
||||
void MSH3_CALL HeaderReceived(struct MsH3Request* , const MSH3_HEADER* Header) {
|
||||
if (Args.Print) {
|
||||
fwrite(Header->Name, 1, Header->NameLength, stdout);
|
||||
printf(":");
|
||||
fwrite(Header->Value, 1, Header->ValueLength, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
bool MSH3_CALL DataReceived(struct MsH3Request* , uint32_t* Length, const uint8_t* Data) {
|
||||
if (Args.Print) fwrite(Data, 1, *Length, stdout);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MSH3_CALL Complete(struct MsH3Request* Request, bool Aborted, uint64_t AbortError) {
|
||||
const uint32_t Index = (uint32_t)(size_t)Request->AppContext;
|
||||
if (Args.Print) printf("\n");
|
||||
if (Aborted) printf("Request %u aborted: 0x%llx\n", Index, (long long unsigned)AbortError);
|
||||
else printf("Request %u complete\n", Index);
|
||||
}
|
||||
|
||||
void ParseArgs(int argc, char **argv) {
|
||||
if (argc < 2 || !strcmp(argv[1], "-?") || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
|
||||
printf("usage: %s <server[:port]> [options...]\n"
|
||||
" -c, --count <num> The number of times to query each path (def=1)\n"
|
||||
" -h, --help Prints this help text\n"
|
||||
" -p, --path <path(s)> The paths to query\n"
|
||||
" -u, --unsecure Allows unsecure connections\n"
|
||||
" -v, --verbose Enables verbose output\n"
|
||||
" -V, --version Prints out the version\n",
|
||||
argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Parse the server[:port] argument.
|
||||
Args.Host = argv[1];
|
||||
char *port = strrchr(argv[1], ':');
|
||||
if (port) {
|
||||
*port = 0; port++;
|
||||
Args.Address.SetPort((uint16_t)atoi(port));
|
||||
}
|
||||
|
||||
// Parse options.
|
||||
for (int i = 2; i < argc; ++i) {
|
||||
if (!strcmp(argv[i], "--count") || !strcmp(argv[i], "-c")) {
|
||||
if (++i >= argc) { printf("Missing count value\n"); exit(-1); }
|
||||
Args.Count = (uint32_t)atoi(argv[i]);
|
||||
|
||||
} else if (!strcmp(argv[i], "--path") || !strcmp(argv[i], "-p")) {
|
||||
if (++i >= argc) { printf("Missing path value(s)\n"); exit(-1); }
|
||||
|
||||
char* Path = (char*)argv[i];
|
||||
do {
|
||||
char* End = strchr(Path, ',');
|
||||
if (End) *End = 0;
|
||||
Args.Paths.push_back(Path);
|
||||
if (!End) break;
|
||||
Path = End + 1;
|
||||
} while (true);
|
||||
|
||||
} else if (!strcmp(argv[i], "--unsecure") || !strcmp(argv[i], "-u")) {
|
||||
Args.Unsecure = true;
|
||||
|
||||
} else if (!strcmp(argv[i], "--verbose") || !strcmp(argv[i], "-v")) {
|
||||
Args.Print = true;
|
||||
|
||||
} else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-V")) {
|
||||
uint32_t Version[4]; MsH3Version(Version);
|
||||
printf("Using msh3 v%u.%u.%u.%u\n", Version[0], Version[1], Version[2], Version[3]);
|
||||
}
|
||||
}
|
||||
|
||||
if (Args.Paths.empty()) {
|
||||
Args.Paths.push_back("/");
|
||||
}
|
||||
}
|
||||
|
||||
int MSH3_CALL init(int argc, char **argv) {
|
||||
ParseArgs(argc, argv);
|
||||
|
||||
MSH3_HEADER Headers[] = {
|
||||
{ ":method", 7, "GET", 3 },
|
||||
{ ":path", 5, Args.Paths[0], strlen(Args.Paths[0]) },
|
||||
{ ":scheme", 7, "https", 5 },
|
||||
{ ":authority", 10, Args.Host, strlen(Args.Host) },
|
||||
{ "user-agent", 10, "curl/7.82.0-DEV", 15 },
|
||||
{ "accept", 6, "*/*", 3 },
|
||||
};
|
||||
const size_t HeadersCount = sizeof(Headers)/sizeof(MSH3_HEADER);
|
||||
|
||||
MsH3Api Api;
|
||||
if (Api.IsValid()) {
|
||||
MsH3Connection Connection(Api, Args.Host, Args.Address, Args.Unsecure);
|
||||
if (Connection.IsValid()) {
|
||||
for (auto Path : Args.Paths) {
|
||||
printf("HTTP/3 GET https://%s%s\n", Args.Host, Path);
|
||||
Headers[1].Value = Path;
|
||||
Headers[1].ValueLength = strlen(Path);
|
||||
for (uint32_t i = 0; i < Args.Count; ++i) {
|
||||
auto Request = new (std::nothrow) MsH3Request(Connection, Headers, HeadersCount, MSH3_REQUEST_FLAG_FIN, (void*)(size_t)(i+1), HeaderReceived, DataReceived, Complete, CleanUpAutoDelete);
|
||||
if (!Request || !Request->IsValid()) {
|
||||
printf("Request %u failed to start\n", i+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Connection.ShutdownComplete.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -111,6 +111,7 @@ int main( int argc, char **argv)
|
||||
ParodusCfg *cfg;
|
||||
|
||||
ParodusInfo ("RAND_MAX is %ld (0x%lx)\n", RAND_MAX, RAND_MAX);
|
||||
ParodusInfo("TEST PRINT");
|
||||
srandom (getpid());
|
||||
|
||||
/* TODO not ideal, but it fixes a more major problem for now. */
|
||||
|
||||
Reference in New Issue
Block a user