config

package
v0.0.0-...-b0038d1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GLOBAL = iota
	GROUP  = iota
	USER   = iota
)
View Source
const (
	NOT_SET = 0
	OFF     = 1
	ON      = 2
	ALL     = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSConfig

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

func NewAWSConfig

func NewAWSConfig(s3bucket, prefix string) (*AWSConfig, error)

func (*AWSConfig) FetchFile

func (c *AWSConfig) FetchFile(key string, ifNotTag string) (io.ReadCloser, string, error)

func (*AWSConfig) FetchGroup

func (c *AWSConfig) FetchGroup(name string) ([]string, error)

func (*AWSConfig) FetchGroupsForUser

func (c *AWSConfig) FetchGroupsForUser(user string) ([]string, error)

func (*AWSConfig) FetchKey

func (c *AWSConfig) FetchKey(user, alias string) ([]byte, error)

func (*AWSConfig) FetchKeys

func (c *AWSConfig) FetchKeys(user string) ([]string, error)

func (*AWSConfig) FetchNetworkInfo

func (c *AWSConfig) FetchNetworkInfo() (*NetworkInfo, error)

func (*AWSConfig) PutFile

func (c *AWSConfig) PutFile(key string, data []byte) error

func (*AWSConfig) RegisterDNS

func (c *AWSConfig) RegisterDNS(zone, name string, weighted bool) error

func (*AWSConfig) UnregisterDNS

func (c *AWSConfig) UnregisterDNS() error

type ConfigFile

type ConfigFile struct {
	WatchTime       *time.Duration
	Network         *net.IPNet
	Route53Zone     string
	DomainName      string
	Route53Weighted bool
	KeyStrength     int
	GlobalConfig    *SectionConfig
	Groups          map[string]*SectionConfig
	Users           map[string]*SectionConfig
}

func ParseConfig

func ParseConfig(reader io.Reader) (*ConfigFile, error)

func (*ConfigFile) GetUserConfig

func (config *ConfigFile) GetUserConfig(user string, groups []string, netinfo *NetworkInfo) (*UserConfig, error)

func (*ConfigFile) String

func (config *ConfigFile) String() string

type ConfigFlag

type ConfigFlag byte

func (ConfigFlag) String

func (flag ConfigFlag) String() string

type ConfigStatement

type ConfigStatement struct {
	SectionType string
	SectionName string
	Word        string
	Fields      []string
	Line        int
}

type ConfigurationBackend

type ConfigurationBackend interface {
	FetchFile(path string, ifNotTag string) (reader io.ReadCloser, tag string, err error)
	PutFile(path string, data []byte) error
	FetchNetworkInfo() (*NetworkInfo, error)
	FetchGroup(name string) ([]string, error)
	FetchGroupsForUser(user string) ([]string, error)
	FetchKeys(user string) ([]string, error)
	FetchKey(user, key string) ([]byte, error)
	RegisterDNS(zone, name string, weighted bool) error
	UnregisterDNS() error
}

type LocalConfig

type LocalConfig struct {
	Root string
}

func (*LocalConfig) FetchFile

func (c *LocalConfig) FetchFile(path string, ifNotTag string) (io.ReadCloser, string, error)

func (*LocalConfig) FetchGroup

func (c *LocalConfig) FetchGroup(name string) ([]string, error)

func (*LocalConfig) FetchGroupsForUser

func (c *LocalConfig) FetchGroupsForUser(user string) ([]string, error)

func (*LocalConfig) FetchKey

func (c *LocalConfig) FetchKey(user string, key string) ([]byte, error)

func (*LocalConfig) FetchKeys

func (c *LocalConfig) FetchKeys(user string) ([]string, error)

func (*LocalConfig) FetchNetworkInfo

func (c *LocalConfig) FetchNetworkInfo() (*NetworkInfo, error)

func (*LocalConfig) PutFile

func (c *LocalConfig) PutFile(path string, data []byte) error

func (*LocalConfig) RegisterDNS

func (c *LocalConfig) RegisterDNS(zone, name string, weighted bool) error

func (*LocalConfig) UnregisterDNS

func (c *LocalConfig) UnregisterDNS() error

type NetworkInfo

type NetworkInfo struct {
	Subnets map[string]net.IPNet
	NAT     []net.IPNet
}

type Parser

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

func Open

func Open(data io.Reader) *Parser

func (*Parser) Read

func (p *Parser) Read() (*ConfigStatement, error)

type Route

type Route struct {
	Network net.IPNet
	Ports   []uint16
}

func (Route) String

func (route Route) String() string

type SectionConfig

type SectionConfig struct {
	Type       SectionType
	Name       string
	Order      int
	Subnets    []Subnet
	Routes     []Route
	NATRoutes  []Route
	NATSetting ConfigFlag
	DNSSetting ConfigFlag
}

func (*SectionConfig) String

func (section *SectionConfig) String() string

type SectionType

type SectionType byte

type Subnet

type Subnet struct {
	Name  string
	Ports []uint16
}

func (Subnet) String

func (subnet Subnet) String() string

type UserConfig

type UserConfig struct {
	DNSSetting ConfigFlag
	Routes     []UserRoute
}

type UserRoute

type UserRoute struct {
	Network net.IPNet
	Ports   []uint16
}

Jump to

Keyboard shortcuts

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