pre-commit / fix simple file trailing things
This commit is contained in:
@ -37,7 +37,7 @@ if (NOT JSONCPP_FOUND)
|
||||
set(JSONCPP_SOURCES ../third_party/jsoncpp/jsoncpp.cpp)
|
||||
endif()
|
||||
|
||||
add_executable(ws
|
||||
add_executable(ws
|
||||
../third_party/msgpack11/msgpack11.cpp
|
||||
${STATSD_CLIENT_SOURCES}
|
||||
${JSONCPP_SOURCES}
|
||||
|
@ -7,7 +7,7 @@ generate_key() {
|
||||
local path=${1}
|
||||
local base=${2}
|
||||
local type=${3:-'rsa'} # "ec" or "rsa"
|
||||
|
||||
|
||||
mkdir -p ${path}
|
||||
if [[ "${type}" == "rsa" ]]; then
|
||||
openssl genrsa -out "${path}/${base}-key.pem"
|
||||
@ -24,7 +24,7 @@ generate_ca() {
|
||||
local base="${2:-'root-ca'}"
|
||||
local type="${3:-'rsa'}" # "ec" or "rsa"
|
||||
local org="${4:-'/O=machinezone/O=IXWebSocket'}"
|
||||
|
||||
|
||||
mkdir -p ${path}
|
||||
|
||||
generate_key "${path}" "${base}" "${type}"
|
||||
@ -54,14 +54,14 @@ generate_cert() {
|
||||
-key "${path}/${base}-key.pem" \
|
||||
-subj "${org}/CN=${base}" \
|
||||
-out "${path}/${base}.csr"
|
||||
|
||||
|
||||
|
||||
if [ "${base}" == "${cabase}" ]; then
|
||||
# self-signed
|
||||
openssl x509 -req -in "${path}/${base}.csr" \
|
||||
-signkey "${path}/${base}-key.pem" -days 365 -sha256 \
|
||||
-extfile <(printf "subjectAltName=${san}") \
|
||||
-outform PEM -out "${path}/${base}-crt.pem"
|
||||
-outform PEM -out "${path}/${base}-crt.pem"
|
||||
else
|
||||
openssl x509 -req -in ${path}/${base}.csr \
|
||||
-CA "${path}/${cabase}-crt.pem" \
|
||||
@ -82,7 +82,7 @@ type=${2:-'rsa'}
|
||||
org=${3:-'/O=machinezone/O=IXWebSocket'}
|
||||
|
||||
if ! which openssl &>/dev/null; then
|
||||
|
||||
|
||||
if ! grep -qa -E 'docker|lxc' /proc/1/cgroup; then
|
||||
# launch a container with openssl and run this script there
|
||||
docker run --rm -i -v $(pwd):/work alpine sh -c "apk add bash openssl && /work/generate_certs.sh /work/${outdir} && chown -R $(id -u):$(id -u) /work/${outdir}"
|
||||
@ -90,9 +90,9 @@ if ! which openssl &>/dev/null; then
|
||||
echo "Please install openssl in this container to generate test certs, or launch outside of docker" >&2 && exit 1
|
||||
fi
|
||||
else
|
||||
|
||||
|
||||
generate_ca "${outdir}" "trusted-ca" "${type}" "${org}"
|
||||
|
||||
|
||||
generate_cert "${outdir}" "trusted-server" "trusted-ca" "${type}" "${org}"
|
||||
generate_cert "${outdir}" "trusted-client" "trusted-ca" "${type}" "${org}"
|
||||
|
||||
|
@ -39,7 +39,7 @@ fi
|
||||
cd /tmp/ws_test
|
||||
ws transfer --port 8090 ${server_tls} --pidfile /tmp/ws_test/pidfile.transfer &
|
||||
|
||||
# Wait until the transfer server is up
|
||||
# Wait until the transfer server is up
|
||||
while true
|
||||
do
|
||||
nc -zv 127.0.0.1 8090 && {
|
||||
@ -60,7 +60,7 @@ cd /tmp/ws_test/send
|
||||
dd if=/dev/urandom of=/tmp/ws_test/send/20M_file count=20000 bs=1024
|
||||
|
||||
# Start the sender job
|
||||
ws send ${client_tls} --pidfile /tmp/ws_test/pidfile.send "${protocol}127.0.0.1:8090" /tmp/ws_test/send/20M_file
|
||||
ws send ${client_tls} --pidfile /tmp/ws_test/pidfile.send "${protocol}127.0.0.1:8090" /tmp/ws_test/send/20M_file
|
||||
|
||||
# Wait until the file has been written to disk
|
||||
while true
|
||||
|
Reference in New Issue
Block a user