pub async fn bind(repo: Repo, opts: ServeOptions) -> Result<Server>Expand description
Binds the listeners of opts and returns a server over repo.
The function checks the options and builds the TLS configuration of
opts. Then it binds each listen address of opts, in order. The server
serves the archive view of repo. With ServeOptions::receive, it also
serves the receive endpoint over repo.
ยงErrors
The checks run in this order:
Error::Optionsiflistenis empty, or ifbody_timeoutis zero.Error::Optionsiftrusted_proxy_client_certis not a header name (ostrya::access::is_header_name).Error::Optionsiftrusted_proxy_client_certis set andclient_ca_pemisNone, ortrusted_proxiesis empty.Error::Optionsiftrusted_proxiesis not empty andtrusted_proxy_headerisNone, or the reverse.Error::Optionsifclient_ca_pemis set, andtlsandtrusted_proxy_client_certareNone.Error::Optionsif a client group ofreceivecarries atls:*,tls:NAME, ortls-sha256:HEXitem andclient_ca_pemisNone. The message names the group and the item.Error::Tlsifclient_ca_pemgives no verifier: it does not decode as PEM, holds no certificate, or holds a certificate that rustls refuses as a trust anchor.Error::Optionsifreceiveis set andparallel_uploadsis outside1..=31, orsession_idle_timeoutormax_sessionsis zero.Error::Tlsif the TLS files give no server configuration.Error::Bindif a listen address cannot be bound, or if its local address cannot be read.