network

package
v0.0.0-...-bd03ed3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package network handles the network config file.

Index

Constants

View Source
const DefaultPath = "/etc/tsp-controller/network"

Variables

View Source
var (
	// DefaultConfig is the default configuration, served in absence of the config file.
	DefaultConfig = defaultConfig()

	// DefaultRestrictions is the default resrict ruleset of Config. It is effective in absence
	// of ruleset in the config file, or in absence of the config file itself. In this mode,
	// controller's scope is maximal: it handles every declared host.
	DefaultRestrictions = []*Restriction{
		{Host: regexp.MustCompile(".")},
	}
)

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	Host string `xml:"host,attr"`
}

Aggregator specifies the aggregator node, a node that exports the indirect site feed.

type Config

type Config struct {

	// Network topology.
	Aggregator *Aggregator
	Subscriber []*Subscriber
	// contains filtered or unexported fields
}

Config contains network configuration details.

func ReadFile

func ReadFile(path string) (*Config, error)

func (*Config) InScope

func (c *Config) InScope(host string) bool

InScope reports if the given hostname is in scope.

func (*Config) UnmarshalXML

func (c *Config) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type Restriction

type Restriction struct {
	Host *regexp.Regexp
}

A Restriction is a rule used to reduce scope of the controller.

func (*Restriction) UnmarshalXML

func (r *Restriction) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type Subscriber

type Subscriber struct {
	ID     string `xml:"id,attr"`
	Host   string `xml:"host,attr"`
	Direct bool   `xml:"direct,attr"`
	Dedup  bool   `xml:"dedup,attr"`
}

Subscriber represents a consumer of the site feed. The feed arrives in the aggregated form (unless Direct is true), and without any pre-processing (unless Dedup is true).

Jump to

Keyboard shortcuts

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