xraydaemonmigration

package
v1.300026.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

View Source
var GetProcesses = func() ([]Process, error) {
	processList, err := process.Processes()
	if err != nil {
		return nil, err
	}
	var xrayProcesses []Process
	for _, p := range processList {
		curName, err := p.Name()
		if err != nil {
			continue
		}
		if curName == "xray" {
			xrayProcesses = append(xrayProcesses, p)
		}
	}
	return xrayProcesses, nil
}

Functions

func ConvertYamlToJson

func ConvertYamlToJson(yamlData []byte, process Process) ([]byte, error)

Converting yaml Data to Json File. Pid is needed to get command line arguments of the process (if Daemon is running as a process and not a service).

func FindAllPotentialConfigFiles

func FindAllPotentialConfigFiles() ([]string, error)

func GetPathFromArgs

func GetPathFromArgs(argList []string) string

get the config file path from arguments

Types

type Flag

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

func NewFlag

func NewFlag(name string) *Flag

NewFlag returns a new flag with provided flag name.

func (*Flag) BoolVarF

func (f *Flag) BoolVarF(ptr *bool, name string, shortName string, value bool, usage string)

BoolVarF defines 2 bool flags with specified name and shortName, default value, and usage string. The argument ptr points to a bool variable in which to store the value of the flag.

func (*Flag) IntVarF

func (f *Flag) IntVarF(ptr *int, name string, shortName string, value int, usage string)

IntVarF defines 2 int flags for specified name and shortName with default value, and usage string. The argument ptr points to an int variable in which to store the value of the flag.

func (*Flag) StringVarF

func (f *Flag) StringVarF(ptr *string, name string, shortName string, value string, usage string)

StringVarF defines 2 string flags for specified name and shortName, default value, and usage string. The argument ptr points to a string variable in which to store the value of the flag.

type JsonConfig

type JsonConfig struct {
	Traces struct {
		TracesCollected struct {
			Xray struct {
				BindAddress string `json:"bind_address"`
				TcpProxy    struct {
					BindAddress string `json:"bind_address"`
				} `json:"tcp_proxy"`
			} `json:"xray"`
		} `json:"traces_collected"`
		Concurrency  int    `json:"concurrency"`
		BufferSizeMB int    `json:"buffer_size_mb"`
		ResourceArn  string `json:"resource_arn"`
		LocalMode    bool   `json:"local_mode"` //local
		Insecure     bool   `json:"insecure"`   //noverifyssl
		Credentials  struct {
			RoleArn string `json:"role_arn"`
		} `json:"credentials"`
		EndpointOverride string `json:"endpoint_override"` //endpoint
		RegionOverride   string `json:"region_override"`   //region
		ProxyOverride    string `json:"proxy_override"`
	} `json:"traces"`
}

type Process

type Process interface {
	Cwd() (string, error)
	CmdlineSlice() ([]string, error)
}

func FindAllDaemons

func FindAllDaemons() ([]Process, error)

Finds all Daemons and returns their pid

type YamlConfig

type YamlConfig struct {
	TotalBufferSizeMB int    `yaml:"TotalBufferSizeMB"`
	Concurrency       int    `yaml:"Concurrency"`
	Region            string `yaml:"Region"`
	Socket            struct {
		UDPAddress string `yaml:"UDPAddress"`
		TCPAddress string `yaml:"TCPAddress"`
	} `yaml:"Socket"`
	LocalMode    bool   `yaml:"LocalMode"`
	ResourceARN  string `yaml:"ResourceARN"`
	RoleARN      string `yaml:"string"`
	ProxyAddress string `yaml:"ProxyAddress"`
	Endpoint     string `yaml:"Endpoint"`
	NoVerifySSL  bool   `yaml:"NoVerifySSL"`
}

Jump to

Keyboard shortcuts

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