Skip to content

Commit 298bffe

Browse files
committed
WIP: Initial commit
0 parents  commit 298bffe

17 files changed

Lines changed: 6969 additions & 0 deletions

.github/workflows/ci.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Use workflows from ninenines/ci.erlang.mk to test Corral.
2+
3+
name: Check Corral
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
schedule:
11+
## Every Monday at 6am.
12+
- cron: 0 6 * * 1
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
check:
20+
name: Check all backends
21+
if: ${{ !cancelled() }}
22+
uses: ninenines/ci.erlang.mk/.github/workflows/ci.yaml@master

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.corral.plt
2+
.erlang.mk/
3+
corral.d
4+
deps/
5+
ebin/*.beam
6+
ebin/test
7+
logs/
8+
test/*.beam

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2026, Loïc Hoguin <essen@ninenines.eu>
2+
3+
Permission to use, copy, modify, and/or distribute this software for any
4+
purpose with or without fee is hereby granted, provided that the above
5+
copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Makefile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# See LICENSE for licensing information.
2+
3+
PROJECT = corral
4+
PROJECT_DESCRIPTION = QUIC backends for Erlang/OTP.
5+
PROJECT_VERSION = 0.1.0
6+
7+
# Dependencies.
8+
9+
LOCAL_DEPS = public_key
10+
11+
# @todo Make sure it still works if using CORRAL_DEPS=quicer or with both.
12+
# @todo And then remove quicer by default?
13+
CORRAL_DEPS ?= quic quicer
14+
export CORRAL_DEPS
15+
16+
DEPS = $(CORRAL_DEPS)
17+
TEST_DEPS = quic
18+
19+
dep_quic = git https://github.com/essen/erlang_quic corral
20+
dep_quicer = git https://github.com/emqx/quic main
21+
22+
TEST_DEPS = ct_helper
23+
dep_ct_helper = git https://github.com/ninenines/ct_helper master
24+
25+
# CI configuration.
26+
27+
dep_ci.erlang.mk = git https://github.com/ninenines/ci.erlang.mk master
28+
DEP_EARLY_PLUGINS = ci.erlang.mk
29+
30+
AUTO_CI_OTP ?= OTP-LATEST-26+
31+
AUTO_CI_WINDOWS ?= OTP-LATEST-26+
32+
33+
include erlang.mk
34+
35+
# Conditional backend macros.
36+
37+
ifeq ($(filter quic,$(CORRAL_DEPS)),quic)
38+
ERLC_OPTS += -D BACKEND_ERLANG_QUIC=1
39+
TEST_ERLC_OPTS += -D BACKEND_ERLANG_QUIC=1
40+
endif
41+
42+
ifeq ($(filter quicer,$(CORRAL_DEPS)),quicer)
43+
ERLC_OPTS += -D BACKEND_QUICER=1
44+
TEST_ERLC_OPTS += -D BACKEND_QUICER=1
45+
endif
46+
47+
# Fix quicer compilation.
48+
49+
autopatch-quicer::
50+
$(verbose) printf "%s\n" "all: ;" > $(DEPS_DIR)/quicer/c_src/Makefile.erlang.mk
51+
52+
# Generate certificates for testing.
53+
54+
$(ERLANG_MK_TMP)/certs:
55+
$(verbose) mkdir -p $@
56+
# Server.
57+
$(gen_verbose) openssl req -x509 -nodes \
58+
-days 365 \
59+
-newkey ec -pkeyopt ec_paramgen_curve:P-256 \
60+
-subj "/CN=localhost" \
61+
-addext "subjectAltName = DNS:localhost, IP:127.0.0.1" \
62+
-keyout $@/server.key \
63+
-out $@/server.crt \
64+
2>/dev/null
65+
# Client CA.
66+
$(verbose) openssl genrsa -out $@/ca.key 4096
67+
$(verbose) openssl req -x509 -new -nodes -days 3650 \
68+
-key $@/ca.key \
69+
-subj "/CN=Test CA" \
70+
-out $@/ca.crt
71+
# Client.
72+
$(verbose) openssl req -new -nodes \
73+
-newkey ec -pkeyopt ec_paramgen_curve:P-256 \
74+
-subj "/CN=client" \
75+
-addext "subjectAltName = DNS:client" \
76+
-addext "extendedKeyUsage = clientAuth" \
77+
-keyout $@/client.key \
78+
-out $@/client.csr \
79+
2>/dev/null
80+
$(verbose) openssl x509 -req -days 365 \
81+
-in $@/client.csr \
82+
-CA $@/ca.crt \
83+
-CAkey $@/ca.key \
84+
-CAcreateserial \
85+
-out $@/client.crt \
86+
-extfile <(printf "subjectAltName = DNS:client\nextendedKeyUsage = clientAuth") \
87+
2>/dev/null
88+
89+
test-build:: $(ERLANG_MK_TMP)/certs

ebin/corral.app

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{application, 'corral', [
2+
{description, "QUIC backends for Erlang/OTP."},
3+
{vsn, "0.1.0"},
4+
{modules, ['corral','corral_app','corral_backend','corral_conns_sup','corral_ets','corral_quic','corral_quicer','corral_quicer_cb','corral_sup']},
5+
{registered, [corral_sup]},
6+
{applications, [kernel,stdlib,public_key,quic,quicer]},
7+
{optional_applications, []},
8+
{mod, {'corral_app', []}},
9+
{env, []}
10+
]}.

0 commit comments

Comments
 (0)