Coder Social home page Coder Social logo

cachesrv's Introduction

cachesrv - serve working directory

cachesrv is a web server that serves the current working directory using a file cache to speed up commonly-accessed files.

Dependencies

cachesrv is based on a file cache I wrote in Go.

Compatibility

cachesrv has been tested on the following operating systems:

  • OpenBSD (5.2)
  • OS X (10.8)

Installation

go install will install the binary to the ${GOROOT}/bin directory.

Usage

cachesrv [options] [dir]

Valid options:
        -c certfile     specify the TLS certificate
        -d duration     dump cache stats duration; by default, this is turned
                        off. Must be parsable with time.ParseDuration.
        -e seconds      seconds to expire cache items after; 0 to never expire
                        due to time in cache
        -g seconds      seconds to delay between checks for expired items in
                        the cache.
        -k key          specify the TLS key
        -n items        maximum number of files to store in cache
        -p              the port to listen on
        -r              the server should chroot to the target directory
        -u user         the server should drop privileges to this user
        -v              display the version and exit

Specifying a key and certificate will cause the server to listen in TLS mode.

Use ^C to halt the server.

Why require sudo for chroot?

From chroot(2):

 This call is restricted to the super-user.

The server uses root privileges to chroot to the target directory, then immediately drops privileges.

Known bugs / caveats

setgrp isn't implemented here, as no good solution exists in Go.

History

This is version 3.0.0 of the srvwd file server. The original version (the 1.x series) was written in C; a subsequent rewrite in Go (the 2.x series) used only the standard library to serve files. This version, the 3.x series, uses a file cache to speed up commonly accessed files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.