agent

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEF_WG_IFACE string = "wg0"
	DEF_WG_ETH   string = "eth"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	AgentType uint8               `yaml:"agent_type"`    // pop or connector, WG_AGENT_TYPE_POP = 1; WG_AGENT_TYPE_CONNECTOR = 2; WG_AGENT_TYPE_CLIENT = 3
	AgentId   string              `yaml:"agent_id"`      // pop id or connector
	ConfigDir string              `yaml:"config_dir"`    // for cert files/...
	Api       ApiConfig           `yaml:"api"`           // server api
	Log       *logger.LogModule   `yaml:"log,omitempty"` //
	Version   string              `yaml:"version"`       //
	Env       string              `yaml:"env"`           //
	HostName  string              `yaml:"host_name"`     //
	MqCfg     *AgentMqConfig      `yaml:"mq,omitempty"`  // mq 不用放在mtls之后的register里返回,register只是返回wg 信息,mq和api配置信息一样,配置了通常不会变化
	Wg        AgentWgCommonConfig `yaml:"wg"`            // common info no need to response in register, register 只是为了获取ip等动态信息(当然也可以固定),另外拿到证书不能register成功也不能直接连
}

config can be downloaded from web ui

func (*AgentConfig) GetWgAgentLogCfg

func (c *AgentConfig) GetWgAgentLogCfg() *logger.LogModule

type AgentMqConfig

type AgentMqConfig struct {
	Host        string `yaml:"host"`         // mq host, may equal=ApiHost
	Port        int    `yaml:"port"`         // mq port, diff with RegisterPort
	SubProtocol string `yaml:"sub_protocol"` // for message q, message-queue-v1
}

type AgentWgCommonConfig added in v0.0.36

type AgentWgCommonConfig struct {
	PublicKeyFile  string `yaml:"public_key_file"`
	PrivateKeyFile string `yaml:"private_key_file"`
}

type AgentWgConfig

type AgentWgConfig struct {
	WgInterfaces string `yaml:"interfaces"` //
	EthName      string `yaml:"eth"`        //
	Forward      bool   `yaml:"forward"`    //
	Iptables     bool   `yaml:"iptables"`   //
}

func (*AgentWgConfig) GetEth

func (c *AgentWgConfig) GetEth() string

func (*AgentWgConfig) GetWgInterface

func (c *AgentWgConfig) GetWgInterface() string

func (*AgentWgConfig) GetWgInterface4Connector added in v0.0.32

func (c *AgentWgConfig) GetWgInterface4Connector() string

func (*AgentWgConfig) GetWgInterface4Pop added in v0.0.32

func (c *AgentWgConfig) GetWgInterface4Pop() string

func (*AgentWgConfig) GetWgInterfaces

func (c *AgentWgConfig) GetWgInterfaces() []string

type ApiConfig

type ApiConfig struct {
	Host         string `yaml:"host"`          // API host, controller(hostname), maybe use websocket
	Port         int    `yaml:"port"`          // Register port on API host, 8081
	SSL          SSLCfg `yaml:"ssl"`           // ssl config of api/mtls
	RegEndpoint  string `yaml:"reg_endpoint"`  // =/ws/agent
	DataEndpoint string `yaml:"data_endpoint"` // =/ws/data, or other api
}

type SSLCfg

type SSLCfg struct {
	// Enable            bool   `yaml:"enable"`
	MTLS          bool   `yaml:"mtls"`
	RootCaFile    string `yaml:"root_ca_file"`    // root ca pem
	AgentCertFile string `yaml:"agent_cert_file"` // cert pem, agent could be pop/connector
	AgentKeyFile  string `yaml:"agent_key_file"`  // cert key, agent could be pop/connector
}

Jump to

Keyboard shortcuts

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