Skip to main content

Module port_info

Module port_info 

Source
Expand description

Record information about where we are listening to a file, so that other programs can find it without going through RPC.

§File format

The file holds a single json Object, containing the key “ports”.

The “ports” entry contains a list. Each entry in “ports” is a json Object containing these fields:

  • “protocol” - one of “socks”, “http”, or “dns_udp”.
  • “address” - An IPv4 or IPv6 socket address, prefixed with the string “inet:”.

All software using this format MUST ignore:

  • unrecognized keys in json Objects,
  • entries in the “ports” list with unrecognized “protocol“s
  • entries in “ports” whose “address” fields are null.
  • entries in “ports” whose “address” fields have an unrecognized prefix (not “inet:”).

(Note that as with other formats, we may break this across Arti major versions, though we will make our best effort not to do so.)

§Liveness

Arti updates this file whenever on startup, when it binds to its ports. It does not try to delete the file on shutdown, however, and on a crash or unexpected SIGKILL, it will have no opportunity to delete the file. Therefore, you should not assume that the file will always be up to date, or that the ports will not be bound by some other program.

Structs§

Port
Representation of a single port in a port_info.json file.
PortInfo
Information about all the ports we are listening on as a proxy.

Enums§

SupportedProtocol
A protocol that a given port supports.

Functions§

serialize_address 🔒
Helper: serialize a general::SocketAddr as a string if possible, or as None if it can’t be represented as a string.