proxy

package
v0.237.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 11

Documentation

Overview

Package proxy provides utilities for updating a data source plugin connection to go through a proxy.

Index

Constants

View Source
const (
	// Deprecated: PluginSecureSocksProxyEnabledEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_SERVER_ENABLED
	// environment variable used to specify if a secure socks proxy is allowed to be used for datasource connections.
	PluginSecureSocksProxyEnabledEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_SERVER_ENABLED"
	// Deprecated: PluginSecureSocksProxyClientCertFilePathEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_CERT
	// environment variable used to specify the file location of the client cert for the secure socks proxy.
	PluginSecureSocksProxyClientCertFilePathEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_CERT"
	// Deprecated: PluginSecureSocksProxyClientKeyFilePathEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_KEY
	// environment variable used to specify the file location of the client key for the secure socks proxy.
	PluginSecureSocksProxyClientKeyFilePathEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_KEY"
	// Deprecated: PluginSecureSocksProxyRootCACertFilePathsEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_ROOT_CA_CERT
	// environment variable used to specify the file location of the root ca for the secure socks proxy.
	PluginSecureSocksProxyRootCACertFilePathsEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_ROOT_CA_CERT"
	// Deprecated: PluginSecureSocksProxyAddressEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_PROXY_ADDRESS
	// environment variable used to specify the secure socks proxy server address to proxy the connections to.
	PluginSecureSocksProxyAddressEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_PROXY_ADDRESS"
	// Deprecated: PluginSecureSocksProxyServerNameEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_SERVER_NAME
	// environment variable used to specify the server name of the secure socks proxy.
	PluginSecureSocksProxyServerNameEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_SERVER_NAME"
	// Deprecated: PluginSecureSocksProxyAllowInsecureEnvVarName is a constant for the GF_SECURE_SOCKS_DATASOURCE_PROXY_ALLOW_INSECURE
	// environment variable used to specify if the proxy should use a TLS dialer.
	PluginSecureSocksProxyAllowInsecureEnvVarName = "GF_SECURE_SOCKS_DATASOURCE_PROXY_ALLOW_INSECURE"
)
View Source
const (
	PluginSecureSocksProxyEnabled            = "GF_SECURE_SOCKS_DATASOURCE_PROXY_SERVER_ENABLED"
	PluginSecureSocksProxyClientCert         = "GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_CERT"
	PluginSecureSocksProxyClientCertContents = "GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_CERT_VAL"
	PluginSecureSocksProxyClientKey          = "GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_KEY"
	PluginSecureSocksProxyClientKeyContents  = "GF_SECURE_SOCKS_DATASOURCE_PROXY_CLIENT_KEY_VAL"
	PluginSecureSocksProxyRootCAs            = "GF_SECURE_SOCKS_DATASOURCE_PROXY_ROOT_CA_CERT"
	PluginSecureSocksProxyRootCAsContents    = "GF_SECURE_SOCKS_DATASOURCE_PROXY_ROOT_CA_CERT_VALS"
	PluginSecureSocksProxyProxyAddress       = "GF_SECURE_SOCKS_DATASOURCE_PROXY_PROXY_ADDRESS"
	PluginSecureSocksProxyServerName         = "GF_SECURE_SOCKS_DATASOURCE_PROXY_SERVER_NAME"
	PluginSecureSocksProxyAllowInsecure      = "GF_SECURE_SOCKS_DATASOURCE_PROXY_ALLOW_INSECURE"
)

Variables

View Source
var DefaultTimeoutOptions = TimeoutOptions{
	Timeout:   30 * time.Second,
	KeepAlive: 30 * time.Second,
}

DefaultTimeoutOptions default timeout/connection options for the proxy.

Functions

func SecureSocksProxyEnabledOnDS

func SecureSocksProxyEnabledOnDS(jsonData map[string]interface{}) bool

SecureSocksProxyEnabledOnDS checks the datasource json data for `enableSecureSocksProxy` to determine if the secure socks proxy should be enabled on it

Types

type AuthOptions

type AuthOptions struct {
	Username string
	Password string
}

AuthOptions socks5 username and password options. Every datasource can have separate credentials to the proxy.

type Client added in v0.171.0

type Client interface {
	SecureSocksProxyEnabled() bool
	ConfigureSecureSocksHTTPProxy(transport *http.Transport) error
	NewSecureSocksProxyContextDialer() (proxy.Dialer, error)
}

Client is the main Proxy Client interface.

func New added in v0.171.0

func New(opts *Options) Client

New creates a new proxy client from a given config.

type ClientCfg added in v0.171.0

type ClientCfg struct {
	// Deprecated: ClientCert is the file path to the client certificate.
	ClientCert string
	// Deprecated: ClientKey is the file path to the client key.
	ClientKey string
	// Deprecated: RootCAs is a list of file paths to the root CA certificates.
	RootCAs []string

	ClientCertVal string
	ClientKeyVal  string
	RootCAsVals   []string
	ProxyAddress  string
	ServerName    string
	AllowInsecure bool
}

ClientCfg contains the information needed to allow datasource connections to be proxied to a secure socks proxy.

type Options

type Options struct {
	Enabled bool
	// DatasourceName is the name of the datasource the proxy will be used to communicate with.
	DatasourceName string
	// DatasourceType is the type of the datasource the proxy will be used to communicate with.
	// It should be the value assigned to the type property in a datasource provisioning file (e.g mysql, prometheus)
	DatasourceType string
	Auth           *AuthOptions
	Timeouts       *TimeoutOptions
	ClientCfg      *ClientCfg
}

Options defines per datasource options for creating the proxy dialer.

type TimeoutOptions

type TimeoutOptions struct {
	Timeout   time.Duration
	KeepAlive time.Duration
}

TimeoutOptions timeout/connection options.

Jump to

Keyboard shortcuts

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