12 releases

0.3.7 Apr 14, 2024
0.3.6 Apr 7, 2024
0.3.4 Mar 5, 2024
0.3.3 Jan 29, 2024
0.1.0 Nov 23, 2023

#558 in HTTP server

Download history 2/week @ 2023-12-25 20/week @ 2024-01-08 5/week @ 2024-01-22 17/week @ 2024-01-29 8/week @ 2024-02-19 9/week @ 2024-02-26 119/week @ 2024-03-04 9/week @ 2024-03-11 60/week @ 2024-04-01 119/week @ 2024-04-08

180 downloads per month

MIT/Apache

47KB
852 lines

$ trillium help
The trillium.rs cli

Usage: trillium <COMMAND>

Commands:
  serve   Static file server and reverse proxy
  client  Make http requests using the trillium client
  proxy   Run a http proxy
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

HTTP Client

$ trillium help client
Make http requests using the trillium client

Usage: trillium client [OPTIONS] <METHOD> <URL>

Arguments:
  <METHOD>
          

  <URL>
          

Options:
  -f, --file <FILE>
          provide a file system path to a file to use as the request body
          
          alternatively, you can use an operating system pipe to pass a file in
          
          three equivalent examples:
          
          trillium client post http://httpbin.org/anything -f ./body.json
          trillium client post http://httpbin.org/anything < ./body.json
          cat ./body.json | trillium client post http://httpbin.org/anything

  -o, --output-file [<OUTPUT_FILE>]
          write the body to a file

  -b, --body <BODY>
          provide a request body on the command line
          
          example:
          trillium client post http://httpbin.org/post -b '{"hello": "world"}'

  -H, --headers <HEADERS>
          provide headers in the form -h KEY1=VALUE1 KEY2=VALUE2
          
          example:
          trillium client get http://httpbin.org/headers -H Accept=application/json Authorization="Basic u:p"

  -t, --tls <TLS>
          tls implementation
          
          requests to https:// urls with `none` will fail
          
          [default: rustls]
          [possible values: none, rustls]

  -v, --verbose...
          Increase logging verbosity

  -q, --quiet...
          Decrease logging verbosity

  -h, --help
          Print help (see a summary with '-h')

Proxy (reverse and forward)

$ trillium help proxy
Run a http proxy

Usage: trillium proxy [OPTIONS] [UPSTREAM]...

Arguments:
  [UPSTREAM]...
          [env: UPSTREAM=]

Options:
  -s, --strategy <STRATEGY>
          [env: STRATEGY=]
          [default: round-robin]
          [possible values: round-robin, connection-counting, random, forward]

  -o, --host <HOST>
          Local host or ip to listen on
          
          [env: HOST=]
          [default: localhost]

  -p, --port <PORT>
          Local port to listen on
          
          [env: PORT=]
          [default: 8080]

      --rustls-cert <RUSTLS_CERT>
          Path to a tls certificate for trillium_rustls
          
          This will panic unless rustls_key is also provided. Providing both rustls_key and rustls_cert enables tls.
          
          Example: `--rustls-cert ./cert.pem --rustls-key ./key.pem` For development, try using mkcert
          
          [env: RUSTLS_CERT=]

      --rustls-key <RUSTLS_KEY>
          The path to a tls key file for trillium_rustls
          
          This will panic unless rustls_cert is also provided. Providing both rustls_key and rustls_cert enables tls.
          
          Example: `--rustls-cert ./cert.pem --rustls-key ./key.pem` For development, try using mkcert
          
          [env: RUSTLS_KEY=]

  -c, --client-tls <CLIENT_TLS>
          tls implementation
          
          required if the upstream url is https.
          
          [default: rustls]
          [possible values: none, rustls]

  -v, --verbose...
          Increase logging verbosity

  -q, --quiet...
          Decrease logging verbosity

  -h, --help
          Print help (see a summary with '-h')

Static file server with optional reverse-proxy passthrough

$ trillium help serve
Static file server and reverse proxy

Usage: trillium serve [OPTIONS] [ROOT]

Arguments:
  [ROOT]
          Filesystem path to serve
          
          Defaults to the current working directory
          
          [default: /Users/jbr/code/futures-rustls]

Options:
  -o, --host <HOST>
          Local host or ip to listen on
          
          [env: HOST=]
          [default: localhost]

  -p, --port <PORT>
          Local port to listen on
          
          [env: PORT=]
          [default: 8080]

      --rustls-cert <RUSTLS_CERT>
          Path to a tls certificate for trillium_rustls
          
          This will panic unless rustls_key is also provided. Providing both rustls_key and rustls_cert enables tls.
          
          Example: `--rustls-cert ./cert.pem --rustls-key ./key.pem` For development, try using mkcert
          
          [env: RUSTLS_CERT=]

      --rustls-key <RUSTLS_KEY>
          The path to a tls key file for trillium_rustls
          
          This will panic unless rustls_cert is also provided. Providing both rustls_key and rustls_cert enables tls.
          
          Example: `--rustls-cert ./cert.pem --rustls-key ./key.pem` For development, try using mkcert
          
          [env: RUSTLS_KEY=]

  -f, --forward <FORWARD>
          Host to forward (reverse proxy) not-found requests to
          
          This forwards any request that would otherwise be a 404 Not Found to the specified listener spec.
          
          Examples: `--forward localhost:8081` `--forward http://localhost:8081` `--forward https://localhost:8081`
          
          Note: http+unix:// schemes are not yet supported
          
          [env: FORWARD=]

  -i, --index <INDEX>
          [env: INDEX=]

  -v, --verbose...
          Increase logging verbosity

  -q, --quiet...
          Decrease logging verbosity

  -h, --help
          Print help (see a summary with '-h')

Dependencies

~12–28MB
~498K SLoC