masque_ip_client_session (masque v0.7.0)

View Source

Client-side CONNECT-IP session (RFC 9484).

One gen_statem per tunnel, transport-generic: the same module drives both HTTP/3 (quic_h3, QUIC DATAGRAM frames) and HTTP/2 (erlang_h2, RFC 9297 DATAGRAM-type capsules on the stream body) by dispatching on a transport :: h3 | h2 field — following the architecture already used by masque_tcp_client_session.

Owner-side events (the process that called masque:connect/3):

  • {masque_ip_packet, Sess, Packet}
  • {masque_address_assign, Sess, [ip_assignment()]}
  • {masque_address_request, Sess, [ip_prefix_request()]}
  • {masque_route_advertisement, Sess, [ip_route()]}
  • {masque_ip_error, Sess, Reason}
  • {masque_closed, Sess, Reason}

Summary

Functions

Send a ROUTE_ADVERTISEMENT capsule.

Send an ADDRESS_ASSIGN capsule. Nonzero Request IDs must match an outstanding peer ADDRESS_REQUEST (tracked in the session's pending set); ID 0 is unprompted and always accepted.

Block for the next inbound IP packet when in queue mode.

Send an ADDRESS_REQUEST capsule asking the server to assign addresses matching the given prefixes. Returns the list of allocated Request IDs (strictly nonzero).

Send a full IP packet through the tunnel.

Functions

assign_addresses(Pid, Assignments)

-spec assign_addresses(pid(), [masque_ip_capsule:address_entry()]) -> ok | {error, term()}.

Send an ADDRESS_ASSIGN capsule. Nonzero Request IDs must match an outstanding peer ADDRESS_REQUEST (tracked in the session's pending set); ID 0 is unprompted and always accepted.

callback_mode()

closing(Event, Msg, Data)

code_change(OldVsn, State, Data, Extra)

connecting(_, Msg, Data)

info(Pid)

init(_)

ip_info(Pid)

-spec ip_info(pid()) -> map().

open(_, Msg, Data)

recv(Pid, Timeout)

Block for the next inbound IP packet when in queue mode.

request_addresses(Pid, Prefixes)

-spec request_addresses(pid(), [{4 | 6, inet:ip_address(), non_neg_integer()}]) ->
                           {ok, [pos_integer()]} | {error, term()}.

Send an ADDRESS_REQUEST capsule asking the server to assign addresses matching the given prefixes. Returns the list of allocated Request IDs (strictly nonzero).

send_capsule(Pid, Type, Value)

send_ip_packet(Pid, Packet)

-spec send_ip_packet(pid(), binary()) -> ok | {error, term()}.

Send a full IP packet through the tunnel.

set_mode(Pid, Mode)

start(Target, Opts, Owner)

start_link(Target, Opts, Owner)

stop(Pid)

terminate(Reason, State, Data)