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 HelloData
- type LogicalConn
- type ServerConfig
- type SingleBackendProxy
- type StartupData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateClient ¶ added in v0.18.0
func AuthenticateClient(be *pgproto3.Backend) error
AuthenticateClient tells the client they've successfully authenticated.
func CopySteadyState ¶ added in v0.18.0
func CopySteadyState(client *pgproto3.Backend, server *pgproto3.Frontend) error
CopySteadyState copies messages back and forth after the initial handshake.
func FinalizeInitialHandshake ¶ added in v0.18.0
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 ¶ added in v0.18.0
func SendCancelRequest(conn io.ReadWriter, req *pgproto3.CancelRequest) error
func SetupServer ¶ added in v0.18.0
func SetupServer(server net.Conn, cfg *ServerConfig) (*pgproto3.Frontend, error)
SetupServer sets up a frontend connected to the given server.
Types ¶
type CancelData ¶ added in v0.18.0
type CancelData struct {
Raw *pgproto3.CancelRequest
}
type Client ¶ added in v0.18.0
type Client struct { Backend *pgproto3.Backend Hello HelloData }
func SetupClient ¶ added in v0.18.0
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 ¶ added in v0.18.0
type HelloData ¶ added in v0.18.0
type HelloData interface {
// contains filtered or unexported methods
}
type LogicalConn ¶ added in v0.18.0
type LogicalConn interface { net.Conn Cancel(*CancelData) error }
type ServerConfig ¶ added in v0.18.0
type ServerConfig struct { TLS *tls.Config // nil indicates no TLS Startup *StartupData }
type SingleBackendProxy ¶ added in v0.18.0
type SingleBackendProxy struct { Log zerolog.Logger RequirePassword bool FrontendTLS *tls.Config DialBackend func(context.Context, *StartupData) (LogicalConn, error) // contains filtered or unexported fields }