gateway

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2018 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchTLSCertificate

func FetchTLSCertificate(domain string, cacheDir string) (string, string, error)

FetchTLSCertificate will use the ACME protocol and LetsEncrypt to download a certificate to the user's cache dir automatically. This either needs rights to bind :80 (i.e. sudo) or the right capabilities (i.e. sudo setcap CAP_NET_BIND_SERVICE=+ep ~/go/bin/brig)

func UserCacheDir

func UserCacheDir() (string, error)

UserCacheDir is the same as os.UserCacheDir from go1.11, but taken from the standard library. This way it also works for go1.9 and go1.10.

This method should be replaced by os.UserCacheDir by go1.13.

Types

type Backend

type Backend interface {
	Stat(nodePath string) (*catfs.StatInfo, error)
	Cat(nodePath string) (mio.Stream, error)
	Tar(nodePath string, w io.Writer) error
}

Backend is the backend that the gateway uses to output files. This is conviniently the same API as catfs.FS, but useful for testing purposes to separate this.

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway is a small HTTP server that is able to serve files from brig over HTTP. This can be used to share files inside of brig with users that do not use brig.

func NewGateway

func NewGateway(backend Backend, cfg *config.Config) *Gateway

NewGateway returns a newly built gateway. This function does not yet start a server.

func (*Gateway) ServeHTTP

func (gw *Gateway) ServeHTTP(rw http.ResponseWriter, rq *http.Request)

func (*Gateway) Start

func (gw *Gateway) Start()

Start will start the gateway. If the gateway is not enabled in the config, this does nothing. The gateway is started in the background, this method does not block.

func (*Gateway) Stop

func (gw *Gateway) Stop() error

Stop stops the gateway gracefully.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL