Documentation ¶
Index ¶
- Constants
- Variables
- func AttachAndExec(containerID string, bashcmd []string) error
- func AttachAndRun(containerID string, bashcmd []string) ([]byte, error)
- func Base62(n uint) string
- func CipherSuites(connectionType string) []uint16
- func CipherSuitesByName(c *tls.Config) []string
- func CompareVersions(v1, v2 string) int
- func ConvertUp(oldNumber string, baseAlphabet string) string
- func DockerIsLoggedIn() bool
- func ExecDockerExec(containerID string, bashcmd []string) error
- func GetCipherName(cipher uint16) string
- func GetDefaultCiphers(connectionType string) []string
- func GetExitStatus(err error) (int, bool)
- func GetGateway(defaultRPCPort int) string
- func GetIPAddress() (ip string, err error)
- func GetIPv4Addresses() (ips []string, err error)
- func GetMemorySize() (size uint64, err error)
- func HostID() (hostid string, err error)
- func InterfaceArrayToStringArray(inArray []interface{}) ([]string, bool)
- func IsNFSMountStale(mountpoint string) bool
- func Isatty(f *os.File) bool
- func LocalDir(p string) string
- func LockFile(filelockpath string) (*os.File, error)
- func MinTLS(connectionType string) uint16
- func NewUUID() (string, error)
- func NewUUID36() (string, error)
- func NewUUID62() (string, error)
- func PackTCPAddress(ip string, port uint16) ([]byte, error)
- func PackTCPAddressString(address string) ([]byte, error)
- func ParseEngineeringNotation(in string) (uint64, error)
- func ParsePercentage(in string, value uint64) (uint64, error)
- func ResourcesDir() string
- func RunDockerExec(containerID string, bashcmd []string) ([]byte, error)
- func RunTTL(ttl TTL, cancel <-chan interface{}, min, max time.Duration)
- func ServiceDHome() string
- func ServicedLogDir() string
- func SetCiphers(connectionType string, cipherNames []string) error
- func SetMinTLS(connectionType string, version string) error
- func SetSysctl(key string, value string) ([]byte, error)
- func ShellQuoteArg(arg string) string
- func ShellQuoteArgs(args []string) string
- func StringInSlice(a string, list []string) bool
- func StringSliceEquals(lhs []string, rhs []string) bool
- func TempDir(p string) string
- func UnpackTCPAddress(packed []byte) (ip string, port uint16)
- func UnpackTCPAddressToString(packed []byte) string
- type ChannelCond
- type Clock
- type ConfigReader
- type ConfigValue
- type DockerExecError
- type EngNotation
- type EnvironConfigReader
- func (p *EnvironConfigReader) BoolVal(name string, defaultval bool) bool
- func (p *EnvironConfigReader) Float64Val(name string, defaultval float64) float64
- func (p *EnvironConfigReader) GetConfigValues() map[string]ConfigValue
- func (p *EnvironConfigReader) IntVal(name string, defaultval int) int
- func (p *EnvironConfigReader) StringNumberedList(name string, defaultval []string) []string
- func (p *EnvironConfigReader) StringSlice(name string, defaultval []string) []string
- func (p *EnvironConfigReader) StringVal(name string, defaultval string) string
- type ExecError
- type LinuxMount
- type MountInfo
- type MountProc
- type MutexMap
- type ParseError
- type RouteEntry
- type TTL
- type TestClock
- type URL
- type ValueChangePublisher
Constants ¶
const ( Rhel = iota Debian Darwin )
const DefaultProcMount = "/proc/mounts"
const DefaultTLSMinVersion = "VersionTLS10"
DefaultTLSMinVersion minimum TLS version supported
const LOGSTASH_CONTAINER_DIRECTORY = "/usr/local/serviced/resources/logstash"
The container-local path to the directory for logstash/filebeat configuration. This directory is bind mounted into both isvcs and service containers
const LOGSTASH_LOCAL_SERVICED_LOG_DIR = "/var/log/serviced"
The container-local path to the directory logstash uses to write application audit logs
const RESOURCES_CONTAINER_DIRECTORY = "/usr/local/serviced/resources"
The container-local path to the resources directory. This directory is bind mounted into both isvcs and service containers
Variables ¶
var ( // ErrInvalidTCPAddress is thrown when a specified address can't be packed ErrInvalidTCPAddress = errors.New("Invalid TCP address") )
var (
ErrParseMount = errors.New("could not parse mount data")
)
var Platform = determinePlatform()
Functions ¶
func AttachAndExec ¶
AttachAndExec attaches to a container and execs the command
func AttachAndRun ¶
AttachAndRun attaches to a container and runs the command
func CipherSuites ¶
CipherSuites the ciphers that can be sued
func CipherSuitesByName ¶
func CompareVersions ¶
Compare two version strings by splitting by '.', making the slices the same length, then padding the strings with 0's. The string comparison will now work against numeric versioning, as well as "1.5.2b1" style strings.
func DockerIsLoggedIn ¶
func DockerIsLoggedIn() bool
func ExecDockerExec ¶
ExecDockerExec execs the command using docker exec
func GetDefaultCiphers ¶
GetDefaultCiphers returns the default tls ciphers
func GetExitStatus ¶
GetExitStatus tries to extract the exit code from an error
func GetIPAddress ¶
GetIPAddress attempts to find the IP address to the default outbound interface.
func GetIPv4Addresses ¶
GetIPAddresses returns a list of all IPv4 interface addresses
func GetMemorySize ¶
GetMemorySize attempts to get the size of the installed RAM.
func InterfaceArrayToStringArray ¶
Extract all strings from an array of interfaces. If the input array contains items that are not strings, set the output flag (allConverted) to false.
func IsNFSMountStale ¶
func LocalDir ¶
LocalDir gets the absolute path to a particular directory under ServiceDHome if SERVICED_HOME is not defined then we use the location of the caller
func LockFile ¶
LockFile opens and locks the file at the given path - it will block and wait for unlock
func PackTCPAddress ¶
PackTCPAddress packs a TCP address (IP and port) to 6 bytes
func PackTCPAddressString ¶
PackTCPAddressString packs a TCP address represented as a string ("IP:port") to 6 bytes
func ResourcesDir ¶
func ResourcesDir() string
ResourcesDir points to internal services resources directory
func RunDockerExec ¶
RunDockerExec runs the command using docker exec
func ServiceDHome ¶
func ServiceDHome() string
ServiceDHome gets the home location of serviced by looking at the environment
func SetCiphers ¶
SetCiphers that can be used
func ShellQuoteArgs ¶
Quote a list of arguments and join them with spaces
func StringInSlice ¶
StringInSlice test if a string exists in a slice
func StringSliceEquals ¶
StringSliceEquals compare two string slices for equality
func UnpackTCPAddress ¶
UnpackTCPAddress unpacks a 6-byte representation of a TCP address produced by PackTCPAddress into an IP and port
func UnpackTCPAddressToString ¶
UnpackTCPAddressToString unpacks a 6-byte representation of a TCP address produced by PackTCPAddress into a string of the format "IP:port"
Types ¶
type ChannelCond ¶
ChannelCond provides functionality similar to sync.Cond, but is backed by channels instead of a mutex, allowing it to support timeouts and cancellation.
func (*ChannelCond) Broadcast ¶
func (c *ChannelCond) Broadcast()
Broadcast notifies all waiting goroutines that this condition has been satisfied
func (*ChannelCond) Wait ¶
func (c *ChannelCond) Wait() <-chan struct{}
Wait returns a channel that will close when the condition is satisfied.
type ConfigReader ¶
type ConfigReader interface { StringVal(key, dflt string) string StringSlice(key string, dflt []string) []string StringNumberedList(key string, dflt []string) []string IntVal(key string, dflt int) int BoolVal(key string, dflt bool) bool GetConfigValues() map[string]ConfigValue Float64Val(key string, dflt float64) float64 }
type ConfigValue ¶
type DockerExecError ¶
An error type for failed docker exec attempts.
func (DockerExecError) Error ¶
func (err DockerExecError) Error() string
type EngNotation ¶
type EngNotation struct { Value uint64 // contains filtered or unexported fields }
Structure used for serializing/deserializing values represented as strings in engineering notation (e.g., 1K, 256M, etc.)
func NewEngNotation ¶
func NewEngNotation(value int64) EngNotation
func NewEngNotationFromString ¶
func NewEngNotationFromString(in string) (EngNotation, error)
func (EngNotation) MarshalJSON ¶
func (i EngNotation) MarshalJSON() (text []byte, err error)
func (*EngNotation) UnmarshalJSON ¶
func (e *EngNotation) UnmarshalJSON(b []byte) (err error)
type EnvironConfigReader ¶
type EnvironConfigReader struct {
// contains filtered or unexported fields
}
func NewEnvironConfigReader ¶
func NewEnvironConfigReader(filename, prefix string) (*EnvironConfigReader, error)
func NewEnvironOnlyConfigReader ¶
func NewEnvironOnlyConfigReader(prefix string) *EnvironConfigReader
NewEnvironOnlyConfigReader creates an EnvironConfigReader without parsing a file first.
func (*EnvironConfigReader) BoolVal ¶
func (p *EnvironConfigReader) BoolVal(name string, defaultval bool) bool
func (*EnvironConfigReader) Float64Val ¶
func (p *EnvironConfigReader) Float64Val(name string, defaultval float64) float64
func (*EnvironConfigReader) GetConfigValues ¶
func (p *EnvironConfigReader) GetConfigValues() map[string]ConfigValue
func (*EnvironConfigReader) IntVal ¶
func (p *EnvironConfigReader) IntVal(name string, defaultval int) int
func (*EnvironConfigReader) StringNumberedList ¶
func (p *EnvironConfigReader) StringNumberedList(name string, defaultval []string) []string
func (*EnvironConfigReader) StringSlice ¶
func (p *EnvironConfigReader) StringSlice(name string, defaultval []string) []string
type LinuxMount ¶
type LinuxMount struct {
ProcMount string
}
LinuxMount loads mount data from a file
func (*LinuxMount) IsMounted ¶
func (m *LinuxMount) IsMounted(path string) (bool, error)
IsMounted returns true if path is a mountpoint or device
func (*LinuxMount) ListAll ¶
func (m *LinuxMount) ListAll() (mounts []MountInfo, err error)
ListAll returns info on all mount points
func (*LinuxMount) Unmount ¶
func (m *LinuxMount) Unmount(path string) error
Unmount unmounts a device or mountpoint
type MountInfo ¶
type MountInfo struct { Device string MountPoint string FSType string Options []string Dump int Fsck int }
MountInfo is the object describing the mount point
type MountProc ¶
type MountProc interface { ListAll() ([]MountInfo, error) IsMounted(string) (bool, error) Unmount(string) error }
MountProc manages mount info
func GetDefaultMountProc ¶
func GetDefaultMountProc() MountProc
GetDefaultMountProc returns the default mount process manager
type ParseError ¶
type ParseError struct {
String string
}
func (ParseError) Error ¶
func (err ParseError) Error() string
type RouteEntry ¶
type RouteEntry struct { Destination string Gateway string Genmask string Flags string Metric int Ref int Use int Iface string }
RouteEntry represents a entry from the route command
func RouteCmd ¶
func RouteCmd() (routes []RouteEntry, err error)
RouteCmd wrapper around the route command
type TTL ¶
type TTL interface { // Name identifies the TTL instance Name() string // Purge purges expired data from source Purge(time.Duration) (time.Duration, error) }
TTL manages time-to-live data
type TestClock ¶
func NewBufferedTestClock ¶
func NewBufferedTestClock() TestClock
func NewTestClock ¶
func NewTestClock() TestClock
type ValueChangePublisher ¶
type ValueChangePublisher struct {
// contains filtered or unexported fields
}
ValueChangePublisher allows for subscribers to be notified upon change of a value.
func NewValueChangePublisher ¶
func NewValueChangePublisher(initialValue interface{}) ValueChangePublisher
Returns a new ValueChangePublisher
func (*ValueChangePublisher) Get ¶
func (v *ValueChangePublisher) Get() (interface{}, <-chan struct{})
Get returns the current value of the publisher and a channel that will be closed when the value changes.
func (*ValueChangePublisher) Set ¶
func (v *ValueChangePublisher) Set(value interface{})
Set closes the current channel notifying current subscribers of a change and stores the value.