Class: QuietQUIC::Server
- Inherits:
-
Object
- Object
- QuietQUIC::Server
- Defined in:
- lib/quietquic/server.rb
Overview
A running cloaked QUIC server.
Build one with Server.bind (from a listen address + a {client_id => psk} map)
or Server.bind_toml (from a secrets file). Both parse and validate the config
synchronously (raising ConfigError on a bad address or PSK),
then await the native bind on the shared runtime.
#accept yields the next authenticated Connection; it blocks (parking the
fiber under an Async reactor) until a peer completes the cloaked handshake.
Class Method Summary collapse
-
.bind(listen:, clients:) ⇒ Server
Bind a server from a listen address and an authorized-clients map.
-
.bind_toml(path) ⇒ Server
Bind a server from a TOML secrets file.
Instance Method Summary collapse
-
#accept ⇒ Connection
Await and return the next authenticated Connection.
-
#close ⇒ void
Stop the server: drop the crate server, halting its driver and releasing the socket.
-
#initialize(native) ⇒ Server
constructor
A new instance of Server.
-
#local_address ⇒ String
The address the server is actually listening on (e.g.
"127.0.0.1:54321").
Constructor Details
#initialize(native) ⇒ Server
Returns a new instance of Server.
38 39 40 |
# File 'lib/quietquic/server.rb', line 38 def initialize(native) @native = native end |
Class Method Details
Instance Method Details
#accept ⇒ Connection
Await and return the next authenticated Connection.
Blocks until a peer completes the cloaked handshake. Under an Async
reactor it parks the fiber; otherwise it blocks with the GVL released.
50 51 52 |
# File 'lib/quietquic/server.rb', line 50 def accept Connection.new(QuietQUIC.await(@native.accept_op)) end |
#close ⇒ void
This method returns an undefined value.
Stop the server: drop the crate server, halting its driver and releasing the socket. Idempotent.
66 67 68 |
# File 'lib/quietquic/server.rb', line 66 def close @native.close end |
#local_address ⇒ String
The address the server is actually listening on (e.g. "127.0.0.1:54321").
After binding to port 0 this reports the kernel-chosen port.
58 59 60 |
# File 'lib/quietquic/server.rb', line 58 def local_address @native.local_address end |