Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(message, secret []byte) ([]byte, error)
- func Encrypt(message, secret []byte) ([]byte, error)
- func Hashsum(args ...interface{}) ([]byte, error)
- type BuildInfo
- type Config
- type Connector
- type ConnectorDTO
- type DSConnection
- type GWConnection
- type GWConnections
- type LogLevel
- type Nats
Constants ¶
const ( InstallationModeEnv = "INSTALLATION_MODE" InstallationModeCMC = "CHILD_MANAGED_CHILD" InstallationModePMC = "PARENT_MANAGED_CHILD" InstallationModeP = "PARENT" InstallationModeS = "STANDALONE" SecVerPrefix = "_v1_" )
Variables ¶
var ( // AllowFlags defines processing the cli arguments // true by default // false on init of C-shared library libtransit AllowFlags = true // EnvPrefix defines name prefix for environment variables // with struct-path selector and value, for example: // TCG_GWCONNECTIONS_0_PASSWORD=TOK_EN EnvPrefix = "TCG_" // ConfigEnv defines environment variable for config file path, overrides the ConfigName ConfigEnv = "TCG_CONFIG" // ConfigName defines default filename for look in work directory if ConfigEnv is empty ConfigName = "tcg_config.yaml" // SecKeyEnv defines environment variable for SecKeyEnv = "TCG_SECKEY" )
Functions ¶
Types ¶
type Config ¶
type Config struct { Connector Connector `yaml:"connector"` DSConnection DSConnection `yaml:"dsConnection"` GWConnections GWConnections `yaml:"gwConnections"` }
Config defines TCG Agent configuration
func (Config) ConfigPath ¶
ConfigPath returns config file path
func (Config) Hashsum ¶
Hashsum calculates FNV non-cryptographic hash suitable for checking the equality
func (Config) InitTracerProvider ¶
func (cfg Config) InitTracerProvider() (*tracesdk.TracerProvider, error)
InitTracerProvider inits provider
func (*Config) IsConfiguringPMC ¶
IsConfiguringPMC checks configuration stage
func (*Config) LoadConnectorDTO ¶
func (cfg *Config) LoadConnectorDTO(data []byte) (*ConnectorDTO, error)
LoadConnectorDTO loads ConnectorDTO into Config
type Connector ¶
type Connector struct { transit.AgentIdentity `yaml:",inline"` BatchEvents time.Duration `yaml:"batchEvents"` BatchMetrics time.Duration `yaml:"batchMetrics"` BatchMaxBytes int `yaml:"batchMaxBytes"` // ControllerAddr accepts value for combined "host:port" // used as `http.Server{Addr}` ControllerAddr string `yaml:"controllerAddr"` ControllerCertFile string `yaml:"controllerCertFile"` ControllerKeyFile string `yaml:"controllerKeyFile"` // ControllerPin accepts value from environment // provides local access for debug ControllerPin string `yaml:"-"` // Custom HTTP configuration ControllerReadTimeout time.Duration `yaml:"-"` ControllerWriteTimeout time.Duration `yaml:"-"` ControllerStartTimeout time.Duration `yaml:"-"` ControllerStopTimeout time.Duration `yaml:"-"` Enabled bool `yaml:"enabled"` InstallationMode string `yaml:"installationMode,omitempty"` IsDynamicInventory bool `yaml:"-"` // GWEncode defines using HTTPEncode in Groundwork client: child|force|off // enabled for child by default GWEncode string `yaml:"-"` // LogCondense accepts time duration for condensing similar records // if 0 turn off condensing LogCondense time.Duration `yaml:"logCondense"` // LogFile accepts file path to log in addition to stdout LogFile string `yaml:"logFile"` LogFileMaxSize int64 `yaml:"logFileMaxSize"` // Log files are rotated count times before being removed. // If count is 0, old versions are removed rather than rotated. LogFileRotate int `yaml:"logFileRotate"` LogLevel LogLevel `yaml:"logLevel"` LogColors bool `yaml:"logColors"` LogTimeFormat string `yaml:"logTimeFormat"` Nats `yaml:",inline"` TransportStartRndDelay int `yaml:"-"` ExportProm bool `yaml:"exportProm"` }
Connector defines TCG Connector configuration see GetConfig() for defaults
type ConnectorDTO ¶
type ConnectorDTO struct { AgentID string `json:"agentId"` AppName string `json:"appName"` AppType string `json:"appType"` TcgURL string `json:"tcgUrl"` LogLevel LogLevel `json:"logLevel"` Enabled bool `json:"enabled"` DSConnection DSConnection `json:"dalekservicesConnection"` GWConnections GWConnections `json:"groundworkConnections"` }
ConnectorDTO defines TCG Connector configuration
type DSConnection ¶
type DSConnection clients.DSConnection
DSConnection defines DalekServices Connection configuration
type GWConnection ¶
type GWConnection clients.GWConnection
GWConnection defines Groundwork Connection configuration
func (GWConnection) MarshalYAML ¶
func (con GWConnection) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler interface overrides the password field
func (*GWConnection) UnmarshalYAML ¶
func (con *GWConnection) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface. overrides the password field
type GWConnections ¶
type GWConnections []*GWConnection
GWConnections defines a set of configurations
func (*GWConnections) UnmarshalYAML ¶
func (cc *GWConnections) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements the yaml.Unmarshaler interface. Applies decode to items in collection for setting only fields present in yaml. Note (as for gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b):
if yaml defines an empty set this method is not called but target is truncated.
type Nats ¶
type Nats struct { // NatsAckWait is the time the NATS server will wait before resending a message // Should be greater then the GWClient request duration NatsAckWait time.Duration `yaml:"-"` // designates the maximum number of outstanding acknowledgements // (messages that have been delivered but not acknowledged) // that NATS Streaming will allow for a given subscription. // When this limit is reached, NATS Streaming will suspend delivery of messages // to this subscription until the number of unacknowledged messages falls below the specified limit NatsMaxInflight int `yaml:"-"` // NatsMaxPubAcksInflight accepts number of unacknowledged messages // that a publisher may have in-flight at any given time. // When this maximum is reached, further async publish calls will block // until the number of unacknowledged messages falls below the specified limit NatsMaxPubAcksInflight int `yaml:"-"` // NatsMaxPayload int32 `yaml:"-"` NatsMaxPayload int32 `yaml:"natsMaxPayload"` // enabling for testing oversized payloads // NatsMonitorPort enables monitoring on http port useful for debug // curl 'localhost:8222/streaming/channelsz?limit=0&offset=0&subs=1' // More info: https://docs.nats.io/nats-streaming-concepts/monitoring NatsMonitorPort int `yaml:"-"` NatsStoreDir string `yaml:"natsFilestoreDir"` // NatsStoreType accepts "FILE"|"MEMORY" NatsStoreType string `yaml:"natsStoreType"` // How long messages are kept NatsStoreMaxAge time.Duration `yaml:"natsStoreMaxAge"` // How many bytes are allowed per-channel NatsStoreMaxBytes int64 `yaml:"natsStoreMaxBytes"` // How many messages are allowed per-channel NatsStoreMaxMsgs int64 `yaml:"natsStoreMaxMsgs"` // NatsServerConfigFile is used to override yaml values for // NATS server configuration (debug only). NatsServerConfigFile string `yaml:"natsServerConfigFile"` }