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::Credentialsifreceiveis set and a line ofcredentialsis malformed.Error::Optionsifreceiveis set and the endpoint has no authentication method.Error::Optionsifreceiveis set,tlsisNone, and bothallow_anonymous_pushandallow_cleartext_credentialsarefalse.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.