diff --git a/cert/Dockerfile b/cert/Dockerfile index 84cb44c..df5be10 100644 --- a/cert/Dockerfile +++ b/cert/Dockerfile @@ -1,13 +1,12 @@ # Use ubuntu because it's ez FROM ubuntu:latest +WORKDIR /build + # Use openssl and golang to generate certificates RUN apt-get update && \ - apt-get install -y ca-certificates openssl golang + apt-get install -y ca-certificates openssl golang xxd -# Save the certificates to a volume -VOLUME /cert -WORKDIR /cert # Download the go modules COPY go.mod go.sum ./ @@ -16,5 +15,8 @@ RUN go mod download # Copy over the remaining files. COPY . . +# Save the certificates to a volume +VOLUME /cert + # TODO support an output directory -CMD ./generate \ No newline at end of file +CMD ./generate && cp localhost.* /cert \ No newline at end of file diff --git a/cert/generate b/cert/generate index c86b309..63bb335 100755 --- a/cert/generate +++ b/cert/generate @@ -17,4 +17,4 @@ go run filippo.io/mkcert -ecdsa -install go run filippo.io/mkcert -ecdsa -days 10 -cert-file "$CRT" -key-file "$KEY" localhost 127.0.0.1 ::1 # Compute the sha256 fingerprint of the certificate for WebTransport -openssl x509 -in "$CRT" -outform der | openssl dgst -sha256 > localhost.hex \ No newline at end of file +openssl x509 -in "$CRT" -outform der | openssl dgst -sha256 -binary | xxd -p -c 256 > localhost.hex \ No newline at end of file diff --git a/media/Dockerfile b/media/Dockerfile index f8f36e4..372db90 100644 --- a/media/Dockerfile +++ b/media/Dockerfile @@ -1,6 +1,9 @@ # Create a build image FROM ubuntu:latest +# Create the working directory. +WORKDIR /build + # Install necessary packages RUN apt-get update && \ apt-get install -y \ @@ -8,13 +11,15 @@ RUN apt-get update && \ wget \ ffmpeg -# Create a media volume -VOLUME /media -WORKDIR /media - # Download a file from the internet, in this case my boy big buck bunny RUN wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -O source.mp4 # Copy an run a script to create a fragmented mp4 (more overhead, easier to split) COPY fragment . -CMD ./fragment + +# Create a media volume +VOLUME /media + +# Fragment the media +# TODO support an output directory +CMD ./fragment && cp fragmented.mp4 /media \ No newline at end of file diff --git a/server/src/main.rs b/server/src/main.rs index 56441d7..373474c 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -6,7 +6,7 @@ use clap::Parser; #[derive(Parser)] struct Cli { /// Listen on this address - #[arg(short, long, default_value = "0.0.0.0:4443")] + #[arg(short, long, default_value = "[::]:4443")] addr: String, /// Use the certificate file at this path diff --git a/web/src/index.ts b/web/src/index.ts index 2f83061..5c46360 100644 --- a/web/src/index.ts +++ b/web/src/index.ts @@ -6,8 +6,8 @@ import fingerprintHex from 'bundle-text:../fingerprint.hex'; // Convert the hex to binary. let fingerprint = []; -for (let c = 0; c < fingerprintHex.length-1; c += 2) { - fingerprint.push(parseInt(fingerprintHex.substring(c, c+2), 16)); +for (let c = 0; c < fingerprintHex.length - 1; c += 2) { + fingerprint.push(parseInt(fingerprintHex.substring(c, c + 2), 16)); } const params = new URLSearchParams(window.location.search)