Skip to main content

bind

Function bind 

Source
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::Options if listen is empty, or if body_timeout is zero.
  • Error::Credentials if receive is set and a line of credentials is malformed.
  • Error::Options if receive is set and the endpoint has no authentication method.
  • Error::Options if receive is set, tls is None, and both allow_anonymous_push and allow_cleartext_credentials are false.
  • Error::Options if receive is set and parallel_uploads is outside 1..=31, or session_idle_timeout or max_sessions is zero.
  • Error::Tls if the TLS files give no server configuration.
  • Error::Bind if a listen address cannot be bound, or if its local address cannot be read.