Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeTestClient ¶
MakeTestClient returns SQL Server client used in tests.
Types ¶
type Connector ¶
type Connector interface {
Connect(context.Context, *common.Session, *protocol.Login7Packet) (io.ReadWriteCloser, []mssql.Token, error)
}
Connector defines an interface for connecting to a SQL Server so it can be swapped out in tests.
type Engine ¶
type Engine struct { // EngineConfig is the common database engine configuration. common.EngineConfig // Connector allows to override SQL Server connection logic. Used in tests. Connector Connector // contains filtered or unexported fields }
Engine handles connections from SQL Server clients coming from Teleport proxy over reverse tunnel.
func (*Engine) HandleConnection ¶
HandleConnection authorizes the incoming client connection, connects to the target SQL Server server and starts proxying messages between client/server.
func (*Engine) InitializeConnection ¶
InitializeConnection initializes the client connection.
type Proxy ¶
type Proxy struct { // Middleware is the auth middleware. Middleware *auth.Middleware // Service is used to connect to a remote database service. Service common.Service // Log is used for logging. Log logrus.FieldLogger }
Proxy accepts connections from SQL Server clients, performs a Pre-Login handshake and then forwards the connection to the database service agent.
func (*Proxy) HandleConnection ¶
func (p *Proxy) HandleConnection(ctx context.Context, proxyCtx *common.ProxyContext, conn net.Conn) error
HandleConnection accepts connection from a SQL Server client, authenticates it and proxies it to an appropriate database service.
type TestConnector ¶
type TestConnector struct{}
TestConnector is used in tests to mock connections to SQL Server.
func (*TestConnector) Connect ¶
func (c *TestConnector) Connect(ctx context.Context, sessionCtx *common.Session, loginPacket *protocol.Login7Packet) (io.ReadWriteCloser, []mssql.Token, error)
Connect simulates successful connection to a SQL Server.
type TestServer ¶
type TestServer struct {
// contains filtered or unexported fields
}
TestServer is a test MSServer server used in functional database access tests.
func NewTestServer ¶
func NewTestServer(config common.TestServerConfig) (svr *TestServer, err error)
NewTestServer returns a new instance of a test MSServer.
func (*TestServer) Serve ¶
func (s *TestServer) Serve() error
Serve starts serving client connections.