visage

package module
v0.0.0-...-ed0f25c Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

README

visage

GoDoc

Visage is a library that allows services to share file content over the web. It can be integrated directly with existing programs or run as a standalone package.

Integration

The visage package can be used to add the ability to share files based on arbitrary credentials. Application authors can implement a type that satisfies the FileSystem interface (or use the provided Directory type, for local file system access) and then selectively allow access.

Standalone

The standalone binary included in this repository serves as a proof-of-concept implementation. It provides a simple web interface that allows one or more administrators to create shares and assign share ownership to others, who can themselves share individual files or directories with third parties as they please.


This is not an official Google product.

Documentation

Overview

Package visage allows programs to expose files publicly with access control.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAccess = errors.New("access denied")
)

Functions

func Walk

func Walk(fs FileSystem, root string, fn filepath.WalkFunc) error

Walk implements filepath.Walk for the given directory in the given file system, except that it does not know about symlinks because FileSystem does not implement Lstat.

Types

type FileSystem

type FileSystem interface {
	// String is a unique, descriptive identifier for this file system.
	String() string

	// Open the named file for reading.
	Open(path string) (io.ReadCloser, error)

	// Create should return a writer for the given path.  It is left to specific
	// implementations whether they want to allow users to overwrite existing files,
	// or to return an error, or to implement something more sophisticated such as
	// versioning.
	Create(path string) (io.WriteCloser, error)

	// Stat should behave as os.Stat.  If the underlying file system implements
	// symlinks, Stat should follow them and treat them as directories.
	Stat(path string) (os.FileInfo, error)

	// ReadDir should return all the entries in a given directory.
	ReadDir(path string) ([]os.FileInfo, error)
}

FileSystem specifies the abstraction that backends must satisfy.

func NewDirectory

func NewDirectory(path string) FileSystem

NewDirectory creates a FileSystem that serves files with the given path at the root.

func NewEncryptedDirectory

func NewEncryptedDirectory(path string, recipients []*openpgp.Entity, signer *openpgp.Entity) FileSystem

NewEncryptedDirectory returns a FileSystem that serves files from the given root. Files are encrypted on disk, and optionally signed. Files are automatically decrypted when read.

type Share

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

func New

func New() *Share

func (*Share) AddFileSystem

func (s *Share) AddFileSystem(fs FileSystem) error

func (*Share) AddOK

func (s *Share) AddOK(fs string, ok okay.OK) error

func (*Share) FileSystem

func (s *Share) FileSystem(fs string) (FileSystem, error)

func (*Share) FileSystems

func (s *Share) FileSystems() []string

func (*Share) View

func (s *Share) View(fs string) (*View, error)

type View

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

func (View) List

func (v View) List(ctx context.Context) ([]string, error)

func (View) Open

func (v View) Open(ctx context.Context, path string) (io.ReadCloser, error)

func (View) ReadDir

func (v View) ReadDir(ctx context.Context, path string) ([]os.FileInfo, error)

Directories

Path Synopsis
bin
visage
Visage is a very simple implementation of the visage library with the bad web UI.
Visage is a very simple implementation of the visage library with the bad web UI.
oauth2
github
Package github provides OKs and tokens for GitHub authentication.
Package github provides OKs and tokens for GitHub authentication.
google
Package google provides OKs and tokens for Google Single-Sign On.
Package google provides OKs and tokens for Google Single-Sign On.
Package token implements a token-based OK.
Package token implements a token-based OK.
Package web implements a simple web UI for visage.
Package web implements a simple web UI for visage.

Jump to

Keyboard shortcuts

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