Skip to content

samicpp/muon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

muon

A rust webserver built for ease of use, and speed

Crate features

feature requires desciption
unix-sockets - enables unix sockets
ring - uses ring provider
aws-lc-rs - uses aws provider
simple - enables the simple handler
samicpp - enables the samicpp handler

Usage

muon tries to read a file named settings.toml from the directory its executable lies.
Alternatively a different file can be specified with cli argument --settings ./path/to/file.toml

Handlers

handler description
simple a simple static content handler
samicpp a handler with all of my needs

If you need a specific handler open an issue and i can make one named after you,
or fork the repo and open a pull request.

TODO::Features

  • support TLS
  • TLS certificate selection
  • add loglevels based on individual logs
  • add simple handler
  • support multiple different addresses in same field
  • allow customizing tokio runtime
  • support cli arguments
  • support HTTP/2 and h2c
  • rework logging
  • colorize log output
  • create runtime console via stdin or socket
  • allow reloading settings file
  • allow stopping the servers / listeners
  • advanced socket options with socket2
  • support HTTP/1.1 pipelining
  • allow exporting/sending server connection data
  • temporarily support HTTP/3 through quinn

TODO::Features::SamicppHandler

  • support serving files
  • support partial content
  • support redirect, var, and link files
  • support download files
  • support route level auth
  • support FFI handler endpoints
  • embed rhai ()
  • support conditional checks before handling request
  • colorize logging and add more logging
  • make some built in method of making services through data driven behaviour
  • allow chaining builtin services using rhai
  • allow sql and redis connectivity for local variables
  • store logging information about clients and more
  • support forwarding the request by proxying
  • allow forwarding connection based on file/socket descriptors and ffi. example extern "C" fn muon_receive_tcp(fd: *mut Fd) -> bool { /* ... */ } in a running process
  • embed Deno engine to execute javascript
  • implement complex caching algorithm
  • make many helper methods for rhai embedding and simple middleware setup. such as serve_file error etc

Examples

settings.toml

[network]
address = [
    "http://0.0.0.0:8001",
    "https://0.0.0.0:8002",
]
default_key = "./tls/localhost-key.pem"
default_cert = "./tls/localhost.pem"
alpn = [ "h2", "http/1.1" ]

[[network.sni]]
domain = "one.localhost"
key = "./tls/one.localhost-key.pem"
cert = "./tls/one.localhost.pem"

[[network.sni]]
domain = "two.localhost"
key = "./tls/two.localhost-key.pem"
cert = "./tls/two.localhost.pem"

[[network.binding]]
address = "httpx://0.0.0.0:2233"
backlog = 1


[environment]
cwd = "/var/www"


[content]
handler = "simple"
max_file_size = 16777216 # 16mb
serve_dir = "public"


[logging]

config.json

{
    "default": {
        "match-type": "default",
        "dir": "."
    },
    "auth-test": {
        "match-type": "path-start",
        "dir": ".",
        "auth": "hello:world"
    },
    "prereq-test": {
        "match-type": "path-start",
        "dir": ".",
        "prerequisites": [
            "no-body",
            { "has-header": "x-custom-header" }
        ]
    }
}

About

A rust webserver built for ease of use, configurability, and speed

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages