masque_h2_server (masque v0.7.0)

View Source

MASQUE CONNECT-UDP listener over HTTP/2.

Wraps h2:start_server/3 with a handler fun that validates the Extended CONNECT envelope (RFC 8441 + RFC 9298), matches the request path against the configured URI template, and spawns a per-tunnel masque_h2_server_session on acceptance.

For the cert/key config this follows erlang_h2 conventions: both are PEM file paths (string or binary). quic_h3 takes DER binaries, so the masque facade exposes two distinct start functions and the test helpers keep both forms around.

Summary

Types

listener_name/0

-type listener_name() :: atom().

listener_opts/0

-type listener_opts() :: map().

Functions

h2_handlers(Opts0)

-spec h2_handlers(map()) ->
                     #{handler := fun((pid(), non_neg_integer(), binary(), binary(), list()) -> any())}.

release_tunnel(Conn)

-spec release_tunnel(pid()) -> ok.

start_listener(Name, Opts0)

-spec start_listener(listener_name(), listener_opts()) -> {ok, h2:server_ref()} | {error, term()}.

stop_listener(Ref)

-spec stop_listener(h2:server_ref() | listener_name()) -> ok | {error, term()}.

try_reserve_tunnel(Conn, Max)

-spec try_reserve_tunnel(pid(), pos_integer()) -> boolean().