-
Notifications
You must be signed in to change notification settings - Fork 42
/
connector.go
31 lines (25 loc) · 1.08 KB
/
connector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
// TODO: change the package name to your plugin name if this will be an internal connector
import (
"net"
"github.com/cyberark/secretless-broker/pkg/secretless/log"
"github.com/cyberark/secretless-broker/pkg/secretless/plugin/connector"
)
// SingleUseConnector is passed the client's net.Conn and the current CredentialValuesById,
// and returns an authenticated net.Conn to the target service
type SingleUseConnector struct {
logger log.Logger
config []byte // Note: this can be removed if your plugin does not use any custom config
}
// Connect receives a connection to the client, and opens a connection to the target using the client's connection
// and the credentials provided in credentialValuesByID
func (connector *SingleUseConnector) Connect(
clientConn net.Conn,
credentialValuesByID connector.CredentialValuesByID,
) (net.Conn, error) {
// TODO: add logic according to
// https://github.com/cyberark/secretless-broker/blob/master/pkg/secretless/plugin/connector/README.md#tcp-connector
// tcp/pg/connector.go is a good example.
var err error
return nil, err
}