services

package module
v0.0.0-...-10f35ca Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 27 Imported by: 8

README

Services collection

Introduction

This project contains a set of services used for programming

  • authorization and authentication
  • services creating runlevel daemons
  • pid file creation

PID file

Following method will create a pid file

err:=CreatePidFile("file.pid)

Read of PID file with

err:=ReadPidFile("file.pid)

Delete of PID file with

err:=DeletePidFile("file.pid)

Authentication

  • Login parameters for different password checks
    • Realm password file
    • PAM authentication
    • LDAP password checks
    • [Open] First OpenID implementation started
    • Database authentication (send user authentication to database)
  • JSON Web token creation and validation certification dependent tokens

Documentation

Index

Constants

View Source
const LineBreak = "\n"

LineBreak line break for unix

View Source
const (
	// TimeFormat time format schema
	TimeFormat = "2006-01-02 15:04:05.000"
)

Variables

View Source
var ActualConfigStoreType = XMLStoreType

ActualConfigStoreType actual config store type

View Source
var BuildDate string

BuildDate build date

View Source
var BuildVersion string

BuildVersion build version

View Source
var DefaultEnvironment = ""

DefaultEnvironment default environment path

View Source
var EnableLogCache = true

EnableLogCache enable log cache

View Source
var LogLevel = 0

LogLevel defined, 0 - no debug, 1 - debug, 2 - info

View Source
var MessageReference = "MSG"

MessageReference default message reference

View Source
var OutputMessageMode = true

OutputMessageMode output messages if set

View Source
var PidFileLocation = ""

PidFileLocation pid file location for creating the PID file

View Source
var Version string

Version component version

Functions

func CloseConfig

func CloseConfig()

CloseConfig close configuration watcher and file descriptors

func CloseMessageLog

func CloseMessageLog() error

CloseMessageLog Close message log

func CreatePidFile

func CreatePidFile(flagPidFile string) error

CreatePidFile create PID file

func DeletePidFile

func DeletePidFile(flagPidFile string) error

DeletePidFile delete PID file

func FormatByteBuffer

func FormatByteBuffer(header string, b []byte) string

FormatByteBuffer formats the byte array to an output with a hexadecimal part, a ASCII part and a EBCDIC converted part of the same data

func FormatBytes

func FormatBytes(header string, b []byte, bufferLength int, modSpace int, max int, showLength bool) string

FormatBytes formats a given byte array and modulo space operator. The modulo space defines the the possition a space is added to the output. The maximum give the maximum characters per line. This function enhance the display with showing the length if showLength is set to true

func LoadConfig

func LoadConfig(file string, config ConfigInterface, watch bool) error

LoadConfig load old XML configuration

func NewError

func NewError(msgID string, args ...interface{}) error

NewError wrap error messages to initialize error list

func ParseConfig

func ParseConfig(byteValue []byte, config ConfigInterface) error

ParseConfig parse config input with config store type

func ReadConfig

func ReadConfig(file string) ([]byte, error)

ReadConfig read config file

func ReadPidFile

func ReadPidFile(flagPidFile string) (int, error)

ReadPidFile read PID file

func ServerErrorMessage

func ServerErrorMessage(msgID string, args ...interface{})

ServerErrorMessage Central output information

func ServerMessage

func ServerMessage(msg string, args ...interface{})

ServerMessage Central output information

func ShutdownServer

func ShutdownServer(pidFile string, sleep int)

ShutdownServer shutdown server reference by PID file

func StoreConfig

func StoreConfig(file string, config ConfigInterface) error

StoreConfig store configuration

Types

type ConfigInterface

type ConfigInterface interface {
	Logging(interface{}) *Logging
	SetLogging(*Logging)
	Default() interface{}
	Current() interface{}
	Loaded(interface{}) error
	IsServer() bool
}

ConfigInterface config interface for logging

type ConfigStoreType

type ConfigStoreType byte

ConfigStoreType config store type

const (
	// NoStoreType no store type found
	NoStoreType ConfigStoreType = iota
	// XMLStoreType using XML to store config
	XMLStoreType
	// YAMLStoreType using YAML to store config
	YAMLStoreType
	// JSONStoreType using JSON to store config
	JSONStoreType
)

type Logging

type Logging struct {
	TraceLocation  string `xml:"directory,attr"`
	ServerLocation string `xml:"serverlog,attr"`
	LogLevel       string `xml:"level,attr"`
	MaxSize        int    `xml:"maxsize,attr"`
	MaxBackups     int    `xml:"maxbackups,attr"`
	MaxAge         int    `xml:"maxage,attr"`
	Compress       bool   `xml:"compress,attr"`
}

Logging contains log parameters

func (*Logging) InitTraceLogging

func (xlog *Logging) InitTraceLogging()

InitTraceLogging init trace logging with log level

func (*Logging) OpenMessageLog

func (xlog *Logging) OpenMessageLog()

OpenMessageLog Open message log

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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