control

package
v0.0.0-...-dd7ab19 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseDirectory           = "data" // configurable base directory where records are cached
	GitDatastoreURL         = ""
	MasterEthIface          = ""
	DefaultInterval         = 20                                  // time in seconds
	DefaultIntervalMin      = 10                                  // time in seconds
	EndpointBase            = BaseDirectory + "/endpoints"        // .old and .new are appended to this
	EndpointPushRoot        = BaseDirectory + "/config"           // new endpoints push their conf from here
	EndpointPushSubDir      = BaseDirectory + "/config/endpoints" // new endpoint sources here
	DefaultBackupPath       = BaseDirectory + "/snapshots"        // backup path for configs
	EndpointStoreLatestRoot = EndpointBase + ".latest"            // latest pull from the git repository
	EndpointStoreOldRoot    = EndpointBase + ".old"               // latest pull from the git repository
	EndpointStoreLatest     = EndpointStoreLatestRoot + "/endpoints"
	EndpointStoreOld        = EndpointStoreOldRoot + "/endpoints"
)

Exported default configurations values

Functions

func AddRoute

func AddRoute(neighborNetwork *net.IPNet, nextHop net.IP, iface netlink.Link) error

AddHostRoute adds a host-scoped route to a device.

func AnnounceEndpoint

func AnnounceEndpoint(networkCidr *net.IPNet, hostIface, gitRepoURL string)

AnnounceEndpoint takes libnetwork endpoint data writes it to a json file and pushes it to a Git repo for distribution

func CopyFile

func CopyFile(dstName, srcName string) (written int64, err error)

func CreatePaths

func CreatePaths(path string) error

func DeleteDir

func DeleteDir(path string) error

func DiffDirectories

func DiffDirectories(previousRecords, latestRecords string) (removed, added []string, err error)

func DirectoryList

func DirectoryList(basedir string) ([]string, error)

func FileModifiedCompare

func FileModifiedCompare(slice1 []string, slice2 []string) []string

func MakeAbs

func MakeAbs(fpath string) string

func RecursiveDirectoryList

func RecursiveDirectoryList(basedir string) ([]string, error)

func Run

func Run(gitURL, masterIface string, timeInterval int, daemon bool)

Types

type ControlConfig

type ControlConfig struct {
	Repo         string // URL for git repo.
	TimeInterval int    // time between checking repo for endpoint updates
	BaseDir      string // base cache directory
	MasterIface  string // master netlink iface "ethX"
}

Useful or not, on the fence

func (*ControlConfig) GetBasePath

func (g *ControlConfig) GetBasePath() string

func (*ControlConfig) GetRepo

func (g *ControlConfig) GetRepo() string

GetParam accessors

func (*ControlConfig) GetTimeInterval

func (g *ControlConfig) GetTimeInterval() int

func (*ControlConfig) Process

func (g *ControlConfig) Process()

func (*ControlConfig) Read

func (g *ControlConfig) Read()

Run the daemon

func (*ControlConfig) String

func (g *ControlConfig) String() string

type GitCmd

type GitCmd struct {
	Dir string
}

Git commands

type LocalEndpoint

type LocalEndpoint struct {
	Endpoint string `json:"Endpoint"`
	Network  string `json:"Network"`
	Meta     string `json:"Meta"`
}

type Node

type Node struct {
	Endpoint string
	Network  string
	Meta     string
	SegID    int
}

todo: unused implement

type NodeEvent

type NodeEvent int
const (
	EVENT_PREFIX_BEST NodeEvent
	EVENT_PREFIX_WITHDRAWN
	EVENT_NODE_JOIN
	EVENT_NODE_REMOVE
	EVENT_NODE_MODIFIED
)

type NodeState

type NodeState struct {
	GitPoints   []string // fancy play on the word endpoint
	FileRecords []string
}

func NewNodeState

func NewNodeState(endpoints, fileRecords []string) *NodeState

Jump to

Keyboard shortcuts

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