...
Package fuse
import "github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/fuse"
- Overview
- Index
Package fuse provides a connection source wherein the user does not need to
specify which instance they are connecting to before they start the
executable. Instead, simply attempting to access a file in the provided
directory will transparently create a proxied connection to an instance
which has that name.
Specifically, given that NewConnSrc was called with the mounting directory
as /cloudsql:
- Execute `mysql -S /cloudsql/speckle:instance`
- The 'mysql' executable looks up the file "speckle:instance" inside "/cloudsql"
- This lookup is intercepted by the code in this package. A local unix socket
located in a temporary directory is opened for listening and the lookup for
"speckle:instance" returns to mysql saying that it is a symbolic link
pointing to this new local socket.
- mysql dials the local unix socket, creating a new connection to the
specified instance.
func NewConnSrc(mountdir, tmpdir string, client *proxy.Client, connset *proxy.ConnSet) (<-chan proxy.Conn, io.Closer, error)
NewConnSrc returns a source of new connections based on Lookups in the
provided mount directory. If there isn't a directory located at tmpdir one
is created. The second return parameter can be used to shutdown and release
any resources. As a result of this shutdown, or during any other fatal
error, the returned chan will be closed.
The connset parameter is optional.
func Supported() bool
Supported returns true if the current system supports FUSE.