config

package
v0.0.0-...-c675715 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLoader

type ConfigLoader func() (Configuration, error)

ConfigLoader is a function that can load a configuration from specific manner, i.e. NewYamlConfigLoader

func NewYamlConfigLoader

func NewYamlConfigLoader(filename string) ConfigLoader

NewYamlConfigLoader returns a loader for a given YAML configuration file

type Configuration

type Configuration interface {
	Sites() []Site
	Index() bool
	Port() uint16
}

Configuration represents the setup of the whole GGSP

type ConfigurationYaml

type ConfigurationYaml struct {
	PortField  uint16      `yaml:"port"`
	SitesField []*SiteYaml `yaml:"sites"`
	IndexField bool        `yaml:"index"`
}

ConfigurationYaml is a structure that will be automatically populated with the value of the configuration

func (*ConfigurationYaml) Index

func (config *ConfigurationYaml) Index() bool

Index returns true if an index should be displayed when neither a host or a redirect was found

func (*ConfigurationYaml) Port

func (config *ConfigurationYaml) Port() uint16

Port return the port to which the daemon will listen to

func (*ConfigurationYaml) Sites

func (config *ConfigurationYaml) Sites() []Site

Sites returns the list of sites

type FrontProxyYaml

type FrontProxyYaml struct {
	ForceSSL bool   `yaml:"forcessl"`
	IPHeader string `yaml:"ipheader"`
}

FrontProxyYaml is a structure that will be automatically populated with the value of the configuration

type Site

type Site interface {
	Ref() string
	Host() string
	Description() string
	Redirects() []string
	Language() string
	KeepLinks() bool
	FaviconPath() string
	GRef() string

	IPHeader() string
}

Site represents the settings of a specific site

type SiteYaml

type SiteYaml struct {
	RefField         string          `yaml:"ref"`
	HostField        string          `yaml:"host"`
	DescriptionField string          `yaml:"description"`
	RedirectsField   []string        `yaml:"redirects"`
	LanguageField    string          `yaml:"language"`
	KeepLinksField   bool            `yaml:"keeplinks"`
	FaviconPathField string          `yaml:"faviconpath"`
	FrontProxyField  *FrontProxyYaml `yaml:"frontproxy"`
}

SiteYaml is a structure that will be automatically populated with the value of the configuration

func (*SiteYaml) Description

func (site *SiteYaml) Description() string

Description returns a string describing the content of the site

func (*SiteYaml) FaviconPath

func (site *SiteYaml) FaviconPath() string

FaviconPath returns the path to the favicon file. No file is assumed if the string is empty

func (*SiteYaml) GRef

func (site *SiteYaml) GRef() string

GRef returns a consistent reference to the Google Sites instance

func (*SiteYaml) Host

func (site *SiteYaml) Host() string

Host returns the host that is supposed to handle respond for this site

func (*SiteYaml) IPHeader

func (site *SiteYaml) IPHeader() string

IPHeader returns the HTTP header containing the ip of the requester, if empty this information will be taken from the connection directly

func (site *SiteYaml) KeepLinks() bool

KeepLinks returns true if links should be kept

func (*SiteYaml) Language

func (site *SiteYaml) Language() string

Language returns the HTTP header used to query Google servers

func (*SiteYaml) Redirects

func (site *SiteYaml) Redirects() []string

Redirects returns a list of hostname that should redirect their traffic to the host

func (*SiteYaml) Ref

func (site *SiteYaml) Ref() string

Ref returns the Google Sites reference of the websites

Jump to

Keyboard shortcuts

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