package fuse

import "github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/fuse"

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:

  1. Execute `mysql -S /cloudsql/speckle:instance`
  2. The 'mysql' executable looks up the file "speckle:instance" inside "/cloudsql"
  3. 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.
  4. mysql dials the local unix socket, creating a new connection to the specified instance.

Index

Functions

func NewConnSrc

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

func Supported() bool

Supported returns true if the current system supports FUSE.

Source Files

fuse.go fuse_linux.go

Version
v1.37.7 (latest)
Published
Apr 16, 2025
Platform
linux/amd64
Imports
18 packages
Last checked
2 months ago

Tools for package owners.