Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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
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.
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 ¶
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 ¶
AllowNetwork adds a network definition (CIDR format) to the list of allowed networks
func (*NetFilter) FilterHandler ¶
FilterHandler wraps and limits access to an http.Handler with the help of a NetFilter