utils

package
v0.3.11-8 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FileModeDir           = os.FileMode(0755)
	FileModeFile          = os.FileMode(0644)
	FileModeFileExec      = os.FileMode(0755)
	FileModeDirSensitive  = os.FileMode(0700)
	FileModeFileSensitive = os.FileMode(0600)
)
View Source
const (
	ConfigDirMode = os.FileMode(0755)
)
View Source
const HaproxyCfgExt = "cfg"

Variables

This section is empty.

Functions

func DirStagingToFinal

func DirStagingToFinal(s string) string

func HaproxyBalanceAlgorithm

func HaproxyBalanceAlgorithm(scheduler string) (balance string, err error)

func HaproxyConfigHttpCheck

func HaproxyConfigHttpCheck(uri, domain string) string

func HaproxyConfigHttpCheckExpect

func HaproxyConfigHttpCheckExpect(s string) string

func HaproxySendProxy

func HaproxySendProxy(s string) (r string, err error)

func KeepalivedConfHexQuote

func KeepalivedConfHexQuote(s string) string

func KeepalivedConfQuoteScriptArgs

func KeepalivedConfQuoteScriptArgs(args []string) string

func WritePidFile

func WritePidFile(pid int, pidFile string) error

Types

type ConfigDirManager

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

func NewConfigDirManager

func NewConfigDirManager(baseDir string) *ConfigDirManager

TODO

  • set active

func (*ConfigDirManager) MostRecentSubdir

func (m *ConfigDirManager) MostRecentSubdir() string

func (*ConfigDirManager) NewDir

func (m *ConfigDirManager) NewDir(f DirFunc) (finalDir string, err error)

call f() inside 20180830.104050.333.lbcorpus.json.staging move to final name 20180830.104050.333.lbcorpus.json

func (*ConfigDirManager) Prune

func (m *ConfigDirManager) Prune(nRetain int) error

type DirFunc

type DirFunc func(string) error

type HaproxySslPolicyParams

type HaproxySslPolicyParams struct {
	SslMinVer string
	Ciphers   string
}

func HaproxySslPolicy

func HaproxySslPolicy(policy string) *HaproxySslPolicyParams

TODO restrict ciphers as noted in https://help.aliyun.com/document_detail/90740.html

type PidFile

type PidFile struct {
	Path string
	Comm string
}

func NewPidFile

func NewPidFile(path, comm string) *PidFile
func (pf *PidFile) ConfirmOrUnlink() (proc *os.Process, confirmed bool, err error)

ConfirmedOrUnlink reads the pidfile, confirm that it's running and comm matches pf.Comm

When confirmed is true, proc must be non-nil

Jump to

Keyboard shortcuts

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