Versions in this module Expand all Collapse all v0 v0.1.1 Jul 14, 2023 Changes in this version + var ErrTLSConfigRequired = errors.New("require TLS config on TiProxy when require-backend-tls=true") v0.1.0 May 22, 2023 Changes in this version + const CheckBackendInterval + const DialTimeout + const StatusInTrans + const StatusPrepareWaitExecute + const StatusPrepareWaitFetch + const StatusQuit + const SupportedServerCapabilities + var ErrBackendConn = errors.New("this is an error from backend") + var ErrCapabilityNegotiation = errors.New("capability negotiation failed") + var ErrClientConn = errors.New("this is an error from client") + var ErrCloseConnMgr = errors.New("failed to close connection manager") + func GenerateSalt(size int) []byte + func IsMySQLError(err error) bool + func Uint32N(a uint64) uint64 + func WriteUserError(clientIO *pnet.PacketIO, err error, lg *zap.Logger) + type Authenticator struct + func (auth *Authenticator) String() string + type BCConfig struct + CheckBackendInterval time.Duration + HealthyKeepAlive config.KeepAlive + ProxyProtocol bool + RequireBackendTLS bool + UnhealthyKeepAlive config.KeepAlive + type BackendConnManager struct + func NewBackendConnManager(logger *zap.Logger, handshakeHandler HandshakeHandler, connectionID uint64, ...) *BackendConnManager + func (mgr *BackendConnManager) ClientAddr() string + func (mgr *BackendConnManager) ClientInBytes() uint64 + func (mgr *BackendConnManager) ClientOutBytes() uint64 + func (mgr *BackendConnManager) Close() error + func (mgr *BackendConnManager) Connect(ctx context.Context, clientIO *pnet.PacketIO, ...) error + func (mgr *BackendConnManager) ConnectionID() uint64 + func (mgr *BackendConnManager) ExecuteCmd(ctx context.Context, request []byte) (err error) + func (mgr *BackendConnManager) GracefulClose() + func (mgr *BackendConnManager) NotifyBackendStatus(status router.BackendStatus) + func (mgr *BackendConnManager) QuitSource() ErrorSource + func (mgr *BackendConnManager) Redirect(newAddr string) bool + func (mgr *BackendConnManager) ServerAddr() string + func (mgr *BackendConnManager) SetEventReceiver(receiver router.ConnEventReceiver) + func (mgr *BackendConnManager) SetValue(key, val any) + func (mgr *BackendConnManager) UpdateLogger(fields ...zap.Field) + func (mgr *BackendConnManager) Value(key any) any + type CmdProcessor struct + func NewCmdProcessor() *CmdProcessor + type ConnContext interface + ClientAddr func() string + ClientInBytes func() uint64 + ClientOutBytes func() uint64 + QuitSource func() ErrorSource + ServerAddr func() string + SetValue func(key, val any) + UpdateLogger func(fields ...zap.Field) + Value func(key any) any + type ConnContextKey string + const ConnContextKeyTLSState + type CustomHandshakeHandler struct + func (h *CustomHandshakeHandler) GetCapability() pnet.Capability + func (h *CustomHandshakeHandler) GetRouter(ctx ConnContext, resp *pnet.HandshakeResp) (router.Router, error) + func (h *CustomHandshakeHandler) GetServerVersion() string + func (h *CustomHandshakeHandler) HandleHandshakeResp(ctx ConnContext, resp *pnet.HandshakeResp) error + func (h *CustomHandshakeHandler) OnConnClose(ctx ConnContext) error + func (h *CustomHandshakeHandler) OnHandshake(ctx ConnContext, addr string, err error) + func (h *CustomHandshakeHandler) OnTraffic(ctx ConnContext) + type DefaultHandshakeHandler struct + func NewDefaultHandshakeHandler(nsManager *namespace.NamespaceManager, serverVersion string) *DefaultHandshakeHandler + func (handler *DefaultHandshakeHandler) GetCapability() pnet.Capability + func (handler *DefaultHandshakeHandler) GetRouter(ctx ConnContext, resp *pnet.HandshakeResp) (router.Router, error) + func (handler *DefaultHandshakeHandler) GetServerVersion() string + func (handler *DefaultHandshakeHandler) HandleHandshakeResp(ConnContext, *pnet.HandshakeResp) error + func (handler *DefaultHandshakeHandler) OnConnClose(ConnContext) error + func (handler *DefaultHandshakeHandler) OnHandshake(ConnContext, string, error) + func (handler *DefaultHandshakeHandler) OnTraffic(ConnContext) + type ErrorSource int + const SrcBackendErr + const SrcBackendQuit + const SrcClientErr + const SrcClientQuit + const SrcProxyErr + const SrcProxyQuit + func (es ErrorSource) String() string + type HandshakeHandler interface + GetCapability func() pnet.Capability + GetRouter func(ctx ConnContext, resp *pnet.HandshakeResp) (router.Router, error) + GetServerVersion func() string + HandleHandshakeResp func(ctx ConnContext, resp *pnet.HandshakeResp) error + OnConnClose func(ctx ConnContext) error + OnHandshake func(ctx ConnContext, to string, err error) + OnTraffic func(ctx ConnContext) + type UserError struct + func WrapUserError(err error, userMsg string) *UserError + func (ue *UserError) Error() string + func (ue *UserError) Unwrap() error + func (ue *UserError) UserMsg() string