Documentation ¶
Index ¶
- Constants
- Variables
- func GetConfigPath() string
- func GetSysConfigPath() (string, error)
- func GetSysHomePath() (string, error)
- func GetSysTargetPath() string
- func GetTargetPath() string
- func MergeHosts(hosts ...HostStruct) string
- type App
- type Config
- type HostEntry
- type HostFile
- type HostFileRemote
- type HostGroup
- type HostNode
- type HostScope
- type HostStruct
Constants ¶
View Source
const CONFIG_DIRECTORY = ".ghosts"
View Source
const EOL = "\n"
View Source
const HostLineRegex = `^([a-zA-Z0-9\._-]+)\s+([a-zA-Z0-9\._-]+)$`
View Source
const ValidHostnameRegex = `^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9_\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9_\-]*[A-Za-z0-9])$`
View Source
const ValidIpAddressRegex = `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`
http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address
Variables ¶
View Source
var Environment = struct { ConfigPath string TargetPath string }{}
Global environment
View Source
var HostLineRegexCompile *regexp.Regexp
View Source
var ValidHostnameRegexCompile *regexp.Regexp
View Source
var ValidIpAddressRegexCompile *regexp.Regexp
Functions ¶
func GetConfigPath ¶
func GetConfigPath() string
func GetSysConfigPath ¶
func GetSysHomePath ¶
Get home dir of current user (or sudo_user)
func GetSysTargetPath ¶
func GetSysTargetPath() string
func GetTargetPath ¶
func GetTargetPath() string
func MergeHosts ¶
func MergeHosts(hosts ...HostStruct) string
Types ¶
type Config ¶
type Config struct { Path string // contains filtered or unexported fields }
type HostEntry ¶
Simple entry node
func (*HostEntry) GetList ¶
func (this *HostEntry) GetList() []HostStruct
type HostFile ¶
type HostFile struct { FilePath string // contains filtered or unexported fields }
The file node
func (*HostFile) GetList ¶
func (this *HostFile) GetList() []HostStruct
type HostFileRemote ¶
type HostFileRemote struct { FileUrl string // contains filtered or unexported fields }
The remote file node
func (*HostFileRemote) GetList ¶
func (this *HostFileRemote) GetList() []HostStruct
func (*HostFileRemote) GetRaw ¶
func (this *HostFileRemote) GetRaw() string
func (*HostFileRemote) Validate ¶
func (this *HostFileRemote) Validate() error
type HostGroup ¶
type HostGroup struct {
Children []HostNode
}
func (*HostGroup) GetList ¶
func (this *HostGroup) GetList() []HostStruct
type HostNode ¶
type HostNode interface { Validate() error GetList() []HostStruct GetRaw() string }
type HostScope ¶
type HostScope struct { Scope string // contains filtered or unexported fields }
The scope node, could be content of a host file
func (*HostScope) GetList ¶
func (this *HostScope) GetList() []HostStruct
type HostStruct ¶
Click to show internal directories.
Click to hide internal directories.