Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NoTunnelCloser func() error = func() error { return nil }
NoTunnelCloser is a function that does nothing and returns nil.
Functions ¶
func Socks5HTTPTransport ¶
Socks5HTTPTransport returns an http.Transport that uses the provided host and port as a socks5 proxy. This is useful for making http requests through a socks5 tunnel. It uses http.DefaultTransport as a base.
func ValidateHost ¶ added in v1.30.1
func ValidateHost(c *Config, opts ...util.HostValidationOption) error
ValidateHost validates the tunnel endpoint, if a tunnel is configured.
The ssh host is caller-supplied like every other connection field, and the tunnel is an outbound connection in its own right — so a benign warehouse host says nothing about where the tunnel actually goes. Connectors pass the same options they use for the warehouse host, so a config permitted to use loopback for the database may use it for the tunnel too.
Types ¶
type Config ¶
type Config struct {
User string `json:"sshUser"`
Host string `json:"sshHost"`
Port string `json:"sshPort"`
PrivateKey string `json:"sshPrivateKey"`
}
Config represents the configuration for an SSH tunnel.
func ParseInlineConfig ¶
ParseInlineConfig parses the given data as a JSON object and returns a Config if the "useSSH" field is true.
type Tunnel ¶
type Tunnel interface {
// Addr returns the address that the tunnel is listening on
Addr() string
// Host returns the host that the tunnel is listening on
Host() string
// Port returns the port that the tunnel is listening on
Port() int
// Close closes the tunnel
Close() error
}
Tunnel is an ssh tunnel
func NewSocks5Tunnel ¶
NewSocks5Tunnel creates a new socks5 proxy using the ssh tunnel