{"id":37098825,"url":"https://github.com/toby/ran","last_synced_at":"2026-01-14T12:01:13.279Z","repository":{"id":57592879,"uuid":"167041654","full_name":"toby/ran","owner":"toby","description":"a simple static web server written in Go","archived":false,"fork":true,"pushed_at":"2019-01-22T18:43:22.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T03:29:47.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"m3ng9i/ran","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toby.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-22T18:03:03.000Z","updated_at":"2019-01-22T18:03:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/toby/ran","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/toby/ran","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toby%2Fran","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toby%2Fran/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toby%2Fran/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toby%2Fran/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toby","download_url":"https://codeload.github.com/toby/ran/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toby%2Fran/sbom","scorecard":{"id":891011,"data":{"date":"2025-08-11","repo":{"name":"github.com/toby/ran","commit":"fb2a28fa7ec4b02fece801fb7e6f452ed931ea02"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T11:50:12.697Z","repository_id":57592879,"created_at":"2025-08-24T11:50:12.697Z","updated_at":"2025-08-24T11:50:12.697Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T12:01:12.513Z","updated_at":"2026-01-14T12:01:13.269Z","avatar_url":"https://github.com/toby.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ran: a simple static web server written in Go\n=============================================\n\n![Ran](ran.gif)\n\nRan is a simple web server for serving static files.\n\n## Features\n\n- Directory listing\n- Automatic gzip compression\n- Digest authentication\n- Access logging\n- Custom 401 and 404 error file\n- TLS encryption\n\n## What is Ran for?\n\n- File sharing in LAN or home network\n- Web application testing\n- Personal web site hosting or demonstrating\n\n## Dependencies\n\n- [github.com/abbot/go-http-auth](https://github.com/abbot/go-http-auth)\n- [github.com/oxtoacart/bpool](https://github.com/oxtoacart/bpool)\n- [github.com/m3ng9i/go-utils/http](https://github.com/m3ng9i/go-utils)\n- [github.com/m3ng9i/go-utils/log](https://github.com/m3ng9i/go-utils)\n- [github.com/m3ng9i/go-utils/possible](https://github.com/m3ng9i/go-utils)\n- [golang.org/x/net/context](https://github.com/golang/net)\n\n## Installation\n\nUse the command below to install the dependencies mentioned above, and build the binary into $GOPATH/bin.\n\n```bash\ngo get -u github.com/m3ng9i/ran\n```\n\nFor convenience, you can move the ran binary to a directory in the PATH environment variable.\n\nYou can also call `./build.py` command under the Ran source directory to write version information into the binary, so that `ran -v` will give a significant result. Run `./build.py -h` for help.\n\n## Download binary\n\nYou can also download the Ran binary without building it yourself.\n\n[Download Ran binary from the release page](https://github.com/m3ng9i/ran/releases).\n\n## Run Ran\n\nYou can start a web server without any options by typing `ran` and pressing return in terminal window. This will use the following default configuration:\n\nConfiguration               | Default value\n----------------------------|--------------------------------\nRoot directory              | the current working directory\nPort                        | 8080\nIndex file                  | index.html, index.htm\nList files of directories   | false\nGzip                        | true\nDigest auth                 | false\nTLS encryption              | off\n\nOpen http://127.0.0.1:8080 in browser to see your website.\n\nYou can use the command line options to override the default configuration.\n\nOptions:\n\n```\n    -r,  -root=\u003cpath\u003e        Root path of the site. Default is current working directory.\n    -p,  -port=\u003cport\u003e        HTTP port. Default is 8080.\n         -404=\u003cpath\u003e         Path of a custom 404 file, relative to Root. Example: /404.html.\n    -i,  -index=\u003cpath\u003e       File name of index, priority depends on the order of values.\n                             Separate by colon. Example: -i \"index.html:index.htm\"\n                             If not provide, default is index.html and index.htm.\n    -l,  -listdir=\u003cbool\u003e     When request a directory and no index file found,\n                             if listdir is true, show file list of the directory,\n                             if listdir is false, return 404 not found error.\n                             Default is false.\n    -sa, -serve-all=\u003cbool\u003e   Serve all paths even if the path is start with dot.\n    -g,  -gzip=\u003cbool\u003e        Turn on or off gzip compression. Default value is true (means turn on).\n\n    -am, -auth-method=\u003cauth\u003e Set authentication method, valid values are basic and digest. Default is basic.\n    -a,  -auth=\u003cuser:pass\u003e   Turn on authentication and set username and password (separate by colon).\n                             After turn on authentication, all the page require authentication.\n         -401=\u003cpath\u003e         Path of a custom 401 file, relative to Root. Example: /401.html.\n                             If authentication fails and 401 file is set,\n                             the file content will be sent to the client.\n\n         -tls-port=\u003cport\u003e    HTTPS port. Default is 443.\n         -tls-policy=\u003cpol\u003e   This option indicates how to handle HTTP and HTTPS traffic.\n                             There are three option values: redirect, both and only.\n                             redirect: redirect HTTP to HTTPS\n                             both:     both HTTP and HTTPS are enabled\n                             only:     only HTTPS is enabled, HTTP is disabled\n                             The default value is: only.\n         -cert=\u003cpath\u003e        Load a file as a certificate.\n                             If use with -make-cert, will generate a certificate to the path.\n         -key=\u003cpath\u003e         Load a file as a private key.\n                             If use with -make-cert, will generate a private key to the path.\n```\n\nOther options:\n\n```\n         -make-cert          Generate a self-signed certificate and a private key used in TLS encryption.\n                             You should use -cert and -key to set the output paths.\n         -showconf           Show config info in the log.\n         -debug              Turn on debug mode.\n    -v,  -version            Show version information.\n    -h,  -help               Show help message.\n```\n\nIf you want to shutdown Ran, type `ctrl+c` in the terminal, or kill it in the task manager.\n\n### Examples\n\nExample 1: Start a server in the current directory and set port to 8888\n\n```bash\nran -p=8888\n```\n\nExample 2: Set root to /tmp, list files of directories and set a custom 404 page\n\n```bash\nran -r=/tmp -l=true -404=/404.html\n```\n\n`-l=true` can be shorted to `-l` for convenience.\n\nExample 3: Turn off gzip compression, set access username and password and set a custom 401 page\n\n```bash\nran -g=false -a=user:pass -401=/401.html\n```\n\nExample 4: Set custom index file\n\n```bash\nran -i default.html:index.html\n```\n\nExample 5: Turn on TLS encryption\n\nIf you want to turn on TLS encryption (https), you should use `-cert` to load a certificate and `-key` to load a private key.\n\nThe default TLS port is 443, you can use `-tls-port` to set it to another port.\n\nThe following command load a certificate and a private key, and set TLS port to 9999. It can be browsed at https://127.0.0.1:9999.\n\n```bash\nran -cert=/path/to/cert.pem -key=/path/to/key.pem -tls-port=9999\n```\n\nExample 6: Control HTTP and HTTPS traffic\n\nWhen you turn on TLS, you can choose to disable HTTP, redirect HTTP to HTTPS or let them work together.\n\nYou can use `-tls-policy` to control HTTP and HTTPS traffic:\n\n- If set to \"redirect\", all HTTP traffic will be redirect to HTTPS.\n- If set to \"both\", both HTTP and HTTPS are enabled.\n- If set to \"only\", only HTTPS is enabled, HTTP is disabled.\n\nIf not provide `-tls-policy`, the default value \"only\" will be used.\n\nAn example:\n\n```bash\nran -cert=cert.pem -key=key.pem -tls-policy=redirect\n```\n\nExample 7: Create a self-signed certificate and a private key\n\nFor testing purposes or internal usage, you can use `-make-cert` to create a self-signed certificate and a private key.\n\n```bash\nran -make-cert -cert=/path/to/cert.pem -key=/path/to/key.pem\n```\n\n## Tips and tricks\n\n### Execute permission\n\nBefore running Ran binary or build.py, make sure they have execute permission. If don't, use `chmod u+x \u003cfilename\u003e` to set.\n\n### download parameter\n\nIf you add `download` as a query string parameter in the url, the browser will download the file instead of displaying it in the browser window. Example:\n\n```\nhttp://127.0.0.1:8080/readme.html?download\n```\n\n### gzip parameter\n\nGzip compression is enabled by default. Ran will gzip file automaticly according to the file extension. Example: a `.txt` file will be compressed and a `.jpg` file will not.\n\nIf you add `gzip=true` in the url, Ran will force compress the file even if the file should not be compressed. Example:\n\n```\nhttp://127.0.0.1:8080/picture.jpg?gzip=true\n```\n\nIf you add `gzip=false` in the url, Ran will not compress it even if it should be compressed. Example:\n\n```\nhttp://127.0.0.1:8080/large-file.txt?gzip=false\n```\n\nRead the source code of [CanBeCompressed()](https://github.com/m3ng9i/go-utils/blob/master/http/can_be_compressed.go) to learn more about automatic gzip compression.\n\n## Changelog\n\n- **v0.1.3**:\n\n    - Add trailing slash if the request path is a directory and the directory contains a index file.\n    - Add basic auth; add -am, -auth-method option.\n    - Add -sa, -serve-all option to set if skip paths that start with dot.\n    - Print the listening URLs after the server starts.\n\n- **v0.1.2**: Add TLS encryption; add custom 401 file.\n- **v0.1.1**: Fix bugs and typos.\n- **v0.1**: Initial release.\n\n## ToDo\n\nThe following functionalities will be added in the future:\n\n- Load config from file\n- IP filter\n- Custom log format\n- etc\n\n## What's the meaning of Ran\n\nIt's a Chinese PinYin and pronounce 燃, means flame burning.\n\n## Author\n\nmengqi \u003chttps://github.com/m3ng9i\u003e\n\nIf you like this project, please give me a star.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoby%2Fran","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoby%2Fran","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoby%2Fran/lists"}