Skip to main content

Module net

Module net 

Source
Expand description

Transport for the LocalSend protocol: a self-signed TLS identity, rustls streams, and the small slice of HTTP/1.1 the protocol needs. Every connection carries one request and is closed after the response.

Structs§

Identity
This device’s certificate and key. The fingerprint the protocol asks for is the SHA-256 of the certificate (DER), as lowercase hex. The host stores the two DER blobs (a Keychain item, or a file it protects) and hands them back through Identity::load; the crate never writes key material.
Reply
Request

Enums§

Wire

Functions§

accept_tls
Wrap an accepted connection in TLS (server side).
call
Send one request on wire and read the whole response. write_body writes exactly length bytes.
connect
Connect to a peer. HTTPS peers are pinned to their announced fingerprint.
connect_within
connect with its own limit on how long the TCP connection may take.
prove_key
Connect-back proof for a sender that presented no client certificate: open our own TLS connection to ip:port and require that the server there holds the private key of a certificate whose SHA-256 is fingerprint (the pinned handshake signature is genuinely verified, see PinVerifier). False for a malformed fingerprint, a refused connection, a wrong key or a timeout (3 s).
read_body
Read a message body (Content-Length or chunked) and hand it to sink in pieces. More than max bytes is an error.
read_request
request_json
One small request with an optional JSON body, on a fresh connection.
server_config
set_client_identity
set_user_agent
sha256_hex
valid_pin
Whether fingerprint is a SHA-256 in hex, the only thing a send is pinned to.
write_response