Skip to content
/ fht2p Public

A cross-platform HTTP static file server developed using Rust.

License

Notifications You must be signed in to change notification settings

biluohc/fht2p

Repository files navigation

Actions Status

中文

fht2p is a cross-platform HTTP static file server developed using Rust. The CI test covers Linux, MacOS and Windows.

Features

  • Reliable: Implemented in Rust, integrated testing, safe and reliable
  • Universal: Fully cross-platform, available for both Unix-like and Windows systems
  • Convenient: static linking, does not depend on external dynamic libraries such as openssl, download and use
  • Fast: Asynchronous multi-threaded, built on tokio and hyper, fast response, massive concurrency
  • Functions: file download and upload, directory browsing, resume from breakpoint, proxy function, configuration options, everything

Functions

  1. Multi-path sharing
  2. File breakpoint resume
  3. Closeable directory browsing (and sorting and other functions)
  4. HTTP Cache
  5. File upload, make directory
  6. HTTPS (tokio-rustls, does not depend on external dynamic libraries)
  7. HTTP proxy (tunnel proxy, general proxy)
  8. Basic Authentication
  9. Cross-Origin Resource Sharing (CORS)
  10. Directory page compression (GZIP)
  11. Command line arguments
  12. Configuration file (format is json5, similar to json but supports comments, etc.)
  13. Terminal log optional level
  14. Output service's URL at startup, output QR code optionally

Snapshot

snapshot.png

Install

1. Download from Releases

2. Compile from Source Code

    cargo install --locked --git https://github.com/biluohc/fht2p fht2p -f
    # cargo install --locked --git https://github.com/biluohc/fht2p --branch dev fht2p -f
    
    fht2p -h
Or
    git clone https://github.com/biluohc/fht2p
    # cargo install --locked --path fht2p/ fht2p -f

    cd fht2p
    cargo build --release

    ./target/release/fht2p --help

Tips

  1. View help information by using the --help option

  2. View the default configuration content by using the --config-print option.

  3. See a complete configuration example from the config directory under this project.

  4. About the priority of options and profiles

    The default configuration file is located in $HOME/.config/fht2p/fht2p.json, you can create if it doesn't exist.

    There are four types of options:

  • The first is --help, --version and --config-print. Programs will exit very quickly, regardless of priority.
  • The second is --verbose and --qr-code They ignore priority and have no conflict with other options
  • The third is --config specifies the configuration file, the fourth option is ignored
  • The fourth is other options and parameters, once you have it, the default configuration file will be ignored (this is to prevent the priority from being too complicated)
  1. About security and HTTPS
  • HTTP is a plain text protocol based on TCP. There is no security at all. If security is required, HTTPS must be used.
  • The program listens to the local loopback address (127.0.0.1) by default for security. If you want to access outside the machine, you can monitor 0.0.0.0 or a specific address and configure your firewall
  • The program listens to the current directory by default. Please do not share the home directory or the root directory on the network unless you understand what you are doing