snappy

package
v0.0.0-...-6d4f196 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDataPathNotSet indicates that SNAP_DATA has not been set by the
	// launching system.
	ErrDataPathNotSet = errors.New("package data path not set")
	// ErrOnIconDataPathSet indicates that there has been an error when setting up
	// the location where icons are going to be saved.
	ErrOnIconDataPathSet = errors.New("cannot prepare icon data path")
	// ErrIconNotExist happens when the package has no icon.
	ErrIconNotExist = errors.New("the icon does not exist")
)

Functions

func IconDir

func IconDir() (dataPath, relativeBasePath string, err error)

IconDir returns information to properly serve package icons with an http.FileServer

Types

type Config

type Config struct {
	DisableAccessToken bool     `json:"disableAccessToken,omitempty"`
	DisableHTTPS       bool     `json:"disableHttps,omitempty"`
	DisableIPFilter    bool     `json:"disableIPFilter,omitempty"`
	AllowNetworks      []string `json:"allowNetworks,omitempty"`
	AllowInterfaces    []string `json:"allowInterfaces,omitempty"`
}

Config described the runtime configuration

func ReadConfig

func ReadConfig() (Config, error)

ReadConfig loads the configuration from disk

type Handler

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

Handler implements snappy's packages api.

func NewHandler

func NewHandler() *Handler

NewHandler creates an instance that implements snappy's packages api.

func (*Handler) MakeMuxer

func (h *Handler) MakeMuxer(prefix string, parentRouter *mux.Router) http.Handler

MakeMuxer sets up the handlers multiplexing to handle requests against snappy's packages api

type NetFilter

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

NetFilter manages an IP-based filter to limit access to Snapweb

func NewFilter

func NewFilter() *NetFilter

NewFilter creates a new empty NetFilter to block all connections by default

func (*NetFilter) AddLocalNetworkForInterface

func (f *NetFilter) AddLocalNetworkForInterface(ifname string)

AddLocalNetworkForInterface adds the network for a given interface to the list of allowed networks

func (*NetFilter) AddLocalNetworks

func (f *NetFilter) AddLocalNetworks()

AddLocalNetworks enumerates local interfaces and adds the networks they belong to to the list of allowed networks. This essentially says: connections originating from any of the local networks are authorized, anything else is refused

func (*NetFilter) AllowNetwork

func (f *NetFilter) AllowNetwork(network string) error

AllowNetwork adds a network definition (CIDR format) to the list of allowed networks

func (*NetFilter) FilterHandler

func (f *NetFilter) FilterHandler(handler http.Handler) http.Handler

FilterHandler wraps and limits access to an http.Handler with the help of a NetFilter

func (*NetFilter) IsAllowed

func (f *NetFilter) IsAllowed(ip net.IP) bool

IsAllowed verifies if an IP is allowed to access Snapweb

type SnapState

type SnapState struct {
	Status      string `json:"status"`
	TaskSummary string `json:"task_summary"`
	LocalSize   uint64 `json:"local_size,omitempty"`
}

SnapState wraps the current state of a snap

Jump to

Keyboard shortcuts

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