Documentation
¶
Index ¶
- func AuthenticateClient(be *pgproto3.Backend) error
- func CopySteadyState(client *pgproto3.Backend, server *pgproto3.Frontend) error
- func FinalizeInitialHandshake(client *pgproto3.Backend, server *pgproto3.Frontend) (*pgproto3.BackendKeyData, error)
- func SendCancelRequest(conn io.ReadWriter, req *pgproto3.CancelRequest) error
- func SetupServer(server net.Conn, cfg *ServerConfig) (*pgproto3.Frontend, error)
- type AuthData
- type CancelData
- type Client
- type ClientConfig
- type DatabaseNotFoundError
- type HelloData
- type LogicalConn
- type ServerConfig
- type SingleBackendProxy
- type StartupData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateClient ¶
AuthenticateClient tells the client they've successfully authenticated.
func CopySteadyState ¶
CopySteadyState copies messages back and forth after the initial handshake.
func FinalizeInitialHandshake ¶
func FinalizeInitialHandshake(client *pgproto3.Backend, server *pgproto3.Frontend) (*pgproto3.BackendKeyData, error)
FinalizeInitialHandshake completes the handshake between client and server, snooping the BackendKeyData from the server if sent. It is nil if the server did not send any backend key data.
func SendCancelRequest ¶
func SendCancelRequest(conn io.ReadWriter, req *pgproto3.CancelRequest) error
func SetupServer ¶
SetupServer sets up a frontend connected to the given server.
Types ¶
type CancelData ¶
type CancelData struct {
Raw *pgproto3.CancelRequest
}
type Client ¶
func SetupClient ¶
func SetupClient(client net.Conn, cfg *ClientConfig) (*Client, error)
SetupClient sets up a backend connected to the given client. If tlsConfig is non-nil it negotiates TLS if requested by the client.
On successful startup the returned message is either *pgproto3.StartupMessage or *pgproto3.CancelRequest.
It is up to the caller to authenticate the client using AuthenticateClient.
type ClientConfig ¶
type DatabaseNotFoundError ¶
type DatabaseNotFoundError struct {
Database string
}
func (DatabaseNotFoundError) Error ¶
func (e DatabaseNotFoundError) Error() string
type LogicalConn ¶
type LogicalConn interface {
net.Conn
Cancel(*CancelData) error
}
type ServerConfig ¶
type ServerConfig struct {
TLS *tls.Config // nil indicates no TLS
Startup *StartupData
}
type SingleBackendProxy ¶
type SingleBackendProxy struct {
Log zerolog.Logger
RequirePassword bool
FrontendTLS *tls.Config
DialBackend func(context.Context, *StartupData) (LogicalConn, error)
// contains filtered or unexported fields
}
type StartupData ¶
type StartupData struct {
Raw *pgproto3.StartupMessage
Database string
Username string
Password string // may be empty if RequirePassword is false
}