sqlproxy

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHTTPAuthClient

func CreateHTTPAuthClient() *http.Client

CreateHTTPAuthClient creats http auth client for google apis

func CreateProxy

func CreateProxy(localPort int, instanceConnectionName CloudSQLInstance)

CreateProxy creates a proxy tunnel to a given instance

func GetDefaultPortForType

func GetDefaultPortForType(dbType CloudSQLInstanceType) int

GetDefaultPortForType returns default port for given database type

func WatchInstances

func WatchInstances(dir string, cfgs []instanceConfig, updates <-chan string, cl *http.Client) (<-chan proxy.Conn, error)

WatchInstances handles the lifecycle of local sockets used for proxying local connections. Values received from the updates channel are interpretted as a comma-separated list of instances. The set of sockets in 'dir' is the union of 'instances' and the most recent list from 'updates'.

Types

type CloudSQLInstance

type CloudSQLInstance struct {
	// project[:region]:instance-name
	ConnectionName string
	Type           CloudSQLInstanceType
	DefaultPort    int
}

CloudSQLInstance struct

func GetInstancesList

func GetInstancesList(projects []string) ([]CloudSQLInstance, error)

GetInstancesList gets list of Cloud SQL instances for given projects

type CloudSQLInstanceType

type CloudSQLInstanceType string

CloudSQLInstanceType is one of supported POSTGRES, MYSQL, SQLSERVER

const (
	// TypePostgres cloud SQL instance
	TypePostgres CloudSQLInstanceType = "POSTGRES"
	// TypeMySQL cloud SQL instance
	TypeMySQL CloudSQLInstanceType = "MYSQL"
	// TypeSQLServer cloud SQL instance
	TypeSQLServer CloudSQLInstanceType = "SQLSERVER"
	// TypeUnknown for unknown cloud SQL instance type
	TypeUnknown CloudSQLInstanceType = "UNKNOWN"
)

Jump to

Keyboard shortcuts

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